2011-05-20 20:02:21 +04:00
|
|
|
# $NetBSD: sets.subr,v 1.132 2011/05/20 16:02:22 plunky Exp $
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-29 06:13:25 +03:00
|
|
|
|
|
|
|
#
|
2004-01-03 05:38:58 +03:00
|
|
|
# The following variables contain defaults for sets.subr functions and callers:
|
2003-12-29 06:13:25 +03:00
|
|
|
# setsdir path to src/distrib/sets
|
|
|
|
# nlists list of base sets
|
|
|
|
# xlists list of x11 sets
|
2009-11-30 19:13:22 +03:00
|
|
|
# extlists list of extsrc sets
|
2003-12-29 06:13:25 +03:00
|
|
|
# obsolete controls if obsolete files are selected instead
|
2008-11-26 18:45:56 +03:00
|
|
|
# module if != "no", enable MODULE sets
|
2003-12-29 06:13:25 +03:00
|
|
|
# shlib shared library format (a.out, elf, or "")
|
|
|
|
# stlib static library format (a.out, elf)
|
2004-01-03 05:38:58 +03:00
|
|
|
#
|
|
|
|
# The following <bsd.own.mk> variables are exported to the environment:
|
|
|
|
# MACHINE
|
|
|
|
# MACHINE_ARCH
|
|
|
|
# MACHINE_CPU
|
2009-09-08 11:08:00 +04:00
|
|
|
# HAVE_BINUTILS
|
2006-04-07 23:38:58 +04:00
|
|
|
# HAVE_GCC
|
2006-07-12 17:39:04 +04:00
|
|
|
# HAVE_GDB
|
2010-12-28 12:15:24 +03:00
|
|
|
# HAS_SSP
|
2004-01-03 05:38:58 +03:00
|
|
|
# TOOLCHAIN_MISSING
|
|
|
|
# OBJECT_FMT
|
2004-01-11 18:09:51 +03:00
|
|
|
# as well as:
|
|
|
|
#
|
2009-12-02 17:28:24 +03:00
|
|
|
|
2006-01-03 18:42:42 +03:00
|
|
|
#
|
|
|
|
# The following variables refer to tools that are used when building sets:
|
|
|
|
#
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${AWK:=awk}
|
2006-01-03 18:42:42 +03:00
|
|
|
: ${CKSUM:=cksum}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${COMM:=comm}
|
2006-01-04 17:23:22 +03:00
|
|
|
: ${DATE:=date}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${DB:=db}
|
|
|
|
: ${EGREP:=egrep}
|
|
|
|
: ${ENV_CMD:=env} # ${ENV} is special to sh(1), ksh(1), etc.
|
2006-01-04 17:23:22 +03:00
|
|
|
: ${FGREP:=fgrep}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${FIND:=find}
|
2006-01-04 17:23:22 +03:00
|
|
|
: ${GREP:=grep}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${GZIP_CMD:=gzip} # ${GZIP} is special to gzip(1)
|
2009-12-02 18:52:14 +03:00
|
|
|
: ${HOSTNAME_CMD:=hostname} # ${HOSTNAME} is special to bash(1)
|
2006-01-03 18:42:42 +03:00
|
|
|
: ${HOST_SH:=sh}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${IDENT:=ident}
|
|
|
|
: ${JOIN:=join}
|
|
|
|
: ${LS:=ls}
|
|
|
|
: ${MAKE:=make}
|
2006-01-03 18:42:42 +03:00
|
|
|
: ${MKTEMP:=mktemp}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${MTREE:=mtree}
|
|
|
|
: ${PASTE:=paste}
|
2006-01-03 18:42:42 +03:00
|
|
|
: ${PAX:=pax}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${PRINTF:=printf}
|
|
|
|
: ${SED:=sed}
|
|
|
|
: ${SORT:=sort}
|
2006-01-04 17:23:22 +03:00
|
|
|
: ${STAT:=stat}
|
|
|
|
: ${TSORT:=tsort}
|
2006-01-03 19:40:16 +03:00
|
|
|
: ${UNAME:=uname}
|
|
|
|
: ${WC:=wc}
|
2009-12-21 18:37:25 +03:00
|
|
|
: ${XARGS:=xargs}
|
2006-01-03 19:40:16 +03:00
|
|
|
|
2006-01-04 17:35:03 +03:00
|
|
|
#
|
|
|
|
# If printf is a shell builtin command, then we can
|
|
|
|
# implement cheaper versions of basename and dirname
|
|
|
|
# that do not involve any fork/exec overhead.
|
|
|
|
# If printf is not builtin, approximate it using echo,
|
|
|
|
# and hope there are no weird file names that cause
|
|
|
|
# some versions of echo to do the wrong thing.
|
|
|
|
# (Converting to this version of dirname speeded up the
|
|
|
|
# syspkgdeps script by an order of magnitude, from 68
|
|
|
|
# seconds to 6.3 seconds on one particular host.)
|
|
|
|
#
|
|
|
|
# Note that naive approximations for dirname
|
|
|
|
# using ${foo%/*} do not do the right thing in cases
|
|
|
|
# where the result should be "/" or ".".
|
|
|
|
#
|
|
|
|
case "$(type printf)" in
|
|
|
|
*builtin*)
|
|
|
|
basename ()
|
|
|
|
{
|
|
|
|
local bn
|
|
|
|
bn="${1##*/}"
|
|
|
|
bn="${bn%$2}"
|
|
|
|
printf "%s\n" "$bn"
|
|
|
|
}
|
|
|
|
dirname ()
|
|
|
|
{
|
|
|
|
local dn
|
|
|
|
case "$1" in
|
|
|
|
?*/*) dn="${1%/*}" ;;
|
|
|
|
/*) dn=/ ;;
|
|
|
|
*) dn=. ;;
|
|
|
|
esac
|
|
|
|
printf "%s\n" "$dn"
|
|
|
|
}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
basename ()
|
|
|
|
{
|
|
|
|
local bn
|
|
|
|
bn="${1##*/}"
|
|
|
|
bn="${bn%$2}"
|
|
|
|
echo "$bn"
|
|
|
|
}
|
|
|
|
dirname ()
|
|
|
|
{
|
|
|
|
local dn
|
|
|
|
case "$1" in
|
|
|
|
?*/*) dn="${1%/*}" ;;
|
|
|
|
/*) dn=/ ;;
|
|
|
|
*) dn=. ;;
|
|
|
|
esac
|
|
|
|
echo "$dn"
|
|
|
|
}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2009-12-10 18:51:24 +03:00
|
|
|
#####
|
|
|
|
|
2003-12-29 06:13:25 +03:00
|
|
|
oIFS=$IFS
|
|
|
|
IFS="
|
|
|
|
"
|
2009-12-02 20:51:30 +03:00
|
|
|
|
2009-12-11 15:07:58 +03:00
|
|
|
for x in $( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars ); do
|
2009-12-10 18:51:24 +03:00
|
|
|
eval export $x
|
2003-12-29 06:13:25 +03:00
|
|
|
done
|
2009-12-02 20:51:30 +03:00
|
|
|
|
2003-12-29 06:13:25 +03:00
|
|
|
IFS=$oIFS
|
|
|
|
|
2009-12-21 18:37:25 +03:00
|
|
|
MKVARS="$( ${MAKE} -B -f ${rundir}/mkvars.mk mkvars | ${SED} -e 's,=.*,,' | ${XARGS} )"
|
2009-12-02 20:51:30 +03:00
|
|
|
|
2009-12-10 08:15:28 +03:00
|
|
|
#####
|
|
|
|
|
2009-12-15 09:18:07 +03:00
|
|
|
setsdir=${rundir}
|
2003-12-29 06:13:25 +03:00
|
|
|
obsolete=0
|
2009-11-05 20:34:25 +03:00
|
|
|
if [ "${MKKMOD}" = "no" ]; then
|
|
|
|
module=no # MODULEs are off.
|
2010-12-09 02:56:01 +03:00
|
|
|
modset=""
|
|
|
|
else
|
|
|
|
module=yes
|
|
|
|
modset="modules"
|
|
|
|
fi
|
|
|
|
if [ "${MKATF}" = "no" ]; then
|
|
|
|
testset=""
|
|
|
|
else
|
|
|
|
testset="tests"
|
2003-12-29 06:13:25 +03:00
|
|
|
fi
|
2004-03-05 07:52:50 +03:00
|
|
|
# Determine lib type. Do this first so stlib also gets set.
|
|
|
|
if [ "${OBJECT_FMT}" = "ELF" ]; then
|
2003-12-29 06:13:25 +03:00
|
|
|
shlib=elf
|
|
|
|
else
|
|
|
|
shlib=aout
|
|
|
|
fi
|
|
|
|
stlib=$shlib
|
2004-03-05 07:52:50 +03:00
|
|
|
# Now check for MKPIC or specials and turn off shlib if need be.
|
|
|
|
if [ "${MKPIC}" = "no" ]; then
|
|
|
|
shlib=no
|
|
|
|
fi
|
2010-12-09 02:56:01 +03:00
|
|
|
nlists="base comp etc games man misc $modset $testset text"
|
2009-09-07 06:27:27 +04:00
|
|
|
xlists="xbase xcomp xetc xfont xserver"
|
2009-11-30 19:13:22 +03:00
|
|
|
extlists="extbase extcomp extetc"
|
2003-12-29 06:13:25 +03:00
|
|
|
|
2008-05-22 18:48:42 +04:00
|
|
|
OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh`
|
2009-01-25 01:14:44 +03:00
|
|
|
MODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules"
|
2008-05-20 23:01:10 +04:00
|
|
|
SUBST="s#@MODULEDIR@#${MODULEDIR}#g"
|
|
|
|
SUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g"
|
|
|
|
SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g"
|
2008-05-20 19:17:22 +04:00
|
|
|
|
2003-12-29 06:13:25 +03:00
|
|
|
#
|
|
|
|
# list_set_files setfile [...]
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-29 06:13:25 +03:00
|
|
|
# Produce a packing list for setfile(s).
|
|
|
|
# In each file, a record consists of a path and a System Package name,
|
|
|
|
# separated by whitespace. E.g.,
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2011-05-20 20:02:21 +04:00
|
|
|
# # $NetBSD: sets.subr,v 1.132 2011/05/20 16:02:22 plunky Exp $
|
2003-12-29 06:13:25 +03:00
|
|
|
# . base-sys-root [keyword[,...]]
|
|
|
|
# ./altroot base-sys-root
|
|
|
|
# ./bin base-sys-root
|
|
|
|
# ./bin/[ base-util-root
|
|
|
|
# ./bin/cat base-util-root
|
|
|
|
# [...]
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-29 06:13:25 +03:00
|
|
|
# A # in the first column marks a comment.
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-29 06:13:25 +03:00
|
|
|
# If ${obsolete} != 0, only entries with an "obsolete" keyword will
|
2006-07-12 17:39:04 +04:00
|
|
|
# be printed. All other keywords must be present.
|
2003-12-29 06:13:25 +03:00
|
|
|
#
|
|
|
|
# The third field is an optional comma separated list of keywords to
|
|
|
|
# control if a record is printed; every keyword listed must be enabled
|
|
|
|
# for the record to be printed. The following keywords are available:
|
|
|
|
# dummy dummy entry (ignored)
|
2004-01-03 16:31:38 +03:00
|
|
|
# obsolete file is obsolete, and only printed if
|
|
|
|
# ${obsolete} != 0
|
|
|
|
#
|
2010-12-09 02:56:01 +03:00
|
|
|
# atf ${MKATF} != no
|
2009-09-08 11:08:00 +04:00
|
|
|
# bfd obsolete, use binutils.
|
|
|
|
# binutils ${MKBINUTILS} != no
|
2011-04-21 18:26:33 +04:00
|
|
|
# bsdgrep ${MKBSDGREP} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# catpages ${MKCATPAGES} != no
|
2008-10-26 10:31:00 +03:00
|
|
|
# compat ${MKCOMPAT} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# crypto ${MKCRYPTO} != no
|
|
|
|
# crypto_idea ${MKCRYPTO_IDEA} != no
|
|
|
|
# crypto_mdc2 ${MKCRYPTO_MDC2} != no
|
|
|
|
# crypto_rc5 ${MKCRYPTO_RC5} != no
|
|
|
|
# cvs ${MKCVS} != no
|
2006-07-23 15:41:24 +04:00
|
|
|
# debug ${MKDEBUG} != no
|
2008-08-28 11:22:41 +04:00
|
|
|
# debuglib ${MKDEBUGLIB} != no
|
2004-01-12 02:42:27 +03:00
|
|
|
# doc ${MKDOC} != no
|
2010-02-21 06:18:45 +03:00
|
|
|
# dtrace ${MKDTRACE} != no
|
2008-08-25 11:27:27 +04:00
|
|
|
# dynamicroot ${MKDYNAMICROOT} != no
|
2009-11-30 19:13:22 +03:00
|
|
|
# extsrc ${MKEXTSRC} != no
|
2006-07-12 17:39:04 +04:00
|
|
|
# gcc ${MKGCC} != no
|
2005-01-10 01:24:04 +03:00
|
|
|
# gcccmds ${MKGCCCMDS} != no
|
2004-03-17 23:32:02 +03:00
|
|
|
# gdb ${MKGDB} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# hesiod ${MKHESIOD} != no
|
2008-08-28 11:17:13 +04:00
|
|
|
# html ${MKHTML} != no
|
2008-08-25 11:27:27 +04:00
|
|
|
# inet6 ${MKINET6} != no
|
2004-01-12 02:42:27 +03:00
|
|
|
# info ${MKINFO} != no
|
2005-02-22 17:39:58 +03:00
|
|
|
# ipfilter ${MKIPFILTER} != no
|
2006-06-24 09:11:40 +04:00
|
|
|
# iscsi ${MKISCSI} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# kerberos ${MKKERBEROS} != no
|
2009-08-30 05:49:41 +04:00
|
|
|
# kmod ${MKKMOD} != no
|
2008-08-25 11:27:27 +04:00
|
|
|
# ldap ${MKLDAP} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# lint ${MKLINT} != no
|
2011-02-06 04:13:42 +03:00
|
|
|
# llvm ${MKLLVM} != no
|
2008-12-23 05:56:10 +03:00
|
|
|
# lvm ${MKLVM} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# man ${MKMAN} != no
|
2008-08-25 11:27:27 +04:00
|
|
|
# manpages ${MKMANPAGES} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# manz ${MKMANZ} != no
|
2009-09-30 03:56:26 +04:00
|
|
|
# mdns ${MKMDNS} != no
|
2004-01-12 02:42:27 +03:00
|
|
|
# nls ${MKNLS} != no
|
2008-07-23 01:07:58 +04:00
|
|
|
# nvi ${MKNVI} != no
|
2005-01-10 03:20:21 +03:00
|
|
|
# pam ${MKPAM} != no
|
2010-02-04 16:07:55 +03:00
|
|
|
# pcc ${MKPCC} != no
|
2005-02-22 17:39:58 +03:00
|
|
|
# pf ${MKPF} != no
|
2008-08-25 11:27:27 +04:00
|
|
|
# pic ${MKPIC} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# postfix ${MKPOSTFIX} != no
|
|
|
|
# profile ${MKPROFILE} != no
|
2011-05-09 18:45:44 +04:00
|
|
|
# perfuse ${MKPERFUSE} != no
|
2004-01-12 06:08:06 +03:00
|
|
|
# share ${MKSHARE} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
# skey ${MKSKEY} != no
|
2010-03-03 19:13:42 +03:00
|
|
|
# solaris ${MKDTRACE} != no or ${MKZFS} != no
|
2010-12-28 12:15:24 +03:00
|
|
|
# ssp ${HAS_SSP} != no
|
2008-11-10 02:07:22 +03:00
|
|
|
# x11 ${MKX11} != no && ${X11FLAVOUR} != "Xorg"
|
|
|
|
# xorg ${MKX11} != no && ${X11FLAVOUR} == "Xorg"
|
2004-01-11 18:09:51 +03:00
|
|
|
# yp ${MKYP} != no
|
2009-10-08 02:22:18 +04:00
|
|
|
# zfs ${MKZFS} != no
|
2004-01-11 18:09:51 +03:00
|
|
|
#
|
2009-09-08 11:08:00 +04:00
|
|
|
# binutils=<n> <n> = value of ${HAVE_BINUTILS}
|
2006-07-12 17:39:04 +04:00
|
|
|
# gcc=<n> <n> = value of ${HAVE_GCC}
|
|
|
|
# gdb=<n> <n> = value of ${HAVE_GDB}
|
|
|
|
#
|
2005-05-01 11:06:09 +04:00
|
|
|
# use_inet6 ${USE_INET6} != no
|
|
|
|
# use_kerberos ${USE_KERBEROS} != no
|
|
|
|
# use_yp ${USE_YP} != no
|
|
|
|
#
|
2004-01-11 18:09:51 +03:00
|
|
|
# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no"
|
|
|
|
# automatically append ".gz" to the filename
|
|
|
|
#
|
|
|
|
# .man if ${MKMANZ} != "no" && ${MKMAN} != "no"
|
|
|
|
# automatically append ".gz" to the filename
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-26 09:05:27 +03:00
|
|
|
list_set_files()
|
|
|
|
{
|
2009-04-08 00:46:20 +04:00
|
|
|
if [ ${MAKEVERBOSE:-2} -lt 3 ]; then
|
2008-05-23 02:56:40 +04:00
|
|
|
verbose=false
|
|
|
|
else
|
|
|
|
verbose=true
|
|
|
|
fi
|
2009-12-15 08:11:08 +03:00
|
|
|
print_set_lists "$@" | \
|
2006-01-03 19:40:16 +03:00
|
|
|
${AWK} -v obsolete=${obsolete} '
|
2003-12-29 06:13:25 +03:00
|
|
|
BEGIN {
|
2006-07-12 17:39:04 +04:00
|
|
|
if (obsolete)
|
|
|
|
wanted["obsolete"] = 1
|
|
|
|
|
2009-12-02 20:51:30 +03:00
|
|
|
split("'"${MKVARS}"'", needvars)
|
2006-07-12 17:39:04 +04:00
|
|
|
for (vi in needvars) {
|
|
|
|
nv = needvars[vi]
|
|
|
|
kw = tolower(nv)
|
|
|
|
sub(/^mk/, "", kw)
|
2010-12-28 12:15:24 +03:00
|
|
|
sub(/^has_/, "", kw)
|
2006-07-12 17:39:04 +04:00
|
|
|
if (ENVIRON[nv] != "no")
|
|
|
|
wanted[kw] = 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("'"${TOOLCHAIN_MISSING}"'" != "yes") {
|
2009-11-03 03:38:56 +03:00
|
|
|
if ("binutils" in wanted)
|
|
|
|
wanted["binutils=" "'"${HAVE_BINUTILS}"'"] = 1
|
|
|
|
if ("gcc" in wanted)
|
|
|
|
wanted["gcc=" "'"${HAVE_GCC}"'"] = 1
|
|
|
|
if ("gdb" in wanted)
|
|
|
|
wanted["gdb=" "'"${HAVE_GDB}"'"] = 1
|
2003-12-29 06:13:25 +03:00
|
|
|
}
|
2006-07-12 17:39:04 +04:00
|
|
|
if (("man" in wanted) && ("catpages" in wanted))
|
|
|
|
wanted[".cat"] = 1
|
|
|
|
if (("man" in wanted) && ("manpages" in wanted))
|
|
|
|
wanted[".man"] = 1
|
2003-12-29 06:13:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/^#/ {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
2011-01-28 23:36:19 +03:00
|
|
|
/^-/ {
|
|
|
|
notwanted[substr($1, 2)] = 1;
|
|
|
|
delete list [substr($1, 2)];
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-29 06:13:25 +03:00
|
|
|
NF > 2 && $3 != "-" {
|
2011-01-28 23:36:19 +03:00
|
|
|
if (notwanted[$1] != "")
|
|
|
|
next;
|
2003-12-29 06:13:25 +03:00
|
|
|
split($3, keywords, ",")
|
|
|
|
show = 1
|
2006-07-12 17:39:04 +04:00
|
|
|
haveobs = 0
|
2003-12-29 06:13:25 +03:00
|
|
|
for (ki in keywords) {
|
|
|
|
kw = keywords[ki]
|
2004-01-11 18:09:51 +03:00
|
|
|
if (("manz" in wanted) &&
|
|
|
|
(kw == ".cat" || kw == ".man"))
|
|
|
|
$1 = $1 ".gz"
|
2008-02-09 22:30:11 +03:00
|
|
|
negated = match(kw, "! *")
|
|
|
|
if (negated > 0) {
|
|
|
|
kw = substr(kw, RSTART + RLENGTH)
|
|
|
|
if (kw in wanted)
|
|
|
|
show = 0
|
|
|
|
} else {
|
|
|
|
if (! (kw in wanted))
|
|
|
|
show = 0
|
|
|
|
}
|
2006-07-12 17:39:04 +04:00
|
|
|
if (kw == "obsolete")
|
|
|
|
haveobs = 1
|
2003-12-29 06:13:25 +03:00
|
|
|
}
|
2006-07-12 17:39:04 +04:00
|
|
|
if (obsolete && ! haveobs)
|
|
|
|
next
|
2003-12-29 06:13:25 +03:00
|
|
|
if (show)
|
2011-01-28 23:36:19 +03:00
|
|
|
list[$1] = $0
|
2003-12-29 06:13:25 +03:00
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2011-01-28 23:36:19 +03:00
|
|
|
if (notwanted[$1] != "")
|
|
|
|
next;
|
2003-12-29 06:13:25 +03:00
|
|
|
if (! obsolete)
|
2011-01-28 23:36:19 +03:00
|
|
|
list[$1] = $0
|
|
|
|
}
|
|
|
|
|
|
|
|
END {
|
|
|
|
for (i in list) {
|
|
|
|
print list[i]
|
|
|
|
}
|
2003-12-29 06:13:25 +03:00
|
|
|
}'
|
|
|
|
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# list_set_lists setname
|
|
|
|
#
|
|
|
|
# Print to stdout a list of files, one filename per line, which
|
|
|
|
# concatenate to create the packing list for setname. E.g.,
|
|
|
|
#
|
|
|
|
# .../lists/base/mi
|
|
|
|
# .../lists/base/rescue.mi
|
|
|
|
# .../lists/base/md.i386
|
2003-12-29 06:13:25 +03:00
|
|
|
# [...]
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-29 06:13:25 +03:00
|
|
|
# For a given setname $set, the following files may be selected from
|
|
|
|
# .../list/$set:
|
|
|
|
# mi
|
2009-11-30 19:13:22 +03:00
|
|
|
# mi.ext.*
|
2004-01-03 05:38:58 +03:00
|
|
|
# ad.${MACHINE_ARCH}
|
|
|
|
# (or) ad.${MACHINE_CPU}
|
|
|
|
# ad.${MACHINE_CPU}.shl
|
|
|
|
# md.${MACHINE}.${MACHINE_ARCH}
|
|
|
|
# (or) md.${MACHINE}
|
2003-12-29 06:13:25 +03:00
|
|
|
# stl.mi
|
2009-11-30 19:13:22 +03:00
|
|
|
# stl.${stlib}
|
2003-12-29 06:13:25 +03:00
|
|
|
# shl.mi
|
2009-11-30 19:13:22 +03:00
|
|
|
# shl.mi.ext.*
|
|
|
|
# shl.${shlib}
|
|
|
|
# shl.${shlib}.ext.*
|
2008-11-29 20:57:33 +03:00
|
|
|
# module.mi if ${module} != no
|
|
|
|
# module.${MACHINE} if ${module} != no
|
|
|
|
# module.ad.${MACHINE_ARCH} if ${module} != no
|
|
|
|
# (or) module.ad.${MACHINE_CPU} if ${module} != no
|
2003-12-29 06:13:25 +03:00
|
|
|
# rescue.shl
|
2004-01-03 05:38:58 +03:00
|
|
|
# rescue.${MACHINE}
|
|
|
|
# rescue.ad.${MACHINE_ARCH}
|
|
|
|
# (or) rescue.ad.${MACHINE_CPU}
|
|
|
|
# rescue.ad.${MACHINE_CPU}.shl
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
#
|
2003-12-29 06:13:25 +03:00
|
|
|
# Environment:
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
# shlib
|
|
|
|
# stlib
|
|
|
|
#
|
2003-12-26 09:05:27 +03:00
|
|
|
list_set_lists()
|
|
|
|
{
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
setname=$1
|
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_mi $setname
|
2009-12-11 16:30:11 +03:00
|
|
|
list_set_lists_ad $setname
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_md $setname
|
|
|
|
list_set_lists_stl $setname
|
2009-12-11 16:30:11 +03:00
|
|
|
list_set_lists_shl $setname
|
|
|
|
list_set_lists_module $setname
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_rescue $setname
|
2009-12-15 09:18:07 +03:00
|
|
|
return 0
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
2009-12-11 15:57:39 +03:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_mi()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 16:30:11 +03:00
|
|
|
# always exist!
|
2003-12-29 06:13:25 +03:00
|
|
|
echo $setdir/mi
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
2009-12-11 15:57:39 +03:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_ad()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 16:30:11 +03:00
|
|
|
[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
|
|
|
|
list_set_lists_common_ad $1
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
2009-12-11 15:57:39 +03:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_md()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 15:57:39 +03:00
|
|
|
echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \
|
|
|
|
echo_if_exist $setdir/md.${MACHINE}
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
2009-12-11 15:57:39 +03:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_stl()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 15:57:39 +03:00
|
|
|
echo_if_exist $setdir/stl.mi
|
|
|
|
echo_if_exist $setdir/stl.${stlib}
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
2009-12-11 15:57:39 +03:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_shl()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 16:30:11 +03:00
|
|
|
[ "$shlib" != "no" ] || return
|
2009-12-11 16:10:47 +03:00
|
|
|
echo_if_exist $setdir/shl.mi
|
|
|
|
echo_if_exist $setdir/shl.${shlib}
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
2009-12-11 15:57:39 +03:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_module()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 16:30:11 +03:00
|
|
|
[ "$module" != "no" ] || return
|
2009-12-11 16:10:47 +03:00
|
|
|
echo_if_exist $setdir/module.mi
|
|
|
|
echo_if_exist $setdir/module.${MACHINE}
|
2009-12-11 16:30:11 +03:00
|
|
|
# XXX module never has .shl
|
|
|
|
[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
|
|
|
|
list_set_lists_common_ad $1 module
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
|
2009-12-11 16:10:06 +03:00
|
|
|
list_set_lists_rescue()
|
|
|
|
{
|
|
|
|
setdir=$setsdir/lists/$1
|
2009-12-11 15:57:39 +03:00
|
|
|
echo_if_exist $setdir/rescue.mi
|
|
|
|
echo_if_exist $setdir/rescue.${MACHINE}
|
2009-12-11 16:30:11 +03:00
|
|
|
[ "${MACHINE}" != "${MACHINE_ARCH}" ] && \
|
|
|
|
list_set_lists_common_ad $1 rescue
|
2009-12-11 16:10:06 +03:00
|
|
|
}
|
|
|
|
|
2009-12-11 16:30:11 +03:00
|
|
|
list_set_lists_common_ad()
|
2009-12-11 16:10:06 +03:00
|
|
|
{
|
2009-12-11 16:30:11 +03:00
|
|
|
setdir=$setsdir/lists/$1; _prefix=$2
|
|
|
|
|
|
|
|
[ -n "$_prefix" ] && prefix="$_prefix".
|
|
|
|
|
|
|
|
# Prefer a <prefix>.ad.${MACHINE_ARCH} over a
|
|
|
|
# <prefix>.ad.${MACHINE_CPU}, since the arch-
|
2009-12-11 16:10:47 +03:00
|
|
|
# specific one will be more specific than the
|
|
|
|
# cpu-specific one.
|
2009-12-11 16:30:11 +03:00
|
|
|
echo_if_exist $setdir/${prefix}ad.${MACHINE_ARCH} || \
|
|
|
|
echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}
|
|
|
|
[ "$shlib" != "no" ] && \
|
|
|
|
echo_if_exist $setdir/${prefix}ad.${MACHINE_CPU}.shl
|
For System Packages, two new utilities, a subroutine library, and
a new list:
sets.subr -- The set-listing code that is common to makeplist,
makeflist, and regpkg has moved here.
syspkgdeps -- Compute naive dependencies for system packages based
on directory containment. I.e., if package A contains
path /p/q, and package B contains path /p, then B is
considered a dependency of A. As Jim Wise remarks,
this is not quite right: system-package dependencies
should indicate a functional dependency. Nevertheless,
these naive dependencies protect us from orphaning
files when pkg_delete'ing system packages.
culldeps -- Helper for syspkgdeps. Removes redundant dependencies
from a dependencies table. Essentially does the opposite
of a transitive closure on a dependencies table: if
the table contains A depends-on B, B depends-on C, and
A depends-on C, then A depends-on C is removed because
it can be derived from the prior two dependencies.
deps -- Dependencies computed by syspkgdeps.
2003-06-23 13:02:31 +04:00
|
|
|
}
|
|
|
|
|
2009-12-11 15:57:39 +03:00
|
|
|
echo_if_exist()
|
|
|
|
{
|
|
|
|
[ -f $1 ] && echo $1
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
|
|
|
echo_if_exist_foreach()
|
|
|
|
{
|
|
|
|
local _list=$1; shift
|
|
|
|
for _suffix in $@; do
|
|
|
|
echo_if_exist ${_list}.${_suffix}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2009-12-15 08:11:08 +03:00
|
|
|
print_set_lists()
|
|
|
|
{
|
|
|
|
for setname; do
|
|
|
|
list=`list_set_lists $setname`
|
|
|
|
for l in $list; do
|
|
|
|
echo $l
|
|
|
|
if $verbose; then
|
|
|
|
echo >&2 "DEBUG: list_set_files: $l"
|
|
|
|
fi
|
|
|
|
done
|
2009-12-21 18:37:25 +03:00
|
|
|
done | ${XARGS} ${SED} ${SUBST}
|
2009-12-15 08:11:08 +03:00
|
|
|
}
|
|
|
|
|
2003-12-29 06:13:25 +03:00
|
|
|
# arch_to_cpu mach
|
|
|
|
#
|
2004-01-03 05:38:58 +03:00
|
|
|
# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach,
|
2003-12-29 06:13:25 +03:00
|
|
|
# as determined by <bsd.own.mk>.
|
|
|
|
#
|
2003-12-26 09:05:27 +03:00
|
|
|
arch_to_cpu()
|
|
|
|
{
|
2007-02-05 21:26:01 +03:00
|
|
|
MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE
|
2003-11-25 10:19:46 +03:00
|
|
|
.include <bsd.own.mk>
|
|
|
|
all:
|
|
|
|
@echo \${MACHINE_CPU}
|
2004-01-03 15:23:11 +03:00
|
|
|
EOMAKE
|
2003-11-25 10:19:46 +03:00
|
|
|
}
|
2006-01-08 13:25:33 +03:00
|
|
|
|
|
|
|
# arch_to_endian mach
|
|
|
|
#
|
|
|
|
# Print the ${TARGET_ENDIANNESS} for ${MACHINE_ARCH}=mach,
|
|
|
|
# as determined by <bsd.endian.mk>.
|
|
|
|
#
|
|
|
|
arch_to_endian()
|
|
|
|
{
|
2007-02-05 21:26:01 +03:00
|
|
|
MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE
|
2006-01-08 13:25:33 +03:00
|
|
|
.include <bsd.endian.mk>
|
|
|
|
all:
|
|
|
|
@echo \${TARGET_ENDIANNESS}
|
|
|
|
EOMAKE
|
|
|
|
}
|
2009-12-15 09:18:07 +03:00
|
|
|
|
|
|
|
#####
|
|
|
|
|
|
|
|
# print_mkvars
|
|
|
|
print_mkvars()
|
|
|
|
{
|
|
|
|
for v in $MKVARS; do
|
|
|
|
eval echo $v=\$$v
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
# print_set_lists_{base,x,ext}
|
|
|
|
# list_set_lists_{base,x,ext}
|
|
|
|
# list_set_files_{base,x,ext}
|
|
|
|
for func in print_set_lists list_set_lists list_set_files; do
|
|
|
|
for x in base x ext; do
|
|
|
|
if [ $x = base ]; then
|
|
|
|
list=nlists
|
|
|
|
else
|
|
|
|
list=${x}lists
|
|
|
|
fi
|
|
|
|
eval ${func}_${x} \(\) \{ $func \$$list \; \}
|
|
|
|
done
|
|
|
|
done
|