From 910a40dd86c12d9ae6c8d3c425979a73c3e73195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20E=C3=9Fer?= Date: Wed, 3 Jan 2018 11:10:33 +0000 Subject: [PATCH] Fix pm_islocked function, which could lead to a spurious error message if used for a port that is not found in the package database. Reported by: Tatsuki Makino Approved by: antoine (implicit) --- ports-mgmt/portmaster/Makefile | 2 +- ports-mgmt/portmaster/files/patch-portmaster | 36 +++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/ports-mgmt/portmaster/Makefile b/ports-mgmt/portmaster/Makefile index 766c10770ec7..5ea890b854ee 100644 --- a/ports-mgmt/portmaster/Makefile +++ b/ports-mgmt/portmaster/Makefile @@ -2,7 +2,7 @@ PORTNAME= portmaster PORTVERSION= 3.18 -PORTREVISION= 6 +PORTREVISION= 7 CATEGORIES= ports-mgmt MAINTAINER= se@FreeBSD.org diff --git a/ports-mgmt/portmaster/files/patch-portmaster b/ports-mgmt/portmaster/files/patch-portmaster index 2c4931c44d10..af04ee64e950 100644 --- a/ports-mgmt/portmaster/files/patch-portmaster +++ b/ports-mgmt/portmaster/files/patch-portmaster @@ -27,7 +27,19 @@ *'make -DBATCH checksum'*|*'/fetch '*|\[sh\]) pm_kill $pid ;; esac ;; esac -@@ -412,7 +411,7 @@ usage () { +@@ -333,9 +332,8 @@ pm_mktemp () { + fail "mktemp for $1 failed:\n ${pm_mktemp_file#mktemp: }" + } + pm_unlink () { [ -e "$1" ] && /bin/unlink $1; } +-pm_islocked () { [ -n "$1" ] || return 1; +- [ -e "$pdb/$1/+IGNOREME" ] && pkg info -e "$1" || +- [ `pkg query %k "$1"` -eq "1" ]; } ++pm_islocked () { local locked; [ -n "$1" ] && locked=`pkg query %k "$1"` && ++ [ "$locked" = 1 -o -e "$pdb/$1/+IGNOREME" ]; } + + # Superuser versions for commands that need root privileges + +@@ -412,7 +410,7 @@ usage () { echo " [[[--packages|-P]|[--packages-only|-PP]] | [--packages-build]]" echo " [--packages-if-newer] [--delete-build-only] [--always-fetch]" echo " [--local-packagedir=] [--packages-local] [--delete-packages]" @@ -36,7 +48,7 @@ echo " [--index|--index-first|--index-only] [-m ]" echo " [-x ]" echo "$progname [Common flags] " -@@ -653,6 +652,10 @@ for var in "$@" ; do +@@ -653,6 +651,10 @@ for var in "$@" ; do export LOCAL_PACKAGEDIR ;; --delete-packages) PM_DELETE_PACKAGES=pm_delete_packages export PM_DELETE_PACKAGES ;; @@ -47,7 +59,7 @@ # --flavor=*) PM_FLAVOR=${var#--flavor=} ;; --update-if-newer) PM_UPDATE_IF_NEWER=pm_update_if_newer export PM_UPDATE_IF_NEWER ;; -@@ -1589,25 +1592,30 @@ init_packages () { +@@ -1589,25 +1591,30 @@ init_packages () { } pm_pkg_create () { @@ -80,7 +92,7 @@ if [ "$1" = "$pbu" ]; then if [ -n "$BACKUP" ]; then echo " ===>>> Package saved to $1" ; echo '' -@@ -1616,15 +1624,14 @@ pm_pkg_create () { +@@ -1616,15 +1623,14 @@ pm_pkg_create () { NB_DELETE="${NB_DELETE}${pkg} " fi elif [ "$1" = "$PACKAGES" ]; then @@ -100,7 +112,7 @@ fi cd ${1}/${portdir%/*} -@@ -1665,7 +1672,7 @@ find_dl_distfiles () { +@@ -1665,7 +1671,7 @@ find_dl_distfiles () { else # Old method, for now if pm_cd $pd/$1; then @@ -109,7 +121,7 @@ dist_list="${dist_list%options}distfiles" else # The port might have moved, etc.; so take a stab at it, -@@ -1803,6 +1810,7 @@ set_distfiles_and_subdir () { +@@ -1803,6 +1809,7 @@ set_distfiles_and_subdir () { } delete_stale_distfiles () { @@ -117,7 +129,7 @@ # Global: distfiles_checked local file answer -@@ -1849,6 +1857,7 @@ delete_stale_distfiles () { +@@ -1849,6 +1856,7 @@ delete_stale_distfiles () { } delete_all_distfiles () { @@ -125,7 +137,7 @@ # Global: delete_all DISTDIR local origin rc delete_current -@@ -2264,12 +2273,14 @@ make_dep_list () { +@@ -2264,12 +2272,14 @@ make_dep_list () { for dep_type in $*; do case $dep_type in @@ -145,7 +157,7 @@ *) fail "make_dep_list: Unsupported option '$dep_type'" esac -@@ -3302,7 +3313,7 @@ pm_cd_pd $portdir +@@ -3302,7 +3312,7 @@ pm_cd_pd $portdir if [ -n "$PM_BUILD_ONLY_LIST" ]; then case "$build_only_dl_g" in @@ -154,7 +166,7 @@ [ -n "$PM_PACKAGES_BUILD" ] && PM_PACKAGES_BUILD=doing_build_only_dep [ -n "$PM_DEL_BUILD_ONLY" ] && PM_DEL_BUILD_ONLY=doing_build_only_dep ;; *) [ -n "$PM_PACKAGES_BUILD" ] && PM_PACKAGES_BUILD=pmp_build -@@ -3402,31 +3413,19 @@ fetch_package () { +@@ -3402,31 +3412,19 @@ fetch_package () { } if [ -z "$PACKAGESITE" -a -z "$PM_PACKAGES_LOCAL" ]; then release=`uname -r` @@ -191,7 +203,7 @@ echo "===>>> Checking package repository for latest available version" -@@ -3437,11 +3436,12 @@ fetch_package () { +@@ -3437,11 +3435,12 @@ fetch_package () { latest_pv=${local_package##*/} fi if [ -z "$latest_pv" -a -z "$PM_INDEX_ONLY" ]; then @@ -209,7 +221,7 @@ latest_pv=${latest_pv##*/} else pm_v "===>>> No local package for ${new_port}, attempting fetch" -@@ -3850,7 +3850,7 @@ fi +@@ -3850,7 +3849,7 @@ fi if [ -n "$MAKE_PACKAGE" ]; then if [ -z "$use_package" ]; then echo "===>>> Creating a package for new version $new_port"