Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Print out the files in some or all lists.
|
2006-01-04 16:57:04 +03:00
|
|
|
# Usage: makeplist [options] setname pkgname
|
|
|
|
# options:
|
|
|
|
# -a arch set arch (e.g, m68k, mips, powerpc)
|
|
|
|
# -m machine set machine (e.g, amiga, i386, macppc)
|
|
|
|
# -s setsdir directory to find sets
|
|
|
|
# -p prefix prefix for package creation
|
|
|
|
# -I realprefix prefix for eventual installation
|
|
|
|
# setname pkgname set and package to build plist for
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
#
|
|
|
|
|
2006-01-03 21:31:09 +03:00
|
|
|
rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
|
|
|
|
. "${rundir}/sets.subr"
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
prefix=/
|
2006-01-04 16:57:04 +03:00
|
|
|
realprefix=/
|
|
|
|
got_realprefix=false
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
|
2006-01-04 16:57:04 +03:00
|
|
|
usage() {
|
2003-12-29 06:13:25 +03:00
|
|
|
cat 1>&2 <<USAGE
|
2006-01-04 16:57:04 +03:00
|
|
|
Usage: $0 [options] setname pkgname"
|
|
|
|
options:"
|
2006-01-03 21:31:09 +03:00
|
|
|
-a arch set arch (e.g, m68k, mips, powerpc) [${MACHINE_ARCH}]
|
|
|
|
-m machine set machine (e.g, amiga, i386, macppc) [${MACHINE}]
|
|
|
|
-s setsdir directory to find sets [${setsdir}]
|
|
|
|
-p prefix prefix for created plist [${prefix}]
|
2006-01-04 16:57:04 +03:00
|
|
|
-I realprefix prefix for eventual installation [${realprefix}]
|
2003-12-29 06:13:25 +03:00
|
|
|
setname pkgname set and package to build plist for
|
|
|
|
USAGE
|
|
|
|
exit 1
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
# handle args
|
2006-01-04 16:57:04 +03:00
|
|
|
while getopts a:I:m:p:s: ch; do
|
2003-12-29 06:13:25 +03:00
|
|
|
case ${ch} in
|
|
|
|
a)
|
2006-01-03 21:31:09 +03:00
|
|
|
MACHINE_ARCH="${OPTARG}"
|
|
|
|
MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
;;
|
2006-01-04 16:57:04 +03:00
|
|
|
I)
|
|
|
|
realprefix=${OPTARG}
|
|
|
|
got_realprefix=true
|
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
m)
|
2006-01-03 21:31:09 +03:00
|
|
|
MACHINE="${OPTARG}"
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
p)
|
2006-01-03 21:31:09 +03:00
|
|
|
prefix="${OPTARG}"
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
;;
|
2003-12-29 06:13:25 +03:00
|
|
|
s)
|
2006-01-03 21:31:09 +03:00
|
|
|
setsdir="${OPTARG}"
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
;;
|
|
|
|
*)
|
2003-12-29 06:13:25 +03:00
|
|
|
usage
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2003-12-29 06:13:25 +03:00
|
|
|
shift $((${OPTIND} - 1))
|
|
|
|
if [ $# -ne 2 ]; then
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
usage
|
|
|
|
fi
|
2003-12-29 06:13:25 +03:00
|
|
|
setname="$1"
|
2006-01-03 21:31:09 +03:00
|
|
|
pkgname="$2"
|
2003-06-12 23:55:18 +04:00
|
|
|
|
2006-01-04 16:57:04 +03:00
|
|
|
if ! ${got_realprefix}; then
|
|
|
|
realprefix="${prefix}"
|
|
|
|
fi
|
|
|
|
|
2006-01-03 21:31:09 +03:00
|
|
|
filename="/tmp/makeplist.$$"
|
|
|
|
ffilename="/tmp/makeplist.files.$$"
|
|
|
|
dfilename="/tmp/makeplist.dirs.$$"
|
2003-06-12 23:55:18 +04:00
|
|
|
|
2006-01-03 21:31:09 +03:00
|
|
|
list_set_files "${setname}" | \
|
|
|
|
${ENV_CMD} PLISTPKG="${pkgname}" ${AWK} '
|
2003-12-29 06:13:25 +03:00
|
|
|
$2 == ENVIRON["PLISTPKG"] {
|
|
|
|
sub("^\\./", "", $1);
|
|
|
|
print $1
|
2006-01-03 21:31:09 +03:00
|
|
|
}' | ${SORT} -u > "${filename}"
|
2003-06-23 13:17:04 +04:00
|
|
|
|
2005-01-12 04:38:04 +03:00
|
|
|
SELECTDIRS="-prune -type d"
|
|
|
|
SELECTNONDIRS="! -type d -print -o ( -type d -prune )"
|
2003-06-23 13:17:04 +04:00
|
|
|
|
2006-01-04 16:57:04 +03:00
|
|
|
#
|
|
|
|
# XXX: The "lists" do not differentiate between directories and files.
|
|
|
|
# But we need to differentiate between them, so we do so by checking
|
|
|
|
# what's actually present in the file system. Files or directories that
|
|
|
|
# are listed in the "lists" but that do not exist in the file system end
|
|
|
|
# up not appearing in our output, and this subverts a large part of the
|
|
|
|
# purpose of the "lists".
|
|
|
|
#
|
|
|
|
# XXX: Given that we have to figure out what is or is not a directory
|
|
|
|
# without assistance from the "lists", it would be much more efficient
|
|
|
|
# to consult the metalog instead of the file system.
|
|
|
|
#
|
|
|
|
|
2009-12-02 18:52:14 +03:00
|
|
|
(
|
2006-01-03 21:31:09 +03:00
|
|
|
cd "${prefix}"
|
2009-12-02 18:52:14 +03:00
|
|
|
|
2003-06-23 13:17:04 +04:00
|
|
|
#
|
2005-01-12 04:38:04 +03:00
|
|
|
# Match the directories. Use find(1) to avoid repeat calls to
|
|
|
|
# 'test -d'.
|
|
|
|
#
|
|
|
|
# This is a little clever. I cannot use 'xargs find', because
|
|
|
|
# find wants for the option arguments to follow the path arguments.
|
2006-01-03 21:31:09 +03:00
|
|
|
# So I use 'xargs echo ${SELECTDIRS}' to make a maximum-length proto-command
|
2005-01-12 04:38:04 +03:00
|
|
|
# line. I use 'read' to peel the options off the front of the
|
2006-01-03 21:31:09 +03:00
|
|
|
# command-line, and 'find ${args} ${SELECTDIRS}' to put them at the end.
|
2003-06-23 13:17:04 +04:00
|
|
|
#
|
2006-01-03 21:31:09 +03:00
|
|
|
xargs echo ${SELECTDIRS} < "${filename}" | \
|
2005-01-12 04:38:04 +03:00
|
|
|
while read ignore ignore ignore args; do
|
2006-01-03 21:31:09 +03:00
|
|
|
[ -z "${args}" ] && break
|
|
|
|
${FIND} ${args} ${SELECTDIRS}
|
|
|
|
done | ${AWK} '{ print "@dirrm " $1; }' > "${dfilename}"
|
2003-06-23 13:17:04 +04:00
|
|
|
|
|
|
|
#
|
2005-01-12 04:38:04 +03:00
|
|
|
# Match the non-directories. Use find(1) to avoid repeat calls to
|
|
|
|
# 'test ! -d'. See 'Match the directories' for an explanation of the
|
|
|
|
# cleverness.
|
2003-06-23 13:17:04 +04:00
|
|
|
#
|
2006-01-03 21:31:09 +03:00
|
|
|
xargs echo ${SELECTNONDIRS} < "${filename}" | \
|
2005-01-12 04:38:04 +03:00
|
|
|
while read ignore ignore ignore ignore ignore ignore ignore ignore ignore \
|
|
|
|
ignore args; do
|
2006-01-03 21:31:09 +03:00
|
|
|
[ -z "${args}" ] && break
|
|
|
|
${FIND} ${args} ${SELECTNONDIRS}
|
|
|
|
done > "${ffilename}"
|
2003-06-23 13:17:04 +04:00
|
|
|
|
2009-12-02 18:52:14 +03:00
|
|
|
)
|
Add two utility scripts used by syspkg from draga.com CVS:
listpkgs -- a utility script for syspkg maintainers. Given a pkgset name,
list all packages in that pkgset by parsing the src/distrib
set list files. Imported at draga.com revision 1.2.
Usage: ./listpkgs [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
setname set to list packages for
makeplist -- a script called by <bsd.syspkg.mk>. Given a pkgset name
and a pkg name, output a valid PLIST for that package by
parsing the src/distrib set list files. Imported at
draga.com revision 1.2.
Usage: ./makeplist [-a arch] [-m machine] [-s setsdir] [-p prefix] setname pkgname
-a arch set arch (e.g, m68k, mips, powerpc)
-m machine set machine (e.g, amiga, i386, macppc)
-s setsdir directory to find sets
-p prefix prefix for created plist
setname pkgname set and package to build plist for
2001-12-26 21:43:00 +03:00
|
|
|
|
2006-01-04 16:57:04 +03:00
|
|
|
echo "@cwd ${realprefix}"
|
2006-01-03 21:31:09 +03:00
|
|
|
if [ -s "${ffilename}" ]; then
|
|
|
|
cat "${ffilename}"
|
2003-06-12 23:55:18 +04:00
|
|
|
fi
|
2006-01-03 21:31:09 +03:00
|
|
|
if [ -s "${dfilename}" ]; then
|
|
|
|
${SORT} -r "${dfilename}"
|
2003-06-12 23:55:18 +04:00
|
|
|
fi
|
|
|
|
|
2006-01-03 21:31:09 +03:00
|
|
|
rm -f "${filename}" "${ffilename}" "${dfilename}"
|
2003-06-12 23:55:18 +04:00
|
|
|
|
|
|
|
exit 0
|