From af854b4e2f19e5f1a83b686e99ca3dd6122af942 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 17 Mar 2011 19:28:23 +0000 Subject: [PATCH] rpms: Make makesrpm.pl cater for new rpm names Starting from 1.6.0, our specfile no longer adds a stray '1.' to the start of the release field. makesrpm.pl was failing to deal with these new-style names and therefore not actually making an rpm. Fix this by conditionalising on the OpenAFS version when selecting which rpm to copy. Change-Id: I36b32ccc20baa167f46e5095eacb38a8e7d65e27 Cc: Alexander Redinger Reviewed-on: http://gerrit.openafs.org/4258 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Derrick Brashear --- src/packaging/RedHat/makesrpm.pl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/packaging/RedHat/makesrpm.pl b/src/packaging/RedHat/makesrpm.pl index 733f90df9..320ea0c64 100755 --- a/src/packaging/RedHat/makesrpm.pl +++ b/src/packaging/RedHat/makesrpm.pl @@ -71,6 +71,13 @@ if (not defined($afsversion)) { $afsversion = `"$srcdir/build-tools/git-version" "$srcdir"`; } +# 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 +$afsversion=~/([0-9]+)\.([0-9]+)\.([0-9]+)/; +my $major = $1; +my $minor = $2; +my $patchlevel = $3; + # Build the RPM root print "Building version $afsversion\n"; @@ -148,9 +155,18 @@ system("rpmbuild -bs --define \"_topdir $tmpdir/rpmdir\" ". or die "rpmbuild failed : $!\n"; # Copy it out to somewhere useful -File::Copy::copy("$tmpdir/rpmdir/SRPMS/openafs-$linuxver-1.$linuxrel.src.rpm", - "openafs-$linuxver-1.$linuxrel.src.rpm") - or die "Unable to copy output RPM : $!\n"; +if ($major > 1 || ($major == 1 && $minor >= 6)) { + File::Copy::copy("$tmpdir/rpmdir/SRPMS/openafs-$linuxver-$linuxrel.src.rpm", + "openafs-$linuxver-$linuxrel.src.rpm") + or die "Unable to copy output RPM : $!\n"; + + print "SRPM is openafs-$linuxver-$linuxrel.src.rpm\n"; +} else { + File::Copy::copy("$tmpdir/rpmdir/SRPMS/openafs-$linuxver-1.$linuxrel.src.rpm", + "openafs-$linuxver-1.$linuxrel.src.rpm") + or die "Unable to copy output RPM : $!\n"; + + print "SRPM is openafs-$linuxver-1.$linuxrel.src.rpm\n"; +} -print "SRPM is openafs-$linuxver-1.$linuxrel.src.rpm\n"; -- 2.39.5