From 1912ebfa0e74322dcb9c5c19f7480b5d9cca2b9a Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 20 Aug 2009 13:58:26 +0000 Subject: [PATCH] b=20478 i=wangyb i=adilger Fix bug where version_tag.pl failed when there was no kernel source available. --- lustre/scripts/version_tag.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lustre/scripts/version_tag.pl b/lustre/scripts/version_tag.pl index 84365b1..31978cf 100644 --- a/lustre/scripts/version_tag.pl +++ b/lustre/scripts/version_tag.pl @@ -154,6 +154,10 @@ sub get_linuxdir() $dir = $1; } elsif ($line =~ /LINUX_OBJ :?= (.*)/) { $objdir = $1; + } elsif ($line =~ /MODULES_TRUE :?= (.*)/) { + # nothing to do if modules are not being built + return "" + if ($1 eq "#"); last; } } @@ -165,6 +169,7 @@ sub get_linuxdir() !$ver->open("$dir/include/linux/version.h")) { die "Run make dep on $dir\n"; } + while(defined($line = <$ver>)) { $line =~ /\#define UTS_RELEASE "(.*)"/; if ($1) { @@ -198,6 +203,13 @@ sub generate_ver($$$) my $mtime = shift; my $linuxdir = shift; + # assume building without modules + my $postfix = ""; + + if ($linuxdir ne "") { + $postfix = "-$kernver"; + } + #print "localtime: " . localtime($mtime) . "\n"; my $lustre_vers = $ENV{LUSTRE_VERS}; @@ -215,9 +227,9 @@ sub generate_ver($$$) # lines. maybe we only want to print -CHANGED when something is changed # and print nothing when it's pristine if ($pristine) { - print "$tag-$show_last-PRISTINE-$linuxdir-$kernver\"\n"; + print "$tag-$show_last-PRISTINE$postfix\"\n"; } else { - print "$tag-$show_last-CHANGED-$linuxdir-$kernver\"\n"; + print "$tag-$show_last-CHANGED$postfix\"\n"; } } -- 1.8.3.1