findunref(1ONBLD) illumos Build Tools findunref(1ONBLD)
findunref - find unused files in a source tree

SYNOPSIS

findunref [ -s subtree] [-t tstampfile] [ -S hg|tw|git] srcroot exceptfile

DESCRIPTION

The findunref utility lists the files in a source tree which have not been accessed more recently than a particular timestamp file. Although findunref may be used on its own, it is usually invoked by nightly(1ONBLD) to find files that are never referenced during a given build (see -f in nightly(1ONBLD)).

The root of the source tree to examine is specified by srcroot. To simplify comparing findunref output from different source trees, findunref outputs all filenames relative to srcroot.

Some files in a source tree may be intentionally unreferenced (e.g., documentation) or only referenced during specialized types of builds. Accordingly, exceptfile names a file containing a list of pathname globs that will be ignored by findunref. Within exceptfile, any lines consisting solely of whitespace or starting with # will be ignored. Directory globs may also be specified, which will cause any matching directories to be skipped entirely. If no exceptions are desired, exceptfile can be /dev/null.

Depending on how findunref is invoked, it can either check all files, or limit its checks to files under control of a specific source code management (SCM) system.

To limit checks to files managed by Mercurial, the hg(1) utility must be present in $PATH and any relevant repositories must be located at or under srcroot. Nested Mercurial repositories are supported.

To limit checks to files managed by Git, the git(1) utility must be present in $PATH and any relevant repositories must be located at or under srcroot. Nested Git repositories are not supported.

OPTIONS

-s subtree
Only look under subtree for unreferenced files. By default, all directories under srcroot are examined.
-t tstampfile
Consider files older than tstampfile to be unreferenced. By default, srcroot/.build.tstamp is used.
-S hg|tw|git
Only check files that are managed by the specified SCM. To simplify interaction with which_scm(1ONBLD), the SCM names "mercurial" and "teamware" may also be specified for "hg" and "tw", respectively. By default, all files are checked.

SEE ALSO

git(1), hg(1), nightly(1ONBLD), which_scm(1ONBLD)

NOTES

Since many files are only used when building for a particular ISA (e.g., Makefiles that are specific to x86 or SPARC), builds must be done on all applicable ISAs and the results merged. For instance, if nightly builds (with -f) are done on both SPARC and x86, usr/src will be populated with a corresponding unref-isa.out file, which can be merged with comm(1):


comm -12 /path/to/unref-i386.out
/path/to/unref-sparc.out > unref.out

This merged file can then be compared against the gate's latest unreferenced file list (e.g. /ws/onnv-gate/usr/src/unrefmaster.out).

Different gates have different unreferenced file policies. Any changes to exceptfile that would define new unreferenced file policies for a given gate must be cleared with the appropriate gatekeepers.

October 30, 2012