mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Merge
This commit is contained in:
commit
2cdf95dbcf
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
|
# Do-rpm - compile RPM packages out of a source tarball and move the
|
||||||
# resulting RPM packages into the current directory.
|
# resulting RPM packages into the current directory.
|
||||||
#
|
#
|
||||||
# The script currently assumes the following environment (which should exist
|
# The script currently assumes the following environment:
|
||||||
# like that, if the Do-compile script was used to build the binary
|
|
||||||
# distribution)
|
|
||||||
#
|
#
|
||||||
# - there must be a source distribution (mysql-<version>.tar.gz)
|
# - there must be a source distribution (mysql-<version>.tar.gz)
|
||||||
# in the current directory
|
# in the current directory
|
||||||
# - there must be a spec file (mysql-<version>.spec) in the directory
|
# - You must provide the name of an RPM spec file (mysql-<version>.spec)
|
||||||
# $HOME/<hostname>/mysql-<version>/support-files/
|
# as the argument
|
||||||
#
|
#
|
||||||
# Use the "--help" option for more info!
|
# Use the "--help" option for more info!
|
||||||
#
|
#
|
||||||
|
@ -35,7 +33,10 @@ $opt_log= undef;
|
||||||
$opt_mail= "";
|
$opt_mail= "";
|
||||||
$opt_verbose= undef;
|
$opt_verbose= undef;
|
||||||
|
|
||||||
|
# Set a dummy version until we know the correct one
|
||||||
|
$VERSION= "x.y.z";
|
||||||
$MAJOR= $MINOR= $RELEASE= 0;
|
$MAJOR= $MINOR= $RELEASE= 0;
|
||||||
|
$SUFFIX= "";
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
"cc=s",
|
"cc=s",
|
||||||
|
@ -50,7 +51,9 @@ GetOptions(
|
||||||
"verbose|v",
|
"verbose|v",
|
||||||
) || &print_help;
|
) || &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
|
# Include helper functions
|
||||||
$PWD= cwd();
|
$PWD= cwd();
|
||||||
|
@ -64,6 +67,28 @@ else
|
||||||
die "ERROR: $LOGGER cannot be found!\n";
|
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
|
# 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
|
# 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($SPECDIR= `$RPM --eval "%{_specdir}" 2> /dev/null`);
|
||||||
chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
|
chomp($SRCRPMDIR= `$RPM --eval "%{_srcrpmdir}" 2> /dev/null`);
|
||||||
|
|
||||||
$SOURCEFILE= "mysql-$VERSION.tar.gz";
|
$SOURCEFILE= glob "mysql*-$VERSION.tar.gz";
|
||||||
$SPECFILE= "$PWD/$HOST/mysql-$VERSION/support-files/mysql-$VERSION.spec";
|
|
||||||
|
|
||||||
&logger("Starting RPM build of MySQL-$VERSION on $HOST");
|
&logger("Starting RPM build of MySQL-$VERSION on $HOST");
|
||||||
|
|
||||||
|
@ -134,10 +150,13 @@ foreach $file ($SOURCEFILE, $SPECFILE)
|
||||||
# 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)
|
||||||
|
{
|
||||||
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
|
||||||
|
@ -168,11 +187,13 @@ $command.= basename($SPECFILE);
|
||||||
$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*.src.rpm $PWD";
|
||||||
|
&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";
|
||||||
|
&logger("Moving binary RPMs to current dir.");
|
||||||
&run_command($command, "Error moving binary RPMs!");
|
&run_command($command, "Error moving binary RPMs!");
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -181,11 +202,14 @@ $command.= "$RPMDIR/$RPMARCH/MySQL*$VERSION*.$RPMARCH.rpm $PWD";
|
||||||
if ($opt_clean)
|
if ($opt_clean)
|
||||||
{
|
{
|
||||||
&logger("Removing spec file and source package");
|
&logger("Removing spec file and source package");
|
||||||
|
unless ($opt_dry_run)
|
||||||
|
{
|
||||||
unlink("$SPECDIR/" . basename($SPECFILE));
|
unlink("$SPECDIR/" . basename($SPECFILE));
|
||||||
unlink("$SOURCEDIR/$SOURCEFILE");
|
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;
|
exit 0;
|
||||||
|
|
||||||
sub print_help
|
sub print_help
|
||||||
|
@ -198,11 +222,14 @@ sub print_help
|
||||||
}
|
}
|
||||||
print <<EOF;
|
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
|
Creates a binary RPM package out of a MySQL source distribution and moves
|
||||||
resulting RPMs into the current directory. <version> is the MySQL version
|
the resulting RPMs into the current directory. <specfile> is the MySQL RPM
|
||||||
number (e.g. 4.0.11-gamma)
|
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:
|
Options:
|
||||||
|
|
||||||
|
@ -222,6 +249,10 @@ Options:
|
||||||
Example: --mail=user\\\@domain.com
|
Example: --mail=user\\\@domain.com
|
||||||
-v, --verbose Verbose execution
|
-v, --verbose Verbose execution
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
Do-rpm -cv mysql-4.0.17.spec
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ export PATH
|
||||||
|
|
||||||
# If we want to compile with RAID using gcc 3, we need to use
|
# 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++)
|
# 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
|
then
|
||||||
export CXX="gcc"
|
export CXX="gcc"
|
||||||
fi
|
fi
|
||||||
|
@ -567,6 +567,10 @@ fi
|
||||||
# The spec file changelog only includes changes made to the spec file
|
# The spec file changelog only includes changes made to the spec file
|
||||||
# itself
|
# itself
|
||||||
%changelog
|
%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>
|
* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com>
|
||||||
|
|
||||||
- removed dependency on MySQL-client from the MySQL-devel subpackage
|
- removed dependency on MySQL-client from the MySQL-devel subpackage
|
||||||
|
|
Loading…
Add table
Reference in a new issue