listpkgs revision 1.2
11.1Sjwise#!/bin/sh 21.1Sjwise# 31.2Slukem# $NetBSD: listpkgs,v 1.2 2002/02/27 10:43:42 lukem Exp $ 41.2Slukem# 51.2Slukem# List all packages in the given pkgset by parsing the list files. 61.1Sjwise# 71.1Sjwise 81.1Sjwise# set defaults 91.1Sjwise: ${MAKE=make} 101.1Sjwisemachine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`} 111.1Sjwisearch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`} 121.1Sjwisesetd=`dirname $0` 131.1Sjwiseprefix=/ 141.1Sjwise 151.1Sjwiseusage() { 161.1Sjwiseexec 1>&2 171.1Sjwise 181.1Sjwiseecho "Usage: $0 [-a arch] [-m machine] [-s setsdir] [-p prefix] setname" 191.1Sjwiseecho " -a arch set arch (e.g, m68k, mips, powerpc) [$arch]" 201.1Sjwiseecho " -m machine set machine (e.g, amiga, i386, macppc) [$machine]" 211.1Sjwiseecho " -s setsdir directory to find sets [$setd]" 221.1Sjwiseecho " setname set to list packages for" 231.1Sjwise 241.1Sjwiseexit 1 251.1Sjwise} 261.1Sjwise 271.1Sjwise# handle args 281.1Sjwisewhile : ; do 291.1Sjwise case $1 in 301.1Sjwise -a*) 311.1Sjwise arch=$2; shift 321.1Sjwise ;; 331.1Sjwise -m*) 341.1Sjwise machine=$2; shift 351.1Sjwise ;; 361.1Sjwise -s*) 371.1Sjwise setd=$2; shift 381.1Sjwise ;; 391.1Sjwise -*) 401.1Sjwise usage 411.1Sjwise exit 1 421.1Sjwise ;; 431.1Sjwise *) 441.1Sjwise break 451.1Sjwise ;; 461.1Sjwise esac 471.1Sjwise shift 481.1Sjwisedone 491.1Sjwiseif [ -n "$1" ]; then 501.1Sjwise setname="$1" 511.1Sjwiseelse 521.1Sjwise usage 531.1Sjwise exit 1 541.1Sjwisefi 551.1Sjwise 561.1Sjwise# Convert mipse[lb] to mips after processing command line arguments. 571.1Sjwisearch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,` 581.1Sjwise 591.1Sjwise# Compute toolchain used on target cpu. 601.1Sjwiseif [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "sparc64" -o "$arch" = "i386" -o "$arch" = "arm26" -o "$machine" = "mvme68k" -o "$machine" = "hp300" ]; then 611.1Sjwise shlib=elf 621.1Sjwiseelse 631.1Sjwise if [ "$arch" = "sh3" ]; then 641.1Sjwise shlib= 651.1Sjwise else 661.1Sjwise shlib=aout 671.1Sjwise fi 681.1Sjwisefi 691.1Sjwise 701.1Sjwise( 711.1Sjwise cat $setd/lists/$setname/mi 721.1Sjwise if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then 731.1Sjwise cat $setd/lists/$setname/ad.${arch} 741.1Sjwise fi 751.1Sjwise if [ -f $setd/lists/$setname/md.${machine} ]; then 761.1Sjwise cat $setd/lists/$setname/md.${machine} 771.1Sjwise fi 781.1Sjwise if [ "$shlib" != "" ]; then 791.1Sjwise if [ -f $setd/lists/$setname/shl.mi ]; then 801.1Sjwise cat $setd/lists/$setname/shl.mi 811.1Sjwise fi 821.1Sjwise if [ -f $setd/lists/$setname/shl.${shlib} ]; then 831.1Sjwise cat $setd/lists/$setname/shl.${shlib} 841.1Sjwise fi 851.1Sjwise fi 861.2Slukem)| awk -- '/^[^#]/ {print $2}' | sort -u 87