summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBuild-tools/Do-rpm67
1 files changed, 38 insertions, 29 deletions
diff --git a/Build-tools/Do-rpm b/Build-tools/Do-rpm
index 7da8b022031..da06e1f58e4 100755
--- a/Build-tools/Do-rpm
+++ b/Build-tools/Do-rpm
@@ -22,6 +22,7 @@ use Getopt::Long;
Getopt::Long::Configure ("bundling");
use Sys::Hostname;
+$opt_nobuild = undef;
$opt_cc= undef;
$opt_cflags= undef;
$opt_clean= undef;
@@ -48,6 +49,7 @@ GetOptions(
"help|h",
"log|l:s",
"mail|m=s",
+ "nobuild",
"verbose|v",
) || &print_help;
@@ -79,7 +81,10 @@ foreach (@spec)
if (m/^%define\s*mysql_version\s*(.*)/)
{
$VERSION= $1;
+ $VERSION_SRPM=$VERSION;
($MAJOR, $MINOR, $RELEASE)= split(/\./,$VERSION);
+ $VERSION_SRPM= $MAJOR . '.' . $MINOR . '.' . $RELEASE;
+ $VERSION_SRPM =~ s/\-\w+$//;
($RELEASE, $SUFFIX)= split(/\-/,$RELEASE);
$SUFFIX= "-" . $SUFFIX if ($SUFFIX);
}
@@ -143,60 +148,64 @@ chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
-&logger("Starting RPM build of MySQL-$VERSION on $HOST");
+unless($opt_nobuild) {
-foreach $file ($SOURCEFILE, $SPECFILE)
-{
- &abort("Unable to find $file!") unless (-f "$file");
-}
+ &logger("Starting RPM build of MySQL-$VERSION on $HOST");
+
+ foreach $file ($SOURCEFILE, $SPECFILE)
+ {
+ &abort("Unable to find $file!") unless (-f "$file");
+ }
#
# Install source and spec file
#
-&logger("Copying SOURCE and SPEC file to build directories.");
-unless ($opt_dry_run)
-{
- copy($SOURCEFILE, $SOURCEDIR)
- or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
- copy($SPECFILE, $SPECDIR)
- or &abort("Unable to copy $SPECFILE to $SPECDIR!");
-}
+ &logger("Copying SOURCE and SPEC file to build directories.");
+ unless ($opt_dry_run)
+ {
+ copy($SOURCEFILE, $SOURCEDIR)
+ or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
+ copy($SPECFILE, $SPECDIR)
+ or &abort("Unable to copy $SPECFILE to $SPECDIR!");
+ }
#
# Set environment variables - these are being used in the
# official MySQL RPM spec file
#
-&logger("Setting special build environment variables")
-if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
-$ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
-$ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
-$ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
-$ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
+ &logger("Setting special build environment variables")
+ if ($opt_cc) or ($opt_cflags) or ($opt_cxxflags) or ($opt_cxx);
+ $ENV{MYSQL_BUILD_CC}=$opt_cc if ($opt_cc);
+ $ENV{MYSQL_BUILD_CFLAGS}=$opt_cflags if ($opt_cflags);
+ $ENV{MYSQL_BUILD_CXXFLAGS}=$opt_cxxflags if ($opt_cxxflags);
+ $ENV{MYSQL_BUILD_CXX}=$opt_cxx if ($opt_cxx);
#
# Build the RPMs
#
-$command= "$RPM";
-$command.= " -v" if ($opt_verbose);
-$command.= " -ba";
-$command.= " --clean $RMSOURCE" if $opt_clean;
-$command.= " $SPECDIR/";
-$command.= basename($SPECFILE);
-&logger("Building RPM.");
-&run_command($command, "Error while building the RPMs!");
+ $command= "$RPM";
+ $command.= " -v" if ($opt_verbose);
+ $command.= " -ba";
+ $command.= " --clean $RMSOURCE" if $opt_clean;
+ $command.= " $SPECDIR/";
+ $command.= basename($SPECFILE);
+ &logger("Building RPM.");
+ &run_command($command, "Error while building the RPMs!");
+}
#
# Move the resulting RPMs into the pwd
#
$command= "mv";
$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.");
&run_command($command, "Error moving source RPM!");
$command= "mv";
$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.");
&run_command($command, "Error moving binary RPMs!");