Package Building in the Large

Stephen Montgomery-Smith stephen at math.missouri.edu
Sun Nov 25 18:58:49 PST 2007


Doug Barton wrote:
> On Mon, 19 Nov 2007, Jason C. Wells wrote:
> 
>> What I am trying to do is to build 30 or so packages including the big 
>> ones like X, kde, gnome, plus all of their dependencies on a build 
>> host and then use pkg_add on various machines.  I have had a variety 
>> of difficulties with all of the methods I have used thus far 
>> (portmaster, portupgrade, homegrown).

What I do is this.  After building the ports I want (and I admit that I 
use vanilla "cd the-port; make install clean", I run a little script I 
call "make-packages."  And after I have updated the ports, I run a 
program called "make-packages-purge" to get rid of the old stuff.

I enclose them as attachments.

-------------- next part --------------
#!/usr/bin/make -f

PACKAGES?=/usr/home/stephen/packages-7
PKG_DBDIR?=/var/db/pkg
PORTSDIR?=/usr/ports

PKG_LIST!=ls ${PKG_DBDIR}
all:	${PKG_LIST:C+(.*)+${PACKAGES}/All/\1.tbz+}

.for target in ${PKG_LIST}
${PACKAGES}/All/${target}.tbz:	${PKG_DBDIR}/${target}/+CONTENTS
	@origin=${PORTSDIR}/`sed -n 's/@comment ORIGIN://p' \
		${PKG_DBDIR}/${target}/+CONTENTS`; \
	if [ $$origin != ${PORTSDIR}/ ] && [ -e $$origin ] && (! [ -e $$origin/work ] || [ -e $$origin/work/.install_done* ]); then \
		echo creating package ${target}; \
		make -C $$origin PACKAGES=${PACKAGES} package-links; \
		pkg_create -GjY -b ${target} $@ || (rm -f $@ && false); \
	fi
.endfor

.BEGIN:
	@mkdir -p ${PACKAGES}/All
-------------- next part --------------
#!/bin/sh

PACKAGES=/usr/home/stephen/packages-7
DB=/var/db/pkg

for p in `ls $PACKAGES/All | sed s/\.tbz//`; do
  if ! [ -e ${DB}/$p ]; then
    rm -i $PACKAGES/All/$p.tbz
  fi
done

for l in `find $PACKAGES -type l`; do
  if ! stat -q -L $l > /dev/null; then
    rm -f $l
  fi
done


More information about the freebsd-ports mailing list