summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2001-07-31 17:32:06 +0000
committertron <tron@pkgsrc.org>2001-07-31 17:32:06 +0000
commit1915eca856467985d53fc4c6a30ccf8c0df3b84f (patch)
tree0d4a3cc058748f336edfad56c19ccf99f7519df1 /pkgtools
parent1afee94795ed925eebfdaba1a07dc0b1a42fb660 (diff)
downloadpkgsrc-1915eca856467985d53fc4c6a30ccf8c0df3b84f.tar.gz
Update "pkgchk" to version 1.07:
- Add Solaris portability fixes supplied by Stoned Elipot in PR pkg/13434. - Rename binary to "pkg_chk" which matches the naming of our package tools and avoids confusion with Solaris's "pkgchk" command.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkgchk/Makefile32
-rw-r--r--pkgtools/pkgchk/files/pkgchk.88
-rwxr-xr-xpkgtools/pkgchk/files/pkgchk.sh101
-rw-r--r--pkgtools/pkgchk/pkg/PLIST6
4 files changed, 110 insertions, 37 deletions
diff --git a/pkgtools/pkgchk/Makefile b/pkgtools/pkgchk/Makefile
index 44e5e46bc66..efbf27d09ec 100644
--- a/pkgtools/pkgchk/Makefile
+++ b/pkgtools/pkgchk/Makefile
@@ -1,24 +1,24 @@
-# $NetBSD: Makefile,v 1.7 2001/07/09 23:15:56 abs Exp $
-#
+# $NetBSD: Makefile,v 1.8 2001/07/31 17:32:06 tron Exp $
-DISTNAME= pkgchk-1.06
-CATEGORIES= pkgtools
-MASTER_SITES= # empty
-DISTFILES= # empty
+DISTNAME= pkgchk-1.07
+CATEGORIES= pkgtools
+MASTER_SITES= # empty
+DISTFILES= # empty
-MAINTAINER= abs@netbsd.org
-HOMEPAGE= ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/Packages.txt
-COMMENT= Check installed package versions against pkgsrc
+MAINTAINER= abs@netbsd.org
+HOMEPAGE= ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/Packages.txt
+COMMENT= Check installed package versions against pkgsrc
EXTRACT_ONLY= # empty
-NO_WRKSUBDIR= yes
-NO_CHECKSUM= yes
-NO_PATCH= yes
-NO_CONFIGURE= yes
-NO_BUILD= yes
+NO_CHECKSUM= YES
+WRKSRC= ${WRKDIR}
+
+do-build:
+ ${SED} -e 's#@MAKE@#${MAKE}#g' ${FILESDIR}/pkgchk.sh \
+ >${WRKSRC}/pkgchk.sh
do-install:
- ${INSTALL_SCRIPT} ${FILESDIR}/pkgchk.sh ${PREFIX}/sbin/pkgchk
- ${INSTALL_MAN} ${FILESDIR}/pkgchk.8 ${PREFIX}/man/man8/pkgchk.8
+ ${INSTALL_SCRIPT} ${WRKSRC}/pkgchk.sh ${PREFIX}/sbin/pkg_chk
+ ${INSTALL_MAN} ${FILESDIR}/pkgchk.8 ${PREFIX}/man/man8/pkg_chk.8
.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/pkgchk/files/pkgchk.8 b/pkgtools/pkgchk/files/pkgchk.8
index 46089c0aa1e..377cb218b3d 100644
--- a/pkgtools/pkgchk/files/pkgchk.8
+++ b/pkgtools/pkgchk/files/pkgchk.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkgchk.8,v 1.3 2001/07/07 12:17:35 abs Exp $
+.\" $NetBSD: pkgchk.8,v 1.4 2001/07/31 17:32:07 tron Exp $
.\"
.\" Copyright (c) 2001 by David Brownlee (abs@netbsd.org)
.\" Absolutely no warranty.
@@ -10,7 +10,7 @@
.Nd check, and optionally update, installed packages
.Sh SYNOPSIS
.Nm
-.Op Fl abhinsv
+.Op Fl abchinsuvB
.Op Fl D Ar tags
.Op Fl U Ar tags
.Sh DESCRIPTION
@@ -27,6 +27,8 @@ will skip dependent packages to reduce unnecessary rebuilding.
.Pp
.Sy Options
.Bl -tag -width xxxxxxxx
+.It Fl B
+Check the "Build version" (see option -b of pkg_info(1)) of packages.
.It Fl D Ar tags
Add the comma separated list of tags to those checked when parsing
pkgchk.conf.
@@ -50,6 +52,8 @@ is set in
then
.Nm
will automatically generate binary packages for later reuse.
+.It Fl c
+Check versions of packages specified in pkgchk.conf.
.It Fl h
Brief help.
.It Fl i
diff --git a/pkgtools/pkgchk/files/pkgchk.sh b/pkgtools/pkgchk/files/pkgchk.sh
index e57be2b0eaa..b5fc36707d9 100755
--- a/pkgtools/pkgchk/files/pkgchk.sh
+++ b/pkgtools/pkgchk/files/pkgchk.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
#
-# $Id: pkgchk.sh,v 1.7 2001/07/09 23:15:56 abs Exp $
+# $Id: pkgchk.sh,v 1.8 2001/07/31 17:32:07 tron Exp $
#
# TODO: Handle and as well as or tags (eg: i386+x11)
# TODO: Order updates based on DEPENDENCIES.
@@ -13,7 +13,7 @@ extract_variables()
if [ -z "$PKGSRCDIR" ];then
if [ -f /etc/mk.conf ] ;then
- eval `printf 'BSD_PKG_MK=1\nall:\n\t@echo PKGSRCDIR=${PKGSRCDIR}\n' | make -f - -f /etc/mk.conf`
+ eval `printf 'BSD_PKG_MK=1\nall:\n\t@echo PKGSRCDIR=${PKGSRCDIR}\n' | ${MAKE} -f - -f /etc/mk.conf`
fi
if [ -z "$PKGSRCDIR" ];then
PKGSRCDIR=/usr/pkgsrc
@@ -29,7 +29,7 @@ extract_variables()
eval `printf 'CATEGORIES=x\nDISTNAME=x\nall:\n
@echo PACKAGES=${PACKAGES}
@echo PKGCHK_CONF=${PKGCHK_CONF}
- ' | (cd $PKGSRCDIR ; make -f - -f $PKGSRCDIR/mk/bsd.prefs.mk)`
+ ' | (cd $PKGSRCDIR ; ${MAKE} -f - -f $PKGSRCDIR/mk/bsd.prefs.mk)`
if [ -z "$PACKAGES" ];then
PACKAGES=$PKGSRCDIR/packages
@@ -66,18 +66,51 @@ pkg_install()
echo "make update for $PKGNAME"
cd $PKGSRCDIR/$PKGDIR
if [ -z "$opt_n" ];then
- make update
+ ${MAKE} update
fi
fi
}
-args=`getopt D:IU:abchinsuv $*`
+
+get_build_version()
+ {
+ FILESDIR=`${MAKE} show-var VARNAME=FILESDIR`
+ PKGDIR=`${MAKE} show-var VARNAME=PKGDIR`
+ DISTINFO_FILE=`${MAKE} show-var VARNAME=DISTINFO_FILE`
+ PATCHDIR=`${MAKE} show-var VARNAME=PATCHDIR`
+ files=""
+ for f in `pwd`/Makefile ${FILESDIR}/* ${PKGDIR}/*; do
+ if [ -f $f ];then
+ files="$files $f"
+ fi
+ done
+ if [ -f ${DISTINFO_FILE} ]; then
+ for f in `${AWK} 'NF == 4 && $3 == "=" { gsub("[()]", "", $2); print $2 }' < ${DISTINFO_FILE}`; do
+ if [ -f ${PATCHDIR}/$f ]; then
+ files="$files ${PATCHDIR}/$f";
+ fi;
+ done
+ fi
+ if [ -d ${PATCHDIR} ]; then
+ for f in ${PATCHDIR}/patch-*; do
+ case $f in
+ *.orig|*.rej|*~) ;;
+ ${PATCHDIR}/patch-local-*)
+ files="$files $f" ;;
+ esac
+ done
+ fi
+ ${GREP} '\$NetBSD' $files | ${SED} -e "s|^${real_pkgsrcdir}/||"
+ }
+
+args=`getopt BD:U:abchinsuv $*`
if [ $? != 0 ]; then
opt_h=1
fi
set -- $args
while [ $# != 0 ]; do
case "$1" in
+ -B ) opt_B=1 ;;
-D ) opt_D="$2" ; shift;;
-U ) opt_U="$2" ; shift;;
-a ) opt_a=1 ; opt_c=1 ;;
@@ -106,6 +139,7 @@ fi
if [ -n "$opt_h" -o $# != 1 ];then
echo 'Usage: pkgchk [opts]
+ -B Check the "Build version" of packages
-D tags Comma separated list of additional pkgchk.conf tags to set
-U tags Comma separated list of pkgchk.conf tags to unset
-a Add all missing packages (implies -c)
@@ -126,10 +160,34 @@ on hostname and type, see pkgchk(8).
exit 1
fi
+test -n "$MAKE" || MAKE="@MAKE@"
+
+# grabbeb from GNU configure
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
extract_variables
+cd $PKGSRCDIR
+real_pkgsrcdir=`pwd`
+
+cd pkgtools/pkgchk
+AWK=`${MAKE} show-var VARNAME=AWK`
+GREP=`${MAKE} show-var VARNAME=GREP`
+SED=`${MAKE} show-var VARNAME=SED`
+
+
if [ -n "$opt_i" ];then
- PKGDIRLIST=`pkg_info -B \* | awk '/PKGPATH= /{print $2}'`
+ PKGDIRLIST=`pkg_info -B \* | ${AWK} '/PKGPATH= /{print $2}'`
fi
if [ -n "$opt_c" ];then
@@ -141,7 +199,7 @@ if [ -n "$opt_c" ];then
# Determine list of tags
#
- TAGS="`hostname -s`,`hostname`,`uname -srm | awk '{print $1"-"$2"-"$3","$1"-"$2","$1"-"$3","$1","$2","$3}'`"
+ TAGS="`hostname | sed -e 's,\..*,,'`,`uname -srm | ${AWK} '{print $1"-"$2"-"$3","$1"-"$2","$1"-"$3","$1","$2","$3}'`"
if [ -f /usr/X11R6/lib/libX11.so -o /usr/X11R6/lib/libX11.a ];then
TAGS="$TAGS,x11"
fi
@@ -155,7 +213,7 @@ if [ -n "$opt_c" ];then
# Extract list of valid pkgdirs
#
- PKGDIRLIST="$PKGDIRLIST "`awk -v setlist=$TAGS -v unsetlist=$opt_U '
+ PKGDIRLIST="$PKGDIRLIST "`${AWK} -v setlist=$TAGS -v unsetlist=$opt_U '
BEGIN {
split(setlist, tmp, ",");
for (tag in tmp)
@@ -203,33 +261,44 @@ for pkgdir in $PKGDIRLIST ; do
fi
cd $PKGSRCDIR/$pkgdir
# Use 'make x' rather than 'make all' to avoid potential licence errors
- pkgname=`printf 'x:\n\t@echo ${PKGNAME}\n'|make -f - -f Makefile x` || true
+ pkgname=`printf 'x:\n\t@echo ${PKGNAME}\n'|${MAKE} -f - -f Makefile x` || true
if [ -z "$pkgname" ]; then
echo "Unable to extract PKGNAME for $pkgdir"
exit 1
fi
if [ ! -d /var/db/pkg/$pkgname ];then
- echo -n "$pkgname: "
+ echo $ac_n "$pkgname: $ac_c"
pkg=`echo $pkgname | sed 's/-[0-9].*//'`
pkginstalled=`pkg_info -e $pkg || true`
INSTALL=
if [ -n "$pkginstalled" ];then
- echo -n "version mismatch - $pkginstalled"
+ echo $ac_n "version mismatch - $pkginstalled$ac_c"
if [ -n "$opt_u" ]; then
UPDATE_TODO="$UPDATE_TODO $pkgname $pkgdir"
fi
else
- echo -n "missing"
+ echo $ac_n "missing$ac_c"
if [ -n "$opt_a" ] ; then
INSTALL_TODO="$INSTALL_TODO $pkgname $pkgdir"
fi
fi
if [ -f $PACKAGES/All/$pkgname.tgz ] ;then
- echo -n " (binary package available)"
+ echo $ac_n " (binary package available)$ac_c"
fi
echo
- elif [ -n "$opt_v" ];then
- echo "$pkgname: OK"
+ else
+ if [ -n "$opt_B" ];then
+ current_build_version=`get_build_version`
+ installed_build_version=`cat /var/db/pkg/$pkgname/+BUILD_VERSION`
+ if [ x"$current_build_version" != x"$installed_build_version" ];then
+ echo "$pkgname: build version information mismatch"
+ # should we mark this pkg to be updated if -u is given ??
+ elif [ -n "$opt_v" ];then
+ echo "$pkgname: OK"
+ fi
+ elif [ -n "$opt_v" ];then
+ echo "$pkgname: OK"
+ fi
fi
done
@@ -251,7 +320,7 @@ if [ -n "$UPDATE_TODO" ];then
# drop any packages whose 'parents' are also to be updated
#
- UPDATE_TODO=`printf "$LIST" | awk -F '|' '
+ UPDATE_TODO=`printf "$LIST" | ${AWK} -F '|' '
{
pkg2dir[$1] = $2
split($3, deplist, " ")
diff --git a/pkgtools/pkgchk/pkg/PLIST b/pkgtools/pkgchk/pkg/PLIST
index 2af38e2d43e..d21f633b196 100644
--- a/pkgtools/pkgchk/pkg/PLIST
+++ b/pkgtools/pkgchk/pkg/PLIST
@@ -1,3 +1,3 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2001/07/02 14:12:30 abs Exp $
-sbin/pkgchk
-man/man8/pkgchk.8
+@comment $NetBSD: PLIST,v 1.2 2001/07/31 17:32:08 tron Exp $
+sbin/pkg_chk
+man/man8/pkg_chk.8