1 FINDUNREF(1ONBLD)             illumos Build Tools            FINDUNREF(1ONBLD)
   2 
   3 
   4 
   5 findunref - find unused files in a source tree
   6 
   7 SYNOPSIS
   8        findunref [-s subtree] [-t tstampfile] [-S hg|tw|git] srcroot
   9        exceptfile
  10 
  11 DESCRIPTION
  12        The findunref utility lists the files in a source tree which have not
  13        been accessed more recently than a particular timestamp file.  Although
  14        findunref may be used on its own, it is usually invoked by
  15        nightly(1ONBLD) to find files that are never referenced during a given
  16        build (see -f in nightly(1ONBLD)).
  17 
  18        The root of the source tree to examine is specified by srcroot.  To
  19        simplify comparing findunref output from different source trees,
  20        findunref outputs all filenames relative to srcroot.
  21 
  22        Some files in a source tree may be intentionally unreferenced (e.g.,
  23        documentation) or only referenced during specialized types of builds.
  24        Accordingly, exceptfile names a file containing a list of pathname
  25        globs that will be ignored by findunref.  Within exceptfile, any lines
  26        consisting solely of whitespace or starting with # will be ignored.
  27        Directory globs may also be specified, which will cause any matching
  28        directories to be skipped entirely.  If no exceptions are desired,
  29        exceptfile can be /dev/null.
  30 
  31        Depending on how findunref is invoked, it can either check all files,
  32        or limit its checks to files under control of a specific source code
  33        management (SCM) system.
  34 
  35        To limit checks to files managed by Mercurial, the hg(1) utility must
  36        be present in $PATH and any relevant repositories must be located at or
  37        under srcroot.  Nested Mercurial repositories are supported.
  38 
  39        To limit checks to files managed by Git, the git(1) utility must be
  40        present in $PATH and any relevant repositories must be located at or
  41        under srcroot.  Nested Git repositories are not supported.
  42 
  43 OPTIONS
  44        -s subtree
  45                  Only look under subtree for unreferenced files.  By default,
  46                  all directories under srcroot are examined.
  47 
  48        -t tstampfile
  49                  Consider files older than tstampfile to be unreferenced.  By
  50                  default, srcroot/.build.tstamp is used.
  51 
  52        -S hg|tw|git
  53                  Only check files that are managed by the specified SCM.  To
  54                  simplify interaction with which_scm(1ONBLD), the SCM names
  55                  "mercurial" and "teamware" may also be specified for "hg" and
  56                  "tw", respectively.  By default, all files are checked.
  57 
  58 SEE ALSO
  59        git(1), hg(1), nightly(1ONBLD), which_scm(1ONBLD)
  60 
  61 NOTES
  62        Since many files are only used when building for a particular ISA
  63        (e.g., Makefiles that are specific to x86 or SPARC), builds must be
  64        done on all applicable ISAs and the results merged.  For instance, if
  65        nightly builds (with -f) are done on both SPARC and x86, usr/src will
  66        be populated with a corresponding unref-isa.out file, which can be
  67        merged with comm(1):
  68 
  69        comm -12 /path/to/unref-i386.out
  70                 /path/to/unref-sparc.out > unref.out
  71 
  72        This merged file can then be compared against the gate's latest
  73        unreferenced file list (e.g. /ws/onnv-gate/usr/src/unrefmaster.out).
  74 
  75        Different gates have different unreferenced file policies.  Any changes
  76        to exceptfile that would define new unreferenced file policies for a
  77        given gate must be cleared with the appropriate gatekeepers.
  78 
  79 
  80 
  81                                October 30, 2012              FINDUNREF(1ONBLD)