Home | History | Annotate | Line # | Download | only in sets
regpkgset revision 1.3
      1 #! /bin/sh
      2 #
      3 # $NetBSD: regpkgset,v 1.3 2004/07/23 15:11:26 erh Exp $
      4 #
      5 # Copyright (c) 2003 Alistair G. Crooks.  All rights reserved.
      6 #
      7 # Redistribution and use in source and binary forms, with or without
      8 # modification, are permitted provided that the following conditions
      9 # are met:
     10 # 1. Redistributions of source code must retain the above copyright
     11 #    notice, this list of conditions and the following disclaimer.
     12 # 2. Redistributions in binary form must reproduce the above copyright
     13 #    notice, this list of conditions and the following disclaimer in the
     14 #    documentation and/or other materials provided with the distribution.
     15 # 3. All advertising materials mentioning features or use of this software
     16 #    must display the following acknowledgement:
     17 #	This product includes software developed by Alistair G. Crooks.
     18 #	for the NetBSD project.
     19 # 4. The name of the author may not be used to endorse or promote
     20 #    products derived from this software without specific prior written
     21 #    permission.
     22 #
     23 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
     24 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     25 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26 # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
     27 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     29 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     31 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     32 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     33 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     34 #
     35 
     36 # Usage: regpkgset set
     37 
     38 rundir=${0%/*}
     39 
     40 verbose=""
     41 cache=""
     42 
     43 while [ $# -gt 1 ]; do
     44 	case $1 in
     45 	-v)	verbose=$1 ;;
     46 	-c)	cache=$1 ;;
     47 	*)	break ;;
     48 	esac
     49 	shift
     50 done
     51 
     52 if [ $# -lt 1 ]; then
     53 	echo "Usage: regpkgset pkgset..."
     54 	exit 1
     55 fi
     56 
     57 case $1 in
     58 all)	list="base comp etc games man misc text" ;;
     59 *)	list=$@ ;;
     60 esac
     61 
     62 if [ x${cache} != x ]; then
     63 	BUILD_INFO_CACHE=$(mktemp /var/tmp/$(basename $0)-BUILD_INFO.XXXXXX)
     64 	export BUILD_INFO_CACHE
     65 	{
     66 	echo "OPSYS=`uname -s`"
     67 	echo "OS_VERSION=`uname -r`"
     68 	make -f- all <<EOF
     69 .include <bsd.own.mk>
     70 all:
     71 	@echo OBJECT_FMT=${OBJECT_FMT}
     72 	@echo MACHINE_ARCH=${MACHINE_ARCH}
     73 	@echo MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
     74 EOF
     75 	echo "_PKGTOOLS_VER=`pkg_create -V`"
     76 	} > ${BUILD_INFO_CACHE}
     77 fi
     78 
     79 for pkgset in $list; do
     80 	for pkg in `$rundir/listpkgs $pkgset`; do
     81 		$rundir/regpkg $verbose $pkgset $pkg
     82 	done
     83 done
     84 
     85 [ x${BUILD_INFO_CACHE} != x ] && rm -f ${BUILD_INFO_CACHE}
     86 
     87 exit 0
     88