Skip to content

Commit

Permalink
Update pkg_chk to 1.86:
Browse files Browse the repository at this point in the history
    - Fix '-l' to list dependencies needed at runtime by each package, as
      opposed to those at build time. Avoids issues such as 'jdk15' pulling
      in sun-jdk & sun-jre
  • Loading branch information
abs committed Aug 27, 2007
1 parent d4cdec4 commit d3d32b7
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 71 deletions.
3 changes: 2 additions & 1 deletion doc/CHANGES-2007
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$NetBSD: CHANGES-2007,v 1.1883 2007/08/27 10:42:04 ghen Exp $
$NetBSD: CHANGES-2007,v 1.1884 2007/08/27 15:30:33 abs Exp $

Changes to the packages collection and infrastructure in 2007:

Expand Down Expand Up @@ -3441,3 +3441,4 @@ Changes to the packages collection and infrastructure in 2007:
Updated emulators/dosbox to 0.72 [xtraeme 2007-08-27]
Updated mail/dovecot to 1.0.3nb1 [ghen 2007-08-27]
Added mail/dovecot-sieve version 1.0.2 [ghen 2007-08-27]
Updated pkgtools/pkg_chk to 1.86 [abs 2007-08-27]
6 changes: 3 additions & 3 deletions pkgtools/pkg_chk/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# $NetBSD: Makefile,v 1.54 2007/06/19 16:08:47 abs Exp $
# $NetBSD: Makefile,v 1.55 2007/08/27 15:28:54 abs Exp $

DISTNAME= pkg_chk-1.85
PKGREVISION= 6
DISTNAME= pkg_chk-1.86
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down Expand Up @@ -36,6 +35,7 @@ do-build:
-e 's#@MAKE@#${MAKE}#g' \
-e 's#@MAKECONF@#${TMP_MAKECONF}#g' \
-e 's#@PKG_ADD@#${PKG_ADD}#g' \
-e 's#@PKG_ADMIN@#${PKG_ADMIN}#g' \
-e 's#@PKG_DELETE@#${PKG_DELETE}#g' \
-e 's#@PKG_INFO@#${PKG_INFO}#g' \
-e 's#@SED@#${SED}#g' \
Expand Down
7 changes: 3 additions & 4 deletions pkgtools/pkg_chk/files/pkg_chk.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.\" $NetBSD: pkg_chk.8,v 1.24 2006/10/02 07:33:38 abs Exp $
.\" $NetBSD: pkg_chk.8,v 1.25 2007/08/27 15:28:54 abs Exp $
.\"
.\" Copyright (c) 2001 by David Brownlee ([email protected])
.\" Absolutely no warranty.
Expand Down Expand Up @@ -57,7 +57,6 @@ Use the
.Pa pkgchk.conf
file
.Sq Ar conf .

.It Fl D Ar tags
Add the comma separated list of tags to those checked when parsing
.Pa pkgchk.conf .
Expand All @@ -84,8 +83,8 @@ Redirect the output for all commands run into the logfile
Should be specified as a full pathname.
On any error the tail end of the logfile will be displayed.
.It Fl l
List the filename for all binary packages (including the exact dependencies
against which each package was built) based on
List the filename for all binary packages (including best dependencies) based
on
.Pa pkgchk.conf .
Will abort if a binary package is missing.
This can be used (in conjunction with
Expand Down
145 changes: 82 additions & 63 deletions pkgtools/pkg_chk/files/pkg_chk.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!@SH@ -e
#
# $Id: pkg_chk.sh,v 1.49 2007/06/19 13:45:50 joerg Exp $
# $Id: pkg_chk.sh,v 1.50 2007/08/27 15:28:54 abs Exp $
#
# TODO: Make -g check dependencies and tsort
# TODO: Variation of -g which only lists top level packages
Expand Down Expand Up @@ -40,8 +40,10 @@ check_packages_installed()

if [ -n "$opt_B" ];then
extract_pkg_vars $pkgdir PKGNAME FILESDIR PKGDIR DISTINFO_FILE PATCHDIR
else
elif [ -n "$opt_s" ] ; then
extract_pkg_vars $pkgdir PKGNAME
else
PKGNAME=`pkgdir2pkgname $pkgdir`
fi
if [ -z "$PKGNAME" ]; then
MISS_DONE=$MISS_DONE" "$pkgdir
Expand Down Expand Up @@ -137,26 +139,14 @@ extract_pkg_vars()
PKGDIR=$1
PKGNAME=
shift;
if [ -n "$opt_b" -a -z "$opt_s" ] ; then
for pkg in $PKGDB ; do
case $pkg in
"$PKGDIR:"*)
PKGNAME=`echo $pkg| ${SED} 's/[^:]*://'`
return;
;;
esac
done
msg "WARNING: No binary package for $PKGDIR"
else
if [ ! -f $PKGSRCDIR/$pkgdir/Makefile ];then
msg "WARNING: No $pkgdir/Makefile - package moved or obsolete?"
return
fi
cd $PKGSRCDIR/$PKGDIR
extract_make_vars Makefile "$@"
if [ -z "$PKGNAME" ]; then
fatal "Unable to extract PKGNAME for $pkgdir"
fi
if [ ! -f $PKGSRCDIR/$pkgdir/Makefile ];then
msg "WARNING: No $pkgdir/Makefile - package moved or obsolete?"
return
fi
cd $PKGSRCDIR/$PKGDIR
extract_make_vars Makefile "$@"
if [ -z "$PKGNAME" ]; then
fatal "Unable to extract PKGNAME for $pkgdir"
fi
}

Expand All @@ -176,7 +166,7 @@ extract_variables()
extract_make_vars Makefile \
AWK GREP GZIP_CMD ID PACKAGES PKGCHK_CONF PKGCHK_NOTAGS \
PKGCHK_TAGS PKGCHK_UPDATE_CONF PKG_ADD PKG_DBDIR PKG_DELETE \
PKG_INFO PKG_SUFX SED SORT SU_CMD TSORT
PKG_ADMIN PKG_INFO PKG_SUFX SED SORT SU_CMD TSORT
if [ -z "$PACKAGES" ];then
PACKAGES=$PKGSRCDIR/packages
fi
Expand Down Expand Up @@ -254,59 +244,87 @@ get_build_ver()
cat $MY_TMPFILE
}

# 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
#
list_dependencies()
{
${PKG_INFO} -. -q -n $1 | ${GREP} .. || true
}

# Pass a list of pkgdirs, outputs a tsorted list including any dependencies
#
list_packages()
{
# DEPCHECKLIST contains packages for which binary packages are known to
# exist, but now need to be checked for packages on which they depend
DEPCHECKLIST=' '
# Convert passed in list of pkgdirs to a list of binary package files
pkglist=''
for pkgdir in $* ; do
extract_pkg_vars $pkgdir PKGNAME
if [ -z "$PKGNAME" ]; then
pkgname=`pkgdir2pkgname $pkgdir`
if [ -z "$pkgname" ]; then
fatal_later "$pkgdir - Unable to extract pkgname"
continue
fi
if is_binary_available $PKGNAME; then
:
if is_binary_available $pkgname ; then
pkglist="$pkglist $pkgname$PKG_SUFX"
else
fatal_later "$PKGNAME - binary package missing"
continue
fatal_later "$pkgname - no binary package found"
fi
verbose "$PKGNAME$PKG_SUFX: found"
DEPCHECKLIST="$DEPCHECKLIST$PKGNAME ";
done

PAIRLIST=
PKGLIST=' '
while [ "$DEPCHECKLIST" != ' ' ]; do
NEXTCHECK=' '
for pkg in $DEPCHECKLIST ; do
DEPLIST="$(${PKG_INFO} -. -q -N $PACKAGES/$pkg$PKG_SUFX | ${GREP} .. || true)"
if [ -z "$DEPLIST" ] ; then
PAIRLIST="${PAIRLIST}$pkg$PKG_SUFX $pkg$PKG_SUFX\n"
# Variables used in this loop:
# pkglist: Current list of binary package files to check for dependencies
# next_pkglist: List of binary package files to check after pkglist
# pairlist: completed list of package + dependency for use in tsort
while [ -n "$pkglist" ] ; do
verbose "pkglist: $pkglist"
for pkg in $pkglist ; do
set -o noglob
deplist="$(list_dependencies $PACKAGES/$pkg)"
verbose "$pkg: dependencies - `echo $deplist`"
if [ -n "$deplist" ] ; then
for depmatch in $deplist ; do
dep=`${PKG_ADMIN} -b -d $PACKAGES lsbest "$depmatch"`
if [ -z "$dep" ] ; then
fatal_later "$depmatch: dependency missing for $pkg"
else
pairlist="$pairlist$dep $pkg\n"
case $dep_cache in
*" $dep "*)
# depmatch_cache is a quick cache of already
verbose "$pkg: $deplist - cached"
;;
*)
next_pkglist="$next_pkglist $dep"
dep_cache="$dep_cache $dep "
;;
esac
fi
done
else
pairlist="$pairlist$pkg $pkg\n"
fi
for dep in $DEPLIST ; do
if is_binary_available $dep; then
:
else
fatal_later "$dep$PKG_SUFX - dependency missing for $pkg"
break
fi
PAIRLIST="${PAIRLIST}$dep$PKG_SUFX $pkg$PKG_SUFX\n"
case "$PKGLIST$DEPCHECKLIST$NEXTCHECK" in
*" $dep "*)
verbose "$pkg: Duplicate depend $dep"
;;
*)
NEXTCHECK=" $dep$NEXTCHECK"
verbose "$pkg: Add depend $dep"
;;
esac
done
PKGLIST="$pkg $PKGLIST"
set +o noglob
done
DEPCHECKLIST="$NEXTCHECK"
pkglist="$next_pkglist"
next_pkglist=
done
fatal_later_check
printf "$PAIRLIST" | ${TSORT}
printf "$pairlist" | ${TSORT}
}

pkgdir2pkgname()
{
pkgdir=$1
for pkgline in $PKGDB ; do
case $pkgline in
"$pkgdir:"*)
echo $pkgline | ${SED} 's/[^:]*://'
return;
;;
esac
done
msg "WARNING: No binary package for $pkgdir"
}

pkgdirs_from_conf()
Expand Down Expand Up @@ -694,6 +712,7 @@ test -n "$ID" || ID="@ID@"
test -n "$MAKE" || MAKE="@MAKE@"
test -n "$MAKECONF" || MAKECONF="@MAKECONF@"
test -n "$PKG_ADD" || PKG_ADD="@PKG_ADD@"
test -n "$PKG_ADMIN" || PKG_ADMIN="@PKG_ADMIN@"
test -n "$PKG_DBDIR" || PKG_DBDIR="@PKG_DBDIR@"
test -n "$PKG_DELETE" || PKG_DELETE="@PKG_DELETE@"
test -n "$PKG_INFO" || PKG_INFO="@PKG_INFO@"
Expand Down

0 comments on commit d3d32b7

Please sign in to comment.