First experiences with ports-mgmt/synth

I spun up a virtual machine yesterday with the intent of learning how to use ports-mgmt/synth.

I installed the FreeBSD/amd64 stable/11 r326620 snapshot. I used the defaults for a three-way raidz1 zpool.

I nuked the contents of /usr/ports and pulled new working copies of the source and ports trees from our unofficial, local Subversion mirror. I created /usr/ports/distfiles, /usr/ports/local, /usr/ports/packages, /usr/ports/workdirs, /var/cache/ccache, /var/synth, and /var/synth/live_packages as separate ZFS filesystems. /var/cache was created as an intermediary filesystem with the ZFS canmount property set to off.

The ports collection was instructed to store work directories in /usr/ports/workdirs.


I installed ports-mgmt/pkg, ports-mgmt/dialog4ports, devel/ccache, and ports-mgmt/synth using the ports tree.

ccache was configured to use 16G of disk space and to place the cached files in /var/cache/ccache.

max_size = 16.0G
cache_dir = /var/cache/ccache

synth was instructed to use ccache from /var/cache/ccache.

The first run of synth upgrade-system went without a hitch.

I created a simple, local metaport, mymetaport.

SUBDIR+=	local
COMMENT=	Local software

SUBDIR+=	mymetaport

.include <>
PORTNAME=			mymetaport
PORTVERSION=		2017121300

MAINTAINER=			hostmaster@localhost
COMMENT=			mymetaport

USES=				metaport

# These two ports must come first in this particular order.
RUN_DEPENDS+=		pkg>0:${PORTSDIR}/ports-mgmt/pkg
RUN_DEPENDS+=		dialog4ports>0:${PORTSDIR}/ports-mgmt/dialog4ports

# Ports for upgrading 3rd party software.
RUN_DEPENDS+=		ccache>0:${PORTSDIR}/devel/ccache
RUN_DEPENDS+=		synth>0:${PORTSDIR}/ports-mgmt/synth

# Additional ports as you see fit.
#RUN_DEPENDS+=		name>0:${PORTSDIR}/category/name

.include <>

WWW: http://localhost/

Next, I began searching for a way of mounting /usr/ports/local beneeth /xports for all builders. Using /usr/local/etc/synth/hook_run_start didn’t give me any results.

Manually mounting /usr/ports/local as /xports/local with a 3 seconds delay while running synth upgrade-system, resulted in synth nuking all of my files in /usr/ports/local.

Keeping /usr/ports/local together with /usr/ports is an acceptable compromise, but I would avoid it if I can. You should use version control for your local metaports either way. Maybe ports-mgmt/portshaker is something to look into.

I have reached out to the maintainer of synth, asking for a way of mounting additional ports subtrees. Maybe my suggestion is unfounded, but I like the FreeBSD idea of separating base from localbase, and I think that should apply equally to the ports tree and any local metaports. I think it will be nice to have a 24h wall clock in the top, right corner of the ncurses display. It will make a nice companion to the clock showing elapsed time.

ports-mgmt/synth 2.02 compiling 25 ports
ports-mgmt/synth 2.02 compiling 25 ports

If you add www/apache24 to your builder, this fragment might be handy:

<IfModule alias_module>
  Alias /synth /var/log/synth

<Directory /var/log/synth>
  AllowOverride None
  Options Indexes FollowSymlinks
  Require all granted

<IfModule alias_module>
  Alias /pkg /var/synth/live_packages

<Directory /var/synth/live_packages>
  AllowOverride None
  Options Indexes FollowSymlinks
  Require all granted

Use of ccache

Using ccache outside of synth, I discovered that /root/.ccache/ccache.conf is sometimes ignored. ccache thus places its stuff in /root/.ccache. Creating the necessary symlinks should remove that problem:


cd /root/.ccache
for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f tmp; do
  ln -s ../../var/cache/ccache/$d $d;


cd /root/.ccache
foreach d ( 0 1 2 3 4 5 6 7 8 9 a b c d e f tmp )
  ln -s ../../var/cache/ccache/$d $d

Or, you could let /root/.ccache be a symlink to ../var/cache/ccache.

Leave a Reply

Your email address will not be published. Required fields are marked *