Home | History | Annotate | Line # | Download | only in sets
makeobsolete revision 1.1
      1 #!/bin/sh
      2 #
      3 # $NetBSD: makeobsolete,v 1.1 1999/06/05 20:17:42 bouyer 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 # set defaults
     11 : ${MAKE=make}
     12 machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`}
     13 arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`}
     14 setd=`pwd`
     15 nlists="base comp etc games man misc secr text"
     16 xlists="xbase xcomp xcontrib xfont xserver"
     17 lists=$nlists
     18 target=./dist
     19 
     20 # handle args
     21 while : ; do
     22 	case $1 in
     23 	-b*)
     24 		lists="$xlists $nlists"
     25 		;;
     26 	-x*)
     27 		lists=$xlists;;
     28 	-a*)
     29 		arch=$2; shift
     30 		;;
     31 	-m*)
     32 		machine=$2; shift
     33 		;;
     34 	-s*)
     35 		setd=$2; shift
     36 		;;
     37 	-t*)
     38 		target=$2;shift
     39 		;;
     40 	-*)
     41 		cat 1>&2 <<USAGE
     42 Usage: $0 [-a arch] [-m machine] [-s setsdir] [setname ...]
     43 	-b		make netbsd + x11 lists
     44 	-x 		only make x11 lists
     45 	-a arch		set arch (e.g, m68k, mips, powerpc)	[$arch]
     46 	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
     47 	-s setsdir	directory to find sets	[$setd]
     48 	-t target	target directory [$target]
     49 	[setname ...] 	sets to build
     50 USAGE
     51 		exit 1
     52 		;;
     53 	*)
     54 		break
     55 		;;
     56 	esac
     57 	shift
     58 done
     59 if [ -n "$1" ]; then
     60 	lists="$*"
     61 fi
     62 
     63 # Convert mipse[lb] to mips after processing command line arguments.
     64 arch=`echo $arch | sed s,^mipse.,mips,`
     65 
     66 if [ ! -d $target ] ; then
     67 	echo "target directory [$target] doesn't exists"
     68 	exit 1
     69 fi
     70 
     71 for setname in $lists; do
     72 	file=$target/${setname}_obsolete
     73 	(
     74 	if [ -f $setd/lists/$setname/obsolete.mi ]; then
     75 		cat $setd/lists/$setname/obsolete.mi
     76 	fi
     77 	if [ "$machine" != "$cpu" -a \
     78 	    -f $setd/lists/$setname/obsolete.${arch} ]; then
     79 		cat $setd/lists/$setname/obsolete.${arch}
     80 	fi
     81 	if [ -f $setd/lists/$setname/obsolete.${machine} ]; then
     82 		cat $setd/lists/$setname/obsolete.${machine}
     83 	fi) | egrep -v '^#' | sort -u > $file
     84 	if [ ! -s $file ] ; then
     85 		rm $file
     86 	fi
     87 
     88 done | egrep -v '^#' | sort -u
     89