Date: Sat, 08 Aug 2009 19:44:34 +0100 From: Lawrence Stewart <lstewart@freebsd.org> To: Frederique Rijsdijk <frederique@isafeelin.org> Cc: dougb@freebsd.org, Miroslav Lachman <000.fbsd@quip.cz>, freebsd-ports@freebsd.org Subject: Re: portmaster -x not working? Message-ID: <4A7DC792.2080200@freebsd.org> In-Reply-To: <4A5E02DE.1010908@freebsd.org> References: <4A5C954C.5060507@quip.cz> <4A5C9A98.5020006@isafeelin.org> <4A5CA8CF.2070906@freebsd.org> <4A5D9FD8.3080209@isafeelin.org> <4A5E02DE.1010908@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format. --------------020707040308010606030506 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Lawrence Stewart wrote: > Frederique Rijsdijk wrote: >> Lawrence Stewart wrote: >>> Hijacking the thread slightly, but is there a way to exclude multiple >>> ports using the -x switch (or multiple -x switches)? Logically, I want >>> to be able to do something like this: >>> >>> portmaster -a -x '*foo*' -x '*bar*' >>> >> >> portmaster -x '[.*php5.*|.*apache.*]' -n drupal6-6.12 >> >> That seems to work for me.. >> > > Nifty, although regex goo is unfriendly even at the best of times. > > Thanks for the tip (and sorry for the hijack). Today, I again had need of the ability to exclude multiple ports from an update run. It turns out your tip doesn't work with portmaster, though I suspect it would with portupgrade. I finally bit the bullet and created a patch that allows a user to specify -x multiple times, or specify it once with a space-separated list of port globs. Example usage with the patch applied: Update everything, ignoring ports that match *postgres*: portmaster -adx 'postgres' Update everything, ignoring ports that match *postgres* or *imap-uw*: portmaster -adx 'postgres imap-uw' portmaster -adx 'postgres' -x 'imap-uw' Doug, what do you think of the attached patch? Cheers, Lawrence --------------020707040308010606030506 Content-Type: text/plain; name="pm2.9_multiexclude.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pm2.9_multiexclude.diff" --- portmaster.orig 2009-08-08 22:13:01.000000000 +1000 +++ portmaster 2009-08-09 04:24:34.000000000 +1000 @@ -618,17 +618,21 @@ } globstrip () { + local glob + local globs local in - in=$1 + globs="$1" - case "$in" in - *\*) in=`echo $in | sed s/.$//` - esac - - in=${in%\\} + for glob in $globs + do + case "$glob" in + *\*) glob=`echo $glob | sed s/.$//` + esac + in="${glob%\\} $in" + done - echo $in + echo "${in%% }" } #=============== End functions relevant to --features and main =============== @@ -801,7 +805,7 @@ u) echo "===>>> The -u option has been deprecated" ; echo '' ;; v) PM_VERBOSE=vopt; ARGS="-v $ARGS" ;; w) SAVE_SHARED=wopt; ARGS="-w $ARGS" ;; - x) EXCL=`globstrip $OPTARG` ;; + x) EXCL="`globstrip "$OPTARG"` ${EXCL}" ; EXCL="${EXCL%% }" ;; *) echo '' ; echo "===>>> Try ${0##*/} --help"; exit 1 ;; esac done @@ -818,7 +822,7 @@ if [ -n "$EXCL" ]; then case "$EXCL" in -*) fail 'The -x option requires an argument' ;; - *) ARGS="-x $EXCL $ARGS" ;; + *) ARGS="-x '$EXCL' $ARGS" ;; esac fi @@ -1461,16 +1465,21 @@ } check_exclude () { + local glob + [ -n "$EXCL" ] || return 0 - case "$1" in - *${EXCL}*) - if [ -n "$PM_VERBOSE" ]; then - echo "===>>> Skipping $1" - echo " because it matches the pattern: *${EXCL}*" - fi - return 1 ;; - esac + for glob in $EXCL + do + case "$1" in + *$glob*) + if [ -n "$PM_VERBOSE" ]; then + echo "===>>> Skipping $1" + echo " because it matches the pattern: *$glob*" + fi + return 1 ;; + esac + done return 0 } @@ -1509,7 +1518,7 @@ [ -n "$DEPTH" ] && echo " $DEPTH >> ${1#$pd/}" if [ -z "$NO_ACTION" -o -n "$CONFIG_ONLY" ]; then - ($0 $ARGS $1) || fail "Update for $1 failed" + (eval $0 $ARGS $1) || fail "Update for $1 failed" . $IPC_SAVE else [ -n "$PM_VERBOSE" ] && @@ -1701,7 +1710,7 @@ if [ -n "$CONFIG_ONLY" ]; then for port in $worklist; do check_interactive $port || continue - ($0 $ARGS $port) || fail "Update for $port failed" + (eval $0 $ARGS $port) || fail "Update for $port failed" . $IPC_SAVE done check_fetch_only @@ -1721,7 +1730,7 @@ ;; esac check_interactive $port || continue - ($0 $ARGS $port) || fail "Update for $port failed" + (eval $0 $ARGS $port) || fail "Update for $port failed" . $IPC_SAVE done safe_exit @@ -1968,7 +1977,7 @@ [ -d "$pd/$moved_npd" ] || no_valid_port if [ "$$" -eq "$PARENT_PID" ]; then - $0 $ARGS -o $moved_npd $upg_port + eval $0 $ARGS -o $moved_npd $upg_port safe_exit else exec $0 $ARGS -o $moved_npd $upg_port --- portmaster.8.orig 2009-08-09 04:28:51.000000000 +1000 +++ portmaster.8 2009-08-09 04:36:49.000000000 +1000 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD: ports/ports-mgmt/portmaster/files/portmaster.8,v 2.8 2009/07/29 23:26:14 dougb Exp $ .\" -.Dd July 29, 2009 +.Dd August 8, 2009 .Dt PORTMASTER 8 .Os .Sh NAME @@ -296,7 +296,9 @@ any arguments to supply to .Xr make 1 .It Fl x -avoid building or updating ports that match this pattern +avoid building or updating ports that match this pattern. +Can be specified multiple times, or supplied as a space-separated list of port +globs surrounded by ''. .It Fl p Ar port directory in /usr/ports specify the full path to a port directory .It Fl -show-work --------------020707040308010606030506--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A7DC792.2080200>