diff options
author | bdrewery <bdrewery@FreeBSD.org> | 2015-10-20 03:23:53 +0800 |
---|---|---|
committer | bdrewery <bdrewery@FreeBSD.org> | 2015-10-20 03:23:53 +0800 |
commit | 05ce8cd4756cc1eca6993fa86032f7d7bc78b1e0 (patch) | |
tree | acaaf3358083342435e9bbdbfea8d7568eb4c2bd /Mk | |
parent | d6b6acc680ad2a391ede3cf873f543ce8521fadd (diff) | |
download | freebsd-ports-gnome-05ce8cd4756cc1eca6993fa86032f7d7bc78b1e0.tar.gz freebsd-ports-gnome-05ce8cd4756cc1eca6993fa86032f7d7bc78b1e0.tar.zst freebsd-ports-gnome-05ce8cd4756cc1eca6993fa86032f7d7bc78b1e0.zip |
- Combine clean-depends-list.sh into depends-list.sh
- Refactor how depends-list.sh is called from bsd.port.mk for each variant.
With hat: portmgr
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/clean-depends-list.sh | 51 | ||||
-rw-r--r-- | Mk/Scripts/depends-list.sh | 40 | ||||
-rw-r--r-- | Mk/bsd.port.mk | 31 |
3 files changed, 45 insertions, 77 deletions
diff --git a/Mk/Scripts/clean-depends-list.sh b/Mk/Scripts/clean-depends-list.sh deleted file mode 100644 index dace598715e1..000000000000 --- a/Mk/Scripts/clean-depends-list.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# MAINTAINER: portmgr@FreeBSD.org -# $FreeBSD$ - -. ${dp_SCRIPTSDIR}/functions.sh - -set -e -validate_env dp_PKGNAME dp_MAKE dp_PORTSDIR - -arg=$1 -if [ -z "${arg}" ] || [ "${arg}" != "full" -a "${arg}" != "limited" ]; then - echo "The first argument can only be 'full' or 'limited'" >&2 - exit 1 -fi -shift - -set -u - -check_dep() { - for _dep ; do - myifs=${IFS} - IFS=: - set -- ${_dep} - IFS=${myifs} - - case "${2}" in - /*) d=${2} ;; - *) d=${dp_PORTSDIR}/${2} ;; - esac - - case " ${checked} " in - *\ ${d}\ *) continue ;; # Already checked - esac - checked="${checked} ${d}" - if [ ! -d ${d} ]; then - echo "${dp_PKGNAME}: \"${d}\" non-existent -- dependency list incomplete" >&2 - continue - fi - set -- $(${dp_MAKE} -C ${d} -VWRKDIR -V_UNIFIED_DEPENDS) - if [ -d ${1} ]; then - echo ${d} - elif [ "$arg" = "limited" ]; then - continue - fi - shift - check_dep $@ - done -} - -checked= -check_dep ${dp_ALLDEPENDS} diff --git a/Mk/Scripts/depends-list.sh b/Mk/Scripts/depends-list.sh index d5cf1c67ec49..21b7ec103661 100644 --- a/Mk/Scripts/depends-list.sh +++ b/Mk/Scripts/depends-list.sh @@ -7,11 +7,17 @@ set -e . ${dp_SCRIPTSDIR}/functions.sh recursive=0 -while getopts "r" FLAG; do +requires_wrkdir=0 +while getopts "rw" FLAG; do case "${FLAG}" in r) recursive=1 ;; + w) + # Only list dependencies that have a WRKDIR. Used for + # 'make clean-depends'. + requires_wrkdir=1 + ;; *) echo "Unknown flag" >&2 exit 1 @@ -20,8 +26,8 @@ while getopts "r" FLAG; do done shift $((OPTIND-1)) -validate_env dp_ALLDEPENDS dp_PORTSDIR dp_PKGNAME -if [ ${recursive} -eq 1 ]; then +validate_env dp_PORTSDIR dp_PKGNAME +if [ ${recursive} -eq 1 -o ${requires_wrkdir} -eq 1 ]; then validate_env dp_MAKE # Cache command executions to avoid looking them up again in every # sub-make. @@ -31,6 +37,8 @@ fi set -u check_dep() { + local _dep wrkdir show_dep + for _dep ; do myifs=${IFS} IFS=: @@ -46,16 +54,36 @@ check_dep() { *\ ${d}\ *) continue ;; # Already checked esac checked="${checked} ${d}" + # Check if the dependency actually exists or skip otherwise. if [ ! -d ${d} ]; then echo "${dp_PKGNAME}: \"${d}\" non-existent -- dependency list incomplete" >&2 continue fi - echo ${d} + + # Grab any needed vars from the port. + + if [ ${requires_wrkdir} -eq 1 -a ${recursive} -eq 1 ]; then + set -- $(${dp_MAKE} -C ${d} -VWRKDIR -V_UNIFIED_DEPENDS) + wrkdir="$1" + shift + elif [ ${requires_wrkdir} -eq 1 -a ${recursive} -eq 0 ]; then + set -- "$(${dp_MAKE} -C ${d} -VWRKDIR)" + wrkdir="$1" + elif [ ${recursive} -eq 1 ]; then + set -- $(${dp_MAKE} -C ${d} -V_UNIFIED_DEPENDS) + fi + + # If a WRKDIR is required to show the dependency, check for it. + show_dep=1 + if [ ${requires_wrkdir} -eq 1 ] && ! [ -d "${wrkdir}" ]; then + show_dep=0 + fi + [ ${show_dep} -eq 1 ] && echo ${d} if [ ${recursive} -eq 1 ]; then - check_dep $(${dp_MAKE} -C ${d} -V_UNIFIED_DEPENDS) + check_dep $@ fi done } checked= -check_dep ${dp_ALLDEPENDS} +check_dep $@ diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index 89c7a64d79e8..41d8c8958628 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -4377,32 +4377,31 @@ _DEPEND_SPECIALS= ${_UNIFIED_DEPENDS:M*\:*\:*:C,^[^:]*:([^:]*):.*$,\1,} all-depends-list: @${ALL-DEPENDS-LIST} -ALL-DEPENDS-LIST= \ - ${SETENV} dp_ALLDEPENDS="${_UNIFIED_DEPENDS}" \ +# This script is shared among several dependency list variables. See file for +# usage. +DEPENDS-LIST= \ + ${SETENV} \ dp_PORTSDIR="${PORTSDIR}" \ dp_MAKE="${MAKE}" \ dp_PKGNAME="${PKGNAME}" \ dp_SCRIPTSDIR="${SCRIPTSDIR}" \ - ${SH} ${SCRIPTSDIR}/depends-list.sh -r + ${SH} ${SCRIPTSDIR}/depends-list.sh -CLEAN-DEPENDS-LIST= \ - ${SETENV} dp_ALLDEPENDS="${_UNIFIED_DEPENDS}" \ - dp_PORTSDIR="${PORTSDIR}" \ - dp_MAKE="${MAKE}" \ - dp_PKGNAME="${PKGNAME}" \ - dp_SCRIPTSDIR="${SCRIPTSDIR}" \ - ${SH} ${SCRIPTSDIR}/clean-depends-list.sh +ALL-DEPENDS-LIST= ${DEPENDS-LIST} -r ${_UNIFIED_DEPENDS:Q} +TEST-DEPENDS-LIST= ${DEPENDS-LIST} ${TEST_DEPENDS:Q} +CLEAN-DEPENDS-LIST= ${DEPENDS-LIST} -wr ${_UNIFIED_DEPENDS:Q} +CLEAN-DEPENDS-LIMITED-LIST= ${DEPENDS-LIST} -w ${_UNIFIED_DEPENDS:Q} .if !target(clean-depends) clean-depends: - @for dir in $$(${CLEAN-DEPENDS-LIST} full); do \ + @for dir in $$(${CLEAN-DEPENDS-LIST}); do \ (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean); \ done .endif .if !target(limited-clean-depends) limited-clean-depends: - @for dir in $$(${CLEAN-DEPENDS-LIST} limited); do \ + @for dir in $$(${CLEAN-DEPENDS-LIMITED-LIST}); do \ (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean); \ done .endif @@ -4547,14 +4546,6 @@ test-depends-list: @${TEST-DEPENDS-LIST} .endif -TEST-DEPENDS-LIST= \ - ${SETENV} dp_ALLDEPENDS="${TEST_DEPENDS}" \ - dp_PORTSDIR="${PORTSDIR}" \ - dp_MAKE="${MAKE}" \ - dp_PKGNAME="${PKGNAME}" \ - dp_SCRIPTSDIR="${SCRIPTSDIR}" \ - ${SH} ${SCRIPTSDIR}/depends-list.sh - # Package (recursive runtime) dependency list. Print out both directory names # and package names. |