various suggestions for mr

Adam Spiers vcs-home at adamspiers.org
Fri Oct 28 15:34:16 CEST 2011


On Fri, Oct 28, 2011 at 12:40 PM, Dieter Plaetinck <dieter at plaetinck.be> wrote:
> Sorry that I go slightly off-topic but you mentioned Gnu Stow, I looked it up and it seems very nice.
> i haven't run it yet, but (for those who don't want to read the long description) from the description it seems like a simple and elegant tool,
> which you give a directory ("i want symlinks here") and a bunch of package directories ("all files in here must be symlinked")
> and it will do the right thing on package additions and removals.

Yes, it is pretty nice (although the code base is very old-fashioned).

One thing it does which I guess other symlink managers wouldn't, is
called "tree folding" - i.e. it makes intelligent decisions about when
to symlink to a subdirectory vs. to individual files within that
subtree:

  http://www.gnu.org/software/stow/manual.html#SEC4

For example, imagine I have a stow package called 'foo' which wants to
install a file to ~/local/lib/perl/Acme/Foo.pm (by "install", I mean
set up a symlink so that that path points to the Foo.pm inside the
stow package).  If ~/local doesn't already exist, and 'foo' is the
only stow package which installs anywhere under ~/local, then stow's
tree folding feature will ensure that ~/local is a symlink back to
$STOW_DIR/foo/local/lib/perl/Acme/Foo.pm.

However I might very well want to manually place other files inside
~/local which have nothing to do with stow, let alone the 'foo' stow
package.  It might make sense to have ~/local/lib/perl/Acme/ be a
symlink to $STOW_DIR/foo/local/lib/perl/Acme/, but symlinks higher up
the tree would be undesirable.  This is easily overcome by creating a
special stow package (which I call 'ANTIFOLD') which contains (empty)
dummy files called .no-stow-folding in those trees.  So I run a simple
little custom shell script:

    $ unfold ~/local/lib/perl5

which creates an empty file

    $STOW_DIR/ANTIFOLD/local/lib/perl5/.no-stow-folding

and (re)installs the 'ANTIFOLD' stow package, which causes stow to
automatically "split" the ~/local/lib/perl5 tree open so that

    ~/local/
    ~/local/lib/
    ~/local/lib/perl5/

are all normal directories, and ~/local/lib/perl5/Acme becomes the
symlink.  Problem solved!


More information about the vcs-home mailing list