xref: /netbsd-src/distrib/sets/regpkgset (revision 5b84b3983f71fd20a534cfa5d1556623a8aaa717)
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
38rundir=${0%/*}
39
40verbose=""
41cache=""
42
43while [ $# -gt 1 ]; do
44	case $1 in
45	-v)	verbose=$1 ;;
46	-c)	cache=$1 ;;
47	*)	break ;;
48	esac
49	shift
50done
51
52if [ $# -lt 1 ]; then
53	echo "Usage: regpkgset pkgset..."
54	exit 1
55fi
56
57case $1 in
58all)	list="base comp etc games man misc text" ;;
59*)	list=$@ ;;
60esac
61
62if [ 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>
70all:
71	@echo OBJECT_FMT=${OBJECT_FMT}
72	@echo MACHINE_ARCH=${MACHINE_ARCH}
73	@echo MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
74EOF
75	echo "_PKGTOOLS_VER=`pkg_create -V`"
76	} > ${BUILD_INFO_CACHE}
77fi
78
79for pkgset in $list; do
80	for pkg in `$rundir/listpkgs $pkgset`; do
81		$rundir/regpkg $verbose $pkgset $pkg
82	done
83done
84
85[ x${BUILD_INFO_CACHE} != x ] && rm -f ${BUILD_INFO_CACHE}
86
87exit 0
88