regpkgset revision 1.2
1#! /bin/sh
2#
3# $NetBSD: regpkgset,v 1.2 2004/01/16 10:05:10 dyoung 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
38verbose=""
39cache=""
40
41while [ $# -gt 1 ]; do
42	case $1 in
43	-v)	verbose=$1 ;;
44	-c)	cache=$1 ;;
45	*)	break ;;
46	esac
47	shift
48done
49
50if [ $# -lt 1 ]; then
51	echo "Usage: regpkgset pkgset..."
52	exit 1
53fi
54
55case $1 in
56all)	list="base comp etc games man misc text" ;;
57*)	list=$@ ;;
58esac
59
60if [ x${cache} != x ]; then
61	BUILD_INFO_CACHE=$(mktemp /var/tmp/$(basename $0)-BUILD_INFO.XXXXXX)
62	export BUILD_INFO_CACHE
63	{
64	echo "OPSYS=`uname -s`"
65	echo "OS_VERSION=`uname -r`"
66	make -f- all <<EOF
67.include <bsd.own.mk>
68all:
69	@echo OBJECT_FMT=${OBJECT_FMT}
70	@echo MACHINE_ARCH=${MACHINE_ARCH}
71	@echo MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH}
72EOF
73	echo "_PKGTOOLS_VER=`pkg_create -V`"
74	} > ${BUILD_INFO_CACHE}
75fi
76
77for pkgset in $list; do
78	for pkg in `./listpkgs $pkgset`; do
79		./regpkg $verbose $pkgset $pkg
80	done
81done
82
83[ x${BUILD_INFO_CACHE} != x ] && rm -f ${BUILD_INFO_CACHE}
84
85exit 0
86