diff --git a/meta/ancestry.pl b/meta/ancestry.pl
index 29f6115fc..2dabccb2c 100755
--- a/meta/ancestry.pl
+++ b/meta/ancestry.pl
@@ -36,15 +36,27 @@
my %options = ();
-getopts("dsASlDH:", \%options);
+use Getopt::Long qw(GetOptions Configure);
+Configure(qw(no_ignore_case));
-our $optionPrintDebug = 1 if defined $options{d};
-our $optionDisableAspell = 1 if defined $options{A};
-our $optionUseXmlSimple = 1 if defined $options{s};
-our $optionDisableStyleCheck = 1 if defined $options{S};
-our $optionShowLogCaller = 1 if defined $options{l};
-our $optionDumpHistoryFile = 1 if defined $options{D};
-our $optionHistoryFile = $options{H} if defined $options{H};
+my ($optionPrintDebug, $optionDisableAspell, $optionUseXmlSimple,
+ $optionDisableStyleCheck, $optionShowLogCaller, $optionDumpHistoryFile,
+ $optionHistoryFile, $mydir);
+
+my @mycommits;
+
+GetOptions(
+ 'd|debug' => \$optionPrintDebug,
+ 'A|no-aspell' => \$optionDisableAspell,
+ 's|xmlsimple' => \$optionUseXmlSimple,
+ 'S|no-style' => \$optionDisableStyleCheck,
+ 'l|show-caller' => \$optionShowLogCaller,
+ 'D|dump-history' => \$optionDumpHistoryFile,
+ 'H|history-file=s' => \$optionHistoryFile,
+
+ 'dir=s' => \$mydir, # Directory to process, e.g. inc or meta (default: inc)
+ 'commits=s{,}' => \@mycommits, # --commits c1 c2 c3 ...
+) or die "Usage: $0 [opts] --dir
--commits [c2 ...]\n";
$SIG{__DIE__} = sub
{
@@ -127,13 +139,15 @@ sub ProcessHeaders
{
my $commit = shift;
- my @headers = GetHeaderFiles("temp/commit-$commit/inc");
+ my $dir = defined($mydir) ? $mydir : 'inc';
+ my $path = "temp/commit-$commit/$dir";
+
+ my @headers = GetHeaderFiles($path);
for my $header (@headers)
{
- LogDebug "Processing $header";
-
- ProcessSingleHeader "temp/commit-$commit/inc/$header";
+ LogDebug "Processing $path/$header";
+ ProcessSingleHeader "$path/$header";
}
}
@@ -245,7 +259,7 @@ sub CleanData
LogInfo "loaded history from $optionHistoryFile";
}
-for my $commit (@ARGV)
+for my $commit (@mycommits)
{
# reset
@@ -264,7 +278,7 @@ sub CleanData
ExitOnErrorsOrWarnings();
-if (defined $optionDumpHistoryFile and (scalar @ARGV > 0))
+if (defined $optionDumpHistoryFile and (scalar @mycommits > 0))
{
$Data::Dumper::Indent = 0;
@@ -272,7 +286,7 @@ sub CleanData
$history =~ s/ //g;
- my $lastCommit = $ARGV[-1];
+ my $lastCommit = $mycommits[-1];
WriteFile("ancestry.$lastCommit.history", $history);
diff --git a/meta/checkancestry.sh b/meta/checkancestry.sh
index 96da0066c..6ceb7a286 100755
--- a/meta/checkancestry.sh
+++ b/meta/checkancestry.sh
@@ -76,16 +76,18 @@ function create_temp_dir()
function checkout_inc_directories()
{
- echo "git checkout work tree commits:" $LIST
+ echo "git checkout work tree commits:" $LIST_INC
- for commit in $LIST
+ for commit in $LIST_INC
do
#echo working on commit $commit
mkdir temp/commit-$commit
mkdir temp/commit-$commit/inc
+ mkdir temp/commit-$commit/meta
git --work-tree=temp/commit-$commit checkout $commit inc 2>/dev/null
+ git --work-tree=temp/commit-$commit checkout $commit meta 2>/dev/null
done
}
@@ -101,12 +103,21 @@ function create_commit_list()
echo "git rev list from $begin to $end"
- LIST=$(git rev-list --ancestry-path ${begin}^..${end} | xargs -n 1 git rev-parse --short | tac)
+ local FULL_LIST=$(git rev-list --ancestry-path ${begin}^..${end} | xargs -n 1 git rev-parse --short | tac)
+
+ local skip_begin=$3
+ local skip_end=$4
+ local SKIP_LIST=$(git rev-list --ancestry-path ${skip_begin}^..${skip_end} | xargs -n 1 git rev-parse --short | tac)
+
+ LIST_INC=$FULL_LIST
+ LIST_META=$(grep -vxFf <(echo "$SKIP_LIST") <<< "$FULL_LIST")
+
}
function check_enum_history()
{
- perl ancestry.pl -H "ancestry.1f2bca1.history" $LIST
+ perl ancestry.pl -H "ancestry.1f2bca1.history" --dir "inc" --commits $LIST_INC
+ perl ancestry.pl -H "ancestry.1f2bca1.history" --dir "meta" --commits $LIST_META
}
#
@@ -123,11 +134,17 @@ function check_enum_history()
BEGIN_COMMIT=3132018 # from this commit we are backward compatible
BEGIN_COMMIT=1f2bca1 # to this commit we have history file
+
+# commits from skip_begin to skip_end are skipped from backward compatibility check
+# due to a regression in meta directory which was earlier excluded from this check
+SKIP_BEGIN=401bd1f
+SKIP_END=77578c8
+
END_COMMIT=HEAD
clean_temp_dir
create_temp_dir
-create_commit_list $BEGIN_COMMIT $END_COMMIT
+create_commit_list $BEGIN_COMMIT $END_COMMIT $SKIP_BEGIN $SKIP_END
checkout_inc_directories
check_enum_history
clean_temp_dir
diff --git a/meta/checkenumlock.sh b/meta/checkenumlock.sh
index 39bbed47c..02511df7a 100755
--- a/meta/checkenumlock.sh
+++ b/meta/checkenumlock.sh
@@ -37,10 +37,14 @@ rm -rf $TEMP_DIR
mkdir $TEMP_DIR
-git --work-tree=$TEMP_DIR/ checkout origin/master inc experimental
+git --work-tree=$TEMP_DIR/ checkout origin/master inc experimental meta
echo "Checking for possible enum values shift (current branch vs origin/master) ..."
./checkheaders.pl -s ../inc/ $TEMP_DIR/inc/
+./checkheaders.pl -s ../meta/ $TEMP_DIR/meta/
+
+./checkheaders.pl -s ../experimental/ $TEMP_DIR/experimental/
+
rm -rf $TEMP_DIR
diff --git a/meta/checkheaders.pl b/meta/checkheaders.pl
index 037e11818..e3a1f2405 100755
--- a/meta/checkheaders.pl
+++ b/meta/checkheaders.pl
@@ -104,6 +104,8 @@ sub GetEnums
for my $file (@files)
{
+ next if $file eq "saimetadata.h";
+
my $data = ReadHeaderFile("$dir/$file");
my %en = FilterEnums($data, "$dir/$file");
@@ -122,7 +124,21 @@ sub ConstructSource
my $source = "#include \n";
- $source .= "#include \"$dir/sai.h\"\n";
+ $source .= "#include \"$dir/../inc/sai.h\"\n";
+
+ if( ! -e "$dir/sai.h") {
+
+ my @files = GetHeaderFiles $dir;
+
+ for my $file (@files)
+ {
+ if ($file =~ /\.h$/)
+ {
+ $source .= "#include \"$dir/$file\"\n";
+ }
+ }
+ }
+
$source .="int main() { ";
for my $en (sort keys %enums)
@@ -149,7 +165,7 @@ sub GetValues
my ($fhb, $bin) = tempfile( SUFFIX => '.bin', UNLINK => 1 );
- system("gcc $src -I. -I '$dir'/../experimental -I '$dir/../custom/' -I '$dir' -o $bin") == 0 or die "gcc failed! $!";
+ system("gcc $src -I. -I '$dir'/../experimental -I '$dir/../custom/' -I '$dir/../inc/' -I '$dir' -o $bin") == 0 or die "gcc failed! $!";
close $fhs;
close $fhb;