finding things in the source tree, a proposal

David A. Yost yost at esquire.UUCP
Fri Jun 15 00:58:34 AEST 1990


Imagine this:

Thinks to self: Hmm, where is the source to thingy?
Types this:     cd /src/where/`which thingy`
Et voila!

Here's the idea:

For each installed binary or other file which is
built and installed from somewhere else (e.g.
the src tree), there is a symbolic link at a
corresponding path under the directory tree
/src/where, and this symbolic link points to
the directory where the source is found.

Each source directory contains an install
subdirectory, in which each file that is to
be installed exists as a symbolic link to its
installed location.  Thus, the install target
in the Makefile copies to install/thingy, which
automatically causes the install to the right
place.

Benefits:

1.  Provides a reliable mechanism to map between
    each installed file and the location of its
    source.
2.  Source tree hierarchy need not model the
    installed locations, but can (and should) be
    organized according to other criteria, like
    where the source came from, who maintains it,
    etc.  Source tree organizations to date that
    I have seen mix these two models.
3.  A program can be run to verify a one-to-one
    correspondence between source and installed
    versions of things, without having to
    understand or even look at Makefiles or other
    files.

I prefer this way of doing things to reliance on
tools such as the Berkeley `whereis' command
because `whereis' is only able to make guesses,
can give inconclusive, multiple answers, and has
information wired into it.

A similar technique using symbolic links could be
applied to mapping between installed files and
their corresponding online documentation, instead
of rummaging around in man1, man2, ... manl.  For
example, /usr/man/usr/lib/sendmail would be a
symbolic link to /usr/man/man8/sendmail.8.

 --dave yost
   yost at dpw.com or uunet!esquire!yost
   Please ignore the From or Reply-To fields above, if different.



More information about the Comp.unix.wizards mailing list