diff --git a/distrib/sets/culldeps b/distrib/sets/culldeps new file mode 100755 index 000000000000..d9f5818dad6d --- /dev/null +++ b/distrib/sets/culldeps @@ -0,0 +1,75 @@ +#!/bin/sh +# +# culldeps +# +# Filter redundant dependencies. +# +# Emit all the dependencies on the standard input to the standard +# output EXCEPT the dependencies which can be derived from other +# dependencies by the transitive rule. For example, omit both A C +# and A D from +# +# A B +# B C +# C D +# A C +# A D +# +# because A C can be derived from A B and B C by transitivity, +# and A D can be derived from A B, B C, C D by transitivity. +# + +SCRATCH=$(mktemp -d /var/tmp/$0.XXXXXX) +NEXTLEFTOVERS=$SCRATCH/leftovers0 +LASTJOIN=$SCRATCH/join0 +NEXTJOIN=$SCRATCH/join1 +TAB=" " + +sort -k 1 > $LASTJOIN + +LEFTOVERS=$LASTJOIN + +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 + if [ ${DEBUG:-0} -gt 0 ]; then + echo "### filtered ###" 1>&2 + join -t "$TAB" $NEXTJOIN $LEFTOVERS | sort 1>&2 + echo "###" 1>&2 + fi + + # + # Filter out of $LEFTOVERS all of the dependencies X-requires-Z, which + # were produced in the previous step. Write the new leftovers to + # $NEXTLEFTOVERS. + # + join -v 2 -t "$TAB" $NEXTJOIN $LEFTOVERS | sort -u > $NEXTLEFTOVERS + + # + # Swap output files before repeating. + # + LASTJOIN=$NEXTJOIN + if [ $(basename $NEXTJOIN) = join0 ]; then + NEXTJOIN=$SCRATCH/join1 + else + NEXTJOIN=$SCRATCH/join0 + fi + LEFTOVERS=$NEXTLEFTOVERS + if [ $(basename $NEXTLEFTOVERS) = leftovers0 ]; then + NEXTLEFTOVERS=$SCRATCH/leftovers1 + else + NEXTLEFTOVERS=$SCRATCH/leftovers0 + fi +done + +# +# Output all of the dependencies that were not culled and clean up. +# +cat $LEFTOVERS +rm -r $SCRATCH diff --git a/distrib/sets/deps b/distrib/sets/deps new file mode 100644 index 000000000000..eb24014b0403 --- /dev/null +++ b/distrib/sets/deps @@ -0,0 +1,470 @@ +base-adosfs-root base-sys-root +base-amd-bin base-sys-usr +base-amd-examples base-sys-share +base-amd-shlib base-sys-usr +base-audio-bin base-sys-usr +base-bind-bin base-sys-usr +base-bind-examples base-sys-share +base-bind-root base-sys-root +base-bootserver-bin base-sys-usr +base-c-bin base-sys-usr +base-c-usr base-sys-usr +base-calendar-bin base-sys-usr +base-calendar-share base-sys-share +base-cron-bin base-sys-usr +base-cron-root base-sys-root +base-crypto-bin base-sys-usr +base-crypto-examples base-sys-share +base-crypto-root base-sys-root +base-crypto-shlib base-sys-usr +base-cxx-usr base-c-usr +base-debug-bin base-sys-usr +base-dhclient-root base-sys-root +base-dhcpd-bin base-sys-share +base-dhcpd-bin base-sys-usr +base-dhcpd-examples base-sys-share +base-ext2fs-root base-sys-root +base-filecorefs-root base-sys-root +base-fstab-examples base-sys-share +base-games-root base-sys-root +base-games-share base-sys-share +base-games-usr base-sys-root +base-gnats-bin base-sys-usr +base-gnats-share base-sys-share +base-groff-font base-sys-share +base-groff-share base-sys-share +base-hesiod-bin base-sys-usr +base-htmldoc-share base-sys-share +base-i18n-root base-sys-usr +base-i18n-shlib base-i18n-root +base-ipf-lkm base-sys-usr +base-isdn-bin base-sys-usr +base-isdn-examples base-sys-share +base-krb4-root base-sys-root +base-krb4-shlib base-sys-usr +base-krb5-bin base-sys-usr +base-krb5-examples base-sys-share +base-krb5-root base-sys-root +base-krb5-shlib base-sys-usr +base-locale-Pig base-locale-share +base-locale-bin base-sys-usr +base-locale-ca base-locale-share +base-locale-cs base-locale-share +base-locale-da base-locale-share +base-locale-de base-locale-share +base-locale-el base-locale-share +base-locale-en base-locale-share +base-locale-eo base-locale-share +base-locale-es base-locale-share +base-locale-et base-locale-share +base-locale-fi base-locale-share +base-locale-fr base-locale-share +base-locale-gl base-locale-share +base-locale-he base-locale-share +base-locale-hr base-locale-share +base-locale-hu base-locale-share +base-locale-id base-locale-share +base-locale-is base-locale-share +base-locale-it base-locale-share +base-locale-ja base-locale-share +base-locale-ko base-locale-share +base-locale-lt base-locale-share +base-locale-nl base-locale-share +base-locale-no base-locale-share +base-locale-pl base-locale-share +base-locale-pt base-locale-share +base-locale-ru base-locale-share +base-locale-share base-sys-share +base-locale-sk base-locale-share +base-locale-sl base-locale-share +base-locale-sv base-locale-share +base-locale-tr base-locale-share +base-locale-uk base-locale-share +base-locale-zh base-locale-share +base-lpr-bin base-lpr-usr +base-lpr-root base-sys-root +base-lpr-usr base-sys-usr +base-magic-share base-groff-share +base-mail-bin base-sys-usr +base-mail-root base-sys-root +base-mailwrapper-bin base-sys-usr +base-man-bin base-sys-usr +base-man-share base-sys-share +base-miscfs-examples base-sys-share +base-miscfs-root base-sys-root +base-net-shlib base-sys-usr +base-netutil-bin base-sys-usr +base-netutil-examples base-sys-share +base-netutil-root base-sys-root +base-nfsclient-bin base-sys-usr +base-nfsclient-root base-sys-root +base-nfsserver-bin base-sys-usr +base-nis-bin base-sys-usr +base-nis-root base-sys-root +base-ntfs-root base-sys-root +base-ntp-bin base-sys-usr +base-ntp-root base-sys-root +base-objc-usr base-c-usr +base-pkgutil-bin base-sys-usr +base-postfix-bin base-postfix-usr +base-postfix-examples base-sys-share +base-postfix-root base-sys-root +base-postfix-usr base-sys-usr +base-ppp-bin base-sys-usr +base-ppp-lkm base-sys-usr +base-psd-share base-sys-share +base-rcs-bin base-sys-usr +base-reference-share base-groff-share +base-rescue-root base-sys-root +base-router-bin base-sys-usr +base-router-examples base-sys-share +base-router-root base-sys-root +base-rpcbind-bin base-sys-usr +base-rpcserver-bin base-sys-usr +base-rpcutil-bin base-sys-usr +base-secsh-bin base-sys-usr +base-sendmail-bin base-sys-usr +base-sendmail-root base-sys-root +base-sendmail-usr base-sys-usr +base-slip-bin base-sys-usr +base-slip-root base-sys-root +base-smbfs-root base-sys-root +base-smm-share base-sys-share +base-sup-bin base-sys-usr +base-sup-examples base-sys-share +base-sushi-bin base-sys-usr +base-sushi-share base-sys-share +base-sushi_locale-share base-locale-share +base-sys-examples base-sys-share +base-sys-share base-sys-root +base-sys-shlib base-sys-usr +base-sys-usr base-sys-root +base-sysutil-bin base-sys-usr +base-sysutil-examples base-sys-share +base-sysutil-root base-sys-root +base-termcap-share base-groff-share +base-texinfo-bin base-sys-usr +base-texinfo-share base-sys-share +base-texinfo_locale-cs base-locale-cs +base-texinfo_locale-da base-locale-da +base-texinfo_locale-de base-locale-de +base-texinfo_locale-eo base-locale-eo +base-texinfo_locale-fr base-locale-fr +base-texinfo_locale-he base-locale-he +base-texinfo_locale-hr base-locale-hr +base-texinfo_locale-ja base-locale-ja +base-texinfo_locale-nl base-locale-nl +base-texinfo_locale-no base-locale-no +base-texinfo_locale-ru base-locale-ru +base-texinfo_locale-sv base-locale-sv +base-texinfo_locale-tr base-locale-tr +base-texinfo_locale-zh base-locale-zh +base-timed-bin base-sys-usr +base-tn3270-bin base-sys-usr +base-usd-share base-sys-share +base-util-bin base-sys-usr +base-util-root base-sys-root +base-util-share base-sys-share +base-util_locale-cs base-locale-cs +base-util_locale-de base-locale-de +base-util_locale-el base-locale-el +base-util_locale-eo base-locale-eo +base-util_locale-es base-locale-es +base-util_locale-et base-locale-et +base-util_locale-fr base-locale-fr +base-util_locale-gl base-locale-gl +base-util_locale-hr base-locale-hr +base-util_locale-id base-locale-id +base-util_locale-it base-locale-it +base-util_locale-ja base-locale-ja +base-util_locale-sv base-locale-sv +base-uucp-bin base-sys-usr +base-uucp-root base-sys-root +base-vfs-lkm base-sys-usr +comp-c-bin base-sys-usr +comp-c-catman base-man-share +comp-c-include base-objc-usr +comp-c-lib base-sys-usr +comp-c-lintlib base-c-usr +comp-c-man base-man-share +comp-c-piclib base-sys-usr +comp-c-proflib base-sys-usr +comp-c-root base-sys-root +comp-c-share base-groff-share +comp-c-shlib base-sys-usr +comp-c_locale-da base-locale-da +comp-c_locale-de base-locale-de +comp-c_locale-es base-locale-es +comp-c_locale-fr base-locale-fr +comp-c_locale-ko base-locale-ko +comp-c_locale-nl base-locale-nl +comp-c_locale-no base-locale-no +comp-c_locale-pl base-locale-pl +comp-c_locale-pt base-locale-pt +comp-c_locale-sl base-locale-sl +comp-c_locale-sv base-locale-sv +comp-cvs-bin base-sys-usr +comp-cvs-catman base-man-share +comp-cvs-man base-man-share +comp-cxx-bin base-sys-usr +comp-cxx-catman base-man-share +comp-cxx-include base-cxx-usr +comp-cxx-lib base-sys-usr +comp-cxx-man base-man-share +comp-cxx-piclib base-sys-usr +comp-cxx-proflib base-sys-usr +comp-debug-bin base-sys-usr +comp-debug-catman base-man-share +comp-debug-man base-man-share +comp-debug-sbin base-sys-usr +comp-fortran-bin base-sys-usr +comp-fortran-catman base-man-share +comp-fortran-lib base-sys-usr +comp-fortran-man base-man-share +comp-fortran-proflib base-sys-usr +comp-fortran-shlib base-sys-usr +comp-i18n-lib base-i18n-root +comp-krb4-catman base-man-share +comp-krb4-include base-c-usr +comp-krb4-lib base-sys-usr +comp-krb4-man base-man-share +comp-krb4-proflib base-sys-usr +comp-krb5-catman base-man-share +comp-krb5-include base-c-usr +comp-krb5-lib base-sys-usr +comp-krb5-man base-man-share +comp-krb5-proflib base-sys-usr +comp-krb5c-catman base-man-share +comp-objc-bin base-sys-usr +comp-objc-lib base-sys-usr +comp-objc-piclib base-sys-usr +comp-objc-proflib base-sys-usr +comp-sys-catman base-man-share +comp-sys-man base-man-share +comp-sysutil-catman base-man-share +comp-sysutil-man base-man-share +comp-sysutil-sbin base-sys-usr +comp-util-bin base-sys-usr +comp-util-catman base-man-share +comp-util-man base-man-share +comp-util-sbin base-sys-usr +comp-util-share base-groff-share +comp-util-share base-util-share +etc-amd-rc base-sys-root +etc-audio-rc base-sys-root +etc-bind-etc base-bind-root +etc-bind-rc base-sys-root +etc-bootserver-etc base-sys-root +etc-bootserver-rc base-sys-root +etc-cron-log base-sys-root +etc-cron-rc base-sys-root +etc-cron-root base-cron-root +etc-dhclient-rc base-sys-root +etc-dhcpd-rc base-sys-root +etc-games-etc base-sys-root +etc-games-scores base-games-root +etc-ipf-rc base-sys-root +etc-isdn-rc base-sys-root +etc-krb5-rc base-sys-root +etc-lpr-etc base-sys-root +etc-lpr-log base-sys-root +etc-lpr-rc base-sys-root +etc-mail-etc base-sys-root +etc-mailwrapper-etc base-sys-root +etc-man-etc base-sys-root +etc-net-etc base-sys-root +etc-net-rc base-sys-root +etc-netutil-etc base-sys-root +etc-netutil-log base-sys-root +etc-nfsserver-rc base-sys-root +etc-nis-rc base-sys-root +etc-nis-root base-nis-root +etc-ntp-etc base-sys-root +etc-ntp-rc base-sys-root +etc-postfix-etc base-postfix-bin +etc-postfix-rc base-sys-root +etc-ppp-rc base-sys-root +etc-root-root base-sys-root +etc-router-etc base-sys-root +etc-router-rc base-sys-root +etc-rpcbind-rc base-sys-root +etc-secsh-etc base-sys-root +etc-secsh-rc base-sys-root +etc-sendmail-etc base-sendmail-root +etc-sendmail-log base-sys-root +etc-sendmail-rc base-sys-root +etc-sys-defaults base-sys-root +etc-sys-etc base-sys-root +etc-sys-log base-sys-root +etc-sys-rc base-sys-root +etc-sys-root base-sys-root +etc-sysutil-etc base-sysutil-bin +etc-sysutil-log base-util-root +etc-sysutil-rc base-sys-root +etc-timed-rc base-sys-root +etc-util-etc base-sys-root +etc-uucp-etc base-sys-root +etc-uucp-log base-sys-root +etc-x11-rc base-sys-root +games-games-bin base-games-usr +games-games-catman base-man-share +games-games-man base-man-share +games-games-root base-games-root +games-games-share base-games-share +games-utils-bin base-games-usr +games-utils-catman base-man-share +games-utils-man base-man-share +games-utils-share base-games-share +man-adosfs-catman base-man-share +man-adosfs-man base-man-share +man-amd-catman base-man-share +man-amd-info base-texinfo-share +man-amd-man base-man-share +man-audio-catman base-man-share +man-audio-man base-man-share +man-bind-catman base-man-share +man-bind-man base-man-share +man-bootserver-catman base-man-share +man-bootserver-man base-man-share +man-c-catman base-man-share +man-c-info base-texinfo-share +man-c-man base-man-share +man-computil-info base-texinfo-share +man-cron-catman base-man-share +man-cron-man base-man-share +man-crypto-catman base-man-share +man-crypto-man base-man-share +man-cvs-info base-texinfo-share +man-cxx-info base-texinfo-share +man-debug-catman base-man-share +man-debug-info base-texinfo-share +man-debug-man base-man-share +man-dhclient-catman base-man-share +man-dhclient-man base-man-share +man-dhcpd-catman base-man-share +man-dhcpd-man base-man-share +man-ext2fs-catman base-man-share +man-ext2fs-man base-man-share +man-filecorefs-catman base-man-share +man-filecorefs-man base-man-share +man-fortran-info base-texinfo-share +man-games-catman base-man-share +man-games-man base-man-share +man-gnats-catman base-man-share +man-gnats-info base-texinfo-share +man-gnats-man base-man-share +man-groff-catman base-man-share +man-groff-man base-man-share +man-hesiod-catman base-man-share +man-hesiod-man base-man-share +man-info-share base-texinfo-share +man-ipf-catman base-man-share +man-ipf-man base-man-share +man-isdn-catman base-man-share +man-isdn-man base-man-share +man-krb4-info base-texinfo-share +man-krb5-catman base-man-share +man-krb5-info base-texinfo-share +man-krb5-man base-man-share +man-locale-catman base-man-share +man-locale-man base-man-share +man-lpr-catman base-man-share +man-lpr-man base-man-share +man-mail-catman base-man-share +man-mail-man base-man-share +man-mailwrapper-catman base-man-share +man-mailwrapper-man base-man-share +man-man-catman base-man-share +man-man-man base-man-share +man-miscfs-catman base-man-share +man-miscfs-man base-man-share +man-net-catman base-man-share +man-net-man base-man-share +man-netutil-catman base-man-share +man-netutil-man base-man-share +man-nfsclient-catman base-man-share +man-nfsclient-man base-man-share +man-nfsserver-catman base-man-share +man-nfsserver-man base-man-share +man-nis-catman base-man-share +man-nis-man base-man-share +man-ntfs-catman base-man-share +man-ntfs-man base-man-share +man-ntp-catman base-man-share +man-ntp-man base-man-share +man-pkgutil-catman base-man-share +man-pkgutil-man base-man-share +man-postfix-catman base-man-share +man-postfix-man base-man-share +man-ppp-catman base-man-share +man-ppp-man base-man-share +man-rc-catman base-man-share +man-rc-man base-man-share +man-rcs-catman base-man-share +man-rcs-man base-man-share +man-reference-catman base-man-share +man-reference-man base-man-share +man-router-catman base-man-share +man-router-man base-man-share +man-secsh-catman base-man-share +man-secsh-man base-man-share +man-sendmail-catman base-man-share +man-sendmail-man base-man-share +man-shlib-catman base-man-share +man-shlib-man base-man-share +man-slip-catman base-man-share +man-slip-man base-man-share +man-smbfs-catman base-man-share +man-smbfs-man base-man-share +man-sup-catman base-man-share +man-sup-man base-man-share +man-sushi-catman base-man-share +man-sushi-man base-man-share +man-sys-catman base-man-share +man-sys-info base-texinfo-share +man-sys-man base-man-share +man-sysutil-catman base-man-share +man-sysutil-man base-man-share +man-texinfo-catman base-man-share +man-texinfo-info base-texinfo-share +man-texinfo-man base-man-share +man-timed-catman base-man-share +man-timed-man base-man-share +man-tn3270-catman base-man-share +man-tn3270-man base-man-share +man-util-catman base-man-share +man-util-info base-texinfo-share +man-util-man base-man-share +man-uucp-catman base-man-share +man-uucp-info base-texinfo-share +man-uucp-man base-man-share +misc-amd-examples base-amd-examples +misc-amd-examples base-sys-examples +misc-bind-examples base-bind-examples +misc-crypto-examples base-crypto-examples +misc-dhcpd-examples base-dhcpd-examples +misc-fstab-examples base-fstab-examples +misc-isdn-examples base-isdn-examples +misc-krb5-examples base-krb5-examples +misc-netutil-examples base-netutil-examples +misc-ntp-htmldoc base-htmldoc-share +misc-postfix-examples base-postfix-examples +misc-postfix-htmldoc base-htmldoc-share +misc-psd-doc base-psd-share +misc-reference-share base-reference-share +misc-router-examples base-router-examples +misc-sendmail-share base-sys-share +misc-smm-doc base-smm-share +misc-sup-examples base-sup-examples +misc-sys-examples base-miscfs-examples +misc-sys-examples base-sys-examples +misc-sysutil-examples base-sysutil-examples +misc-usd-doc base-usd-share +misc-util-htmldoc base-htmldoc-share +text-groff-bin base-sys-usr +text-groff-catman base-man-share +text-groff-font base-groff-font +text-groff-man base-man-share +text-groff-share base-groff-share +text-texinfo-bin base-sys-usr +text-texinfo-share base-groff-share diff --git a/distrib/sets/sets.subr b/distrib/sets/sets.subr new file mode 100644 index 000000000000..47d957ac73bc --- /dev/null +++ b/distrib/sets/sets.subr @@ -0,0 +1,148 @@ +# +# list_set_files setname +# +# Produce a packing list for setname. Each record is a line +# consisting of a path and a System Package name, separated by +# whitespace. E.g., +# +# ./bin/cp base-util-root +# +# Environment +# +# setd +# machine +# machine_arch +# machine_cpu +# shlib +# stlib +# lkm +# lintlibs +# toolchain_missing +# +list_set_files () { + for setname; do + list_set_lists $setname + done | xargs cat | grep -v '^#' +} + +# +# 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 +# . +# . +# . +# +# In each file, a record consists of a path and a System Package name, +# separated by whitespace. E.g., +# +# # $NetBSD: sets.subr,v 1.1 2003/06/23 09:02:32 dyoung Exp $ +# . base-sys-root +# ./altroot base-sys-root +# ./bin base-sys-root +# ./bin/[ base-util-root +# ./bin/cat base-util-root +# . +# . +# . +# +# A # in the first column marks a comment. +# +# Environment +# +# setd +# machine +# machine_arch +# machine_cpu +# shlib +# stlib +# lkm +# lintlibs +# toolchain_missing +# +list_set_lists () { + setname=$1 + + echo $setd/lists/$setname/mi + if [ "$machine" != "$machine_arch" ]; then + # Prefer an ad.${machine_arch} over an ad.${machine_cpu}, + # since the arch-specific one will be more specific than + # the cpu-specific one. + if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then + echo $setd/lists/$setname/ad.${machine_arch} + elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then + echo $setd/lists/$setname/ad.${machine_cpu} + fi + if [ "$shlib" != "no" -a \ + -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then + echo $setd/lists/$setname/ad.${machine_cpu}.shl + fi + fi + if [ -f $setd/lists/$setname/md.${machine}.${machine_arch} ]; then + echo $setd/lists/$setname/md.${machine}.${machine_arch} + elif [ -f $setd/lists/$setname/md.${machine} ]; then + echo $setd/lists/$setname/md.${machine} + fi + if [ -f $setd/lists/$setname/stl.mi ]; then + echo $setd/lists/$setname/stl.mi + fi + if [ -f $setd/lists/$setname/stl.${stlib} ]; then + echo $setd/lists/$setname/stl.${stlib} + fi + if [ "$shlib" != "no" ]; then + if [ -f $setd/lists/$setname/shl.mi ]; then + echo $setd/lists/$setname/shl.mi + fi + if [ -f $setd/lists/$setname/shl.${shlib} ]; then + echo $setd/lists/$setname/shl.${shlib} + fi + fi + if [ "$lkm" != "no" ]; then + if [ -f $setd/lists/$setname/lkm.mi ]; then + echo $setd/lists/$setname/lkm.mi + fi + fi + if [ "$lintlibs" != no ]; then + if [ -f $setd/lists/$setname/lint.mi ]; then + echo $setd/lists/$setname/lint.mi + fi + fi + if [ "$toolchain_missing" != "yes" ]; then + if [ -f $setd/lists/$setname/tc.mi ]; then + echo $setd/lists/$setname/tc.mi + fi + if [ "$shlib" != "no" ]; then + if [ -f $setd/lists/$setname/tc.shl ]; then + echo $setd/lists/$setname/tc.shl + fi + fi + fi + + if [ -f $setd/lists/$setname/rescue.mi ]; then + echo $setd/lists/$setname/rescue.mi + fi + if [ -f $setd/lists/$setname/rescue.${machine} ]; then + echo $setd/lists/$setname/rescue.${machine} + fi + if [ "$machine" != "$machine_arch" ]; then + # Prefer a rescue.ad.${machine_arch} over a + # rescue.ad.${machine_cpu}, since the arch- + # specific one will be more specific than the + # cpu-specific one. + if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then + echo $setd/lists/$setname/rescue.ad.${machine_arch} + elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then + echo $setd/lists/$setname/rescue.ad.${machine_cpu} + fi + if [ "$shlib" != "no" -a -f \ + $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then + echo $setd/lists/$setname/rescue.ad.${machine_cpu}.shl + fi + fi +} + diff --git a/distrib/sets/syspkgdeps b/distrib/sets/syspkgdeps new file mode 100755 index 000000000000..9c6af07b41bf --- /dev/null +++ b/distrib/sets/syspkgdeps @@ -0,0 +1,127 @@ +#!/bin/sh +# +# syspkgdeps [-a arch] [-m machine] [-s setsdir] [-p prefix] sets +# +# Compute naive package dependencies based on file & directory +# nesting. E.g., if pkg P contains /foo/bar and Q contains /foo, +# then Q is considered a dependency of P. +# + +#set -u + +DB="db -q" + +# +# set defaults and import setlist subroutines +# +. ./sets.subr +setd=$(pwd) +prefix=/ + +usage() { +exec 1>&2 + +echo "Usage: $0 [-a arch] [-m machine] [-s setsdir] [-p prefix] sets" +echo " -a arch set arch (e.g, m68k, mips, powerpc) [$machine_arch]" +echo " -m machine set machine (e.g, amiga, i386, macppc) [$machine]" +echo " -s setsdir directory to find sets [$setd]" +echo " -p prefix prefix for created plist [$prefix]" +echo " sets sets to find dependencies for" + +exit 1 +} + +# parse arguments +while : ; do + case $1 in + -a*) + machine_arch=`MACHINE_ARCH=${2} ${make} print_machine_arch` + machine_cpu=`MACHINE_ARCH=${2} ${make} print_machine_cpu` + shift + ;; + -m*) + machine=$2; shift + ;; + -s*) + setd=$2; shift + ;; + -p*) + prefix=$2; shift + ;; + -*) + usage + ;; + *) + break + ;; + esac + shift +done +if [ $# -lt 1 ]; then + usage +fi + +sets=$@ + +if [ "$object_fmt" = "ELF" ]; then + shlib=elf +else + shlib=aout +fi +stlib=$shlib + +# Turn off shlibs for some ports. +if [ "$machine_cpu" = "sh3" -o "$machine_arch" = "m68000" ]; then + shlib=no +fi + +lkm=yes +# Turn off LKMs for some ports. +if [ "$machine" = "evbppc" ]; then + lkm=no +fi + +# Turn off lintlibs for some ports. +# Not needed anymore, leave the hook here for future use. +lintlibs= + +# TBD clean up +SCRATCH=$(mktemp -d /var/tmp/$(basename $0).XXXXXX) + +[ $? -ne 0 ] && { echo "Could not create scratch directory." 1>&2 ; exit 1 ; } + +PATH_MEMBERSHIP=$SCRATCH/path-membership +PATH_TO_PKGNAME=$SCRATCH/pathpkg.db +PARENT_PKGNAMES=$SCRATCH/parent-pkgnames +PARENT_PATHNAMES=$SCRATCH/parent-pathnames + +echo "indexing packages by pathnames" 1>&2 + +list_set_files $sets | sed 's/^\.\///' | \ +env PREFIX=$prefix awk '{ + if ($1 == ".") { + print ENVIRON["PREFIX"] " " $2; + } else { + print ENVIRON["PREFIX"] $1 " " $2; + } +}' | sort -k 1 -u > $PATH_MEMBERSHIP + +$DB -w -f - btree $PATH_TO_PKGNAME < $PATH_MEMBERSHIP || echo "shit" 1>&2 + +echo "computing parent pathnames" 1>&2 + +while read pathname pkgname; do + # print parent pathname + dirname $pathname +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 | ./culldeps + +if [ $? -ne 0 ]; then + echo "error in parent-directory lookup, aborting" 1>&2 + exit 1 +fi