Home | History | Annotate | Line # | Download | only in sets
listpkgs revision 1.4
      1  1.1  jwise #!/bin/sh
      2  1.1  jwise #
      3  1.4  lukem # $NetBSD: listpkgs,v 1.4 2002/07/23 09:02:45 lukem Exp $
      4  1.2  lukem #
      5  1.2  lukem # List all packages in the given pkgset by parsing the list files.
      6  1.1  jwise #
      7  1.1  jwise 
      8  1.1  jwise # set defaults
      9  1.4  lukem MAKE="${MAKE:-make} -j 1"
     10  1.4  lukem machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | ${MAKE} -s -f-`}
     11  1.4  lukem arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | ${MAKE} -s -f-`}
     12  1.1  jwise setd=`dirname $0`
     13  1.1  jwise prefix=/
     14  1.1  jwise 
     15  1.1  jwise usage() {
     16  1.1  jwise exec 1>&2
     17  1.1  jwise 
     18  1.1  jwise echo "Usage: $0 [-a arch] [-m machine] [-s setsdir] [-p prefix] setname"
     19  1.1  jwise echo "	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]"
     20  1.1  jwise echo "	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]"
     21  1.1  jwise echo "	-s setsdir	directory to find sets			[$setd]"
     22  1.1  jwise echo "	setname set to list packages for"
     23  1.1  jwise 
     24  1.1  jwise exit 1
     25  1.1  jwise }
     26  1.1  jwise 
     27  1.1  jwise # handle args
     28  1.1  jwise while : ; do
     29  1.1  jwise 	case $1 in
     30  1.1  jwise 	-a*)
     31  1.1  jwise 		arch=$2; shift
     32  1.1  jwise 		;;
     33  1.1  jwise 	-m*)
     34  1.1  jwise 		machine=$2; shift
     35  1.1  jwise 		;;
     36  1.1  jwise 	-s*)
     37  1.1  jwise 		setd=$2; shift
     38  1.1  jwise 		;;
     39  1.1  jwise 	-*)
     40  1.1  jwise 		usage
     41  1.1  jwise 		exit 1
     42  1.1  jwise 		;;
     43  1.1  jwise 	*)
     44  1.1  jwise 		break
     45  1.1  jwise 		;;
     46  1.1  jwise 	esac
     47  1.1  jwise 	shift
     48  1.1  jwise done
     49  1.1  jwise if [ -n "$1" ]; then
     50  1.1  jwise 	setname="$1"
     51  1.1  jwise else
     52  1.1  jwise 	usage
     53  1.1  jwise 	exit 1
     54  1.1  jwise fi
     55  1.1  jwise 
     56  1.1  jwise # Convert mipse[lb] to mips after processing command line arguments.
     57  1.1  jwise arch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
     58  1.1  jwise 
     59  1.1  jwise # Compute toolchain  used on target cpu.
     60  1.3  bjh21 if [ "$arch" = "mips" -o "$machine" = "alpha" -o "$arch" = "powerpc" -o "$arch" = "sparc" -o "$arch" = "sparc64" -o "$arch" = "i386" -o "$arch" = "arm" -o "$machine" = "mvme68k" -o "$machine" = "hp300" ]; then
     61  1.1  jwise 	shlib=elf
     62  1.1  jwise else
     63  1.1  jwise 	if [ "$arch" = "sh3" ]; then
     64  1.1  jwise 		shlib=
     65  1.1  jwise 	else
     66  1.1  jwise 		shlib=aout
     67  1.1  jwise 	fi
     68  1.1  jwise fi
     69  1.1  jwise 
     70  1.1  jwise (
     71  1.1  jwise 	cat $setd/lists/$setname/mi
     72  1.1  jwise 	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
     73  1.1  jwise 		cat $setd/lists/$setname/ad.${arch}
     74  1.1  jwise 	fi
     75  1.1  jwise 	if [ -f $setd/lists/$setname/md.${machine} ]; then
     76  1.1  jwise 		cat $setd/lists/$setname/md.${machine}
     77  1.1  jwise 	fi
     78  1.1  jwise 	if [ "$shlib" != "" ]; then
     79  1.1  jwise 		if [ -f $setd/lists/$setname/shl.mi ]; then
     80  1.1  jwise 			cat $setd/lists/$setname/shl.mi
     81  1.1  jwise 		fi
     82  1.1  jwise 		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
     83  1.1  jwise 			cat $setd/lists/$setname/shl.${shlib}
     84  1.1  jwise 		fi
     85  1.1  jwise 	fi
     86  1.2  lukem )| awk -- '/^[^#]/ {print $2}' | sort -u
     87