diff options
author | tnn <tnn> | 2008-02-17 00:55:20 +0000 |
---|---|---|
committer | tnn <tnn> | 2008-02-17 00:55:20 +0000 |
commit | d9952ebe2c8c4fc6013509996ce49944385b73c3 (patch) | |
tree | 9a639b91e8223fa634a277fb353ade52d5cb4afe /pkgtools/pkg_chk | |
parent | 4ac88d8f41c8bfc855601b706e0b9fa64fb06979 (diff) | |
download | pkgsrc-d9952ebe2c8c4fc6013509996ce49944385b73c3.tar.gz |
Bump to pkg_chk-1.89:
Some changes from Aleksey Cheusov in pkg/36298 and pkg/36641 with
additional cleanup by me.
- option -g doesn't need PKGSRCDIR populated
- fatal if mktemp fails
- truncate logfile instead of removing it
- performance improvement for binary package scan
Diffstat (limited to 'pkgtools/pkg_chk')
-rw-r--r-- | pkgtools/pkg_chk/Makefile | 5 | ||||
-rwxr-xr-x | pkgtools/pkg_chk/files/pkg_chk.sh | 33 |
2 files changed, 27 insertions, 11 deletions
diff --git a/pkgtools/pkg_chk/Makefile b/pkgtools/pkg_chk/Makefile index 1cc3e4d5052..1f7fbd43be6 100644 --- a/pkgtools/pkg_chk/Makefile +++ b/pkgtools/pkg_chk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.57 2008/01/18 07:50:03 tnn Exp $ +# $NetBSD: Makefile,v 1.58 2008/02/17 00:55:20 tnn Exp $ -DISTNAME= pkg_chk-1.88 +DISTNAME= pkg_chk-1.89 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty @@ -45,6 +45,7 @@ do-build: -e 's#@TSORT@#${TSORT}#g' \ -e 's#@PREFIX@#${PREFIX}#g' \ -e 's#@PKG_DBDIR@#${PKG_DBDIR}#g' \ + -e 's#@XARGS@#${XARGS}#g' \ ${FILESDIR}/pkg_chk.sh >${WRKSRC}/pkg_chk.sh do-install: diff --git a/pkgtools/pkg_chk/files/pkg_chk.sh b/pkgtools/pkg_chk/files/pkg_chk.sh index e64780bedc3..44f0d8a2754 100755 --- a/pkgtools/pkg_chk/files/pkg_chk.sh +++ b/pkgtools/pkg_chk/files/pkg_chk.sh @@ -1,6 +1,6 @@ #!@SH@ -e # -# $Id: pkg_chk.sh,v 1.52 2008/01/18 07:50:03 tnn Exp $ +# $Id: pkg_chk.sh,v 1.53 2008/02/17 00:55:21 tnn Exp $ # # TODO: Make -g check dependencies and tsort # TODO: Variation of -g which only lists top level packages @@ -31,6 +31,12 @@ is_binary_available() fi } +bin_pkg_info2pkgdb() + { + ${AWK} '/^PKGNAME=/ {sub("^PKGNAME=", ""); PKGNAME=$0} \ + /^PKGPATH=/ {sub("^PKGPATH=", ""); printf("%s:%s ", $0, PKGNAME)}' + } + check_packages_installed() { MISSING_TODO= @@ -161,7 +167,9 @@ extract_variables() # as well as AWK, GREP, SED, PKGCHK_TAGS and PKGCHK_NOTAGS # - if [ -z "$opt_b" -o -n "$opt_s" -o -d $PKGSRCDIR/pkgtools/pkg_chk ] ; then + if [ -n "$opt_g" ]; then + : + elif [ -z "$opt_b" -o -n "$opt_s" -o -d $PKGSRCDIR/pkgtools/pkg_chk ] ; then cd $PKGSRCDIR/pkgtools/pkg_chk extract_make_vars Makefile \ AWK GREP GZIP_CMD ID PACKAGES PKGCHK_CONF PKGCHK_NOTAGS \ @@ -231,6 +239,11 @@ generate_conf_from_installed() echo $(pkgdirs_from_installed) | tr ' ' '\n' >> $FILE } +get_bin_pkg_info() + { + list_bin_pkgs | ${XARGS} ${PKG_INFO} -X + } + get_build_ver() { if [ -n "$opt_b" -a -z "$opt_s" ] ; then @@ -244,6 +257,11 @@ get_build_ver() cat $MY_TMPFILE } +list_bin_pkgs () + { + ls -t $PACKAGES | grep "$PKG_SUFX_RE"'$' | sed "s|^|$PACKAGES/|" + } + # Given a binary package filename as the first argumennt, return a list # of exact package versions against which it was built and on which it # depends @@ -718,8 +736,10 @@ test -n "$PKG_INFO" || PKG_INFO="@PKG_INFO@" test -n "$SED" || SED="@SED@" test -n "$SORT" || SORT="@SORT@" test -n "$TSORT" || TSORT="@TSORT@" +test -n "$XARGS" || XARGS="@XARGS@" MY_TMPDIR=`${MKTEMP} -d ${TMPDIR-/tmp}/${0##*/}.XXXXXX` +test -n "$MY_TMPDIR" || fatal "Couldn't create temporary directory." MY_TMPFILE=$MY_TMPDIR/tmp if [ -z "$MAKECONF" -o ! -f "$MAKECONF" ] ; then @@ -747,7 +767,7 @@ else fi if [ -n "$opt_L" ] ; then - rm -f $opt_L + printf '' > $opt_L fi basedir=$(pwd) @@ -796,12 +816,7 @@ if [ -n "$opt_b" -a -z "$opt_s" ] ; then *) if [ -d "$PACKAGES" ] ; then msg_progress Scan $PACKAGES - cd $PACKAGES - for f in `ls -t | grep "$PKG_SUFX_RE"'$'` ; do # Sort by time to pick up newest first - PKGDIR=`${PKG_INFO} -. -B $PACKAGES/$f|${AWK} -F= '$1=="PKGPATH"{print $2}'` - PKGNAME=`echo $f | ${SED} "s/$PKG_SUFX"'$//'` - PKGDB="${PKGDB} $PKGDIR:$PKGNAME" - done + PKGDB=$(get_bin_pkg_info | bin_pkg_info2pkgdb) PKGSRCDIR=NONE fi;; esac |