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