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

synth are far from perfect

Sometimes synth will complain about some error and grind to a complete standstill.

# synth upgrade-system
Regenerating flavor index: this may take a while ...
Scanning entire ports tree.
 progress: 74.12%              
culprit: sysutils/DtraceToolkit
Scan aborted because 'make' encounted an error in the Makefile.
sysutils/DtraceToolkit (return code = 1)
 progress: 74.16%

This problem was due to a typo in head/sysutils/Makefile, corrected in r459917. And yes, sysutils/DTraceToolkit was resurrected after being removed in early January.

At any rate, synth should be able to cope better with these incidents, i.e. clean up and terminate.

I decided to blow away my ports tree and fetch it anew. This cured a problem with print/texlive-full. Finally, I was able to please synth.

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. Let /root/.ccache be a symlink to ../var/cache/ccache.

mv ~/.ccache/ccache.conf /var/cache/ccache
rm -Rf ~/.ccache
ln -s ../var/cache/ccache ~/.ccache

Leave a Reply

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