summaryrefslogtreecommitdiff
path: root/Build-tools
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-06-25 20:13:05 +0300
committerunknown <monty@mysql.com>2004-06-25 20:13:05 +0300
commitc6e23c85493688417c0274b4630a6b7c44f59d10 (patch)
tree983268d5f30394d4fa4ffdd75cd095f6227e5170 /Build-tools
parent4e664e3e43b1b0e2a37eadb8a6e28142db444352 (diff)
parent07589a6da51e7fb0b741cfca025202341bfa64e6 (diff)
downloadmariadb-git-c6e23c85493688417c0274b4630a6b7c44f59d10.tar.gz
Merge with 4.0 to get the latest bug patches to 4.1
BitKeeper/etc/ignore: added sql/mysql_tzinfo_to_sql BitKeeper/etc/logging_ok: auto-union acinclude.m4: Auto merged extra/perror.c: Auto merged include/mysql.h: Auto merged innobase/include/mach0data.ic: Auto merged innobase/include/mtr0log.h: Auto merged innobase/include/mtr0log.ic: Auto merged innobase/mem/mem0dbg.c: Auto merged innobase/pars/lexyy.c: Auto merged BitKeeper/deleted/.del-4.0.XX-gpl.ipr~f5909a9e9bd8094: Auto merged BitKeeper/deleted/.del-Clients and Tools.fgl~bf0f776883577f02: Auto merged BitKeeper/deleted/.del-Development.fgl~6392ce285e73f5fc: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/innodb_cache.result: Auto merged mysql-test/r/lowercase_table2.result: Auto merged mysql-test/t/innodb_cache.test: Auto merged mysql-test/t/lowercase_table2.test: Auto merged sql/ha_berkeley.cc: Auto merged sql/handler.cc: Auto merged scripts/make_win_src_distribution.sh: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_yacc.yy: Auto merged libmysql/libmysql.c: Merge with 4.0 mysql-test/r/bdb.result: Merge with 4.0 mysql-test/r/range.result: Merge with 4.0 mysql-test/t/bdb.test: Merge with 4.0 mysys/hash.c: Merge with 4.0 scripts/mysql_install_db.sh: Merge with 4.0 sql/field.cc: Merge with 4.0 sql/field.h: Merge with 4.0 sql/mysql_priv.h: Merge with 4.0 sql/sql_handler.cc: Merge with 4.0 sql/sql_select.cc: Merge with 4.0 sql/sql_table.cc: Merge with 4.0
Diffstat (limited to 'Build-tools')
-rwxr-xr-xBuild-tools/Do-rpm67
-rwxr-xr-xBuild-tools/my_md5sum124
2 files changed, 162 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!");
diff --git a/Build-tools/my_md5sum b/Build-tools/my_md5sum
new file mode 100755
index 00000000000..20742ee2ed0
--- /dev/null
+++ b/Build-tools/my_md5sum
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+#
+# my_md5sum
+#
+# Script to clone the 'md5sum' command found on modern systems, since that
+# command is not always found on all systems.
+#
+# Use the "--help" option for more info!
+#
+# Written by Matt Wagner <matt@mysql.com>
+#
+use strict;
+use Digest::MD5;
+use Getopt::Long;
+
+my $VER= "1.1";
+
+#
+# Strip the leading path info off the program name ($0). We want 'my_md5sum'
+# not './my_md5sum'.
+#
+$0=~ s/^.*\/(.+)$/$1/;
+
+my ($opt_check, $opt_help)= undef;
+
+GetOptions(
+ "check|c" => \$opt_check,
+ "help|h" => \$opt_help,
+ ) || usage();
+
+#
+# Put all the [file1 file2 file3 ...]'s into an array
+#
+my @files = @ARGV;
+
+#
+# Give the "--help" text if:
+# - "--help|-h" was specified
+# - The number of files given as arguments is nil
+# - The "--check|-c" option is used with more than one [file] argument
+#
+usage() if $opt_help || $#files == -1 || ($opt_check && $#files > 0);
+
+# If "--check|-c", then go into checking
+if ($opt_check)
+{
+ open (CHECKFILE, $files[0]) or die "$files[0]: $!";
+
+ while (<CHECKFILE>)
+ {
+ #
+ # Goto the next line in the file if it does not match a typical
+ # digest line like:
+ #
+ # f1007efa2c72daa693981ec764cdeaca Bootstrap
+ #
+ next if $_!~ m/^([a-z0-9]{32})\s+(.+)$/;
+
+ # Collect the trappings from the above regex
+ my $checksum= $1;
+ my $checkfile= $2;
+
+ # Generate a fresh MD5 for the file in question
+ my $digest= &mkmd5($checkfile);
+
+ # Check the fresh MD5 against what is recorded in the file
+ # Print an error message if they don't match, else print OK
+ print "$checkfile: FAILED\n" if $digest ne $checksum;
+ print "$checkfile: OK\n" if $digest eq $checksum;
+ }
+}
+# Else generate the MD5 digest to STDOUT
+else
+{
+ foreach my $file (@files)
+ {
+ my $digest= &mkmd5($file);
+
+ print "$digest $file\n";
+ }
+}
+
+
+#
+# This routine generates the MD5 digest of a file
+#
+sub mkmd5
+{
+ my $file= shift;
+
+ open (FILE, $file) or die "$file: $!";
+ binmode(FILE);
+
+ my $digest= Digest::MD5->new->addfile(*FILE)->hexdigest;
+
+ close FILE;
+
+ return $digest;
+}
+
+#
+# Print the help text
+#
+sub usage
+{
+ print <<EOF;
+
+$0 version $VER by Matt Wagner <matt\@mysql.com>
+
+Usage:
+$0 [-c [file]] | [file1...]
+Generates or checks MD5 message digests.
+
+Options:
+-c, --check Check message digests (default is generate)
+-h, --help Display this text and exit
+
+The input for -c should be the list of message digests and file names that is
+printed on STDOUT by this program when it generates digests.
+
+EOF
+
+ exit(0);
+}