Subject: Re: using bulk build mechanism for a pre-selected list of packages
To: None <tech-pkg@netbsd.org>
From: James K. Lowden <jklowden@schemamania.org>
List: tech-pkg
Date: 12/11/2003 23:09:40
On Tue, 9 Dec 2003 15:04:12 -0800 (PST), "Jeremy C. Reed"
<reed@reedmedia.net> wrote:
> Is there a way to use the bulk build mechanism to only install a
> pre-selected list of packages?

I set up my sandbox with a custom Makefile. I generate a list of packages
with pkg_info; in this case everything dependent on "pth".  The list winds
up looking like this:

sandbox for root@oak# head /pkglist 
devel/glib
x11/gtk
graphics/gdk-pixbuf
net/ORBit
www/dillo
...

Familiar, eh?  ;-)  Here's a snippet of my Makefile:

++ cut ++
PKG=pth
[...]
.pkglist.needs:
	pkg_info -R $(PKG) \
		|sed -ne'/^Required by:/,/^$$/p' \
		|grep -v '^Required by:'  \
		> $(.TARGET)

pkglist: .pkglist.needs
	for P in $$(cat .pkglist.needs); \
		do pkg_info -B $$P |grep ^PKGPATH |cut -f2 -d' '; \
	done \
	> $(.TARGET)

packages:  .packages

.packages: pkgtools xpkgwedge pkglist
	# assumes pkglist has already been prepared
	printf "##\n## %s\n##\n" "`date`" >> .$(.TARGET)
	for P in `cat pkglist`; \
		do cd /$(USR.PKGSRC)/$$P  && make package \
			&& echo $$P >> .$(.TARGET) \
			|| exit 1; \
	done
	mv .$(.TARGET) $(.TARGET) 
++ cut ++

I'm sure there are better ways, but that gives you the gist.

--jkl