Package building with pbulk and mksandbox

A bulk to build them all.

mksandbox allows to configure sandboxes. It is not mandatory to use it to run pbulk but a sandbox avoids system configuration dependent results. A sandbox can be created in the /usr/bulk directory by running:

# mksandbox --rwdirs=/var/spool --without-src --without-xsrc --without-x /usr/bulk

The directory /var/spool is mounted read-only in the sandbox to allow sending mails. On the other hand, the /usr/src, /usr/xsrc and /usr/X11R7 directories are not mounted..

It is possible to add configuration elements to the default mk.conf file produced during the bootstrap process by creating a fragment file as in this example:

# cat > /usr/bulk/mk.conf.frag << EOF
ALLOW_VULNERABLE_PACKAGES=      yes
MAKE_JOBS=                      9
SKIP_LICENSE_CHECK=             yes
WRKDIR=                         /tmp/work
X11_TYPE=                       modular

PGSQL_VERSION_DEFAULT=          14
PHP_VERSION_DEFAULT=            81
PYTHON_VERSION_DEFAULT=         310
LUA_VERSION_DEFAULT=            54

PKG_DEFAULT_OPTIONS=            nls
PKG_OPTIONS.dotclear=           pgsql
PKG_OPTIONS.nginx=              auth-request dav encrypted-session flv gzip \
                                headers-more http2 image-filter mail-proxy memcache \
                                push rtmp status sub uwsgi

APACHE_USER=                    root
APACHE_GROUP=                   www
EOF

To enter the sandbox, just run:

# /usr/bulk/sandbox

To create the bulk environment with a limited number of packages, without bootstraping make (native mode) and using a mk.conf fragment, -c, -l and -n options must be specified respectively:

# sh /usr/pkgsrc/mk/pbulk/pbulk.sh -c /mk.conf.frag -l -n

The limited bulk mode implies involves setting the list of packages in the /usr/pbulk/etc/pbulk.list file:

# cat > /usr/pbulk/etc/pbulk.list << EOF
databases/postgresql14-server
editors/vim
lang/php81
pkgtools/pkg_alternatives
pkgtools/pkgin
ww/nginx
www/php-dotclear
www/php-fpm
EOF

By default, report sending and package uploading are disabled by unsetting the mail and rsync variables. Valid values must be added to /usr/pbulk/etc/pbulk.conf. When base_url is a cosmetic variable for the report, pkg_rsync_target and report_rsync_target are needed to upload reports and packages to the correct host at the correct path. The mails of the report recipients must also be provided.

# cat /usr/pbulk/etc/pbulk.conf << EOF
mail=/usr/bin/mail
rsync=/usr/pbulk/bin/rsync
base_url="http://pkg.triaxx.org/pub/pkgsrc/reports/NetBSD/x86_64/9.2/www"
pkg_rsync_target="triaxx@pkg.triaxx.org:/srv/http/pkg/pub/pkgsrc/packages/NetBSD/x86_64/9.2/www" report_rsync_target="triaxx@pkg.triaxx.org:/srv/http/pkg/pub/pkgsrc/reports/NetBSD/x86_64/9.2/www" report_recipients="pkgsrc@triaxx.org"
EOF

Before running pbulk for the first time, make sure that an SSH connection can be established. Otherwise uploads of reports and packages will fail. After making the root directory of the sandbox and copying the SSH triaxx's private key into it, adding the pkg.triaxx.org host to the list of known hosts will be prompted.

# mkdir -p /usr/bulk/root/.ssh
cp /home/triaxx/.ssh/id_dsa /usr/bulk/root/.ssh
ssh triaxx@pkg.triaxx.org

The build of the set of packages can be simply started by running bulkbuild:

# /usr/pbulk/bin/bulkbuild

Page top