redhat: Avoid bogus dependencies when building the srpm
[openafs.git] / src / packaging / RedHat / makesrpm.pl
index 52bd88e..c46e994 100755 (executable)
@@ -43,24 +43,14 @@ die "Unable to find unpacked source code\n" if !$vdir;
 
 my $srcdir = $tmpdir."/".$vdir;
 
-# Work out which version we're dealing with from the configure.ac file
+# Work out which version we're dealing with from git-version script
+# (which may use a .version file)
 my $afsversion;
 my $linuxver;
 my $linuxrel;
-my $fh = new IO::File $srcdir."/configure.ac"
-  or die "Unable to find unpacked configure.ac file";
-while(<$fh>) {
-  next if (/^\s*\#/);
-
-  if (/AM_INIT_AUTOMAKE\(openafs,(.*)\)/) {
-    $afsversion = $1;
-    next;
-  }
-}
-undef $fh;
 
 if (not defined($afsversion)) {
-  $afsversion = `"$srcdir/build-tools/git-version" "$srcdir"`;
+  $afsversion = `"/bin/sh" "$srcdir/build-tools/git-version" "$srcdir"`;
 }
 
 # Build the Linux version and release information from the package version
@@ -82,10 +72,14 @@ if ($afsversion=~m/(.*)(pre[0-9]+)/) {
     $linuxrel=1;
 }
 
-if ($afsversion=~m/-([0-9]+)-(g[a-f0-9]+)$/) {
-    $linuxrel.=".$1.$2";
+if ($afsversion=~m/(.*)-([0-9]+)-(g[a-f0-9]+)$/) {
+    $linuxver = $1 if ($linuxver eq $afsversion);
+    $linuxrel.=".$2.$3";
 }
 
+print "Linux release is $linuxrel\n";
+print "Linux version is $linuxver\n";
+
 # Figure out a major, minor and release so that we know which version we're
 # building, and therefore what the srpm is going to be called
 $linuxver=~/([0-9]+)\.([0-9]+)\.([0-9]+)/;
@@ -165,7 +159,8 @@ if ($changelog) {
 }
 
 # Build an RPM
-system("rpmbuild -bs --define \"dist %undefined\" ".
+system("rpmbuild -bs --nodeps --define \"dist %undefined\" ".
+       "--define \"build_modules 0\" ".
        "--define \"_topdir $tmpdir/rpmdir\" ".
        "$tmpdir/rpmdir/SPECS/openafs.spec > /dev/null") == 0
   or die "rpmbuild failed : $!\n";