how do I tell ports that perl5.8 should never be installed?

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Mar 1 21:11:57 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/03/2010 18:19:36, Matthew Seaman wrote:
> On second thoughts, writing a small wrapper around pkg_add(1) that greps
> through the @pkgdep lines in the +CONTENTS file from the package tarball
> and bails if it finds the wrong version of perl would be a much cleaner
> approach.  The -M (--master) and -S (--slave) flags to pkg_add look
> interesting in this context.

Arrgh.  This is so nearly workable.  Unfortunately, -M or -S don't play
nicely with options like -r or -v -- seems you're meant to have local
copies of all of the dependencies already downloaded and in a directory
on $PKG_PATH in that case.

Given that, then this script will reject any attempt to install a pkg
that depends on perl-5.8:

#!/bin/sh

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin ;
export PATH
IFS=' 	
' ; export IFS
umask 022

reject='^@pkgdep perl-5.8'

TMPFILE=$(mktemp -t mypkgadd) || exit 1
trap "rm $TMPFILE" KILL HUP EXIT

if pkg_add -M ${1+$@} | sed -n -e '/^\/var\/tmp\/instmp/,$p' | \
    tee $TMPFILE | grep "$reject" 2>&1 >/dev/null ; then
    echo "Error: found forbidden package dependency $reject"
    exit 1
fi

pkg_add -S < $TMPFILE && rm -rf $( head -1 $TMPFILE )

#
# That's All Folks!
#

Now, the only missing bit is 'pkg_add -r -S' not fetching dependency
pkgs from the remote  site.  Also options like -r and -v seem to cause
bogons to be emitted to stdout which screws up the -M action, but that
has been worked around.

	Cheers,

	Matthew


- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuMLZcACgkQ8Mjk52CukIwWeQCfSPZQBpoB1cM0ondxT0PfJYXF
nZAAn3g18cY1mfa223gQzZDtusU1moxq
=WbEf
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list