Add shell variables defined in sets.subr for almost all commands used
by scripts in distrib/sets/*. This is intended to be useful when cross building. Only trivial commands like echo, cat, and rm are excluded from this treatment. While I am here, make ${MTREE} and ${DB} follow the pattern used by most other such variables. Reviewed by agc.
This commit is contained in:
parent
de8198c18c
commit
3a0b541193
@ -1,6 +1,6 @@
|
||||
#! /bin/sh --
|
||||
#
|
||||
# $NetBSD: checkflist,v 1.27 2006/01/03 15:42:42 apb Exp $
|
||||
# $NetBSD: checkflist,v 1.28 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Verify output of makeflist against contents of $DESTDIR.
|
||||
|
||||
@ -85,7 +85,7 @@ ${HOST_SH} ./makeflist $xargs $dargs > $SDIR/flist
|
||||
|
||||
(
|
||||
cd $DESTDIR
|
||||
find $origin \( -type d -o -type f -o -type l \) -print
|
||||
${FIND} $origin \( -type d -o -type f -o -type l \) -print
|
||||
) | (
|
||||
while read line; do
|
||||
case "$line" in
|
||||
@ -96,13 +96,13 @@ ${HOST_SH} ./makeflist $xargs $dargs > $SDIR/flist
|
||||
;;
|
||||
esac
|
||||
done
|
||||
) | sort > $SDIR/files
|
||||
) | ${SORT} > $SDIR/files
|
||||
|
||||
comm -23 $SDIR/flist $SDIR/files > $SDIR/missing
|
||||
comm -13 $SDIR/flist $SDIR/files > $SDIR/extra
|
||||
${COMM} -23 $SDIR/flist $SDIR/files > $SDIR/missing
|
||||
${COMM} -13 $SDIR/flist $SDIR/files > $SDIR/extra
|
||||
|
||||
if [ -s $SDIR/extra ]; then
|
||||
count=$(awk 'END {print NR}' $SDIR/extra)
|
||||
count=$(${AWK} 'END {print NR}' $SDIR/extra)
|
||||
echo ""
|
||||
echo "============ ${count} extra files ==============="
|
||||
echo "Files in DESTDIR but missing from flist."
|
||||
@ -119,7 +119,7 @@ if [ -s $SDIR/extra ]; then
|
||||
fi
|
||||
|
||||
if [ -s $SDIR/missing ]; then
|
||||
count=$(awk 'END {print NR}' $SDIR/missing)
|
||||
count=$(${AWK} 'END {print NR}' $SDIR/missing)
|
||||
echo ""
|
||||
echo "=========== ${count} missing files =============="
|
||||
echo "Files in flist but missing from DESTDIR."
|
||||
|
@ -19,28 +19,28 @@
|
||||
# and A D can be derived from A B, B C, C D by transitivity.
|
||||
#
|
||||
|
||||
SCRATCH=$(mktemp -d /var/tmp/$0.XXXXXX)
|
||||
SCRATCH=$(${MKTEMP} -d /var/tmp/$0.XXXXXX)
|
||||
NEXTLEFTOVERS=$SCRATCH/leftovers0
|
||||
LASTJOIN=$SCRATCH/join0
|
||||
NEXTJOIN=$SCRATCH/join1
|
||||
TAB=" "
|
||||
|
||||
sort -k 1 > $LASTJOIN
|
||||
${SORT} -k 1 > $LASTJOIN
|
||||
|
||||
LEFTOVERS=$LASTJOIN
|
||||
|
||||
while [ $(wc -l $LASTJOIN | awk '{ print $1; }') -ne 0 ]; do
|
||||
while [ $(${WC} -l $LASTJOIN | ${AWK} '{ print $1; }') -ne 0 ]; do
|
||||
|
||||
#
|
||||
# From dependencies X-requires-Y in $LEFTOVERS and Y-requires-Z in
|
||||
# $LASTJOIN, produce dependencies X-requires-Z and write them to
|
||||
# $NEXTJOIN.
|
||||
#
|
||||
sort -k 2 < $LEFTOVERS | join -1 2 -2 1 -o '1.1 2.2' - $LASTJOIN | \
|
||||
sort -u > $NEXTJOIN
|
||||
${SORT} -k 2 < $LEFTOVERS | ${JOIN} -1 2 -2 1 -o '1.1 2.2' - $LASTJOIN | \
|
||||
${SORT} -u > $NEXTJOIN
|
||||
if [ ${DEBUG:-0} -gt 0 ]; then
|
||||
echo "### filtered ###" 1>&2
|
||||
join -t "$TAB" $NEXTJOIN $LEFTOVERS | sort 1>&2
|
||||
${JOIN} -t "$TAB" $NEXTJOIN $LEFTOVERS | ${SORT} 1>&2
|
||||
echo "###" 1>&2
|
||||
fi
|
||||
|
||||
@ -49,7 +49,7 @@ while [ $(wc -l $LASTJOIN | awk '{ print $1; }') -ne 0 ]; do
|
||||
# were produced in the previous step. Write the new leftovers to
|
||||
# $NEXTLEFTOVERS.
|
||||
#
|
||||
join -v 2 -t "$TAB" $NEXTJOIN $LEFTOVERS | sort -u > $NEXTLEFTOVERS
|
||||
${JOIN} -v 2 -t "$TAB" $NEXTJOIN $LEFTOVERS | ${SORT} -u > $NEXTLEFTOVERS
|
||||
|
||||
#
|
||||
# Swap output files before repeating.
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: listpkgs,v 1.9 2004/07/23 15:11:26 erh Exp $
|
||||
# $NetBSD: listpkgs,v 1.10 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# List all packages in the given pkgset by parsing the list files.
|
||||
#
|
||||
@ -46,4 +46,4 @@ if [ $# -ne 1 ]; then
|
||||
fi
|
||||
setname="$1"
|
||||
|
||||
list_set_files $setname | awk '{print $2}' | sort -u
|
||||
list_set_files $setname | ${AWK} '{print $2}' | ${SORT} -u
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: makeflist,v 1.71 2004/07/23 15:11:26 erh Exp $
|
||||
# $NetBSD: makeflist,v 1.72 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Print out the files in some or all lists.
|
||||
# Usage: makeflist [-bxlo] [-a arch] [-m machine] [-s setsdir] [setname ...]
|
||||
@ -66,4 +66,4 @@ if [ -n "$listonly" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
list_set_files $lists | awk '{print $1}' | sort -u
|
||||
list_set_files $lists | ${AWK} '{print $1}' | ${SORT} -u
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: makeobsolete,v 1.25 2005/03/28 03:12:34 lukem Exp $
|
||||
# $NetBSD: makeobsolete,v 1.26 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Print out the obsolete files for a set
|
||||
# Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
|
||||
@ -65,5 +65,5 @@ fi
|
||||
|
||||
for setname in $lists; do
|
||||
file=$target/${setname}
|
||||
list_set_files $setname | awk '{print $1}' | sort -ru > $file
|
||||
list_set_files $setname | ${AWK} '{print $1}' | ${SORT} -ru > $file
|
||||
done
|
||||
|
@ -54,11 +54,11 @@ ffilename=/tmp/makeplist.files.$$
|
||||
dfilename=/tmp/makeplist.dirs.$$
|
||||
|
||||
list_set_files $setname | \
|
||||
env PLISTPKG=$pkgname awk '
|
||||
${ENV_CMD} PLISTPKG=$pkgname ${AWK} '
|
||||
$2 == ENVIRON["PLISTPKG"] {
|
||||
sub("^\\./", "", $1);
|
||||
print $1
|
||||
}' | sort -u > $filename
|
||||
}' | ${SORT} -u > $filename
|
||||
|
||||
SELECTDIRS="-prune -type d"
|
||||
SELECTNONDIRS="! -type d -print -o ( -type d -prune )"
|
||||
@ -77,8 +77,8 @@ cd $prefix
|
||||
xargs echo $SELECTDIRS < $filename | \
|
||||
while read ignore ignore ignore args; do
|
||||
[ -z "$args" ] && break
|
||||
find $args $SELECTDIRS
|
||||
done | awk '{ print "@dirrm " $1; }' > $dfilename
|
||||
${FIND} $args $SELECTDIRS
|
||||
done | ${AWK} '{ print "@dirrm " $1; }' > $dfilename
|
||||
|
||||
#
|
||||
# Match the non-directories. Use find(1) to avoid repeat calls to
|
||||
@ -89,7 +89,7 @@ xargs echo $SELECTNONDIRS < $filename | \
|
||||
while read ignore ignore ignore ignore ignore ignore ignore ignore ignore \
|
||||
ignore args; do
|
||||
[ -z "$args" ] && break
|
||||
find $args $SELECTNONDIRS
|
||||
${FIND} $args $SELECTNONDIRS
|
||||
done > $ffilename
|
||||
|
||||
cd -
|
||||
@ -99,7 +99,7 @@ if [ -s $ffilename ]; then
|
||||
cat $ffilename
|
||||
fi
|
||||
if [ -s $dfilename ]; then
|
||||
sort -r $dfilename
|
||||
${SORT} -r $dfilename
|
||||
fi
|
||||
|
||||
rm -f $filename $ffilename $dfilename
|
||||
|
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $NetBSD: makesrctars,v 1.28 2006/01/03 15:42:42 apb Exp $
|
||||
# $NetBSD: makesrctars,v 1.29 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# makesrctars srcdir setdir
|
||||
# Create source tarballs in setdir from the source under srcdir.
|
||||
@ -76,12 +76,12 @@ makeset()
|
||||
fi
|
||||
set -f
|
||||
${MTREE} -c -X /tmp/in$$ | ${MTREE} -C -k type | \
|
||||
egrep -v 'type=link' | egrep $egrep | \
|
||||
sed -e 's:type=file:& mode=0664:' \
|
||||
${EGREP} -v 'type=link' | ${EGREP} $egrep | \
|
||||
${SED} -e 's:type=file:& mode=0664:' \
|
||||
-e 's:type=dir:& mode=0775:' \
|
||||
-e 's:$: uname=root gname=wsrc:' | \
|
||||
${PAX} -M -N ${PASSWD} -w -d -s'|^\.|'${srcprefix}'|' | \
|
||||
gzip > "${setdir}/${set}"
|
||||
${GZIP_CMD} > "${setdir}/${set}"
|
||||
rm -f /tmp/in$$
|
||||
)}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: makesums,v 1.12 2006/01/03 15:42:42 apb Exp $
|
||||
# $NetBSD: makesums,v 1.13 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Make checksum files for files in ``tardir''. Usage:
|
||||
# makesums [-a] [-t tardir] [setname [...]]
|
||||
@ -71,7 +71,8 @@ if [ $dash_all = yes ]; then
|
||||
elif [ -z "$pat" ]; then
|
||||
pat='*.tgz'
|
||||
fi
|
||||
lists=$(find $pat -prune \( -type f -o -type l \) \! -name '*SUM' \! -name MD5 \! -name SHA512 2>/dev/null)
|
||||
lists=$(${FIND} $pat -prune \( -type f -o -type l \) \
|
||||
\! -name '*SUM' \! -name MD5 \! -name SHA512 2>/dev/null)
|
||||
if [ -n "$lists" ]; then
|
||||
eval ${CKSUM} -o1 $lists $append BSDSUM
|
||||
eval ${CKSUM} $lists $append CKSUM
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: maketars,v 1.56 2006/01/03 15:42:42 apb Exp $
|
||||
# $NetBSD: maketars,v 1.57 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Make release tar files for some or all lists. Usage:
|
||||
# maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir]
|
||||
@ -93,7 +93,7 @@ while getopts bxi:a:m:s:SM:N:d:t: ch; do
|
||||
done
|
||||
shift $((${OPTIND} - 1))
|
||||
if [ -n "$installdir" ]; then # if -i, remove etc & xetc from the default list
|
||||
lists=$(echo $lists | sed -e 's/ etc / /;s/ xetc / /')
|
||||
lists=$(echo $lists | ${SED} -e 's/ etc / /;s/ xetc / /')
|
||||
fi
|
||||
if [ -n "$*" ]; then
|
||||
lists="$*"
|
||||
@ -143,11 +143,12 @@ for setname in $lists; do
|
||||
-s $setsdir $setname > $SDIR/flist.$setname
|
||||
if [ -n "$metalog" ]; then
|
||||
$setfilesonly && echo "Creating ${setlistdir}/set.${setname}"
|
||||
awk -f $rundir/getdirs.awk $SDIR/flist.$setname \
|
||||
| sort -u > $SDIR/flist.$setname.full
|
||||
${AWK} -f $rundir/getdirs.awk $SDIR/flist.$setname \
|
||||
| ${SORT} -u > $SDIR/flist.$setname.full
|
||||
(
|
||||
echo "/set uname=root gname=wheel"
|
||||
awk -f $rundir/join.awk $SDIR/flist.$setname.full $SDIR/metalog
|
||||
${AWK} -f $rundir/join.awk \
|
||||
$SDIR/flist.$setname.full $SDIR/metalog
|
||||
echo "./etc/mtree/set.${setname} type=file mode=0444"
|
||||
) > ${setlistdir}/set.${setname}
|
||||
elif ! cmp -s ${SDIR}/flist.${setname} \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $NetBSD: regpkg,v 1.6 2004/07/23 15:11:26 erh Exp $
|
||||
# $NetBSD: regpkg,v 1.7 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Copyright (c) 2003 Alistair G. Crooks. All rights reserved.
|
||||
#
|
||||
@ -72,21 +72,21 @@ $rundir/makeplist $pkgset $pkg > $PLIST
|
||||
|
||||
# create the pkg tiny version
|
||||
case "${SYSPKG_DATES}" in
|
||||
"") tinyvers=`awk '$1 ~ '/$pkg/' { print $2 }' $rundir/versions`
|
||||
"") tinyvers=`${AWK} '$1 ~ '/$pkg/' { print $2 }' $rundir/versions`
|
||||
case "$tinyvers" in
|
||||
"") tinyvers=0
|
||||
;;
|
||||
esac
|
||||
if [ -f ../../sys/conf/osrelease.sh ]; then
|
||||
osvers=`sh ../../sys/conf/osrelease.sh`
|
||||
osvers=`${HOST_SH} ../../sys/conf/osrelease.sh`
|
||||
method=osreleases
|
||||
else
|
||||
osvers=`uname -r`
|
||||
osvers=`${UNAME} -r`
|
||||
method=uname
|
||||
fi
|
||||
t=$osvers.$tinyvers
|
||||
;;
|
||||
*) args=`awk '
|
||||
*) args=`${AWK} '
|
||||
/^@cwd/ { prefix = $2; next }
|
||||
/^@dirrm/ { next }
|
||||
{ printf("%s%s\n", prefix, $0) }' $PLIST`
|
||||
@ -94,7 +94,7 @@ case "${SYSPKG_DATES}" in
|
||||
t=0
|
||||
case "$args" in
|
||||
"") ;;
|
||||
*) t=`ident $args 2>/dev/null | awk '
|
||||
*) t=`${IDENT} $args 2>/dev/null | ${AWK} '
|
||||
BEGIN { last = 0 }
|
||||
$2 == "crt0.c,v" { next }
|
||||
NF == 8 { t = $4; gsub("/", "", t); if (t > last) last = t; }
|
||||
@ -104,7 +104,7 @@ case "${SYSPKG_DATES}" in
|
||||
esac
|
||||
case "$t" in
|
||||
0) # we need the last mtime of the files which make up the package
|
||||
t=`env TZ=UTC LOCALE=C ls -lT $args | awk '
|
||||
t=`${ENV_CMD} TZ=UTC LOCALE=C ${LS} -lT $args | ${AWK} '
|
||||
BEGIN { newest = 0 }
|
||||
{
|
||||
t = $9 "";
|
||||
@ -149,11 +149,12 @@ fi
|
||||
mkdir -p ${SYSPKGDIR}
|
||||
|
||||
# add the dependencies
|
||||
awk '$1 ~ '/$pkg/' { print $2 }' $rundir/deps | sort | \
|
||||
awk '{ print "@pkgdep " $1 "-[0-9]*" }' >> $PLIST
|
||||
${AWK} '$1 ~ '/$pkg/' { print $2 }' $rundir/deps | ${SORT} | \
|
||||
${AWK} '{ print "@pkgdep " $1 "-[0-9]*" }' >> $PLIST
|
||||
|
||||
# create the comment
|
||||
comment=`awk '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' $rundir/comments`
|
||||
comment=`${AWK} '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' \
|
||||
$rundir/comments`
|
||||
case "$comment" in
|
||||
"") echo "***WARNING ***: no comment for \"$pkg\"" 2>&1
|
||||
comment="System package for $pkg"
|
||||
@ -162,28 +163,29 @@ esac
|
||||
echo "$comment" > ${SYSPKGDIR}/+COMMENT
|
||||
|
||||
# create the description
|
||||
descr=`awk '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' $rundir/descrs`
|
||||
descr=`${AWK} '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' \
|
||||
$rundir/descrs`
|
||||
case "$descr" in
|
||||
"") echo "***WARNING ***: no description for \"$pkg\"" 2>&1
|
||||
descr="System package for $pkg"
|
||||
;;
|
||||
esac
|
||||
echo "$descr" > ${SYSPKGDIR}/+DESC
|
||||
printf "\nHomepage:\nhttp://www.NetBSD.org/\n" >> ${SYSPKGDIR}/+DESC
|
||||
${PRINTF} "\nHomepage:\nhttp://www.NetBSD.org/\n" >> ${SYSPKGDIR}/+DESC
|
||||
|
||||
# create the build information
|
||||
if [ x${BUILD_INFO_CACHE} = x ]; then
|
||||
{
|
||||
echo "OPSYS=`uname -s`"
|
||||
echo "OS_VERSION=`uname -r`"
|
||||
make -f- all <<EOF
|
||||
echo "OPSYS=`${UNAME} -s`"
|
||||
echo "OS_VERSION=`${UNAME} -r`"
|
||||
${MAKE} -f- all <<EOF
|
||||
.include <bsd.own.mk>
|
||||
all:
|
||||
@echo OBJECT_FMT=${OBJECT_FMT}
|
||||
@echo MACHINE_ARCH=${MACHINE_ARCH}
|
||||
@echo MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
|
||||
EOF
|
||||
echo "_PKGTOOLS_VER=`pkg_create -V`"
|
||||
echo "_PKGTOOLS_VER=`${PKG_CREATE} -V`"
|
||||
} > ${SYSPKGDIR}/+BUILD_INFO
|
||||
else
|
||||
cp ${BUILD_INFO_CACHE} ${SYSPKGDIR}/+BUILD_INFO
|
||||
@ -191,7 +193,8 @@ fi
|
||||
|
||||
# test for attributes
|
||||
args=""
|
||||
attrs=`awk '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' $rundir/attrs`
|
||||
attrs=`${AWK} '$1 ~ '/$pkg/' { print substr($0, length($1) + 2) }' \
|
||||
$rundir/attrs`
|
||||
for a in "$attrs"; do
|
||||
case "$attrs" in
|
||||
"") ;;
|
||||
@ -201,7 +204,7 @@ for a in "$attrs"; do
|
||||
esac
|
||||
done
|
||||
|
||||
pkg_create -v -c ${SYSPKGDIR}/+COMMENT \
|
||||
${PKG_CREATE} -v -c ${SYSPKGDIR}/+COMMENT \
|
||||
-d ${SYSPKGDIR}/+DESC \
|
||||
$args \
|
||||
-f $PLIST -l -b /dev/null -B ${SYSPKGDIR}/+BUILD_INFO \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# $NetBSD: regpkgset,v 1.3 2004/07/23 15:11:26 erh Exp $
|
||||
# $NetBSD: regpkgset,v 1.4 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
# Copyright (c) 2003 Alistair G. Crooks. All rights reserved.
|
||||
#
|
||||
@ -60,19 +60,19 @@ all) list="base comp etc games man misc text" ;;
|
||||
esac
|
||||
|
||||
if [ x${cache} != x ]; then
|
||||
BUILD_INFO_CACHE=$(mktemp /var/tmp/$(basename $0)-BUILD_INFO.XXXXXX)
|
||||
BUILD_INFO_CACHE=$(${MKTEMP} /var/tmp/$(basename $0)-BUILD_INFO.XXXXXX)
|
||||
export BUILD_INFO_CACHE
|
||||
{
|
||||
echo "OPSYS=`uname -s`"
|
||||
echo "OS_VERSION=`uname -r`"
|
||||
make -f- all <<EOF
|
||||
echo "OPSYS=`${UNAME} -s`"
|
||||
echo "OS_VERSION=`${UNAME} -r`"
|
||||
${MAKE} -f- all <<EOF
|
||||
.include <bsd.own.mk>
|
||||
all:
|
||||
@echo OBJECT_FMT=${OBJECT_FMT}
|
||||
@echo MACHINE_ARCH=${MACHINE_ARCH}
|
||||
@echo MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
|
||||
EOF
|
||||
echo "_PKGTOOLS_VER=`pkg_create -V`"
|
||||
echo "_PKGTOOLS_VER=`${PKG_CREATE} -V`"
|
||||
} > ${BUILD_INFO_CACHE}
|
||||
fi
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $NetBSD: sets.subr,v 1.42 2006/01/03 15:42:42 apb Exp $
|
||||
# $NetBSD: sets.subr,v 1.43 2006/01/03 16:40:16 apb Exp $
|
||||
#
|
||||
|
||||
#
|
||||
@ -64,18 +64,36 @@ MKVARS="\
|
||||
#
|
||||
# The following variables refer to tools that are used when building sets:
|
||||
#
|
||||
: ${AWK:=awk}
|
||||
: ${CKSUM:=cksum}
|
||||
: ${COMM:=comm}
|
||||
: ${DB:=db}
|
||||
: ${EGREP:=egrep}
|
||||
: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc.
|
||||
: ${FIND:=find}
|
||||
: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1)
|
||||
: ${HOST_SH:=sh}
|
||||
: ${IDENT:=ident}
|
||||
: ${JOIN:=join}
|
||||
: ${LS:=ls}
|
||||
: ${MAKE:=make}
|
||||
: ${MKTEMP:=mktemp}
|
||||
: ${MTREE:=/usr/sbin/mtree}
|
||||
: ${MTREE:=mtree}
|
||||
: ${PASTE:=paste}
|
||||
: ${PAX:=pax}
|
||||
: ${TOOL_DB:=db}
|
||||
: ${PKG_CREATE:=pkg_create}
|
||||
: ${PRINTF:=printf}
|
||||
: ${SED:=sed}
|
||||
: ${SORT:=sort}
|
||||
: ${UNAME:=uname}
|
||||
: ${WC:=wc}
|
||||
|
||||
|
||||
oIFS=$IFS
|
||||
IFS="
|
||||
"
|
||||
for x in $(
|
||||
${MAKE:-make} -B -f- all <<EOMAKE
|
||||
${MAKE} -B -f- all <<EOMAKE
|
||||
.include <bsd.own.mk>
|
||||
.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall))
|
||||
MKMANPAGES=no
|
||||
@ -136,7 +154,7 @@ fi
|
||||
# In each file, a record consists of a path and a System Package name,
|
||||
# separated by whitespace. E.g.,
|
||||
#
|
||||
# # $NetBSD: sets.subr,v 1.42 2006/01/03 15:42:42 apb Exp $
|
||||
# # $NetBSD: sets.subr,v 1.43 2006/01/03 16:40:16 apb Exp $
|
||||
# . base-sys-root [keyword[,...]]
|
||||
# ./altroot base-sys-root
|
||||
# ./bin base-sys-root
|
||||
@ -201,7 +219,7 @@ list_set_files()
|
||||
for setname; do
|
||||
list_set_lists $setname
|
||||
done | xargs cat | \
|
||||
awk -v obsolete=${obsolete} '
|
||||
${AWK} -v obsolete=${obsolete} '
|
||||
BEGIN {
|
||||
if (! obsolete) {
|
||||
split("'"${MKVARS}"'", needvars)
|
||||
@ -385,7 +403,7 @@ list_set_lists()
|
||||
#
|
||||
arch_to_cpu()
|
||||
{
|
||||
MACHINE_ARCH=${1} ${MAKE:-make} -f- all <<EOMAKE
|
||||
MACHINE_ARCH=${1} ${MAKE} -f- all <<EOMAKE
|
||||
.include <bsd.own.mk>
|
||||
all:
|
||||
@echo \${MACHINE_CPU}
|
||||
|
@ -15,8 +15,6 @@
|
||||
rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
|
||||
. "${rundir}/sets.subr"
|
||||
|
||||
DB="${TOOL_DB} -q"
|
||||
prefix=/
|
||||
|
||||
usage()
|
||||
{
|
||||
@ -60,7 +58,7 @@ fi
|
||||
sets=$@
|
||||
|
||||
# TBD clean up
|
||||
SCRATCH=$(mktemp -d /var/tmp/$(basename $0).XXXXXX)
|
||||
SCRATCH=$(${MKTEMP} -d /var/tmp/$(basename $0).XXXXXX)
|
||||
|
||||
[ $? -ne 0 ] && { echo "Could not create scratch directory." 1>&2 ; exit 1 ; }
|
||||
|
||||
@ -71,16 +69,16 @@ PARENT_PATHNAMES=$SCRATCH/parent-pathnames
|
||||
|
||||
echo "indexing packages by pathnames" 1>&2
|
||||
|
||||
list_set_files $sets | sed 's/^\.\///' | \
|
||||
env PREFIX=$prefix awk '{
|
||||
list_set_files $sets | ${SED} 's/^\.\///' | \
|
||||
${ENV_CMD} PREFIX=$prefix ${AWK} '{
|
||||
if ($1 == ".") {
|
||||
print ENVIRON["PREFIX"] " " $2;
|
||||
} else {
|
||||
print ENVIRON["PREFIX"] $1 " " $2;
|
||||
}
|
||||
}' | sort -k 1 -u > $PATH_MEMBERSHIP
|
||||
}' | ${SORT} -k 1 -u > $PATH_MEMBERSHIP
|
||||
|
||||
$DB -w -f - btree $PATH_TO_PKGNAME < $PATH_MEMBERSHIP || echo "shit" 1>&2
|
||||
$DB -q -w -f - btree $PATH_TO_PKGNAME < $PATH_MEMBERSHIP || echo "shit" 1>&2
|
||||
|
||||
echo "computing parent pathnames" 1>&2
|
||||
|
||||
@ -91,9 +89,11 @@ done < $PATH_MEMBERSHIP > $PARENT_PATHNAMES
|
||||
|
||||
echo "selecting parent packages using parent pathnames" 1>&2
|
||||
|
||||
$DB -f - btree $PATH_TO_PKGNAME < $PARENT_PATHNAMES | \
|
||||
paste $PATH_MEMBERSHIP - | \
|
||||
awk '{ if ($2 != $4) print $2 " " $4; }' | sort -u | $rundir/culldeps
|
||||
$DB -q -f - btree $PATH_TO_PKGNAME < $PARENT_PATHNAMES | \
|
||||
${PASTE} $PATH_MEMBERSHIP - | \
|
||||
${AWK} '{ if ($2 != $4) print $2 " " $4; }' | \
|
||||
${SORT} -u | \
|
||||
$rundir/culldeps
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "error in parent-directory lookup, aborting" 1>&2
|
||||
|
Loading…
Reference in New Issue
Block a user