diff options
author | Stefan Eßer <se@FreeBSD.org> | 2021-12-30 20:25:18 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2021-12-30 20:30:03 +0000 |
commit | 793d87945d69500ae167166722896d26aa073c03 (patch) | |
tree | 36a13f53ef9c0496a83c08b284428111f69f6f4d /ports-mgmt | |
parent | e362772ad14b5b08de023ed0a4401bb6ca7cf6d1 (diff) | |
download | ports-793d87945d69500ae167166722896d26aa073c03.tar.gz ports-793d87945d69500ae167166722896d26aa073c03.zip |
Diffstat (limited to 'ports-mgmt')
-rw-r--r-- | ports-mgmt/portmaster/Makefile | 5 | ||||
-rw-r--r-- | ports-mgmt/portmaster/distinfo | 6 | ||||
-rw-r--r-- | ports-mgmt/portmaster/files/patch-files_portmaster.8 | 60 | ||||
-rw-r--r-- | ports-mgmt/portmaster/files/patch-files_portmaster.rc.sample | 15 | ||||
-rw-r--r-- | ports-mgmt/portmaster/files/patch-portmaster | 1136 |
5 files changed, 5 insertions, 1217 deletions
diff --git a/ports-mgmt/portmaster/Makefile b/ports-mgmt/portmaster/Makefile index a732d2e2340a..604225084024 100644 --- a/ports-mgmt/portmaster/Makefile +++ b/ports-mgmt/portmaster/Makefile @@ -1,6 +1,5 @@ PORTNAME= portmaster -PORTVERSION= 3.19 -PORTREVISION= 31 +PORTVERSION= 3.20 CATEGORIES= ports-mgmt MAINTAINER= se@FreeBSD.org @@ -28,7 +27,7 @@ verify: checksum do-build: .for file in portmaster files/portmaster.rc.sample files/portmaster.8 @${REINPLACE_CMD} -e 's#/usr/local#${LOCALBASE}#g' \ - -e 's#===>>> Version [0-9._]*#===>>> Version ${PKGVERSION}#' ${WRKSRC}/${file} + -e 's#%%PORTVERSION%%#${PKGVERSION}#' ${WRKSRC}/${file} .endfor do-install: diff --git a/ports-mgmt/portmaster/distinfo b/ports-mgmt/portmaster/distinfo index ff819088efb1..9e697fbbd6f4 100644 --- a/ports-mgmt/portmaster/distinfo +++ b/ports-mgmt/portmaster/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1515967596 -SHA256 (freebsd-portmaster-3.19_GH0.tar.gz) = 2e469d4471f92daff4b571dd3f4c8fbad459bcbc13969c883e2298ac1143a0c1 -SIZE (freebsd-portmaster-3.19_GH0.tar.gz) = 43236 +TIMESTAMP = 1640895731 +SHA256 (freebsd-portmaster-3.20_GH0.tar.gz) = 601618c25c318d3539bfa9dcd1294c2d068a72d59c03c40204cd51fcd1058112 +SIZE (freebsd-portmaster-3.20_GH0.tar.gz) = 44225 diff --git a/ports-mgmt/portmaster/files/patch-files_portmaster.8 b/ports-mgmt/portmaster/files/patch-files_portmaster.8 deleted file mode 100644 index d3c2cd6b5671..000000000000 --- a/ports-mgmt/portmaster/files/patch-files_portmaster.8 +++ /dev/null @@ -1,60 +0,0 @@ ---- files/portmaster.8.orig 2018-01-14 21:53:23 UTC -+++ files/portmaster.8 -@@ -38,6 +38,7 @@ Common Flags: - .Op Fl -delete-build-only - .Op Fl -always-fetch - .Op Fl -backup-format=<fmt> -+.Op Fl -package-format=<fmt> - .Op Fl -local-packagedir=<path> - .Op Fl -packages-local - .Op Fl -delete-packages -@@ -47,6 +48,7 @@ Common Flags: - .Op Sy --index|--index-first|--index-only - .Op Fl m Ar arguments for make - .Op Fl x Ar glob pattern to exclude from building -+.Op Fl -try-broken - .Nm - .Op Common Flags - .Ar full name of port directory in /var/db/pkg -@@ -380,7 +382,7 @@ do not update the xterm title bar - .It Fl -no-index-fetch - skip fetching the INDEX file - .It Fl -index --use INDEX-[7-9] exclusively to check if a port is up to date -+use INDEX file exclusively to check if a port is up to date - .It Fl -index-first - use the INDEX for status, but double-check with the port - .It Fl -index-only -@@ -416,8 +418,14 @@ use package if newer than installed even if the packag - the latest according to the ports tree - .It Fl -always-fetch - fetch package even if it already exists locally -+.It Fl -package-format=<fmt> -+the archive format to use for packages created from newly built ports -+instead of the default of txz, -+which can take a long time for large packages. -+Supported formats are: tar, tgz, tbz, and txz (from fastest to slowest). - .It Fl -backup-format=<fmt> --the archive format to use for backlup packages instead of the default of txz, -+the archive format to use for backup packages (created before an upgraded -+package is deleted) instead of the default of txz, - which can take a long time for large packages. - Supported formats are: tar, tgz, tbz, and txz (from fastest to slowest). - .It Fl -local-packagedir=<path> -@@ -453,6 +461,8 @@ check all ports, update as necessary - .It Fl -show-work - show what dependent ports are, and are not installed (implies - .Fl t ) . -+.It Fl -try-broken -+do not skip ports marked as BROKEN or IGNORED and invoke the make command with -DTRYBROKEN. - .It Fl o Ar <new port dir in /usr/ports> <installed port> - replace the installed port with a port from a different origin - .It [-R] Fl r Ar name/glob of port directory in /var/db/pkg -@@ -603,6 +613,7 @@ variable must be set to a directory where the - superuser has write permissions. - Other useful variables include: - .Bd -literal -+PORTSDIR (default /usr/ports) - MASTER_SITE_INDEX (default http://www.FreeBSD.org/ports/) - FETCHINDEX (default fetch -am -o) - INDEXDIR (default $PORTSDIR, or $TMPDIR for --index-only) diff --git a/ports-mgmt/portmaster/files/patch-files_portmaster.rc.sample b/ports-mgmt/portmaster/files/patch-files_portmaster.rc.sample deleted file mode 100644 index eeccae3ccd98..000000000000 --- a/ports-mgmt/portmaster/files/patch-files_portmaster.rc.sample +++ /dev/null @@ -1,15 +0,0 @@ ---- files/portmaster.rc.sample.orig 2018-01-14 21:53:23 UTC -+++ files/portmaster.rc.sample -@@ -15,6 +15,12 @@ - # Make and save a package of the new port (-g) - # MAKE_PACKAGE=gopt - # -+# Format of saved packages (--package-format={txz,tbz,tgz,tar}) -+# PACKAGE_FORMAT=txz -+# -+# Format of backup packages (--backup-format={txz,tbz,tgz,tar}) -+# BACKUP_FORMAT=txz -+# - # Do not preclean the port's build directory (-C) - # DONT_PRE_CLEAN=Copt - # diff --git a/ports-mgmt/portmaster/files/patch-portmaster b/ports-mgmt/portmaster/files/patch-portmaster deleted file mode 100644 index b3caf4d79fc5..000000000000 --- a/ports-mgmt/portmaster/files/patch-portmaster +++ /dev/null @@ -1,1136 +0,0 @@ ---- portmaster.orig 2018-01-14 21:53:23 UTC -+++ portmaster -@@ -7,10 +7,12 @@ trap trap_exit INT - - umask 022 - --progcmd="$0" # actual invocation of this program for search in ps output --progname="${0##*/}" # program name in messages --program="$(realpath $0)" # full path to program for recursive calls -+progcmd="$0" # actual invocation of this program for search in ps output -+progname="${0##*/}" # program name in messages -+program="$(realpath $0 || echo $0)" # full path to program for recursive calls - -+PKG_CMD="/usr/local/sbin/pkg-static" -+ - # Initialize crucial values for the parent, and export them for the children - if [ -z "$PM_PARENT_PID" ]; then - PM_PARENT_PID=$$ -@@ -45,7 +47,7 @@ if [ -z "$PM_PARENT_PID" ]; then - my_environment=`set` - - # If we are already root, unset this to avoid potential conflict -- [ `ps -o uid= $$` -eq 0 ] && unset PM_SU_CMD PM_SU_VERBOSE -+ [ `id -u` -eq 0 ] && unset PM_SU_CMD PM_SU_VERBOSE - fi - - #=============== Begin functions we always want to have =============== -@@ -181,7 +183,7 @@ parent_exit () { - - pm_v "===>>> Removing empty directories from WRKDIRPREFIX" - [ -n "$needws" ] && echo '' || pm_v -- find $PM_WRKDIRPREFIX -depth -mindepth 1 -type d -empty -delete 2>/dev/null -+ find $PM_WRKDIRPREFIX -depth -mindepth 1 -maxdepth 2 -type d -empty -delete 2>/dev/null - fi - - case "$DISPLAY_LIST" in -@@ -194,8 +196,11 @@ parent_exit () { - fi - - : ${PAGER:='less -e'} -+ if [ -n "$PM_NO_CONFIRM" ]; then -+ PAGER=cat -+ fi - ( -- pkg query "===>>> pkg-message for %n-%v\n%M" $DISPLAY_LIST -+ $PKG_CMD query "===>>> pkg-message for %n-%v\n%M" $DISPLAY_LIST - echo "===>>> Done displaying pkg-message files" ; echo '' ) | $PAGER ;; - esac - -@@ -243,12 +248,12 @@ parent_exit () { - fi - - if [ -n "$1" -a -n "${PM_NEEDS_UPDATE# }" -a -n "$PM_BUILDING" -a -z "$FETCH_ONLY" ]; then -- echo "$progname <flags>${PM_NEEDS_UPDATE}" > ${TMPDIR}/portmasterfail.txt -+ echo "$progname <flags>${PM_NEEDS_UPDATE}" > ~/portmasterfail.txt - echo '' - echo "===>>> You can restart from the point of failure with this command line:" - echo " $progname <flags>${PM_NEEDS_UPDATE}" - echo '' -- echo "This command has been saved to ${TMPDIR}/portmasterfail.txt" -+ echo "This command has been saved to ~/portmasterfail.txt" - echo '' - fi - } -@@ -260,7 +265,7 @@ safe_exit () { - parent_exit $1 - else - # Save state for the parent process to read back in -- > $IPC_SAVE -+ : > $IPC_SAVE - if [ -z "$PM_FIRST_PASS" ]; then - echo "DISPLAY_LIST='$DISPLAY_LIST'" >> $IPC_SAVE - echo "INSTALLED_LIST='$INSTALLED_LIST'" >> $IPC_SAVE -@@ -308,50 +313,55 @@ safe_exit () { - exit ${1:-0} - } # safe_exit() - --flavor_part () { expr "$1" : ".*@" >/dev/null && echo "${1#*@}"; } --dir_part () { echo "${1%%@*}"; } --export_flavor () { local flavor="$1"; if [ "$FLAVOR" != "$flavor" ]; then -- pm_v "===>>> Setting FLAVOR to '$flavor' (was '$FLAVOR')"; -- export FLAVOR="$flavor"; fi; } -- -+target_part () { [ -z "${1##*:*}" ] && echo "${1#*:}" || echo install; } -+flavor_part () { local tmp="${1%%:*}"; [ -z "${tmp##*@*}" ] && echo "${tmp#*@}"; } -+dir_part () { local tmp="${1%%:*}"; echo "${tmp%%@*}"; } -+export_flavor () { if [ -n "$1" ]; then export FLAVOR="$1"; else unset FLAVOR; fi; } -+ - pm_cd () { builtin cd $1 2>/dev/null || return 1; } - pm_cd_pd () { [ -n "$PM_INDEX_ONLY" ] && return 2; - local dir=$pd/$(dir_part $1); - builtin cd $dir 2>/dev/null || - fail "Cannot cd to port directory: $dir"; } - pm_isdir () { builtin test -d "$1"; } --pm_isdir_pd () { local dir=$pd/$(dir_part "$1"); -- builtin test -d "$dir"; } --pm_kill () { kill $* >/dev/null 2>/dev/null; } -+pm_isdir_pd () { local dir=$(dir_part "$1"); -+ builtin test -n "$dir" -a -d "$pd/$dir"; } -+pm_kill () { kill "$@" >/dev/null 2>/dev/null; } - pm_make () { ( unset -v CUR_DEPS INSTALLED_LIST PM_DEPTH build_l PM_URB_LIST; -- /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS $*; ); } --pm_make_b () { /usr/bin/make $PM_MAKE_ARGS BEFOREPORTMK=bpm $*; } -+ /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS "$@"; ); } -+pm_make_b () { /usr/bin/make $PM_MAKE_ARGS BEFOREPORTMK=bpm "$@"; } - pm_mktemp () { - pm_mktemp_file=`/usr/bin/mktemp -t f-${PM_PARENT_PID}-$1 2>&1` || - fail "mktemp for $1 failed:\n ${pm_mktemp_file#mktemp: }" - } - pm_unlink () { [ -e "$1" ] && /bin/unlink $1; } --pm_islocked () { local locked; [ -n "$1" ] && locked=`pkg query %k "$1"` && -- [ "$locked" = 1 -o -e "$pdb/$1/+IGNOREME" ]; } -+pm_islocked () { local locked; [ -n "$1" ] && locked=`$PKG_CMD query %k "$1"` && -+ [ "$locked" = 1 ] || [ -e "$pdb/$1/+IGNOREME" ]; } - - # Superuser versions for commands that need root privileges - --pm_find_s () { $PM_SU_CMD /usr/bin/find $*; } -+pm_find_s () { $PM_SU_CMD /usr/bin/find "$@"; } - pm_install_s () { $PM_SU_CMD /usr/bin/install -p -o root -g wheel -m 644 $1 $2; } - pm_make_s () { ( unset -v CUR_DEPS INSTALLED_LIST PM_DEPTH build_l PM_URB_LIST; -- $PM_SU_CMD /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS $*; ); } -+ $PM_SU_CMD /usr/bin/nice /usr/bin/make $PM_MAKE_ARGS "$@"; ); } - pm_mkdir_s () { $PM_SU_CMD /bin/mkdir -p $1; } - pm_pkg_delete_s () { -- $PM_SU_CMD /usr/local/sbin/pkg delete -yf $*; -+ for f in "$@"; do -+ if [ "$($PKG_CMD query %k $f)" = 1 ]; then -+ was_locked=1 -+ $PKG_CMD unlock -qy $f -+ fi -+ done -+ $PM_SU_CMD /usr/local/sbin/pkg-static delete -yf "$@"; - for d in $* ; do - pm_rm_s -rf $pdb/$d - done - } --pm_rm_s () { $PM_SU_CMD /bin/rm $*; } --pm_rmdir_s () { $PM_SU_CMD /bin/rmdir $*; } -+pm_rm_s () { $PM_SU_CMD /bin/rm "$@"; } -+pm_rmdir_s () { $PM_SU_CMD /bin/rmdir "$@"; } - pm_unlink_s () { [ -e "$1" ] && $PM_SU_CMD /bin/unlink $1; } - --pm_v () { [ -n "$PM_VERBOSE" ] && echo -e "$*"; } -+pm_v () { [ -n "$PM_VERBOSE" ] && echo -e "$@"; } - pm_sv () { [ -n "$PM_SU_VERBOSE" ] && echo -e "===>>> SU $*"; } - - # Do this here so we can have a reasonably good guess. -@@ -359,7 +369,7 @@ pm_sv () { [ -n "$PM_SU_VERBOSE" ] && echo - if [ "$$" -eq "$PM_PARENT_PID" ]; then - if [ -z "$pd" ]; then - if [ -z "$PORTSDIR" ]; then -- pd=`pm_make_b -f/usr/share/mk/bsd.port.mk -V PORTSDIR 2>/dev/null` -+ pd=`pm_make_b -f/usr/share/mk/bsd.port.mk -V PORTSDIR 2>/dev/null` || pd="" - [ -z "$pd" ] && pm_isdir /usr/ports && pd=/usr/ports - else - pd=$PORTSDIR -@@ -433,6 +443,8 @@ usage () { - echo '' - echo "$progname --list-origins" - echo '' -+ echo "$progname --try-broken" -+ echo '' - echo "$progname [--force-config|-G] [-P|-PP] [-aftv] -F" - echo '' - echo "$progname [-n|y] [-b] [-D|d] -e <name/glob of a single port in $pdb>" -@@ -513,6 +525,8 @@ usage () { - echo '-n answer no to all user prompts for the features below' - echo '-y answer yes to all user prompts for the features below' - echo '' -+ echo '--try-broken do not skip ports marked as broken' -+ echo '' - echo '[-n|y] [-b] [-D|d] -e expunge one port via pkg delete, and remove its distfiles' - echo '[-n|y] [-b] [-D|d] -s clean out stale ports that used to be depended on' - echo '' -@@ -549,7 +563,7 @@ find_glob_dirs () { - - pattern=`globstrip $1` - -- glob_dirs=`pkg query -g "%n-%v" ${pattern}\*` -+ glob_dirs=`$PKG_CMD query -g "%n-%v" ${pattern}\*` - case "$glob_dirs" in - # Match a newline in multiple responses from find - *' -@@ -562,12 +576,37 @@ find_glob_dirs () { - return 1 - } - -+match_flavor () { -+ local origin=$(dir_part $1) -+ local flavor # =$(flavor_part $1) -+ local iport="$2" -+ local dir="$pd/$origin" -+ -+ if [ -d "$dir" ]; then -+ local IFS=' ' -+ local pkgname=${iport%-*} -+ local flavors=$(pm_make -C "$dir" -V FLAVORS) -+ for flavor in $flavors; do -+ local p=$(pm_make -C "$dir" FLAVOR=$flavor -V PKGNAME) -+ if [ -n "$p" -a "${p%-*}" = "$pkgname" ]; then -+ echo "$origin@$flavor" -+ return -+ fi -+ done -+ fi -+ echo "$1" # should not be reached! -+} -+ - origin_from_pdb () { -- local flavor pkgname -+ local flavor pkgname origin_flavor - - pkgname="$1" -- flavor=$(pkg annotate -Sq "$pkgname" flavor) -- pkg query '%o'"${flavor:+@$flavor}" "$pkgname" 2>/dev/null && return -+ flavor=$($PKG_CMD annotate -Sq "$pkgname" flavor) -+ -+ if origin_flavor=$($PKG_CMD query '%o'"${flavor:+@$flavor}" "$pkgname" 2>/dev/null); then -+ match_flavor $origin_flavor $pkgname -+ return 0 -+ fi - - case "$pkgname" in bsdpan-*) return 3 ;; esac - -@@ -576,7 +615,7 @@ origin_from_pdb () { - # An error above doesn't necessarily mean there's - # a problem in +MANIFEST, so don't mention it - echo " ===>>> No origin available for $pkgname" >&2 -- echo " ===>>> $pdb/$pkgname/+IGNOREME exists" >&2 -+ echo " ===>>> $pdb/$pkgname/+IGNOREME exists or the package is locked" >&2 - echo '' >&2 - fi - return 2 -@@ -684,6 +723,7 @@ for var in "$@" ; do - --list-origins) LIST_ORIGINS=list_origins ;; - --show-work) SHOW_WORK=show ; PM_THOROUGH=thorough ;; - --force-config) export PM_FORCE_CONFIG=pm_force_config ;; -+ --try-broken) TRY_BROKEN=try_broken; PM_MAKE_ARGS="$PM_MAKE_ARGS -DTRYBROKEN" ;; - --*) echo "Illegal option $var" ; echo '' - echo "===>>> Try $progname --help"; exit 1 ;; - *) newopts="$newopts $var" ;; -@@ -709,6 +749,7 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop:r:stvwx:y' CO - G) [ -z "$PM_FORCE_CONFIG" ] && { - PM_NO_MAKE_CONFIG=Gopt; ARGS="-G $ARGS"; } ;; - H) HIDE_BUILD=Hopt; ARGS="-H $ARGS" ;; -+ I) NON_INTERACTIVE=Iopt; ARGS="-I $ARGS" ;; - K) DONT_POST_CLEAN=Kopt; ARGS="-K $ARGS" ;; - L) LIST_PLUS=Lopt ;; - P) packages_init first ;; -@@ -728,7 +769,7 @@ while getopts 'BCDFGHKLPRabde:fghilm:nop:r:stvwx:y' CO - o) REPLACE_ORIGIN=oopt ;; # -o should take a parameter and $OPTARG should be assigned here - p) fail 'The -p option has been deprecated' ;; - r) PM_URB=ropt -- if [ -d "$pdb/$OPTARG" ] && pkg info -e $OPTARG; then -+ if [ -d "$pdb/$OPTARG" ] && $PKG_CMD info -e $OPTARG; then - glob_dirs=$OPTARG - else - case "$OPTARG" in */*) fail 'The argument to -r must be a package name, or a glob pattern' ;; esac -@@ -789,6 +830,7 @@ if [ -n "$ALWAYS_SCRUB_DISTFILES" -a -n "$DONT_SCRUB_D - fail "The -d and -D options are mutually exclusive" - fi - -+[ -n "$NO_ACTION" ] && PM_NO_MAKE_CONFIG=no_action PM_FORCE_CONFIG="" - [ -n "$PM_NO_MAKE_CONFIG" -a -n "$PM_FORCE_CONFIG" ] && unset PM_NO_MAKE_CONFIG - - if [ -n "$LIST" -o -n "$LIST_PLUS" ]; then -@@ -875,7 +917,7 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then - fi - unset INDEXFILE INDEXDIR - -- PM_INDEX_PORTS=`pkg version -Ivl\< $PM_INDEX | cut -f1 -d\<` -+ PM_INDEX_PORTS=`$PKG_CMD version -Ivl\< $PM_INDEX | cut -f1 -d\<` - export PM_INDEX_PORTS - - if [ -z "$pd" -o "$pd" != /usr/ports ]; then -@@ -927,6 +969,9 @@ if [ "$$" -eq "$PM_PARENT_PID" ]; then - fi - fi # [ "$$" -eq "$PM_PARENT_PID" ] - -+#=============== cache some build parameters in the environment =============== -+SCRIPTSDIR="$pd/Mk/Scripts" PORTSDIR="$pd" MAKE=make . "$pd/Mk/Scripts/ports_env.sh" > /dev/null -+ - #=============== Begin functions relevant to --features and main =============== - - # find installed port for given origin (with optional @flavor) in the pkg DB -@@ -938,11 +983,15 @@ iport_from_origin () { - - origin=$(dir_part "$1") - flavor=$(flavor_part "$1") -- pkgname_l=$(echo $(pkg query '%n-%v' $origin)) || return 1 -+ if [ -z "$flavor" ]; then -+ unset FLAVOR -+ flavor=$(pm_make -C "${pd}/${origin}" -V FLAVOR) -+ fi -+ pkgname_l=$(echo $($PKG_CMD query '%n-%v' $origin)) || return 1 - # if multiple flavors registered then fall back to $FLAVOR if no flavor has been passed in $1 - [ "${pkgname_l}" != "${pkgname_l#* }" ] && : ${flavor:=$FLAVOR} - for pkgname in $pkgname_l; do -- pkgflavor=$(pkg annotate -Sq "$pkgname" flavor) -+ pkgflavor=$($PKG_CMD annotate -Sq "$pkgname" flavor) - if [ "$pkgflavor" = "$flavor" ]; then - echo $pkgname - return 0 -@@ -1002,25 +1051,6 @@ get_answer_yn () { - fi - } - --match_flavor () { -- local origin=$(dir_part $1) -- local flavor=$(flavor_part $1) -- local iport="$2" -- local dir="$pd/$origin" -- -- [ -n "$flavor" -a -d "$dir" ] || return -- local IFS=' ' -- local pkgname=${iport%-*} -- local flavors=$(pm_make -C "$dir" -V FLAVORS) -- for flavor in $flavors; do -- local p=$(pm_make -C "$dir" FLAVOR=$flavor -V PKGNAME) -- if [ -n "$p" -a "${p%-*}" = "$pkgname" ]; then -- moved_npd="$origin@$flavor" -- break -- fi -- done --} -- - # Find the new origin for moved ports - # Set global variable moved_npd on success - # Return values: -@@ -1045,7 +1075,7 @@ find_moved_port () { - echo '' - echo " ===>>> The $sf port has been deleted" - echo " ===>>> Reason: ${moved##*|}" -- echo " ===>>> Skipping it due to +IGNOREME file" -+ echo " ===>>> Skipping it due to +IGNOREME file or the package being locked" - echo '' - fi - return 0 -@@ -1056,7 +1086,8 @@ find_moved_port () { - fi ;; - ${sf}\|*) moved_npd=${moved#*\|} # New port directory - moved_npd=${moved_npd%%\|*} -- [ -n $(flavor_part $moved_npd) ] && match_flavor $moved_npd $iport -+ [ -n "$(flavor_part $moved_npd)" ] && moved_npd=$(match_flavor $moved_npd $iport) -+ - echo '' - echo " ===>>> The $sf port moved to $moved_npd" - echo " ===>>> Reason: ${moved##*|}" -@@ -1082,7 +1113,7 @@ find_moved_port () { - } - - all_pkgs_by_origin () { -- namesorigins=`pkg query -a "%n-%v %o"` -+ namesorigins=`$PKG_CMD query -a "%n-%v %o"` - echo "$namesorigins" - return - } -@@ -1146,11 +1177,10 @@ read_distinfos_all () { - echo '' - - for origin in ${pd}/*/*; do --# origin=$(dir_part "$origin") - case "${origin#$pd/}" in - Mk/*|T*|distfiles/*|packages/*|*/[Mm]akefile*|CVS/*|*/CVS|base/*) continue ;; esac - -- pm_isdir "$origin" ] || continue -+ pm_isdir "$origin" || continue - - if [ -s "${origin}/distinfo" ]; then - distinfo="${origin}/distinfo" -@@ -1181,17 +1211,17 @@ ports_by_category () { - local pkg - - pm_v "===>>> Sorting ports by category" -- roots=` pkg query -e "%#d = 0 && %#r = 0" "%n-%v"` -- trunks=` pkg query -e "%#d = 0 && %#r > 0" "%n-%v"` -- branches=`pkg query -e "%#d > 0 && %#r > 0" "%n-%v"` -- leaves=` pkg query -e "%#d > 0 && %#r = 0" "%n-%v"` -+ roots=` $PKG_CMD query -e "%#d = 0 && %#r = 0" "%n-%v"` -+ trunks=` $PKG_CMD query -e "%#d = 0 && %#r > 0" "%n-%v"` -+ branches=`$PKG_CMD query -e "%#d > 0 && %#r > 0" "%n-%v"` -+ leaves=` $PKG_CMD query -e "%#d > 0 && %#r = 0" "%n-%v"` - - num_roots=$(echo $(echo $roots | wc -w)) - num_trunks=$(echo $(echo $trunks | wc -w)) - num_branches=$(echo $(echo $branches | wc -w)) - num_leaves=$(echo $(echo $leaves | wc -w)) - -- num_ports=$(echo $(pkg query -a "%n-%v" | wc -w)) -+ num_ports=$(echo $($PKG_CMD query -a "%n-%v" | wc -w)) - } - - delete_empty_dist_subdirs () { -@@ -1279,7 +1309,7 @@ if [ -n "$CLEAN_PACKAGES" ]; then - for package in `find $PACKAGES -type f | sort`; do - pkg_dir=${package##*/} ; pkg_dir=${pkg_dir%\.*} ; echo '' - -- origin=`pkg query -F $package "%o" 2>/dev/null` || -+ origin=`$PKG_CMD query -F $package "%o" 2>/dev/null` || - origin=`tar -O -zxvf $package '+CONTENTS' 2>/dev/null | grep '@comment ORIGIN:'` || - origin=`tar -O -zxvf $package '+MANIFEST' 2>/dev/null | grep '^origin:'` || - fail "Empty origin in $package" -@@ -1302,7 +1332,7 @@ if [ -n "$CLEAN_PACKAGES" ]; then - if [ -n "$port_ver" ]; then - if [ "$port_ver" = "$pkg_dir" ]; then - echo "===>>> ${package##*/} is up to date" -- if ! pkg info -e $pkg_dir; then -+ if ! $PKG_CMD info -e $pkg_dir; then - echo " ===>>> $pkg_dir is not installed" - echo " ===>>> Path: ${package}" - get_answer_yn y "\n\t===>>> Delete stale package: ${package##*/}" -@@ -1320,7 +1350,7 @@ if [ -n "$CLEAN_PACKAGES" ]; then - - unset port_ver - -- if pkg info -e $pkg_dir; then -+ if $PKG_CMD info -e $pkg_dir; then - echo " ===>>> ${package##*/} matches the installed version" - else - echo " ===>>> ${package##*/} is not installed" -@@ -1362,7 +1392,7 @@ if [ -n "$CLEAN_PACKAGES" ]; then - fi # [ -n "$CLEAN_PACKAGES" ] - - if [ -n "$CHECK_DEPENDS" ]; then -- pkg check -dn -+ $PKG_CMD check -dn - exit 0 - fi - -@@ -1377,14 +1407,14 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then - if ! pm_isdir_pd "$origin"; then - find_moved_port $origin $pkg nonfatal >/dev/null - [ -n "$moved_npd" ] || continue -- origin=$moved_npd -+ origin=$(dir_part $moved_npd) - fi - - if ! pm_cd $pd/$origin; then - echo " ===>>> $pd/$origin does not exist for $pkg" - continue - fi -- unique_list="${unique_list}`make -V UNIQUENAME -V OPTIONS_NAME | tr '\n' ':'`" -+ unique_list="${unique_list}`pm_make -V OPTIONS_NAME | tr '\n' ':'`" - done <<-EOF - $(all_pkgs_by_origin) - EOF -@@ -1413,7 +1443,7 @@ if [ -n "$CHECK_PORT_DBDIR" ]; then - fi - - if [ -n "$LIST_ORIGINS" ]; then -- pkg query -e '%#r = 0' '%o' -+ $PKG_CMD query -e '%#r = 0' '%o' - - exit 0 - fi -@@ -1423,10 +1453,11 @@ fi - - check_state () { - # Global: state -- local state_set -+ local state_set makevars - -+ [ -z "$TRY_BROKEN" ] && makevars="FORBIDDEN BROKEN IGNORE" || makevars="FORBIDDEN" - if egrep -ql '^(FORBIDDEN|BROKEN|IGNORE)' Makefile; then -- for state in FORBIDDEN BROKEN IGNORE; do -+ for state in $makevars; do - state_set=`pm_make -V $state` - if [ -n "$state_set" ]; then - echo " ===>>> This port is marked $state" -@@ -1502,10 +1533,10 @@ check_for_updates () { - fi - - if [ -z "$do_update" -a -z "$skip" -a -z "$PM_INDEX_ONLY" ] && pm_isdir "$pd/$origin"; then -- if ! pm_cd $pd/$origin; then -+ if ! pm_cd $pd/$origin; then # <se> cannot happen - see pm_isdir test above - if pm_islocked "$iport"; then - echo " ===>>> Warning: Unable to cd to $pd/$origin" -- echo " ===>>> Continuing due to $pdb/$iport/+IGNOREME" -+ echo " ===>>> Continuing due to $pdb/$iport/+IGNOREME or the package being locked" - echo '' - CUR_DEPS="${CUR_DEPS}${iport}:${originflavor}:" - return 0 -@@ -1521,7 +1552,7 @@ check_for_updates () { - # If the port has moved and no +IGNOREME, we have to update it - if [ -n "$moved_npd" ]; then - if pm_islocked "$iport"; then -- echo " ===>>> Continuing due to $pdb/$iport/+IGNOREME" -+ echo " ===>>> Continuing due to $pdb/$iport/+IGNOREME or the package being locked" - echo '' - CUR_DEPS="${CUR_DEPS}${iport}:${originflavor}:" - return 0 -@@ -1545,7 +1576,7 @@ check_for_updates () { - unset port_ver - fi - else -- case `pkg version -t $iport $port_ver` in -+ case `$PKG_CMD version -t $iport $port_ver` in - \<) do_update=upd_lt ;; - =) ;; # Can be reached if same version with different options - \>) if [ -n "$PM_VERBOSE" ]; then -@@ -1569,7 +1600,7 @@ check_for_updates () { - if [ -z "$moved_npd" ]; then - echo " ===>>> New version available: $port_ver" - if pm_islocked "$iport"; then -- echo " ===>>> +IGNOREME file is present for $1" -+ echo " ===>>> +IGNOREME file is present for $1 or the package is locked" - fi - pm_cd_pd $origin && check_state - num_updates=$(( $num_updates + 1 )) -@@ -1628,7 +1659,7 @@ pm_pkg_create () { - fi - - pm_cd $pkgdir || fail "Cannot cd into $pkgdir to create a package" -- if $PM_SU_CMD pkg create $format_option $2; then -+ if $PM_SU_CMD $PKG_CMD create $format_option $2; then - if [ "$1" = "$pbu" ]; then - if [ -n "$BACKUP" ]; then - echo " ===>>> Package saved to $1" ; echo '' -@@ -1637,7 +1668,7 @@ pm_pkg_create () { - NB_DELETE="${NB_DELETE}${pkg} " - fi - elif [ "$1" = "$PACKAGES" ]; then -- local pkg ; pkg=$2.txz -+ local pkg ; pkg=$2.pkg - - if [ -z "$PM_INDEX_ONLY" ]; then - local pkg_latest_file -@@ -1980,7 +2011,7 @@ if [ -n "$LIST" -o -n "$LIST_PLUS" ]; then - fi - - if [ -n "$EXPUNGE" ]; then -- if ! pm_isdir "$pdb/$EXPUNGE" || ! pkg info -e $EXPUNGE; then -+ if ! pm_isdir "$pdb/$EXPUNGE" || ! $PKG_CMD info -e $EXPUNGE; then - find_glob_dirs $EXPUNGE - case $? in - 1) fail "No such port: $EXPUNGE" ;; -@@ -1992,7 +2023,7 @@ if [ -n "$EXPUNGE" ]; then - fi - - origin=`origin_from_pdb $EXPUNGE` -- deplist=`pkg query "%rn-%rv" $origin` -+ deplist=`$PKG_CMD query "%rn-%rv" $origin` - if [ -n "$deplist" ]; then - echo "===>>> Warning: Ports with dependencies on ${EXPUNGE}:" - echo "$deplist" | sed 's/^/ /' -@@ -2020,7 +2051,7 @@ fi - if [ -n "$CLEAN_STALE" ]; then - [ -z "$no_del_list" ] && export no_del_list=':' - -- stale_ports=`pkg query -ae '%a = 1' '%?r %n-%v' | awk '/^0 / { print \$2 }'` -+ stale_ports=`$PKG_CMD query -ae '%a = 1' '%?r %n-%v' | awk '/^0 / { print \$2 }'` - for file in $stale_ports; do - iport="${file%/+REQUIRED_BY}" ; iport=${iport#$pdb/} - -@@ -2040,7 +2071,7 @@ if [ -n "$CLEAN_STALE" ]; then - continue - fi - -- echo '' ; pkg info -f $iport -+ echo '' ; $PKG_CMD info -f $iport - - get_answer_yn n "\t===>>> ${iport} is no longer depended on, delete" - case "$?" in -@@ -2073,7 +2104,7 @@ check_restart_and_udf () { - # to go out to the disk if we don't have to. - [ -z "$RESTART" ] && return 1 - -- if [ ! -e "$pdb/${1}/PM_UPGRADE_DONE_FLAG" ] || ! pkg info -e $1; then -+ if [ ! -e "$pdb/${1}/PM_UPGRADE_DONE_FLAG" ] || ! $PKG_CMD info -e $1; then - return 1 - else - already_done $1 -@@ -2175,26 +2206,32 @@ update_pm_nu () { - } - - update_build_l () { -- local originflavor origin flavor iport -+ local originflavor origin flavor iport make_target - - originflavor=$1 ; update_pm_nu $originflavor - origin=$(dir_part "$originflavor") - flavor=$(flavor_part "$originflavor") - iport="$2" -+ make_target=$3 - - [ -n "$PM_NO_CONFIRM" ] && return - - if [ -z "$iport" ]; then - case "$build_l" in *\ $origin\\*) return ;; esac -- build_l="${build_l}\tInstall $originflavor\n" -+ case $make_target in -+ install) -+ build_l="${build_l}\tInstall $originflavor\n" ;; -+ *) -+ build_l="${build_l}\tExecute make $make_target for $originflavor\n" ;; -+ esac - return -- else -- case "$build_l" in *\ $iport\ *|*\ $iport\\*) return ;; esac - fi - -+ case "$build_l" in *\ $iport\ *|*\ $iport\\*) return ;; esac -+ - find_new_port "$originflavor" # sets global variable new_port - -- case `pkg version -t $iport $new_port 2>/dev/null` in -+ case `$PKG_CMD version -t $iport $new_port 2>/dev/null` in - \<) build_l="${build_l}\tUpgrade $iport to $new_port\n" ;; - =) build_l="${build_l}\tRe-install $iport\n" ;; - \>) build_l="${build_l}\tDowngrade $iport to $new_port\n" ;; -@@ -2203,8 +2240,9 @@ update_build_l () { - } - - update_port () { -- local deps -+ local make_target deps - -+ make_target=$(target_part "$1") - if [ -n "$2" ]; then - echo "===>>> Launching child to update $1 to $2" - else -@@ -2300,7 +2338,7 @@ make_dep_list () { - fail "make_dep_list: Unsupported option '$dep_type'" - esac - done -- [ -n "$var_opt" ] && make $var_opt | tr ' ' '\n' | cut -d: -f2 | sort -u -+ [ -n "$var_opt" ] && pm_make $var_opt | tr ' ' '\n' | cut -d: -f2-3 | sort -u - } - - gen_dep_list () { -@@ -2368,15 +2406,17 @@ dependency_check () { - rundeps=`gen_dep_list run-depends-list` - - for dep in $d_port_list; do -+ # strip optional make target -+ local depdir=${dep%:*} - # If the port is already installed, do not mark - # it as a build-only dependency, or it will be - # installed by package and/or removed -- pkg info -e ${dep#$pd/} && -- run_dl="$run_dl $dep" && -+ $PKG_CMD info -e ${depdir#$pd/} && -+ run_dl="$run_dl $depdir" && - continue - case "$rundeps" in - *" ${dep} "*|*${dep}*) -- varname=`echo ${dep#$pd/} | sed 's#[-+/\.@]#_#g'` -+ varname=`echo ${dep#$pd/} | sed 's#[-+/\.@:]#_#g'` - rundep_list="$rundep_list $varname" - eval $varname=\"$portdir \$$varname\" - eval ${varname}_p=$dep -@@ -2409,7 +2449,10 @@ dependency_check () { - - # Do not export, for THIS parent process only - [ -n "$PM_FIRST_PASS" ] && doing_dep_check=doing_dep_check -- for d_port in $d_port_list; do -+ for d_port_target in $d_port_list; do -+ # strip optional make target -+ local d_port=${d_port_target%:*} -+ local make_target=$(target_part "$d_port_target") - origin="${d_port#$pd/}" - if [ -n "$SHOW_WORK" ]; then - iport=`iport_from_origin $origin` -@@ -2429,23 +2472,14 @@ dependency_check () { - [ -z "$PM_URB_UP" ] && - case "$CUR_DEPS" in *:${origin}:*) continue ;; esac - -- if [ -z "$PM_INDEX_ONLY" ]; then -+ if [ -z "$PM_INDEX_ONLY" -a "$make_target" = install ]; then - local conflicts glob confl_p dir flavor - dir=$(dir_part $d_port) - flavor=$(flavor_part $d_port) -- conflicts='' -- if pm_cd "$pd/$dir"; then -- if grep -ql ^CONFLICTS Makefile ; then -- conflicts=`FLAVOR=$flavor pm_make_b \ -- -V CONFLICTS \ -- -V CONFLICTS_BUILD \ -- -V CONFLICTS_INSTALL` -- fi -- else -- fail "Cannot cd to $dir" -- fi -+ pm_cd "$pd/$dir" || fail "Cannot cd to $dir" -+ conflicts=`FLAVOR=$flavor pm_make_b -V CONFLICTS -V CONFLICTS_BUILD -V CONFLICTS_INSTALL` - for glob in $conflicts; do -- confl_p=`pkg query -g "%n-%v" $glob 2>/dev/null` -+ confl_p=`$PKG_CMD query -g "%n-%v" $glob 2>/dev/null` - if [ -n "$confl_p" ]; then - confl_p=${confl_p%% *} - d_port="$pd/`origin_from_pdb $confl_p`" -@@ -2498,7 +2532,11 @@ dependency_check () { - check_for_updates $iport $origin || fail 'Update failed' - else - check_interactive $origin || continue -- update_port $origin -+ if [ "$make_target" != "install" ]; then -+ [ -z "$PM_FIRST_PASS" ] && post_clean_l="$post_clean_l $origin" -+ origin="$origin:$make_target" -+ fi -+ update_port "$origin" - fi - done - [ -n "$PM_FIRST_PASS" ] && unset doing_dep_check -@@ -2587,7 +2625,7 @@ post_first_pass () { - done - - for dep in $build_only_dl_g; do -- [ "`pkg query "%?r" ${dep#$pd/}`" = "1" ] && continue -+ [ "`$PKG_CMD query "%?r" ${dep#$pd/}`" = "1" ] && continue - [ -n "$PM_DEL_BUILD_ONLY" ] && - iport_from_origin ${dep#$pd/} >/dev/null && continue - temp_bodlg="$temp_bodlg $dep" -@@ -2629,7 +2667,7 @@ urb_update () { - case " $PM_URB_ORIGINS" in *" $req_by_o "*) continue ;; esac - PM_URB_LIST="${PM_URB_LIST} ${req_by}" - done <<-EOF -- $(pkg query "%rn-%rv %ro" ${origin}) -+ $($PKG_CMD query "%rn-%rv %ro" ${origin}) - EOF - done - -@@ -2642,7 +2680,7 @@ urb_update () { - - for req_by in $PM_URB_LIST; do - # Probably not needed, but JIC -- pkg info -e $req_by || continue -+ $PKG_CMD info -e $req_by || continue - - pm_v "===>>> $req_by depends on $PM_URB_IPORTS" - -@@ -2683,7 +2721,7 @@ multiport () { - else - fail "$pd/${port} does not exist" - fi ;; -- *) if pm_isdir "$pdb/$port" && pkg info -e $port; then -+ *) if pm_isdir "$pdb/$port" && $PKG_CMD info -e $port; then - worklist_temp="$worklist_temp $port" - else - find_glob_dirs $port -@@ -2773,8 +2811,8 @@ multiport () { - - num=$(( $num + 1 )) - init_term_printf "$port ${num}/${numports}" -- ("$program" $ARGS $port) || update_failed=update_failed -- . $IPC_SAVE && > $IPC_SAVE -+ ($program $ARGS $port) || update_failed=update_failed -+ . $IPC_SAVE && : > $IPC_SAVE - [ -n "$update_failed" ] && fail "Update for $port failed" - - case "$PM_NEEDS_UPDATE" in -@@ -2803,7 +2841,7 @@ multiport () { - */*) origin=$port ;; - *) # If an installed version does not exist at this - # point it probably got updated as a dependency -- if ! pkg info -e $port; then -+ if ! $PKG_CMD info -e $port; then - numports=$(( $numports - 1 )) - continue - fi -@@ -2823,7 +2861,7 @@ multiport () { - num=$(( $num + 1 )) - init_term_printf "$port ${num}/${numports}" - ("$program" $ARGS $port) || update_failed=update_failed -- . $IPC_SAVE && > $IPC_SAVE -+ . $IPC_SAVE && : > $IPC_SAVE - [ -n "$update_failed" ] && fail "Update for $port failed" - done - -@@ -2951,7 +2989,7 @@ all_first_pass () { - origin=`origin_from_pdb $iport` || { - case "$?" in - 3) ;; -- 2) pm_v " ===>>> No ORIGIN for $iport, and +IGNOREME is present" -+ 2) pm_v " ===>>> No ORIGIN for $iport, and +IGNOREME is present or the package is locked" - echo " ===>>> Skipping" - echo '' ;; - *) fail 'Cannot continue' ;; -@@ -3029,8 +3067,12 @@ no_valid_port () { - echo "===>>> Try $progname --help" ; echo '' ; safe_exit 1 - } - -+make_target=$(target_part "$1") -+post_clean_l="" -+ - # Figure out what we are going to be working on - if [ -z "$REPLACE_ORIGIN" ]; then -+ portdir="${1%:*}" - export_flavor $(flavor_part $portdir) - [ -n "$portdir" ] && { argv=$portdir ; unset portdir; } - argv=${argv:-$1} ; argv=${argv%/} ; argv=`globstrip $argv` -@@ -3048,7 +3090,7 @@ if [ -z "$REPLACE_ORIGIN" ]; then - *) echo '' ; no_valid_port ;; - esac - done ;; -- *) upg_port=$(pkg query %n-%v "$argv") ;; -+ *) upg_port=$($PKG_CMD query %n-%v "$argv") ;; - esac - - if [ -z "$portdir" -a -z "$upg_port" ]; then -@@ -3061,9 +3103,11 @@ if [ -z "$REPLACE_ORIGIN" ]; then - unset glob_dirs - fi - unset argv -+ -+ [ "$make_target" != install ] && PM_MAKE_ARGS="-DDISABLE_CONFLICTS $PM_MAKE_ARGS" - else - portdir="${1#$pd/}" ; portdir="${portdir%/}" -- export_flavor=$(flavor_part $portdir) -+ export_flavor $(flavor_part $portdir) - if [ -z "$PM_INDEX_ONLY" ]; then - pm_isdir_pd "$portdir" ] || missing=missing - else -@@ -3076,12 +3120,12 @@ else - echo '' ; no_valid_port - fi - -- upg_port=`iport_from_origin $portdir` || upg_port=$opd -+ upg_port=`iport_from_origin $portdir` || upg_port=$opd # <se> $opd is never set??? - arg2=${2#$pd/} ; arg2=${arg2#$pdb/} ; arg2=${arg2%/} - - case "$arg2" in - */*) ro_opd=$arg2 ; ro_upg_port=`iport_from_origin $ro_opd` ;; -- *) if pm_isdir "$pdb/$arg2" && pkg info -e $arg2; then -+ *) if pm_isdir "$pdb/$arg2" && $PKG_CMD info -e $arg2; then - ro_upg_port=$arg2 - else - find_glob_dirs $arg2 && ro_upg_port=${glob_dirs#$pdb/} -@@ -3097,7 +3141,7 @@ else - unset arg2 - - if [ -z "$ro_upg_port" ]; then -- pkg query -a "%do" | grep -q "^$ro_opd$" -+ $PKG_CMD query -a "%do" | grep -q "^$ro_opd$" - if [ "$?" -eq 1 ]; then - echo '' - echo "===>>> The second argument to -o can be a package name," -@@ -3133,6 +3177,7 @@ if [ -z "$PM_INDEX_ONLY" ] && ! pm_isdir_pd "$portdir" - pm_isdir_pd "$moved_npd" || no_valid_port - - [ "$$" -eq "$PM_PARENT_PID" ] && parent_exit -+ [ -z "$upg_port" ] && upg_port="$portdir" - exec "$program" $ARGS -o $moved_npd $upg_port - # NOT REACHED - fi -@@ -3142,8 +3187,8 @@ iport_from_pkgname () { - - dir=$(dir_part $1) - flavor=$(flavor_part $1) -- pkgname=$(FLAVOR=$flavor make -C "$pd/$dir" -V PKGNAME) || return 1 -- pkg info -x "^${pkgname%-*}"'-[^-]*' 2>/dev/null -+ pkgname=$(FLAVOR=$flavor pm_make -C "$pd/$dir" -V PKGNAME) && -+ $PKG_CMD query "%n-%v" "${pkgname%-*}" - } - - if [ -z "$upg_port" -a -z "$REPLACE_ORIGIN" ]; then -@@ -3161,7 +3206,7 @@ if pm_islocked "$upg_port"; then - *:${upg_port}:*) ;; # Let it build - *) if [ -z "$FETCH_ONLY" ]; then - echo '' -- echo "===>>> $upg_port has an +IGNOREME file" -+ echo "===>>> $upg_port has an +IGNOREME file or the package is locked" - get_answer_g n y "\t===>>> Update anyway? y/n" - case "$?" in - 1) ;; # Let it build -@@ -3175,7 +3220,7 @@ if pm_islocked "$upg_port"; then - esac - else - echo '' -- echo "===>>> $upg_port has an +IGNOREME file, ignoring" -+ echo "===>>> $upg_port has an +IGNOREME file or the package is locked, ignoring" - echo '' - CUR_DEPS="${CUR_DEPS}${upg_port}:${portdir}:" - safe_exit -@@ -3183,7 +3228,7 @@ if pm_islocked "$upg_port"; then - esac - elif [ -n "$PM_URB_UP" ]; then - echo '' -- echo "===>>> $upg_port has an +IGNOREME file, ignoring" -+ echo "===>>> $upg_port has an +IGNOREME file or the package is locked, ignoring" - echo '' - safe_exit - fi -@@ -3229,11 +3274,14 @@ if [ -n "$PM_FIRST_PASS" -a -z "$FETCH_ONLY" ]; then - fi - fi - -- update_build_l $portdir $upg_port -+ update_build_l "$portdir" "$upg_port" "$make_target" - elif [ -n "$FETCH_ONLY" -a -n "$PM_PACKAGES" ]; then - update_pm_nu $portdir - fi - -+# Test for necessary privileges to actually install ports -+[ -n "$NO_ACTION" ] || [ "$($PM_SU_CMD id -u)" = 0 ] || fail "Insufficient privileges to install ports (run as root or set PM_SU_CMD)" -+ - # Do these things first time through - if [ -z "$PM_INDEX_ONLY" -a -z "$PM_BUILDING" -a -z "$SHOW_WORK" -a -z "$NO_ACTION" ]; then - # Do not start this in the background until we are sure we are going to proceed -@@ -3389,7 +3437,7 @@ fetch_package () { - export ppd - fi - -- pm_isdir "$ppd" ] || { pm_sv Creating $ppd; pm_mkdir_s $ppd; } -+ pm_isdir "$ppd" || { pm_sv Creating $ppd; pm_mkdir_s $ppd; } - - if [ -z "$FETCH_ARGS" ]; then - FETCH_ARGS=`pm_make -f/usr/share/mk/bsd.port.mk -V FETCH_ARGS 2>/dev/null` -@@ -3398,7 +3446,7 @@ fetch_package () { - fi - - if [ -z "$PM_ALWAYS_FETCH" ]; then -- if [ -r "${ppd}/${1}.txz" ]; then -+ if [ -r "${ppd}/${1}.pkg" ]; then - pm_v "===>>> Package exists, skipping fetch" - return 0 - else -@@ -3406,7 +3454,7 @@ fetch_package () { - fi - else - do_fetch=do_fetch_always_fetch -- pm_unlink_s ${ppd}/${1}.txz -+ pm_unlink_s ${ppd}/${1}.pkg - fi - - if [ -n "$do_fetch" ]; then -@@ -3418,10 +3466,10 @@ fetch_package () { - fi - fi - -- pm_sv Fetching ${1}.txz -- if ! $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.txz 2>/dev/null; then -- pm_unlink_s ${ppd}/${1}.txz -- $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.txz 2>/dev/null -+ pm_sv Fetching ${1}.pkg -+ if ! $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.pkg 2>/dev/null; then -+ pm_unlink_s ${ppd}/${1}.pkg -+ $PM_SU_CMD fetch $FETCH_ARGS -o $ppd ${sitepath}${1}.pkg 2>/dev/null - fi - fi - } -@@ -3444,9 +3492,9 @@ fetch_package () { - echo "===>>> Checking package repository for latest available version" - - if [ -n "$LOCAL_PACKAGEDIR" ]; then -- pm_v "===>>> ... checking: ${LOCAL_PACKAGEDIR}/All/${new_port}.txz" -- if [ -r "${LOCAL_PACKAGEDIR}/All/${new_port}.txz" ]; then -- local_package=${LOCAL_PACKAGEDIR}/All/${new_port}.txz -+ pm_v "===>>> ... checking: ${LOCAL_PACKAGEDIR}/All/${new_port}.pkg" -+ if [ -r "${LOCAL_PACKAGEDIR}/All/${new_port}.pkg" ]; then -+ local_package=${LOCAL_PACKAGEDIR}/All/${new_port}.pkg - latest_pv=${local_package##*/} - fi - if [ -z "$latest_pv" -a -z "$PM_INDEX_ONLY" ]; then -@@ -3518,7 +3566,7 @@ fetch_package () { - fi - else - latest_pv=${latest_pv#*href=\"} -- latest_pv=${latest_pv%%\.txz*} -+ latest_pv=${latest_pv%%\.pkg*} - fi - - notnewer () { -@@ -3533,7 +3581,7 @@ notnewer () { - pm_v "===>>> Available package ($latest_pv) matches the current version" - elif [ -n "$latest_pv" -a -n "$PM_PACKAGES_NEWER" ]; then - if [ -n "$upg_port" ]; then -- case `pkg version -t $upg_port $latest_pv` in -+ case `$PKG_CMD version -t $upg_port $latest_pv` in - \<) use_package=up_newer - pm_v "===>>> Available package ($latest_pv)" - pm_v " is newer than installed ($upg_port)" ;; -@@ -3549,7 +3597,7 @@ notnewer () { - pm_v "===>>> There is a package available ($latest_pv)" - fi - elif [ -n "$latest_pv" ]; then -- case `pkg version -t $new_port $latest_pv` in -+ case `$PKG_CMD version -t $new_port $latest_pv` in - \<) # Could happen if ports tree is out of date - use_package=up_old_tree - pm_v "===>>> Available package ($latest_pv)" -@@ -3603,7 +3651,7 @@ if [ -z "$use_package" ]; then - - pm_cd_pd $portdir - export_flavor $(flavor_part $portdir) -- [ -z "$DONT_PRE_CLEAN" ] && { pm_make clean NOCLEANDEPENDS=ncd || -+ [ -z "$DONT_PRE_CLEAN" ] && { pm_make_s clean NOCLEANDEPENDS=ncd || - fail 'make clean failed'; } - - fl_read=`echo ${TMPDIR}/f-${PM_PARENT_PID}-fetchlog-${portdir#*/}.*` -@@ -3632,22 +3680,30 @@ if [ -z "$use_package" ]; then - - # Return flavor for named pkg (must be executed in port directory!) - pkg_flavor () { -- local pkg="$1" flavor -+ local pkg="$1" flavor starttime - pm_make pretty-flavors-package-names | sed -ne 's!^\([A-Za-z0-9_]*\): *'$pkg'$!\1!p'; - } - export_flavor=$(pkg_flavor $new_port) -- if [ -n "$HIDE_BUILD" ] && [ -n "$(pm_make -V LICENSE)" ]; then -+ if [ -n "$HIDE_BUILD" ] && [ -n "$(pm_make -V LICENSE)" ] && [ -z "$(pm_make -V DISABLE_LICENSES)" ]; then - pm_make extract ask-license || fail "make extract ask-license failed for $portdir" - fi -+ if [ "$make_target" = "extract" -o "$make_target" = "patch" ]; then -+ eval pm_make -DNO_DEPENDS $make_target $port_log_args || fail "make $make_target failed for $portdir" -+ safe_exit -+ fi -+ starttime=$(date "+%s") - eval pm_make build $port_log_args || fail "make build failed for $portdir" -+ [ "$make_target" = "build" ] && safe_exit -+ echo "===>>> Building the port required $(( `date "+%s"` - $starttime )) seconds" - - pm_sv Running make stage - # Defining NO_DEPENDS ensures that we will control the installation - # of the depends, not bsd.port.mk. - eval pm_make -DNO_DEPENDS stage $port_log_args || fail "make stage failed for $portdir" -+ [ "$make_target" = "stage" ] && safe_exit - else - [ -z "$local_package" ] && { -- fetch_package $latest_pv || fail "Fetch for ${latest_pv}.txz failed"; } -+ fetch_package $latest_pv || fail "Fetch for ${latest_pv}.pkg failed"; } - fi - - # Ignore if no old port exists, or -F -@@ -3665,7 +3721,7 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" ] && [ -z "$F - grep -v ^$LOCALBASE_COMPAT > $pm_mktemp_file - - unset temp -- for file in `pkg query %Fp $UPGRADE_PORT | -+ for file in `$PKG_CMD query %Fp $UPGRADE_PORT | - sort - $pm_mktemp_file | uniq -d`; do - temp="${temp}$file " - done -@@ -3688,7 +3744,7 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" ] && [ -z "$F - - if [ -n "$REPLACE_ORIGIN" -a -n "$ro_upg_port" ]; then # <se> not always true for port moved to flavored version with no version update??? - # Delete any existing versions of the old port -- np_orphan=`pkg query "%a" $ro_upg_port` -+ np_orphan=`$PKG_CMD query "%a" $ro_upg_port` - pm_sv "Running pkg delete for $ro_upg_port" - pm_pkg_delete_s $ro_upg_port - fi -@@ -3710,7 +3766,7 @@ if [ -n "$upg_port" -o -n "$ro_upg_port" ] && [ -z "$F - - # If $ro_upg_port was non-automatic, keep its state - if [ "${np_orphan:-1}" -eq 1 ]; then -- np_orphan=`pkg query "%a" $upg_port` -+ np_orphan=`$PKG_CMD query "%a" $upg_port` - fi - pm_sv "Running pkg delete for $upg_port" - pm_pkg_delete_s $upg_port -@@ -3775,17 +3831,21 @@ if [ -z "$use_package" ]; then - else - [ -n "$local_package" ] && ppd=${LOCAL_PACKAGEDIR}/All - -- echo "===>>> Installing package from: ${ppd}/${latest_pv}.txz" -- if $PM_SU_CMD pkg add --accept-missing --force ${ppd}/${latest_pv}.txz; then -+ echo "===>>> Installing package from: ${ppd}/${latest_pv}.pkg" -+ if $PM_SU_CMD $PKG_CMD add --accept-missing --force ${ppd}/${latest_pv}.pkg; then - if [ -n "$PM_DELETE_PACKAGES" ]; then -- pm_v "===>>> Deleting ${latest_pv}.txz" -- pm_unlink_s ${ppd}/${latest_pv}.txz -+ pm_v "===>>> Deleting ${latest_pv}.pkg" -+ pm_unlink_s ${ppd}/${latest_pv}.pkg - fi - else -- install_failed ${latest_pv}.txz -+ install_failed ${latest_pv}.pkg - fi - fi - -+if [ "$was_locked" = 1 ]; then -+ $PKG_CMD lock -qy "$new_port" -+fi -+ - if [ -n "$preserve_dir" ]; then - rmdir $preserve_dir 2>/dev/null - unset preserve_dir preserve_port_files -@@ -3801,14 +3861,14 @@ echo '' - temp=`find $LOCALBASE_COMPAT -type d -empty 2>/dev/null` - if [ -z "$temp" ] && pm_isdir "$LOCALBASE_COMPAT"; then - unset files -- for file in `pkg query %Fp $new_port`; do -+ for file in `$PKG_CMD query %Fp $new_port`; do - [ -f "${LOCALBASE_COMPAT}/${file##*/}" ] && - files="${files}${LOCALBASE_COMPAT}/${file##*/} " - done - - if [ -n "$files" ]; then - pm_sv Removing old shared libraries, and running ldconfig -- pm_rm_s `make -V FILES:O:u FILES="$files"` -+ pm_rm_s `pm_make -V FILES:O:u FILES="$files"` - $PM_SU_CMD /etc/rc.d/ldconfig start > /dev/null - fi - unset temp file files -@@ -3868,7 +3928,7 @@ fi - if [ -n "$MAKE_PACKAGE" ]; then - if [ -z "$use_package" ]; then - echo "===>>> Creating a package for new version $new_port" -- pm_make_s -D_OPTIONS_OK ${PACKAGE_FORMAT:+PKG_SUFX=.$PACKAGE_FORMAT} package >/dev/null || fail "Package creation of $new_port failed" -+ pm_make_s -D_OPTIONS_OK ${PACKAGE_FORMAT:+PKG_COMPRESSION_FORMAT=$PACKAGE_FORMAT} package >/dev/null || fail "Package creation of $new_port failed" - echo " ===>>> Package saved to $PACKAGES/All" ; echo '' - else - pm_pkg_create $PACKAGES $new_port -@@ -3876,14 +3936,18 @@ if [ -n "$MAKE_PACKAGE" ]; then - fi - - if [ -z "$use_package" -a -z "$DONT_POST_CLEAN" ]; then --# export_flavor $(flavor_part $portdir) -+ flavor=$(flavor_part $portdir) -+ for dir in $post_clean_l; do -+ pm_v "===>>> Running 'make clean' for special build dependency $dir" -+ (pm_make_s -C "$pd/$dir" ${flavor:+FLAVOR=$flavor} clean NOCLEANDEPENDS=ncd2 >/dev/null)& -+ done - pm_v "===>>> Running 'make clean' in the background" -- (pm_make_s clean NOCLEANDEPENDS=ncd2 >/dev/null)& -+ (pm_make_s ${flavor:+FLAVOR=$flavor} clean NOCLEANDEPENDS=ncd2 >/dev/null)& - pm_v - fi - if [ -n "$ro_opd" ]; then - echo "===>>> Updating dependency entry for $new_port in each dependent port" -- $PM_SU_CMD pkg set -yo $ro_opd:$portdir -+ $PM_SU_CMD $PKG_CMD set -yo $ro_opd:$portdir - fi - - -@@ -3903,7 +3967,7 @@ if [ "$$" -ne "$PM_PARENT_PID" -o -n "$PM_URB" ]; then - fi - - INSTALLED_LIST="${INSTALLED_LIST}\t${ilist}\n" --[ -n "`pkg query %M $new_port`" ] && DISPLAY_LIST="${DISPLAY_LIST}$new_port " -+[ -n "`$PKG_CMD query %M $new_port`" ] && DISPLAY_LIST="${DISPLAY_LIST}$new_port " - CUR_DEPS="${CUR_DEPS}${new_port}:${portdir}:" - - [ -n "$HIDE_BUILD" -a -n "$port_log" ] && pm_unlink $port_log |