Whamcloud - gitweb
b=20478
authorbrian <brian>
Thu, 20 Aug 2009 13:58:26 +0000 (13:58 +0000)
committerbrian <brian>
Thu, 20 Aug 2009 13:58:26 +0000 (13:58 +0000)
i=wangyb
i=adilger

Fix bug where version_tag.pl failed when there was no kernel source
available.

lustre/scripts/version_tag.pl

index 84365b1..31978cf 100644 (file)
@@ -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";
     }
 }