Skip to content

Test your poudriere build with pot

Luca Pizzamiglio edited this page Feb 9, 2018 · 2 revisions

poudriere + pot

Install and initialize pot (currently you need to clone the git repo, because of a needed features still missing in the 0.3.1 tag)

# install pot
pkg install pot
# edit the configuration file setting up proper values for POT_ZFS_ROOT and POT_FS_ROOT
vi /usr/local/etc/pot/pot.conf
# initialize pot
pot init
# create a 11.1 base
pot create-base -r 11.1
# create a fscomp for distfiles
pot create-fscomp -f distfiles

Install and initialize poudriere (https://github.com/freebsd/poudriere/wiki for more):

pkg install poudriere
# configure poudriere to use the zpool of you choice
echo "ZPOOL=zroot" >> /usr/local/etc/poudriere.conf
# configure poudriere to use the distfiles fscomp
echo "DISFILES_CACHE=/opt/pot/fscomp/distfiles
poudriere jails -c -v 11.1-RELEASE -j 111x64
# here you should use the portstree of your choice (git, svn, or whatever)
poudriere ports -c -p upstream

Build a package of your choice

poudriere -j 111x64 -p upstream devel/gdb

Create a testing pot called gdb-test

pot create -p gdb-test -b 11.1
pot add-fscomp -p gdb-test -f zroot/poudriere/data/packages -m /mnt -e
pot run gdb-test

Now you have just to configure your local repository (more info in pkg.conf(5)) with a file like this:

FreeBSD: { enabled: no }
local: {
  url: "file:///mnt/111x64-upstream",
  enabled: yes
}

The pot gdb-test is now configured to use the local repository generated by poudriere

Automation using a flavour

All steps performed after the pot creation can be automated using a proper flavour. To create a flavor called port-test, two files are needed:

  • port-test that contains pot sub-commands (in this case on one sub-command)
add-fscomp -f zroot/poudriere/data/packages -m /mnt -e
  • port-test.sh that is a shell script that contextualize the container
#!/bin/sh
mkdir -p /usr/local/etc/pkg/repos
echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
cat > /usr/local/etc/pkg/repos/local.conf <<EOF
local: {
  url: "file:///mnt/111x64-upstream",
  enabled: yes
}
EOF
ASSUME_ALWAYS_YES=yes pkg bootstrap

Both files have to be placed in /usr/local/etc/pot/flavours. Moreover, the shell scripts has to be executable:

chmod a+x /usr/local/etc/pot/flavours/port-test.sh

Now, you can create the pre-configured pot container using the command:

pot create -p gdb-test -b 11.1 -f port-test
pot run port-test