Home | History | Annotate | Line # | Download | only in sets
makeobsolete revision 1.29
      1 #!/bin/sh
      2 #
      3 # $NetBSD: makeobsolete,v 1.29 2006/01/28 19:01:23 apb Exp $
      4 #
      5 # Print out the obsolete files for a set
      6 # Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
      7 #    [-t target] [setname ...]
      8 #
      9 
     10 rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
     11 . "${rundir}/sets.subr"
     12 lists="${nlists}"
     13 target=./dist
     14 obsolete=1
     15 
     16 usage()
     17 {
     18 	cat 1>&2 <<USAGE
     19 Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [setname ...]
     20 	-b		make netbsd + x11 lists
     21 	-x 		only make x11 lists
     22 	-a arch		set arch (e.g, m68k, mips, powerpc)	[${MACHINE_ARCH}]
     23 	-m machine	set machine (e.g, amiga, i386, macppc)	[${MACHINE}]
     24 	-s setsdir	directory to find sets	[${setd}]
     25 	-t target	target directory [${target}]
     26 	[setname ...] 	sets to build
     27 USAGE
     28 	exit 1
     29 }
     30 
     31 while getopts bxa:m:s:t: ch; do
     32 	case ${ch} in
     33 	b)
     34 		lists="${xlists} ${nlists}"
     35 		;;
     36 	x)
     37 		lists="${xlists}"
     38 		;;
     39 	a)
     40 		MACHINE_ARCH="${OPTARG}"
     41 		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
     42 		;;
     43 	m)
     44 		MACHINE="${OPTARG}"
     45 		;;
     46 	s)
     47 		setsdir="${OPTARG}"
     48 		;;
     49 	t)
     50 		target="${OPTARG}"
     51 		;;
     52 	*)
     53 		usage
     54 		;;
     55 	esac
     56 done
     57 shift $((${OPTIND} - 1))
     58 if [ -n "$1" ]; then
     59 	lists="$*"
     60 fi
     61 
     62 if [ ! -d "${target}" ]; then
     63 	echo "target directory [${target}] doesn't exist"
     64 	exit 1
     65 fi
     66 
     67 for setname in ${lists}; do
     68 	file="${target}/${setname}"
     69 	list_set_files "${setname}" | ${AWK} '{print $1}' | \
     70 		${SORT} -ru > "${file}"
     71 done
     72