xref: /titanic_44/usr/src/tools/scripts/checkpaths.sh (revision c28749e97052f09388969427adf7df641cdcdc22)
1#!/bin/ksh -p
2#
3# CDDL HEADER START
4#
5# The contents of this file are subject to the terms of the
6# Common Development and Distribution License, Version 1.0 only
7# (the "License").  You may not use this file except in compliance
8# with the License.
9#
10# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11# or http://www.opensolaris.org/os/licensing.
12# See the License for the specific language governing permissions
13# and limitations under the License.
14#
15# When distributing Covered Code, include this CDDL HEADER in each
16# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17# If applicable, add the following below this CDDL HEADER, with the
18# fields enclosed by brackets "[]" replaced with your own identifying
19# information: Portions Copyright [yyyy] [name of copyright owner]
20#
21# CDDL HEADER END
22#
23#
24# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25# Use is subject to license terms.
26#
27#ident	"%Z%%M%	%I%	%E% SMI"
28
29# Quis custodiet ipsos custodies?
30
31if [ -z "$SRC" ]; then
32	SRC=$CODEMGR_WS/usr/src
33fi
34
35if [ -z "$CODEMGR_WS" -o ! -d "$CODEMGR_WS" -o ! -d "$SRC" ]; then
36	echo "$0: must be run from within a workspace."
37	exit 1
38fi
39
40cd $CODEMGR_WS || exit 1
41
42# Use -b to tell this script to ignore derived (built) objects.
43if [ "$1" = "-b" ]; then
44	b_flg=y
45fi
46
47# Not currently used; available for temporary workarounds.
48args="-k NEVER_CHECK"
49
50# We intentionally don't depend on $MACH here, and thus no $ROOT.  If
51# a proto area exists, then we use it.  This allows this script to be
52# run against gates (which should contain both SPARC and x86 proto
53# areas), build workspaces (which should contain just one proto area),
54# and unbuilt workspaces (which contain no proto areas).
55if [ "$b_flg" = y ]; then
56	rootlist=
57elif [ $# -gt 0 ]; then
58	rootlist=$*
59else
60	rootlist="$CODEMGR_WS/proto/root_sparc $CODEMGR_WS/proto/root_i386"
61fi
62
63for ROOT in $rootlist
64do
65	case "$ROOT" in
66	*sparc)	arch=sparc;;
67	*i386)	arch=i386;;
68	*)
69		echo "$ROOT has unknown architecture." >&2
70		exit 1
71		;;
72	esac
73	if [ -d $ROOT ]; then
74		validate_paths '-s/\s*'$arch'$//' -e '^opt/onbld' -b $ROOT \
75			$args $SRC/pkgdefs/etc/exception_list_$arch
76	fi
77done
78
79# Two entries in the findunref exception_list deal with things created
80# by nightly.  Otherwise, this test could be run on an unmodifed (and
81# unbuilt) workspace.  We handle this by flagging the one that is
82# present only on a built workspace (./*.out) and the one that's
83# present only after a run of findunref (./*.ref) with ISUSED, and
84# disabling all checks of them.  The assumption is that the entries
85# marked with ISUSED are always known to be good, thus the Latin quote
86# at the top of the file.
87if [ -r $SRC/tools/findunref/exception_list ]; then
88	validate_paths -k ISUSED -r -e '^\*' -b $SRC \
89		$SRC/tools/findunref/exception_list
90fi
91
92# These are straightforward.
93if [ -d $SRC/xmod ]; then
94	validate_paths $SRC/xmod/cry_files
95	validate_paths -b $SRC $SRC/xmod/xmod_files
96fi
97
98# Finally, make sure the that (req|inc).flg files are in good shape.
99validate_flg
100
101exit 0
102