rcrowley/freight — pull request #41 by GregSutcliffe (2013-09-16 17:06:18+00:00)
Title: Provide config option to create symlink components

I have a project with a deb repo (which is managed by Freight, obviously) in which I would like to have a component for each major release (easy) but also to have a "stable" component pointing to the latest release. So

deb http://myproject/ projectname 1.1
deb http://myproject/ projectname 1.2
deb http://myproject/ projectname stable

I could create this simply by copying the debs from the `$VARLIB/apt/project/1.2` directory to the `stable` directory, but this is space inefficient, and with Jenkins publishing new packages to _only_ the 1.2 repo, risks packages being missed over time.

Attached is a patch to optionally allow the `find` command in freight-cache to discover debs within symlinked directories. Using this, one sets SYMLINKS=true in the freight.conf and then simply does `ln 1.2 stable` in VARLIB.

It seems to work for my limited testing - here's some testing output:

# some ls output
-rw-r--r-- 5 root root 74K Sep 16 16:38 lib/apt/squeeze/1.3/facter_1.7.3-1puppetlabs1_amd64.deb
lrwxrwxrwx 1 root root 3 Sep 16 16:46 lib/apt/squeeze/rc -> 1.3

# without SYMLINKS
$ grep SYMLINK freight.conf
#SYMLINKS=true
$ /root/freight/bin/freight-cache -v -c ./freight.conf
# [freight] adding facter_1.7.3-1puppetlabs1_amd64.deb to pool

# with SYMLINKS
$ grep SYMLINK freight.conf
SYMLINKS=true
$ /root/freight/bin/freight-cache -v -c ./freight.conf
# [freight] adding facter_1.7.3-1puppetlabs1_amd64.deb to pool
# [freight] adding facter_1.7.3-1puppetlabs1_amd64.deb to pool

Obviously that's not massively verbose, but you can see it's picked up the same deb twice, once for the real repo and once for the symlink.

Hopefully it's useful, opinions welcome! (oh, and thanks @rcrowley for the awesome project)