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