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