The setup

Prerequisites

This setup assumes that poudriere and subversion are installed, although the svnlite in base can be used instead of svn.

Get the ports tree

First create a dataset in my homedir for the ports tree and checkout the tree via svn:

root@desk /# zfs create -o mountpoint=/home/vidar/ports -o compression=on zroot/ports
root@desk /# svn co https://svn.freebsd.org/ports/head /home/vidar/ports

The ports tree doesn't need to have its own dataset, but giving it one makes it easier to clean up if we make a mess in the tree. If you are not using zfs, skip the first step and create a normal directory instead.

To update the ports tree later, simply run

root@desk /home/vidar/ports# svn up

Set up poudriere

First create the jails that poudriere uses for building:

root@desk /# poudriere jail -c -j fbsd11-1 -v 11.1-RELEASE
[00:00:00] ====>> Creating fbsd11-1 fs... done
[00:00:00] ====>> Using pre-distributed MANIFEST for FreeBSD 11.1-RELEASE amd64
[00:00:00] ====>> Fetching base.txz for FreeBSD 11.1-RELEASE amd64
(...)
[00:01:26] ====>> Recording filesystem state for clean... done
[00:01:26] ====>> Jail fbsd11-1 11.1-RELEASE-p1 amd64 is ready to be used

Repeat the procedure for all supported releases. At the time of writing, this means 11.1-RELEASE, 11.0-RELEASE and 10.3-RELEASE.

I also like to create jails for i386 and arm:

root@desk /# poudriere jail -c -j fbsd-11-1_i386 -v 11.1-RELEASE -a i386
...
[00:01:21] ====>> Jail fbsd11-1_i386 11.1-RELEASE-p1 i386 is ready to be used
root@desk /# pkg install qemu-user-static
root@desk /# sysrc qemu_user_static_enable="YES"
root@desk /# service qemu_user_static start
root@desk /# poudriere jail -c -j fbsd11-1_arm -v release/11.1.0 -a arm.armv6 -m svn+https
(...)
[01:16:06] ====>> Jail fbsd11-1_arm 11.1-RELEASE 1101001 arm.armv6 is ready to be used

Get the appropriate release numbers from svn.freebsd.org/base/release/. This will download the sources and cross-compile the OS for armv6. It will take a while.

All the jails are set up and ready to be used for testing ports:

root@desk /# poudriere jail -l
JAILNAME      VERSION                      ARCH      METHOD    TIMESTAMP           PATH
fbsd10-3      10.3-RELEASE-p16             amd64     ftp       2017-02-18 17:39:10 /usr/local/poudriere/jails/fbsd10-3
fbsd10-3_i386 10.3-RELEASE-p16             i386      ftp       2017-02-18 17:46:29 /usr/local/poudriere/jails/fbsd10-3_i386
fbsd10-3_arm  10.3-RELEASE-p16 r311916     arm.armv6 svn+https 2017-02-18 17:51:35 /usr/local/poudriere/jails/fbsd10-3_arm
fbsd11-0      11.0-RELEASE-p7              amd64     ftp       2017-02-18 17:35:31 /usr/local/poudriere/jails/fbsd11-0
fbsd11-0_i386 11.0-RELEASE-p7              i386      ftp       2017-02-18 17:42:03 /usr/local/poudriere/jails/fbsd11-0_i386
fbsd11-0_arm  11.0-RELEASE-p7 r311916      arm.armv6 svn+https 2017-02-18 19:20:03 /usr/local/poudriere/jails/fbsd11-0_arm
fbsd11-1_arm  11.1-RELEASE 1101001 r321354 arm.armv6 svn+https 2017-09-02 19:33:30 /usr/local/poudriere/jails/fbsd11-1_arm
fbsd11-1      11.1-RELEASE-p1              amd64     ftp       2017-09-02 18:57:03 /usr/local/poudriere/jails/fbsd11-1
fbsd11-1_i386 11.1-RELEASE-p1              i386      ftp       2017-09-02 19:24:59 /usr/local/poudriere/jails/fbsd11-1_i386

Tell poudriere about our ports tree

We need to register this copy of the ports tree with poudriere:

root@desk /# poudriere ports -c -F -M /home/vidar/ports -f none -p portsvn

-c is to create a new tree.

-F will create the needed file systems and directories, but not populate them.

-M /home/vidar/ports specifies the mount point of the tree.

-f none tells poudriere not to create a file system for the tree.

-p portsvn specifies the name of the ports tree (portsvn in this case).

Testing a build

We can now run a test to see if everything works.

root@desk /# poudriere testport -j fbsd11-1 -p portsvn -i textproc/crunch

There should be a few pages of output, including

====>> Installing textproc/crunch
(...)
root@fbsd11-1-portsvn:~ # 

before it drops you to a shell inside the jail, courtesy of the -i switch, where you can tinker with it. Press CTRL + d to exit and shutdown the jail.