tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg_comp -- quick exit if pkg is installed already



Hi there,

I've noticed a little annoyance for pkg_comp: if you give it a
list of packages that are installed already, it will a) try to
build these packages nonetheless, and b) note that this package
is "in error", because the install target failed. In fact everything
is fine though. This can be provoked two ways:
1) pkg_comp build (a package that is installed in chroot already)
2) pkg_comp build (list of package names including dependencies)

The first case is obvious, the second builds the dependencies as
required, but if your dependencies come later in the invocation
(say, you are taking the list of packages to build from a pkgchk.conf,
which is alphabetically sorted, not topologically) ... stuff "fails".

So, of course there's an easy solution:

--- files/pkg_comp.sh   2009-07-07 12:10:47.000000000 -0400
+++ /usr/pkg/sbin/pkg_comp      2009-11-03 07:39:35.000000000 -0500
@@ -730,11 +730,15 @@
         init_script $script
         cat >> $script <<EOF
 cd /usr/pkgsrc/$p
+if pkg_info -qe "\$(make show-var VARNAME=PKGNAME)" ; then
+       echo "PKG_COMP ==> $p already installed!"
+else 
 make $BUILD_TARGET
 if [ \$? != 0 ]; then
     touch /pkg_comp/tmp/`basename $statfile`
 fi
 make clean
+fi
 EOF
         chmod +x $script
         chroot $DESTDIR /pkg_comp/tmp/`basename $script`

Do you agree? It helps for me :)

Regards,

-Martin


Home | Main Index | Thread Index | Old Index