listpkgs revision 1.6
11.1Sjwise#!/bin/sh
21.1Sjwise#
31.6Sdyoung# $NetBSD: listpkgs,v 1.6 2003/11/25 07:19:46 dyoung 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.6Sdyoung. ./sets.defaults
101.6Sdyoung
111.1Sjwisesetd=`dirname $0`
121.1Sjwiseprefix=/
131.1Sjwise
141.5Sdyoung. ./sets.subr
151.5Sdyoung
161.1Sjwiseusage() {
171.1Sjwiseexec 1>&2
181.1Sjwise
191.1Sjwiseecho "Usage: $0 [-a arch] [-m machine] [-s setsdir] [-p prefix] setname"
201.6Sdyoungecho "	-a arch		set arch (e.g, m68k, mips, powerpc)	[$machine_arch]"
211.1Sjwiseecho "	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]"
221.1Sjwiseecho "	-s setsdir	directory to find sets			[$setd]"
231.1Sjwiseecho "	setname set to list packages for"
241.1Sjwise
251.1Sjwiseexit 1
261.1Sjwise}
271.1Sjwise
281.1Sjwise# handle args
291.1Sjwisewhile : ; do
301.1Sjwise	case $1 in
311.1Sjwise	-a*)
321.6Sdyoung		machine_arch=$2; shift
331.1Sjwise		;;
341.1Sjwise	-m*)
351.1Sjwise		machine=$2; shift
361.1Sjwise		;;
371.1Sjwise	-s*)
381.1Sjwise		setd=$2; shift
391.1Sjwise		;;
401.1Sjwise	-*)
411.1Sjwise		usage
421.1Sjwise		exit 1
431.1Sjwise		;;
441.1Sjwise	*)
451.1Sjwise		break
461.1Sjwise		;;
471.1Sjwise	esac
481.1Sjwise	shift
491.1Sjwisedone
501.1Sjwiseif [ -n "$1" ]; then
511.1Sjwise	setname="$1"
521.1Sjwiseelse
531.1Sjwise	usage
541.1Sjwise	exit 1
551.1Sjwisefi
561.1Sjwise
571.1Sjwise# Convert mipse[lb] to mips after processing command line arguments.
581.6Sdyoungmachine_arch=`echo $machine_arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
591.1Sjwise
601.1Sjwise# Compute toolchain  used on target cpu.
611.6Sdyoungif [ "$machine_arch" = "mips" -o "$machine" = "alpha" -o "$machine_arch" = "powerpc" -o "$machine_arch" = "sparc" -o "$machine_arch" = "sparc64" -o "$machine_arch" = "i386" -o "$machine_arch" = "arm" -o "$machine" = "mvme68k" -o "$machine" = "hp300" ]; then
621.1Sjwise	shlib=elf
631.1Sjwiseelse
641.6Sdyoung	if [ "$machine_arch" = "sh3" ]; then
651.1Sjwise		shlib=
661.1Sjwise	else
671.1Sjwise		shlib=aout
681.1Sjwise	fi
691.1Sjwisefi
701.1Sjwise
711.5Sdyounglist_set_files $setname | awk -- '/^[^#]/ {print $2}' | sort -u
72