Questions on portmaster

b. f. bf1783 at googlemail.com
Wed Jul 1 23:09:32 UTC 2009


Manish Jain wrote:
>...Does each child start 'make fetch' in the background ?

make checksum, yes.

>Further, how can portmaster be tuned to automatically ignore ports which
>are actually marked as IGNORE in the port directory ? This is not
>covered in the manpage.

It respects IGNORE (it checks for it in the port Makefile, and also
hands off to bsd.port.mk, which respects it).   If you mean +IGNOREME,
the others have answered your question.

>While doing portmaster -a, I have only managed to stop portmaster from
>building exactly one port specified with the -x option. Can I get to
>stop multiple ports from being built ? Is there regular expression
>support for the -x option ?

Not in the sense that you mean, at least that I'm aware of.  This one
of the things that needs improvement.  It is a bit awkward, because it
uses the shell's built-in POSIX getopts to parse options, and then
calls itself recursively.  One way you could fix it would be to apply
a patch like:

--- portmaster.orig     2009-07-01 12:36:14.000000000 -0400
+++ portmaster  2009-07-01 18:55:59.000000000 -0400
@@ -9,7 +9,7 @@
 if [ -z "$PARENT_PID" ]; then
        PARENT_PID=$$
        : ${TMPDIR:=/tmp}
-       UPGRADE_TOOL=portmaster
+       UPGRADE_TOOL=$0

        # /usr/local is needed in the path for make
        PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
@@ -788,7 +788,11 @@
        u)      UNATTENDED=uopt; ARGS="-u $ARGS" ;;
        v)      PM_VERBOSE=vopt; ARGS="-v $ARGS" ;;
        w)      SAVE_SHARED=wopt; ARGS="-w $ARGS" ;;
-       x)      EXCL=$OPTARG ;;
+       x)      if [ -z "${OPTARG%%-*}" ]; then
+                       fail 'The -x option requires an argument'
+               else
+                       EXCL="-x $OPTARG $EXCL"
+               fi ;;
        *)      echo '' ; echo "===>>> Try ${0##*/} --help"; exit 1 ;;
        esac
 done
@@ -810,10 +814,7 @@
 [ -n "$FETCH_ONLY" -a -n "$NO_RECURSIVE_CONFIG" ] &&
        fail "The -F and -G options are mutually exclusive"
 if [ -n "$EXCL" ]; then
-       case "$EXCL" in
-       -*)     fail 'The -x option requires an argument' ;;
-       *)      ARGS="-x $EXCL $ARGS" ;;
-       esac
+       ARGS="$EXCL $ARGS"
 fi

 #=============== Begin functions for getopts features and main ===============
@@ -1461,14 +1462,17 @@
 check_exclude () {
        [ -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 pkgglob in `echo "$EXCL" | sed -e 's#-x##g'`
+       do
+               case "$1" in
+               *${pkgglob}*)
+               if [ -n "$PM_VERBOSE" ]; then
+                       echo "===>>> Skipping $1"
+                       echo "       because it matches the pattern:
*${pkgglob}*"
+               fi
+               return 1 ;;
+               esac ;
+       done
        return 0
 }


(Mind the whitespace because of my MUA.)  Then you could just use
repeated -x flags, each with one and only one package glob that you
wanted to exclude.  I changed the definition of UPGRADE_TOOL so that
you could put this script in your path under another name, say
"jainpmaster", and then call it independently of the original
portmaster.  As usual, I make no claim that this is the best, only, or
most elegant way to do this.

Regards,
                b.


More information about the freebsd-questions mailing list