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 (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27 28# Quis custodiet ipsos custodies? 29 30if [ -z "$SRC" ]; then 31 SRC=$CODEMGR_WS/usr/src 32fi 33 34if [ -z "$CODEMGR_WS" -o ! -d "$CODEMGR_WS" -o ! -d "$SRC" ]; then 35 echo "$0: must be run from within a workspace." 36 exit 1 37fi 38 39cd $CODEMGR_WS || exit 1 40 41# Use -b to tell this script to ignore derived (built) objects. 42if [ "$1" = "-b" ]; then 43 b_flg=y 44fi 45 46# Not currently used; available for temporary workarounds. 47args="-k NEVER_CHECK" 48 49# We intentionally don't depend on $MACH here, and thus no $ROOT. If 50# a proto area exists, then we use it. This allows this script to be 51# run against gates (which should contain both SPARC and x86 proto 52# areas), build workspaces (which should contain just one proto area), 53# and unbuilt workspaces (which contain no proto areas). 54if [ "$b_flg" = y ]; then 55 rootlist= 56elif [ $# -gt 0 ]; then 57 rootlist=$* 58else 59 rootlist="$CODEMGR_WS/proto/root_sparc $CODEMGR_WS/proto/root_i386" 60fi 61 62# If the closed source is not present, then exclude IKE from validation. 63if [ "$CLOSED_IS_PRESENT" = no ]; then 64 excl="-e ^usr/include/ike/" 65fi 66 67for ROOT in $rootlist 68do 69 case "$ROOT" in 70 *sparc|*sparc-nd) 71 arch=sparc 72 ;; 73 *i386|*i386-nd) 74 arch=i386 75 ;; 76 *) 77 echo "$ROOT has unknown architecture." >&2 78 exit 1 79 ;; 80 esac 81 if [ -d $ROOT ]; then 82 validate_paths '-s/\s*'$arch'$//' -e '^opt/onbld' $excl \ 83 -b $ROOT $args $SRC/pkgdefs/etc/exception_list_$arch 84 fi 85done 86 87# Two entries in the findunref exception_list deal with things created 88# by nightly. Otherwise, this test could be run on an unmodifed (and 89# unbuilt) workspace. We handle this by flagging the one that is 90# present only on a built workspace (./*.out) and the one that's 91# present only after a run of findunref (./*.ref) with ISUSED, and 92# disabling all checks of them. The assumption is that the entries 93# marked with ISUSED are always known to be good, thus the Latin quote 94# at the top of the file. 95# 96# The exception_list is generated from whichever input files are appropriate 97# for this workspace, so checking it obviates the need to check the inputs. 98 99if [ -r $SRC/tools/findunref/exception_list ]; then 100 validate_paths -k ISUSED -r -e '^\*' $SRC/tools/findunref/exception_list 101fi 102 103# These are straightforward. 104if [ -d $SRC/xmod ]; then 105 # If the closed source is not present, then don't validate it. 106 if [ "$CLOSED_IS_PRESENT" = no ]; then 107 excl_cry="-e ^usr/closed" 108 excl_xmod="-e ^../closed" 109 fi 110 validate_paths $excl_cry $SRC/xmod/cry_files 111 validate_paths $excl_xmod -b $SRC $SRC/xmod/xmod_files 112fi 113 114if [ -f $SRC/tools/opensolaris/license-list ]; then 115 excl= 116 if [ "$CLOSED_IS_PRESENT" = no ]; then 117 excl="-e ^usr/closed" 118 fi 119 sed -e 's/$/.descrip/' < $SRC/tools/opensolaris/license-list | \ 120 validate_paths $excl 121fi 122 123# Finally, make sure the that (req|inc).flg files are in good shape. 124# If SCCS files are not expected to be present, though, then don't 125# check them. 126if [ ! -d "$CODEMGR_WS/Codemgr_wsdata" ]; then 127 f_flg='-f' 128fi 129# If the closed source is not present, then don't validate it. 130if [ "$CLOSED_IS_PRESENT" = no ]; then 131 excl="-e ^usr/closed/" 132fi 133 134validate_flg $f_flg $excl 135 136exit 0 137