summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/tools/scripts/checkpaths.sh38
-rw-r--r--usr/src/tools/scripts/validate_flg.pl53
2 files changed, 74 insertions, 17 deletions
diff --git a/usr/src/tools/scripts/checkpaths.sh b/usr/src/tools/scripts/checkpaths.sh
index ff707a078d..723ee14219 100644
--- a/usr/src/tools/scripts/checkpaths.sh
+++ b/usr/src/tools/scripts/checkpaths.sh
@@ -20,7 +20,7 @@
# CDDL HEADER END
#
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -59,6 +59,11 @@ else
rootlist="$CODEMGR_WS/proto/root_sparc $CODEMGR_WS/proto/root_i386"
fi
+# If the closed source is not present, then exclude IKE from validation.
+if [ "$CLOSED_IS_PRESENT" = no ]; then
+ excl="-e ^usr/include/ike/"
+fi
+
for ROOT in $rootlist
do
case "$ROOT" in
@@ -70,8 +75,8 @@ do
;;
esac
if [ -d $ROOT ]; then
- validate_paths '-s/\s*'$arch'$//' -e '^opt/onbld' -b $ROOT \
- $args $SRC/pkgdefs/etc/exception_list_$arch
+ validate_paths '-s/\s*'$arch'$//' -e '^opt/onbld' $excl \
+ -b $ROOT $args $SRC/pkgdefs/etc/exception_list_$arch
fi
done
@@ -84,17 +89,36 @@ done
# marked with ISUSED are always known to be good, thus the Latin quote
# at the top of the file.
if [ -r $SRC/tools/findunref/exception_list ]; then
- validate_paths -k ISUSED -r -e '^\*' -b $SRC/.. \
+ # If the closed source is not present, then don't validate it.
+ if [ "$CLOSED_IS_PRESENT" = no ]; then
+ excl="-e ^\./closed"
+ fi
+ validate_paths -k ISUSED -r -e '^\*' $excl -b $SRC/.. \
$SRC/tools/findunref/exception_list
fi
# These are straightforward.
if [ -d $SRC/xmod ]; then
- validate_paths $SRC/xmod/cry_files
- validate_paths -b $SRC $SRC/xmod/xmod_files
+ # If the closed source is not present, then don't validate it.
+ if [ "$CLOSED_IS_PRESENT" = no ]; then
+ excl_cry="-e ^usr/closed"
+ excl_xmod="-e ^../closed"
+ fi
+ validate_paths $excl_cry $SRC/xmod/cry_files
+ validate_paths $excl_xmod -b $SRC $SRC/xmod/xmod_files
fi
# Finally, make sure the that (req|inc).flg files are in good shape.
-validate_flg
+# If SCCS files are not expected to be present, though, then don't
+# check them.
+if [ ! -d "$CODEMGR_WS/Codemgr_wsdata" ]; then
+ f_flg='-f'
+fi
+# If the closed source is not present, then don't validate it.
+if [ "$CLOSED_IS_PRESENT" = no ]; then
+ excl="-e ^usr/closed/"
+fi
+
+validate_flg $f_flg $excl
exit 0
diff --git a/usr/src/tools/scripts/validate_flg.pl b/usr/src/tools/scripts/validate_flg.pl
index b0c2390ea7..91df343b76 100644
--- a/usr/src/tools/scripts/validate_flg.pl
+++ b/usr/src/tools/scripts/validate_flg.pl
@@ -3,9 +3,8 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
@@ -21,7 +20,7 @@
# CDDL HEADER END
#
-# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
@@ -30,7 +29,7 @@ use strict;
use File::Find ();
require v5.6.1;
-use vars qw/$f_flg *name *dir @execlist $basedir/;
+use vars qw/$f_flg *name *dir @execlist $basedir @opt_e @exclude/;
*name = *File::Find::name;
*dir = *File::Find::dir;
@@ -46,12 +45,16 @@ sub sccs_empty {
# Not pretty, but simple enough to work for the known cases.
# Does not bother with curly braces or fancy substitutions.
+# Returns undef if this pattern is excluded.
sub expand {
my ($str) = @_;
while ($str =~ /\$(\w+)/) {
my $newstr = $ENV{$1};
$str =~ s/\$$1/$newstr/g;
}
+ foreach my $pat (@exclude) {
+ return undef if $str =~ /$pat/;
+ }
$str;
}
@@ -92,11 +95,11 @@ sub process_file {
}
$cont = 0;
if ($text =~ /\s*echo_file\s+(\S+)/) {
- $expfile = expand($1);
+ next if !defined($expfile = expand($1));
warn "$fname:$firstline: $1 isn't a file\n" if ! -f $expfile;
} elsif ($text =~ /\s*find_files\s+['"]([^'"]+)['"]\s+(.*)/) {
foreach my $dir (split(/\s+/, "$2")) {
- $expfile = expand($dir);
+ next if !defined($expfile = expand($dir));
if (! -d $expfile) {
warn "$fname:$firstline: $dir isn't a directory\n";
} elsif ($isincflg && $expfile eq $dname) {
@@ -107,7 +110,7 @@ sub process_file {
}
}
} elsif ($text =~ /\s*exec_file\s+(\S+)/) {
- $expfile = expand($1);
+ next if !defined($expfile = expand($1));
if (-f $expfile) {
push @execlist, $expfile, "$newpath:$firstline";
} else {
@@ -129,8 +132,38 @@ sub wanted {
process_file($_, undef) if /\/(inc|req)\.flg$/ && -f $_;
}
-$f_flg = $ARGV[0] eq "-f";
-shift @ARGV if $f_flg;
+sub next_arg {
+ my ($arg) = @_;
+ if ($arg eq "") {
+ die "$0: missing argument for $_\n" if $#ARGV == -1;
+ $arg = shift @ARGV;
+ }
+ $arg;
+}
+
+# I'd like to use Perl's getopts here, but it doesn't handle repeated
+# options, and using comma separators is just too ugly.
+# This doesn't handle combined options (as in '-rm'), but I don't care.
+my $arg;
+while ($#ARGV >= 0) {
+ $_ = $ARGV[0];
+ last if /^[^-]/;
+ shift @ARGV;
+ last if /^--$/;
+ SWITCH: {
+ /^-f/ && do { $f_flg = 1; last SWITCH; };
+ if (/^-e(.*)$/) {
+ $arg = next_arg($1);
+ push @opt_e, $arg;
+ last SWITCH;
+ }
+ print "$0: unknown option $_\n";
+ usage();
+ }
+}
+
+# compile the 'exclude' regexps
+@exclude = map qr/$_/x, @opt_e;
$basedir = "usr";
if ($#ARGV == 0) {