Commit c7e61b8e authored by patg@krsna.patg.net's avatar patg@krsna.patg.net

Do-rpm:

  Small fix to handle the src rpm file correctly (contains '0', release number in spec file)
parent 580cb3dd
...@@ -22,6 +22,7 @@ use Getopt::Long; ...@@ -22,6 +22,7 @@ use Getopt::Long;
Getopt::Long::Configure ("bundling"); Getopt::Long::Configure ("bundling");
use Sys::Hostname; use Sys::Hostname;
$opt_nobuild = undef;
$opt_cc= undef; $opt_cc= undef;
$opt_cflags= undef; $opt_cflags= undef;
$opt_clean= undef; $opt_clean= undef;
...@@ -48,6 +49,7 @@ GetOptions( ...@@ -48,6 +49,7 @@ GetOptions(
"help|h", "help|h",
"log|l:s", "log|l:s",
"mail|m=s", "mail|m=s",
"nobuild",
"verbose|v", "verbose|v",
) || &print_help; ) || &print_help;
...@@ -79,7 +81,10 @@ foreach (@spec) ...@@ -79,7 +81,10 @@ foreach (@spec)
if (m/^%define\s*mysql_version\s*(.*)/) if (m/^%define\s*mysql_version\s*(.*)/)
{ {
$VERSION= $1; $VERSION= $1;
$VERSION_SRPM=$VERSION;
($MAJOR, $MINOR, $RELEASE)= split(/\./,$VERSION); ($MAJOR, $MINOR, $RELEASE)= split(/\./,$VERSION);
$VERSION_SRPM= $MAJOR . '.' . $MINOR . '.' . $RELEASE;
$VERSION_SRPM =~ s/\-\w+$//;
($RELEASE, $SUFFIX)= split(/\-/,$RELEASE); ($RELEASE, $SUFFIX)= split(/\-/,$RELEASE);
$SUFFIX= "-" . $SUFFIX if ($SUFFIX); $SUFFIX= "-" . $SUFFIX if ($SUFFIX);
} }
...@@ -143,60 +148,64 @@ chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`); ...@@ -143,60 +148,64 @@ chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz"; $SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
&logger("Starting RPM build of MySQL-$VERSION on $HOST"); unless($opt_nobuild) {
foreach $file ($SOURCEFILE, $SPECFILE) &logger("Starting RPM build of MySQL-$VERSION on $HOST");
{
&abort("Unable to find $file!") unless (-f "$file"); foreach $file ($SOURCEFILE, $SPECFILE)
} {
&abort("Unable to find $file!") unless (-f "$file");
}
# #
# Install source and spec file # Install source and spec file
# #
&logger("Copying SOURCE and SPEC file to build directories."); &logger("Copying SOURCE and SPEC file to build directories.");
unless ($opt_dry_run) unless ($opt_dry_run)
{ {
copy($SOURCEFILE, $SOURCEDIR) copy($SOURCEFILE, $SOURCEDIR)
or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!"); or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
copy($SPECFILE, $SPECDIR) copy($SPECFILE, $SPECDIR)
or &abort("Unable to copy $SPECFILE to $SPECDIR!"); or &abort("Unable to copy $SPECFILE to $SPECDIR!");
} }
# #
# Set environment variables - these are being used in the # Set environment variables - these are being used in the
# official MySQL RPM spec file # official MySQL RPM spec file
# #
&logger("Setting special build environment variables") &logger("Setting special build environment variables")
if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx); if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc); $ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags); $ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags); $ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx); $ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
# #
# Build the RPMs # Build the RPMs
# #
$command= "$RPM"; $command= "$RPM";
$command.= " -v" if ($opt_verbose); $command.= " -v" if ($opt_verbose);
$command.= " -ba"; $command.= " -ba";
$command.= " --clean $RMSOURCE" if $opt_clean; $command.= " --clean $RMSOURCE" if $opt_clean;
$command.= " $SPECDIR/"; $command.= " $SPECDIR/";
$command.= basename($SPECFILE); $command.= basename($SPECFILE);
&logger("Building RPM."); &logger("Building RPM.");
&run_command($command, "Error while building the RPMs!"); &run_command($command, "Error while building the RPMs!");
}
# #
# Move the resulting RPMs into the pwd # Move the resulting RPMs into the pwd
# #
$command= "mv"; $command= "mv";
$command.= " -v " if ($opt_verbose); $command.= " -v " if ($opt_verbose);
$command.= " $SRCRPMDIR/MySQL*$VERSION*.src.rpm $PWD"; $command.= " $SRCRPMDIR/MySQL*$VERSION_SRPM*.src.rpm $PWD";
&logger("Moving source RPM to current dir."); &logger("Moving source RPM to current dir.");
&run_command($command, "Error moving source RPM!"); &run_command($command, "Error moving source RPM!");
$command= "mv"; $command= "mv";
$command.= " -v " if ($opt_verbose); $command.= " -v " if ($opt_verbose);
$command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD"; # $command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD";
$command.= " $RPMDIR/$RPMARCH/MySQL*$VERSION_SRPM*.$RPMARCH.rpm $PWD";
&logger("Moving binary RPMs to current dir."); &logger("Moving binary RPMs to current dir.");
&run_command($command, "Error moving binary RPMs!"); &run_command($command, "Error moving binary RPMs!");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment