pkgsrc-Bugs archive

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

pkg/42267: pkg_comp: quick exit if pkg is installed already (patch)



>Number:         42267
>Category:       pkg
>Synopsis:       pkg_comp: quick exit if pkg is installed already (patch)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 04 17:00:00 +0000 2009
>Originator:     Martin S. Weber
>Release:        NetBSD 5.0_STABLE
>Organization:
        
>Environment:
        
        
System: NetBSD agamemnon.entropie.local 5.0_STABLE NetBSD 5.0_STABLE 
(AGAMEMNON5) #0: Sat Jun 27 14:44:07 EDT 2009 
root%agamemnon.entropie.local@localhost:/home/netbsd/obj/sys/arch/i386/compile/AGAMEMNON5
 i386
Architecture: i386
Machine: i386
>Description:
        
(copied from the following email: 
 http://mail-index.netbsd.org/tech-pkg/2009/11/03/msg004188.html
, PR'd by req of JMMV.)

myself:
``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".''

JMMV:
``(...)
Yeah, except this will not catch cases where the installed package is
older than the newest one.(...)''

myself:
``(...)
Intentionally. I expect an error in that case: if I build binary packages
with pkg_comp I expect a binary package whose version matches that in
the underlying pkgsrc. I do want an error in that case.(...) ''


>How-To-Repeat:
        pkg_chk -g
        pkg_comp build $(grep -v '^#' /usr/pkgsrc/pkgchk.conf)
        
>Fix:
        

Index: files/pkg_comp.sh
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh,v
retrieving revision 1.35
diff -u -r1.35 pkg_comp.sh
--- files/pkg_comp.sh   13 May 2009 10:40:24 -0000      1.35
+++ files/pkg_comp.sh   4 Nov 2009 16:53:26 -0000
@@ -729,6 +729,10 @@
         statfile="$prefix.stat"
         init_script $script
         cat >> $script <<EOF
+if pkg_info -qe "\$(make show-var VARNAME=PKGNAME)" ; then
+       echo "PKG_COMP ==> $p is already installed!"
+       exit 0
+fi
 cd /usr/pkgsrc/$p
 make $BUILD_TARGET
 if [ \$? != 0 ]; then

>Unformatted:
        
        
        pkg_comp.sh rev 1.35


Home | Main Index | Thread Index | Old Index