Whamcloud - gitweb
b=18948 Speedy recovery
[fs/lustre-release.git] / lustre / scripts / version_tag.pl
index 84365b1..92655e1 100644 (file)
@@ -154,7 +154,10 @@ sub get_linuxdir()
             $dir = $1;
         } elsif ($line =~ /LINUX_OBJ :?= (.*)/) {
             $objdir = $1;
-            last;
+        } elsif ($line =~ /MODULES_TRUE = #/ ||
+                $line =~ /MODULE_TARGET = $/) {
+            # nothing to do if modules are not being built
+            return ""
         }
     }
     $config->close();
@@ -163,8 +166,9 @@ sub get_linuxdir()
         !$ver->open("$objdir/include/linux/version.h") &&
         !$ver->open("$dir/include/linux/utsrelease.h") &&
         !$ver->open("$dir/include/linux/version.h")) {
-            die "Run make dep on $dir\n";
+            die "Run make dep on '$dir'\n";
         }
+
     while(defined($line = <$ver>)) {
         $line =~ /\#define UTS_RELEASE "(.*)"/;
         if ($1) {
@@ -198,6 +202,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 +226,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";
     }
 }