mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
Merge
This commit is contained in:
commit
a85165912b
2 changed files with 63 additions and 28 deletions
|
@ -3,14 +3,12 @@
|
|||
# Do-rpm - compile RPM packages out of a source tarball and move the
|
||||
# resulting RPM packages into the current directory.
|
||||
#
|
||||
# The script currently assumes the following environment (which should exist
|
||||
# like that, if the Do-compile script was used to build the binary
|
||||
# distribution)
|
||||
# The script currently assumes the following environment:
|
||||
#
|
||||
# - there must be a source distribution (mysql-<version>.tar.gz)
|
||||
# in the current directory
|
||||
# - there must be a spec file (mysql-<version>.spec) in the directory
|
||||
# $HOME/<hostname>/mysql-<version>/support-files/
|
||||
# - You must provide the name of an RPM spec file (mysql-<version>.spec)
|
||||
# as the argument
|
||||
#
|
||||
# Use the "--help" option for more info!
|
||||
#
|
||||
|
@ -35,7 +33,10 @@ $opt_log= undef;
|
|||
$opt_mail= "";
|
||||
$opt_verbose= undef;
|
||||
|
||||
# Set a dummy version until we know the correct one
|
||||
$VERSION= "x.y.z";
|
||||
$MAJOR= $MINOR= $RELEASE= 0;
|
||||
$SUFFIX= "";
|
||||
|
||||
GetOptions(
|
||||
"cc=s",
|
||||
|
@ -50,7 +51,9 @@ GetOptions(
|
|||
"verbose|v",
|
||||
) || &print_help;
|
||||
|
||||
defined($VERSION=$ARGV[0]) || print_help("Please provide the MySQL version!");
|
||||
&print_help("") if ($opt_help);
|
||||
|
||||
defined($SPECFILE=$ARGV[0]) || print_help("Please provide the spec file name!");
|
||||
|
||||
# Include helper functions
|
||||
$PWD= cwd();
|
||||
|
@ -64,6 +67,28 @@ else
|
|||
die "ERROR: $LOGGER cannot be found!\n";
|
||||
}
|
||||
|
||||
# Open the spec file and extract the version number
|
||||
open(SPEC, $SPECFILE) or &abort("Unable to open \"$ARGV[0]\": $!");
|
||||
@spec= <SPEC>;
|
||||
close SPEC;
|
||||
|
||||
foreach (@spec)
|
||||
{
|
||||
if (m/^%define\s*mysql_version\s*(.*)/)
|
||||
{
|
||||
$VERSION= $1;
|
||||
($MAJOR, $MINOR, $RELEASE)= split(/\./,$VERSION);
|
||||
($RELEASE, $SUFFIX)= split(/\-/,$RELEASE);
|
||||
$SUFFIX= "-" . $SUFFIX if ($SUFFIX);
|
||||
}
|
||||
}
|
||||
|
||||
$HOST= hostname();
|
||||
$HOST=~ /^([^.-]*)/;
|
||||
$HOST= $1;
|
||||
$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log";
|
||||
&logger("Using spec file for version: $VERSION");
|
||||
|
||||
#
|
||||
# Override predefined Log file name
|
||||
#
|
||||
|
@ -82,14 +107,6 @@ if (defined $opt_log)
|
|||
}
|
||||
}
|
||||
|
||||
($MAJOR, $MINOR, $RELEASE)= split(/\./, $VERSION);
|
||||
$HOST= hostname();
|
||||
$HOST=~ /^([^.-]*)/;
|
||||
$HOST= $1;
|
||||
$LOGFILE= "$PWD/Logs/Do-rpm-$HOST-$MAJOR.$MINOR.log";
|
||||
|
||||
&print_help("") if ($opt_help);
|
||||
|
||||
#
|
||||
# Newer RPM versions ship with a separate tool "rpmbuild" to build RPMs
|
||||
#
|
||||
|
@ -120,8 +137,7 @@ chomp($SOURCEDIR= `$RPM --eval "%{_sourcedir}" 2> /dev/null`);
|
|||
chomp($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`);
|
||||
chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
|
||||
|
||||
$SOURCEFILE= "mysql-$VERSION.tar.gz";
|
||||
$SPECFILE= "$PWD/$HOST/mysql-$VERSION/support-files/mysql-$VERSION.spec";
|
||||
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
|
||||
|
||||
&logger("Starting RPM build of MySQL-$VERSION on $HOST");
|
||||
|
||||
|
@ -134,10 +150,13 @@ foreach $file ($SOURCEFILE, $SPECFILE)
|
|||
# Install source and spec file
|
||||
#
|
||||
&logger("Copying SOURCE and SPEC file to build directories.");
|
||||
copy($SOURCEFILE, $SOURCEDIR)
|
||||
or &abort("Unable to copy $SOURCEFILE to $SOURCEDIR!");
|
||||
copy($SPECFILE, $SPECDIR)
|
||||
or &abort("Unable to copy $SPECFILE to $SPECDIR!");
|
||||
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
|
||||
|
@ -168,11 +187,13 @@ $command.= basename($SPECFILE);
|
|||
$command= "mv";
|
||||
$command.= " -v " if ($opt_verbose);
|
||||
$command.= "$SRCRPMDIR/MySQL*$VERSION*.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";
|
||||
&logger("Moving binary RPMs to current dir.");
|
||||
&run_command($command, "Error moving binary RPMs!");
|
||||
|
||||
#
|
||||
|
@ -181,11 +202,14 @@ $command.= "$RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD";
|
|||
if ($opt_clean)
|
||||
{
|
||||
&logger("Removing spec file and source package");
|
||||
unlink("$SPECDIR/" . basename($SPECFILE));
|
||||
unlink("$SOURCEDIR/$SOURCEFILE");
|
||||
unless ($opt_dry_run)
|
||||
{
|
||||
unlink("$SPECDIR/" . basename($SPECFILE));
|
||||
unlink("$SOURCEDIR/$SOURCEFILE");
|
||||
}
|
||||
}
|
||||
|
||||
&logger("SUCCESS: RPM files successfully created.") if (!$opt_dry_run);
|
||||
&logger("SUCCESS: RPM files successfully created.") unless ($opt_dry_run);
|
||||
exit 0;
|
||||
|
||||
sub print_help
|
||||
|
@ -198,11 +222,14 @@ sub print_help
|
|||
}
|
||||
print <<EOF;
|
||||
|
||||
Usage: Do-rpm <options> <version>
|
||||
Usage: Do-rpm [options] <specfile>
|
||||
|
||||
Creates a binary RPM package out of a MySQL source distribution and moves the
|
||||
resulting RPMs into the current directory. <version> is the MySQL version
|
||||
number (e.g. 4.0.11-gamma)
|
||||
Creates a binary RPM package out of a MySQL source distribution and moves
|
||||
the resulting RPMs into the current directory. <specfile> is the MySQL RPM
|
||||
spec file to use (e.g. mysql-4.0.17.spec).
|
||||
|
||||
This script expects to find the required MySQL source distribution
|
||||
(mysql-<version>.tar.gz) in the current directory.
|
||||
|
||||
Options:
|
||||
|
||||
|
@ -222,6 +249,10 @@ Options:
|
|||
Example: --mail=user\\\@domain.com
|
||||
-v, --verbose Verbose execution
|
||||
|
||||
Example:
|
||||
|
||||
Do-rpm -cv mysql-4.0.17.spec
|
||||
|
||||
EOF
|
||||
exit 1;
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ export PATH
|
|||
|
||||
# If we want to compile with RAID using gcc 3, we need to use
|
||||
# gcc instead of g++ to avoid linking problems (RAID code is written in C++)
|
||||
if gcc -v 2>&1 | grep 'version 3' > /dev/null 2>&1
|
||||
test -z $CXX && test -z $CC && if gcc -v 2>&1 | grep 'gcc version 3' > /dev/null 2>&1
|
||||
then
|
||||
export CXX="gcc"
|
||||
fi
|
||||
|
@ -567,6 +567,10 @@ fi
|
|||
# The spec file changelog only includes changes made to the spec file
|
||||
# itself
|
||||
%changelog
|
||||
* Thu Dec 11 2003 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- made testing for gcc3 a bit more robust
|
||||
|
||||
* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com>
|
||||
|
||||
- removed dependency on MySQL-client from the MySQL-devel subpackage
|
||||
|
|
Loading…
Reference in a new issue