summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_chk
diff options
context:
space:
mode:
authordillo <dillo>2005-12-12 13:36:37 +0000
committerdillo <dillo>2005-12-12 13:36:37 +0000
commitff70307d67fee61e23ecd2b1d534841373a976b4 (patch)
tree8f55b86c71a979298de3a09798d67b924c2e952e /pkgtools/pkg_chk
parentfa7c5ee30756c8b7307d8fbf426e3b3e49b64368 (diff)
downloadpkgsrc-ff70307d67fee61e23ecd2b1d534841373a976b4.tar.gz
Add new option -S to create summary file of binary package directory.
Use this summary file to support using remote binary packages. Okayed by agc and abs.
Diffstat (limited to 'pkgtools/pkg_chk')
-rw-r--r--pkgtools/pkg_chk/Makefile4
-rw-r--r--pkgtools/pkg_chk/files/pkg_chk.87
-rwxr-xr-xpkgtools/pkg_chk/files/pkg_chk.sh89
3 files changed, 72 insertions, 28 deletions
diff --git a/pkgtools/pkg_chk/Makefile b/pkgtools/pkg_chk/Makefile
index a1d4f73845c..3ce8c7cb6f0 100644
--- a/pkgtools/pkg_chk/Makefile
+++ b/pkgtools/pkg_chk/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.20 2005/09/27 17:13:03 abs Exp $
+# $NetBSD: Makefile,v 1.21 2005/12/12 13:36:37 dillo Exp $
-DISTNAME= pkg_chk-1.62
+DISTNAME= pkg_chk-1.63
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkg_chk/files/pkg_chk.8 b/pkgtools/pkg_chk/files/pkg_chk.8
index e75156d336e..a1504fffffe 100644
--- a/pkgtools/pkg_chk/files/pkg_chk.8
+++ b/pkgtools/pkg_chk/files/pkg_chk.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_chk.8,v 1.13 2005/09/30 12:10:44 wiz Exp $
+.\" $NetBSD: pkg_chk.8,v 1.14 2005/12/12 13:36:37 dillo 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 aBbcfhiklNnrsuv
+.Op Fl aBbcfhiklNnrsSuv
.Op Fl C Ar conf
.Op Fl D Ar tags
.Op Fl L Ar file
@@ -126,6 +126,9 @@ otherwise.
Recursively delete any mismatched packages found.
Use with care, this does not record which packages were installed
for later update.
+.It Fl S
+Create summary file of binary packages. If you are using binary
+packages remotely, this file has to be created on the server.
.It Fl s
Building missing packages from source.
If DEPENDS_TARGET=package is set in
diff --git a/pkgtools/pkg_chk/files/pkg_chk.sh b/pkgtools/pkg_chk/files/pkg_chk.sh
index 01d5260626d..dd718d16931 100755
--- a/pkgtools/pkg_chk/files/pkg_chk.sh
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh
@@ -1,14 +1,35 @@
#!@SH@ -e
#
-# $Id: pkg_chk.sh,v 1.21 2005/10/02 02:05:29 heas Exp $
+# $Id: pkg_chk.sh,v 1.22 2005/12/12 13:36:38 dillo Exp $
#
# TODO: Make -g check dependencies and tsort
# TODO: Variation of -g which only lists top level packages
# TODO: List top level packages installed but not in config
-# TODO: Generate list files so -u can work against a remote URL
PATH=/usr/sbin:/usr/bin:${PATH}
+SUMMARY_FILE=pkg_chk-summary
+
+is_binary_available()
+ {
+ if [ -n "$PKGDB" ]; then
+ for iba_pkg in $PKGDB; do
+ case $iba_pkg in
+ *:"$1")
+ return 0;
+ ;;
+ esac
+ done
+ return 1;
+ else
+ if [ -f "$PACKAGES/$1.tgz" ]; then
+ return 0;
+ else
+ return 1;
+ fi
+ fi
+ }
+
check_packages_installed()
{
MISSING_TODO=
@@ -37,7 +58,7 @@ check_packages_installed()
msg_n "missing"
MISSING_TODO="$MISSING_TODO $PKGNAME $pkgdir"
fi
- if [ -f $PACKAGES/$PKGNAME.tgz ] ;then
+ if is_binary_available $PKGNAME ;then
msg_n " (binary package available)"
fi
msg
@@ -191,7 +212,7 @@ generate_conf_from_installed()
get_build_ver()
{
if [ -n "$opt_b" -a -z "$opt_s" ] ; then
- ${PKG_INFO} -. -b $PACKAGES/$PKGNAME.tgz | tail +4 | ${SED} "s|^[^:]*/[^:]*:||" | ${GREP} .
+ ${PKG_INFO} -. -q -b $PACKAGES/$PKGNAME.tgz | ${SED} "s|^[^:]*/[^:]*:||" | ${GREP} .
return
fi
files=""
@@ -227,7 +248,9 @@ list_packages()
if [ -z "$PKGNAME" ]; then
continue
fi
- if [ ! -f $PACKAGES/$PKGNAME.tgz ] ;then
+ if is_binary_available $PKGNAME; then
+ :
+ else
fatal_maybe " ** $PKGNAME - binary package missing"
continue
fi
@@ -240,16 +263,20 @@ list_packages()
while [ "$CHECKLIST" != ' ' ]; do
NEXTCHECK=' '
for pkg in $CHECKLIST ; do
- if [ ! -f $PACKAGES/$pkg.tgz ] ; then
+ if is_binary_available $pkg; then
+ :
+ else
fatal_maybe " ** $pkg.tgz - binary package dependency missing"
continue
fi
- DEPLIST="$(${PKG_INFO} -. -N $PACKAGES/$pkg.tgz | ${SED} '1,/Built using:/d' | ${GREP} .. || true)"
+ DEPLIST="$(${PKG_INFO} -. -q -N $PACKAGES/$pkg.tgz | ${GREP} .. || true)"
if [ -z "$DEPLIST" ] ; then
PAIRLIST="${PAIRLIST}$pkg.tgz $pkg.tgz\n"
fi
for dep in $DEPLIST ; do
- if [ ! -f $PACKAGES/$dep.tgz ] ; then
+ if is_binary_available $pkg; then
+ :
+ else
fatal_maybe " ** $dep.tgz - dependency missing for $pkg"
break 2
fi
@@ -433,12 +460,11 @@ pkg_install()
if [ -d $PKG_DBDIR/$PKGNAME ];then
msg "$PKGNAME installed in previous stage"
- elif [ -n "$opt_b" -a -f $PACKAGES/$PKGNAME.tgz ] ; then
+ elif [ -n "$opt_b" ] && is_binary_available $PKGNAME; then
if [ -n "$saved_PKG_PATH" ] ; then
export PKG_PATH=$saved_PKG_PATH
fi
- cd $PACKAGES
- run_cmd "${PKG_ADD} $PKGNAME.tgz"
+ run_cmd "${PKG_ADD} $PACKAGES/$PKGNAME.tgz"
if [ -n "$saved_PKG_PATH" ] ; then
unset PKG_PATH
fi
@@ -499,7 +525,8 @@ set_path()
{
arg=$1
case $arg in
- /*) echo $arg ;;
+ http://*|ftp://*|/*)
+ echo $arg ;;
*) echo $basedir/$arg ;;
esac
}
@@ -528,6 +555,7 @@ usage()
-n Display actions that would be taken, but do not perform them
-P dir Set PACKAGES dir (overrides any other setting)
-r Recursively remove mismatches (use with care) (implies -i)
+ -S Create summary of binary packages
-s Install packages by building from source
-U tags Comma separated list of pkgchk.conf tags to unset
-u Update all mismatched packages (implies -i)
@@ -551,7 +579,7 @@ verbose()
fi
}
-args=$(getopt BC:D:L:P:U:abcfghiklNnrsuv $*)
+args=$(getopt BC:D:L:P:U:abcfghiklNnrsSuv $*)
if [ $? != 0 ]; then
opt_h=1
fi
@@ -575,6 +603,7 @@ while [ $# != 0 ]; do
-n ) opt_n=1 ;;
-P ) opt_P="$2" ; shift;;
-r ) opt_r=1 ; opt_i=1 ;;
+ -S ) opt_S=1 ;;
-s ) opt_s=1 ;;
-U ) opt_U="$2" ; shift;;
-u ) opt_u=1 ; opt_i=1 ;;
@@ -588,9 +617,9 @@ if [ -z "$opt_b" -a -z "$opt_s" ];then
opt_b=1; opt_s=1;
fi
-if [ -z "$opt_a" -a -z "$opt_c" -a -z "$opt_g" -a -z "$opt_i" -a -z "$opt_N" -a -z "$opt_l" ];
+if [ -z "$opt_a" -a -z "$opt_c" -a -z "$opt_g" -a -z "$opt_i" -a -z "$opt_N" -a -z "$opt_l" -a -z "$opt_S" ];
then
- usage "Must specify at least one of -a, -c, -g, -i, -l, -N, or -u";
+ usage "Must specify at least one of -a, -c, -g, -i, -l, -N, -S, or -u";
fi
if [ -n "$opt_h" -o $# != 0 ];then
@@ -665,15 +694,27 @@ if [ -n "$opt_N" ]; then
done
fi
-if [ -n "$opt_b" -a -z "$opt_s" -a -d $PACKAGES ] ; then
- msg_progress Scan $PACKAGES
- cd $PACKAGES
- for f in `ls -t *.tgz` ; 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/\.tgz$//'`
- PKGDB="${PKGDB} $PKGDIR:$PKGNAME"
- done
- PKGSRCDIR=NONE
+if [ -n "$opt_b" -o -n "$opt_S" -a -z "$opt_s" ] ; then
+ case $PACKAGES in
+ http://*|ftp://*)
+ PKGDB=`ftp -o - $PACKAGES/$SUMMARY_FILE`;;
+ *)
+ if [ -d "$PACKAGES" ] ; then
+ msg_progress Scan $PACKAGES
+ cd $PACKAGES
+ for f in `ls -t *.tgz` ; 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/\.tgz$//'`
+ PKGDB="${PKGDB} $PKGDIR:$PKGNAME"
+ done
+ PKGSRCDIR=NONE
+ fi;;
+ esac
+fi
+
+if [ -n "$opt_S" ]; then
+ msg_progress "Write $PACKGES/$SUMMARY_FILE"
+ echo "$PKGDB" | tr ' ' '\012' > $PACKAGES/$SUMMARY_FILE
fi
if [ -n "$opt_g" ]; then