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