3 .\" The contents of this file are subject to the terms of the
4 .\" Common Development and Distribution License (the "License").
5 .\" You may not use this file except in compliance with the License.
7 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8 .\" or http://www.opensolaris.org/os/licensing.
9 .\" See the License for the specific language governing permissions
10 .\" and limitations under the License.
12 .\" When distributing Covered Code, include this CDDL HEADER in each
13 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14 .\" If applicable, add the following below this CDDL HEADER, with the
15 .\" fields enclosed by brackets "[]" replaced with your own identifying
16 .\" information: Portions Copyright [yyyy] [name of copyright owner]
20 .\" Copyright 2009 Sun Microsystems, Inc. All rights reserved.
21 .\" Use is subject to license terms.
22 .TH FINDUNREF 1ONBLD "Oct 30, 2012"
24 \- find unused files in a source tree
26 findunref [\fB-s\fP \fIsubtree\fP] [\fB-t\fP \fItstampfile\fP]
27 [\fB-S\fP \fBhg\fP|\fBtw\fP|\fBgit\fP] \fIsrcroot\fP \fIexceptfile\fP
30 The findunref utility lists the files in a source tree which have not been
31 accessed more recently than a particular timestamp file. Although
32 findunref may be used on its own, it is usually invoked by
33 \fBnightly\fP(1ONBLD) to find files that are never referenced during a given
34 build (see \fB-f\fP in \fBnightly\fP(1ONBLD)).
36 The root of the source tree to examine is specified by \fIsrcroot\fP. To
37 simplify comparing findunref output from different source trees, findunref
38 outputs all filenames relative to \fIsrcroot\fP.
40 Some files in a source tree may be intentionally unreferenced (e.g.,
41 documentation) or only referenced during specialized types of builds.
42 Accordingly, \fIexceptfile\fP names a file containing a list of pathname
43 globs that will be ignored by findunref. Within \fIexceptfile\fP, any
44 lines consisting solely of whitespace or starting with \fB#\fP will be
45 ignored. Directory globs may also be specified, which will cause any
46 matching directories to be skipped entirely. If no exceptions are
47 desired, \fIexceptfile\fP can be \fB/dev/null\fP.
49 Depending on how findunref is invoked, it can either check all files, or
50 limit its checks to files under control of a specific source code
51 management (SCM) system.
53 To limit checks to files managed by Mercurial, the \fBhg\fP(1) utility must be
54 present in \fB$PATH\fP and any relevant repositories must be located at or
55 under \fIsrcroot\fP. Nested Mercurial repositories are supported.
57 To limit checks to files managed by Git, the \fBgit\fP(1) utility must be
58 present in \fB$PATH\fP and any relevant repositories must be located at or
59 under \fIsrcroot\fP. Nested Git repositories are \fInot\fR supported.
63 Only look under \fIsubtree\fP for unreferenced files. By default, all
64 directories under \fIsrcroot\fP are examined.
66 .B -t \fItstampfile\fP
67 Consider files older than \fItstampfile\fP to be unreferenced.
68 By default, \fIsrcroot\fB/.build.tstamp\fR is used.
70 .B -S \fBhg\fP|\fBtw\fP|\fBgit\fP
71 Only check files that are managed by the specified SCM. To simplify
72 interaction with \fBwhich_scm\fP(1ONBLD), the SCM names "mercurial" and
73 "teamware" may also be specified for "hg" and "tw", respectively.
74 By default, all files are checked.
79 \fBnightly\fP(1ONBLD),
80 \fBwhich_scm\fP(1ONBLD)
82 Since many files are only used when building for a particular ISA (e.g.,
83 Makefiles that are specific to x86 or SPARC), builds must be done on all
84 applicable ISAs and the results merged. For instance, if nightly builds
85 (with \fB-f\fP) are done on both SPARC and x86, \fBusr/src\fP will be
86 populated with a corresponding \fBunref-\fIisa\fB.out\fR file, which can
87 be merged with \fBcomm\fP(1):
90 comm -12 /path/to/unref-i386.out
91 /path/to/unref-sparc.out > unref.out
94 This merged file can then be compared against the gate's latest
95 unreferenced file list (e.g. \fB/ws/onnv-gate/usr/src/unrefmaster.out\fP).
97 Different gates have different unreferenced file policies. Any changes to
98 \fIexceptfile\fP that would define new unreferenced file policies for a
99 given gate must be cleared with the appropriate gatekeepers.