From 1495088e4168a2ddf35135db872777b9e51823b3 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Tue, 8 Apr 2008 19:35:51 +0000 Subject: [PATCH] redhat-spec-updates-20080408 LICENSE IPL10 FIXES 93616 update to correctly fill in specfile from source tree --- configure-libafs.in | 5 ++++ configure.in | 5 ++++ src/packaging/RedHat/makesrpm.pl | 42 ++++++++++++++++++---------- src/packaging/RedHat/mockbuild.pl | 34 ++++++++++++++++------ src/packaging/RedHat/openafs.spec.in | 4 +-- 5 files changed, 65 insertions(+), 25 deletions(-) diff --git a/configure-libafs.in b/configure-libafs.in index 7d2e482d77..9986f7a7d3 100644 --- a/configure-libafs.in +++ b/configure-libafs.in @@ -2,8 +2,13 @@ AC_INIT(src/libafs/Makefile.common.in) AM_INIT_AUTOMAKE(openafs-libafs,devel) AC_CONFIG_HEADER(src/config/afsconfig.h) MACOS_VERSION=9.9.99 +LINUX_PKGVER=9.9.99 +#LINUX_PKGREL=0.pre3 +LINUX_PKGREL=0.pre0 AC_SUBST(MACOS_VERSION) +AC_SUBST(LINUX_PKGVER) +AC_SUBST(LINUX_PKGREL) define(OPENAFS_CONFIGURE_LIBAFS) AC_PROG_CC diff --git a/configure.in b/configure.in index d0c3a7afcc..e380f7e7a9 100644 --- a/configure.in +++ b/configure.in @@ -2,8 +2,13 @@ AC_INIT(src/config/stds.h) AM_INIT_AUTOMAKE(openafs,devel) AC_CONFIG_HEADER(src/config/afsconfig.h) MACOS_VERSION=9.9.99 +LINUX_PKGVER=9.9.99 +#LINUX_PKGREL=0.pre3 +LINUX_PKGREL=0.pre0 AC_SUBST(MACOS_VERSION) +AC_SUBST(LINUX_PKGVER) +AC_SUBST(LINUX_PKGREL) AC_PROG_CC AC_CHECK_PROGS(CPP,[/lib/cpp /usr/bin/cpp /usr/ccs/lib/cpp cpp],,[$PATH:/]) diff --git a/src/packaging/RedHat/makesrpm.pl b/src/packaging/RedHat/makesrpm.pl index 8dc5e5c2cc..406d7d0853 100755 --- a/src/packaging/RedHat/makesrpm.pl +++ b/src/packaging/RedHat/makesrpm.pl @@ -19,7 +19,7 @@ my $changelog = shift; my $cellservdb = shift; if (!$srcball && !$docball) { - printf "Usage: [ [ []]]\n"; + printf "Usage: makesrpm [ [ []]]\n"; exit(1); } @@ -42,30 +42,40 @@ 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.in file -my $version; +my $afsversion; +my $linuxver; +my $linuxrel; my $fh = new IO::File $srcdir."/configure.in" or die "Unable to find unpacked configure.in file"; while(<$fh>) { if (/AM_INIT_AUTOMAKE\(openafs,(.*)\)/) { - $version = $1; - last; + $afsversion = $1; + next; + } + if (/LINUX_PKGVER=(.*)/) { + $linuxver = $1; + next; + } + if (/LINUX_PKGREL=(.*)/) { + $linuxrel = $1; + next; } } undef $fh; # Build the RPM root -print "Building version $version\n"; +print "Building version $afsversion\n"; File::Path::mkpath([ $tmpdir."/rpmdir/SPECS", $tmpdir."/rpmdir/SRPMS", $tmpdir."/rpmdir/SOURCES"], 0, 0755); File::Copy::copy($srcball, - $tmpdir."/rpmdir/SOURCES/openafs-$version-src.tar.bz2") + $tmpdir."/rpmdir/SOURCES/openafs-$afsversion-src.tar.bz2") or die "Unable to copy $srcball into position\n"; File::Copy::copy($docball, - $tmpdir."/rpmdir/SOURCES/openafs-$version-doc.tar.bz2") + $tmpdir."/rpmdir/SOURCES/openafs-$afsversion-doc.tar.bz2") or die "Unable to copy $docball into position\n"; # Populate it with all the stuff in the packaging directory, except the @@ -90,9 +100,11 @@ chmod 0755, $tmpdir."/rpmdir/SOURCES/openafs-kvers-is.sh"; # Create the specfile. Use sed for this, cos its easier system("cat ".$srcdir."/src/packaging/RedHat/openafs.spec.in | ". - "sed -e 's/\@VERSION\@/$version/g' ". - " -e 's/\%define afsvers.*/%define afsvers $version/g' ". - " -e 's/\%define pkgvers.*/%define pkgvers $version/g' > ". + "sed -e 's/\@VERSION\@/$afsversion/g' ". + " -e 's/\@LINUX_PKGVER\@/$linuxver/g' ". + " -e 's/\@LINUX_PKGREL\@/$linuxrel/g' ". + " -e 's/\%define afsvers.*/%define afsvers $afsversion/g' ". + " -e 's/\%define pkgvers.*/%define pkgvers $linuxver/g' > ". $tmpdir."/rpmdir/SPECS/openafs.spec") == 0 or die "sed failed : $!\n"; @@ -106,11 +118,11 @@ if ($cellservdb) { if ($relnotes) { File::Copy::copy($relnotes, - $tmpdir."/rpmdir/SOURCES/RELNOTES-$version") + $tmpdir."/rpmdir/SOURCES/RELNOTES-$afsversion") or die "Unable to copy $relnotes into position\n"; } else { print "WARNING: No release notes provided. Using empty file\n"; - system("touch $tmpdir/rpmdir/SOURCES/RELNOTES-$version"); + system("touch $tmpdir/rpmdir/SOURCES/RELNOTES-$afsversion"); } if ($changelog) { @@ -128,9 +140,9 @@ 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-$version-1.1.src.rpm", - "openafs-$version-1.1.src.rpm") +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-$version-1.1.src.rpm\n"; +print "SRPM is openafs-$linuxver-1.$linuxrel.src.rpm\n"; diff --git a/src/packaging/RedHat/mockbuild.pl b/src/packaging/RedHat/mockbuild.pl index 77c19ddde5..ace74ca6b9 100755 --- a/src/packaging/RedHat/mockbuild.pl +++ b/src/packaging/RedHat/mockbuild.pl @@ -17,7 +17,7 @@ my $resultbase="/tmp/result/"; my $stashbase="/disk/scratch/repository/"; my $mockcommand = "/usr/bin/mock"; my $buildall = 0; - +my $ignorerelease = 1; my @newrpms; my %platconf = ( "fedora-5-i386" => { osver => "fc5", @@ -97,11 +97,18 @@ my %badkernels = ( "2.6.21-2950.fc8" => { "xen" => 1} # Missing build ID ); +my $help; +my $ok = GetOptions("resultdir=s" => \$resultbase, + "help" => \$help); + my @platforms = @ARGV; my $srpm = pop @platforms; -if (!$srpm || $#platforms==-1) { - print "Usage: $0 [ [ ...] ] \n"; +if (!$ok || $help || !$srpm || $#platforms==-1) { + print "Usage: $0 [options] [ [...]] \n"; + print " Options are : \n"; + print " --resultdir Location to place output RPMS\n"; + print "\n"; print " Platform may be:\n"; foreach ("all", sort(keys(%platconf))) { print " ".$_."\n"; }; exit(1); @@ -175,6 +182,9 @@ foreach my $platform (@platforms) { next if ($variant eq "xen0"); # Fedora 5 has some bad xen0 kernel-devels next if ($variant eq "smp"); } + if ($platform=~/fedora-8/) { + next if ($variant =~/debug$/); # Fedora 8 debug kernels are bad + } print "$arch : $variant : $version\n"; $modulelist{$arch} ={} if !$modulelist{$arch}; $modulelist{$arch}{$version} = {} if !$modulelist{$arch}{$version}; @@ -241,10 +251,18 @@ foreach my $platform (@platforms) { if (!-f $resultdir."/kmod-openafs-".$dvariant. $oafsversion."-".$oafsrelease.".".$kversion.".". $arch.".rpm") { - push @tobuild, $variant; - print $resultdir."/kmod-openafs-".$dvariant. - $oafsversion."-".$oafsrelease.".".$kversion.".". - $arch.".rpm is missing\n"; + my @done = glob ($resultdir."/kmod-openafs-".$dvariant. + $oafsversion."-*.".$kversion.".".$arch.".rpm"); + + if ($ignorerelease && $#done>=0) { + print "Kernel module for $kversion already exists for an". + "older release. Skipping building it this time.\n"; + } else { + push @tobuild, $variant; + print $resultdir."/kmod-openafs-".$dvariant. + $oafsversion."-".$oafsrelease.".".$kversion.".". + $arch.".rpm is missing\n"; + } } } } @@ -289,7 +307,7 @@ foreach my $platform (@platforms) { if (defined($dirh)) { my $file; while (defined($file = $dirh->read)) { - if ( $file=~/^kernel-devel/ && + if ( $file=~/^kernel.*devel/ && -f $yumcachedir.$file && ! -f $rpmstashdir.$file) { print "Stashing $file for later use\n"; system("cp ".$yumcachedir.$file." ".$rpmstashdir.$file) == 0 diff --git a/src/packaging/RedHat/openafs.spec.in b/src/packaging/RedHat/openafs.spec.in index b28f137f06..13d3b8a2b7 100644 --- a/src/packaging/RedHat/openafs.spec.in +++ b/src/packaging/RedHat/openafs.spec.in @@ -1,11 +1,11 @@ # Openafs Spec $Revision$ %define afsvers @VERSION@ -%define pkgvers @VERSION@ +%define pkgvers @LINUX_PKGVER@ # for beta/rc releases make pkgrel 0.X. # for real releases make pkgrel 1 (or more for extra releases) #%define pkgrel 0.1.rc1 -%define pkgrel 1 +%define pkgrel @LINUX_PKGREL@ %if %{?osvers:0}%{!?osvers:1} %define osvers 1