Skip to content

pkg_repos

Bryan Drewery edited this page Nov 9, 2015 · 4 revisions

Creating pkg(8) repositories

Install poudriere on the build host. This should be newer or the same version of all the target machines. Cross-building is supported with an amd64 host for i386 jails.

pkg install poudriere

Create a default configuration in ${LOCALBASE}/etc/poudriere.conf configuration file:

BASEFS=/poudriere
# Only 1 of the 2 following options is needed
# For ZFS:
ZPOOL=myzpool
# For NO ZFS:
NO_ZFS=yes

FREEBSD_HOST=ftp://ftp.freebsd.org
POUDRIERE_DATA=${BASEFS}/data
RESOLV_CONF=/etc/resolv.conf
DISTFILES_CACHE=/usr/ports/distfiles

poudriere is now ready to be used.

First create a ports tree to be used by poudriere:

poudriere ports -c

Create jails for the target versions you want to build packages for:

poudriere jail -c -j 91amd64 -v 9.1-RELEASE -a amd64
poudriere jail -c -j current -v head -a i386 -m svn

The first will create a 9.1-RELEASE amd64 jail from the official sets (fetched from FREEBSD_HOST) The second will create a current jail using svn and build from source for i386.

Create the list of packages you want to see built by poudriere:

In ~/mylist1

editors/vim-lite
www/nginx

In ~/mylist2

www/firefox
editors/libreoffice

Start a poudriere build for each list:

poudriere bulk -f ~/mylist1 -j 91amd64
poudriere bulk -f ~/mylist2 -j current

This will build two pkgng repositories:

  • ${POUDRIERE_DATA}/packages/current-default
  • ${POUDRIERE_DATA}/packages/91amd64-default

Configure an http server to serve these directories.

On your user boxes: (if you use the automatic bootstrap it will take care of creating this file)

echo "packagesite: http://yoururl/current-default" >> /usr/local/etc/pkg.conf

or

echo "packagesite: http://yoururl/91amd64-default" >> /usr/local/etc/pkg.conf

On FreeBSD 9.1 and later it is possible to directly bootstrap from the base:

PACKAGESITE="http://yoururl/current-default" pkg update

Before FreeBSD 9.1, it is necessary to bootstrap by hand:

fetch http://yoururl/91amd64-default/Latest/pkg.txz
tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
./pkg-static add ./pkg.txz

Normal operation after the build jails have been created looks like:

Update the poudriere ports tree:

poudriere ports -u

Run an incremental build on both build jails:

poudriere bulk -f ~/mylist1 -j 91amd64
poudriere bulk -f ~/mylist2 -j current

It might become necessary to do a full fresh build, use the -c flag to bulk to clear all packages and build fresh. This is normally not required though as poudriere, by default, supports incremental builds and will rebuild anything requiring to be rebuilt.

Clone this wiki locally