summaryrefslogtreecommitdiff
path: root/Build-tools
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-07-07 11:29:39 +0300
committerunknown <monty@mysql.com>2004-07-07 11:29:39 +0300
commit11b8987313aab1eb8d9f829731fa0dcd83bf62f5 (patch)
treeca8974710746bb69b04a49bc64f938d0b1a8420a /Build-tools
parentc92670d80b3674fa025e373e0498eccbb407f873 (diff)
parent9890cd9a9eb37083d13370947fa50d64e21e54ff (diff)
downloadmariadb-git-11b8987313aab1eb8d9f829731fa0dcd83bf62f5.tar.gz
Merge with 4.1.3-beta
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/libmysqld/libmysqld.dsp: Auto merged VC++Files/sql/mysqld.dsp: Auto merged client/mysql.cc: Auto merged client/mysqlbinlog.cc: Auto merged client/mysqltest.c: Auto merged include/config-netware.h: Auto merged include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged include/sql_state.h: Auto merged innobase/include/row0mysql.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/libmysql.c: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged mysql-test/r/bdb.result: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/derived.result: Auto merged mysql-test/r/func_group.result: Auto merged mysql-test/r/func_like.result: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/insert.result: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/key.result: Auto merged mysql-test/r/multi_update.result: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/null_key.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/rpl_rotate_logs.result: Auto merged mysql-test/r/rpl_server_id1.result: Auto merged mysql-test/r/rpl_until.result: Auto merged mysql-test/r/select.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/system_mysql_db.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/multi_update.test: Auto merged mysql-test/t/mysqlbinlog.test: Auto merged mysql-test/t/rpl000015.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/mf_iocache2.c: Auto merged mysys/my_bitmap.c: Auto merged mysys/my_pthread.c: Auto merged netware/Makefile.am: Auto merged netware/my_manage.c: Auto merged netware/mysql_test_run.c: Auto merged netware/BUILD/compile-linux-tools: Auto merged netware/BUILD/compile-netware-standard: Auto merged netware/BUILD/mwenv: Auto merged netware/BUILD/nwbootstrap: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_berkeley.h: Auto merged sql/ha_heap.h: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/item_timefunc.h: Auto merged sql/lex.h: Auto merged sql/mysql_priv.h: Auto merged sql/net_serv.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_update.cc: Auto merged sql/structs.h: Auto merged sql-common/client.c: Auto merged configure.in: Merge with 4.1 include/mysqld_error.h: New errors from 4.1 libmysqld/Makefile.am: Merge with 4.1 myisam/myisamchk.c: Merge with 4.1 myisam/myisamdef.h: Merge with 4.1 myisam/sort.c: Merge with 4.1 mysql-test/r/mysqlbinlog.result: Merge with 4.1 mysql-test/r/range.result: Merge with 4.1 mysql-test/r/rpl_flush_log_loop.result: Merge with 4.1 mysql-test/r/rpl_replicate_do.result: Merge with 4.1 mysql-test/r/rpl_temporary.result: Merge with 4.1 mysql-test/r/rpl_user_variables.result: Merge with 4.1 mysql-test/t/func_time.test: Merge with 4.1 scripts/mysql_create_system_tables.sh: Merge with 4.1 scripts/mysql_fix_privilege_tables.sql: Merge with 4.1 sql/Makefile.am: Merge with 4.1 sql/filesort.cc: Merge with 4.1 sql/ha_innodb.cc: Merge with 4.1 sql/ha_innodb.h: Merge with 4.1 sql/ha_myisam.cc: Merge with 4.1 sql/handler.cc: Merge with 4.1 sql/handler.h: Merge with 4.1 sql/item_func.cc: Merge with 4.1 sql/item_timefunc.cc: Merge with 4.1 sql/log.cc: Merge with 4.1 sql/log_event.cc: Merge with 4.1 sql/mysqld.cc: Merge with 4.1 sql/opt_range.cc: Merge with 4.1 sql/opt_range.h: Merge with 4.1 sql/share/czech/errmsg.txt: Merge with 4.1 Updated english error messages sql/share/danish/errmsg.txt: Merge with 4.1 sql/share/dutch/errmsg.txt: Merge with 4.1 sql/share/english/errmsg.txt: Merge with 4.1 sql/share/estonian/errmsg.txt: Merge with 4.1 sql/share/french/errmsg.txt: Merge with 4.1 sql/share/german/errmsg.txt: Merge with 4.1 sql/share/greek/errmsg.txt: Merge with 4.1 sql/share/hungarian/errmsg.txt: Merge with 4.1 sql/share/italian/errmsg.txt: Merge with 4.1 sql/share/japanese/errmsg.txt: Merge with 4.1 sql/share/korean/errmsg.txt: Merge with 4.1 sql/share/norwegian-ny/errmsg.txt: Merge with 4.1 sql/share/norwegian/errmsg.txt: Merge with 4.1 sql/share/polish/errmsg.txt: Merge with 4.1 sql/share/portuguese/errmsg.txt: Merge with 4.1 sql/share/romanian/errmsg.txt: Merge with 4.1 sql/share/russian/errmsg.txt: Merge with 4.1 sql/share/serbian/errmsg.txt: Merge with 4.1 sql/share/slovak/errmsg.txt: Merge with 4.1 sql/share/spanish/errmsg.txt: Merge with 4.1 sql/share/swedish/errmsg.txt: Merge with 4.1 sql/share/ukrainian/errmsg.txt: Merge with 4.1 sql/slave.cc: Merge with 4.1 sql/sql_class.cc: Merge with 4.1 sql/sql_class.h: Merge with 4.1 sql/sql_db.cc: Merge with 4.1 sql/sql_insert.cc: Merge with 4.1 sql/sql_lex.cc: Merge with 4.1 sql/sql_lex.h: Merge with 4.1 sql/sql_parse.cc: Merge with 4.1 tree Changed // comments to /* */ sql/sql_prepare.cc: Merge with 4.1 sql/sql_select.cc: Merge with 4.1 sql/sql_table.cc: Merge with 4.1 sql/sql_yacc.yy: Merge with 4.1 sql/table.h: Merge with 4.1 tests/client_test.c: Merge with 4.1
Diffstat (limited to 'Build-tools')
-rwxr-xr-xBuild-tools/Do-compile50
-rwxr-xr-xBuild-tools/Do-rpm67
-rwxr-xr-xBuild-tools/my_md5sum124
-rwxr-xr-xBuild-tools/mysql-copyright104
-rwxr-xr-xBuild-tools/mysql-copyright-21
5 files changed, 282 insertions, 64 deletions
diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile
index 03571593f77..cf466ef5848 100755
--- a/Build-tools/Do-compile
+++ b/Build-tools/Do-compile
@@ -7,16 +7,17 @@ use Sys::Hostname;
@config_options= ();
@make_options= ();
-$opt_distribution=$opt_user=$opt_config_env="";
+$opt_distribution=$opt_user=$opt_config_env=$opt_config_extra_env="";
$opt_dbd_options=$opt_perl_options=$opt_config_options=$opt_make_options=$opt_suffix="";
$opt_tmp=$opt_version_suffix="";
$opt_help=$opt_delete=$opt_debug=$opt_stage=$opt_no_test=$opt_no_perl=$opt_with_low_memory=$opt_fast_benchmark=$opt_static_client=$opt_static_server=$opt_static_perl=$opt_sur=$opt_with_small_disk=$opt_local_perl=$opt_tcpip=$opt_build_thread=$opt_use_old_distribution=$opt_enable_shared=$opt_no_crash_me=$opt_no_strip=$opt_with_cluster=$opt_with_debug=$opt_no_benchmark=$opt_no_mysqltest=$opt_without_embedded=$opt_readline=0;
-$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=$opt_without_ndbcluster=0;
+$opt_innodb=$opt_bdb=$opt_raid=$opt_libwrap=$opt_clearlogs=0;
GetOptions(
"bdb",
"build-thread=i",
"config-env=s" => \@config_env,
+ "config-extra-env=s" => \@config_extra_env,
"config-options=s" => \@config_options,
"dbd-options=s",
"debug",
@@ -56,8 +57,7 @@ GetOptions(
"with-other-libc=s",
"with-small-disk",
"without-embedded",
- "clearlogs",
- "without-ndbcluster",
+ "clearlogs",
) || usage();
usage() if ($opt_help);
@@ -81,6 +81,12 @@ if (@config_env > 0)
$opt_config_env= join(" ", @config_env);
}
+if (@config_extra_env > 0)
+{
+ chomp(@config_extra_env);
+ $opt_config_extra_env= join(" ", @config_extra_env);
+}
+
$host= hostname();
chomp($uname=`uname`);
$full_host_name=$host;
@@ -91,6 +97,7 @@ $email="$opt_user\@mysql.com";
chomp($pwd = `pwd`);
$VER= basename($opt_distribution);
$VER=~ /mysql.*-([1-9]\.[0-9]{1,2}\.[0-9]{1,2}.*)\.tar*/; $version=$1;
+$release=""; # Shut up perl
($major, $minor, $release) = split(/\./,$version);
$log="$pwd/Logs/$host-$major.$minor$opt_version_suffix.log";
$opt_distribution =~ /(mysql[^\/]*)\.tar/;
@@ -113,6 +120,8 @@ if (defined($gcc_version) && ! $opt_config_env)
}
}
+$opt_config_env.=" $opt_config_extra_env";
+
$new_opt_tmp=0;
if ($opt_tmp)
{
@@ -139,6 +148,7 @@ $ENV{'MYSQL_TCP_PORT'}= $mysql_tcp_port= 3334 + $opt_build_thread*2;
$ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql$opt_suffix.build";
$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl";
$slave_port=$mysql_tcp_port+16;
+$ndbcluster_port= 9350 + $opt_build_thread*2;
$manager_port=$mysql_tcp_port+1;
$mysqladmin_args="--no-defaults -u root --connect_timeout=5 --shutdown_timeout=20";
@@ -156,6 +166,9 @@ select STDOUT;
$|=1;
info("Compiling MySQL$opt_version_suffix at $host$opt_suffix, stage: $opt_stage\n");
+info("LD_LIBRARY_PATH is $ENV{LD_LIBRARY_PATH}");
+info("PATH is $ENV{PATH}");
+
log_timestamp();
if (-x "$host/bin/mysqladmin")
@@ -237,9 +250,15 @@ if ($opt_stage <= 1)
$opt_config_options.= " --with-low-memory" if ($opt_with_low_memory);
$opt_config_options.= " --with-mysqld-ldflags=-all-static" if ($opt_static_server);
$opt_config_options.= " --with-raid" if ($opt_raid);
- $opt_config_options.= " --with-readline" if ($opt_readline);
+ if ($opt_readline)
+ {
+ $opt_config_options.= " --with-readline";
+ }
+ else
+ {
+ $opt_config_options.= " --with-libedit";
+ }
$opt_config_options.= " --with-embedded-server" unless ($opt_without_embedded);
- $opt_config_options.= " --without-ndbcluster" if ($opt_without_ndbcluster);
$opt_config_options.= " --with-ndbcluster" if ($opt_with_cluster);
# Only enable InnoDB when requested (required to be able to
@@ -295,7 +314,7 @@ if ($opt_stage <= 3)
}
$flags.= " --no-strip" if ($opt_no_strip || $opt_with_debug);
- $flags.= " --with-ndbcluster" if ($opt__with_ndbcluster);
+ $flags.= " --with-ndbcluster" if ($opt_with_cluster);
check_system("scripts/make_binary_distribution --tmp=$opt_tmp --suffix=$opt_suffix $flags",".tar.gz created");
safe_system("mv mysql*.t*gz $pwd/$host");
if (-f "client/.libs/mysqladmin")
@@ -334,10 +353,12 @@ $ENV{"LD_LIBRARY_PATH"}= ("$test_dir/lib" .
#
if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
{
+ my $flags= "";
+ $flags.= " --with-ndbcluster" if ($opt_with_cluster);
log_timestamp();
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
safe_cd("${test_dir}/mysql-test");
- check_system("./mysql-test-run --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
+ check_system("./mysql-test-run $flags --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful");
}
#
@@ -448,16 +469,25 @@ exit 0;
sub usage
{
print <<EOF;
-$0 version 1.5
+$0 version 1.6
$0 takes the following options:
--bdb
Compile with support for Berkeley DB tables
+--build-thread=<1,2,3...>
+When running several Do-compile runs in parallel, each build
+should have its own thread ID, so running the test suites
+does not cause conflicts with duplicate TCP port numbers.
+
--config-env=<environment for configure>
To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3'
+--config-extra-env <environment for configure>
+Additional flags for environment (not CC or CXX). Should be used when one
+wants Do-compile to propose proper CC and CXX flags.
+
--config-options=<options>
To add some extra options to configure (e.g. '--with-perl=yes')
@@ -554,7 +584,7 @@ If user is empty then no mail is sent.
Set name suffix (e.g. 'com' or '-max') for a distribution
--with cluster
-Compile with NDB Cluster
+Compile and test with NDB Cluster enabled
--with-debug
Build binaries with debug information (implies "--no-strip")
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);
+}
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright
index 004476ff92c..f2da3cdf447 100755
--- a/Build-tools/mysql-copyright
+++ b/Build-tools/mysql-copyright
@@ -12,15 +12,17 @@ use Getopt::Long;
$opt_help = 0;
$opt_version = 0;
+$opt_verbose = 0;
$opt_target = "mysql-copyright-target-";
$opt_target .= `date +%d%m%y-%H%M%S`;
chop $opt_target;
-GetOptions("help","version","target=s") || error();
+GetOptions("help","version","target=s", "verbose") || error();
# fix the directory prefix for target dir
$WD= cwd();
+my $win_flag = 0;
$opt_target= $WD . '/' . $opt_target;
&main();
@@ -50,6 +52,7 @@ sub main
for ($i=0; $ARGV[$i]; $i++)
{
my $distfile= $ARGV[$i];
+ $win_flag = ($distfile =~ /win-src/) ? 1 : 0;
my $dir;
$dir= "mysql-copyright-";
@@ -66,20 +69,19 @@ sub main
}
# if the distfile is mysql-3.22.22-alpha.tar.gz, then
# distname is 'mysql-3.22.22-alpha' and suffix '.tar.gz'
- if ($distfile =~ m/^($REG_BASENAME)([\-\_])
- ($REG_VERSION){1}([\.\-\+])
- (.*)?$/xo)
+ if ($distfile =~
+ m/^($REG_BASENAME)([\-\_])($REG_VERSION){1}([\.\-\+]\w+\-\w+)?[\.\-\+](.*)?$/xo)
{
$distname= $1.$2.$3;
- $suffix= $5.$6;
+ $suffix= $5;
+ $fileext = $6;
$newdistname= $1."com".$2.$3;
+ $newdistname .= $suffix if $win_flag;
}
# find out the extract path (should be same as distname!)
chomp($destdir= `tar ztf ../$distfile | head -1`);
# remove slash from the end
$destdir= substr($destdir, 0, -1);
- print "destdir: $destdir\n";
- print "distname: $distname\n";
if ("$destdir" ne "$distname")
{
@@ -100,45 +102,92 @@ sub main
# exist in the new mysql distributions, but let's be sure..
unlink("$destdir/PUBLIC", "$destdir/README");
copy("$WD/Docs/MySQLEULA.txt", "$destdir");
-
- # remove readline subdir and update configure accordingly
- system("rm -rf $destdir/cmd-line-utils/readline");
- unlink ("$destdir/configure") or die "Can't delete $destdir/configure: $!\n";
- `(cd $destdir ; sed -e 's!\ cmd-line-utils\/readline\/Makefile\ dnl!!g' < configure.in > configure.in.new)`;
- rename ("$destdir/configure.in.new","$destdir/configure.in") or die "Can't rename $destdir/configure.in.new: $!\n";;
- `(cd $destdir ; autoconf)`;
+
+ # remove readline, bdb subdirs and update 'configure'
+ my @extra_fat= ('bdb', 'cmd-line-utils/readline');
+
+ foreach my $fat (@extra_fat)
+ {
+ &trim_the_fat($fat);
+ }
# fix file copyrights
&fix_usage_copyright();
&add_copyright();
# rename the directory with new distribution name
+ chdir("$WD/$dir");
+ print "renaming $destdir $newdistname\n" if $opt_verbose;
rename($destdir, $newdistname);
# tar the new distribution
- `tar cz -f $opt_target/$newdistname.tar.gz *`;
+ `tar cz -f $WD/$newdistname.tar.gz $newdistname`;
$pec= $? >> 8;
abort($dir, "Making new tar archive failed!\n") if ($pec);
# remove temporary directory
- chdir "..";
- `rm -rf $dir/`;
+ chdir($WD) or print "$! Unable to move up one dir\n";
+ `cd $WD`;
+ my $cwd = getcwd();
+ print "current dir is $cwd\n" if $opt_verbose ;
+ if (-e $dir) {
+ print "Trying to delete $dir\n" if $opt_verbose;
+ if ( system("rm -rf $dir")){
+ print "$! Unable to delete $dir!\n";
+ }
+ }
}
exit(0);
}
####
+#### This function will remove unwanted parts of a src tree for the mysqlcom
+#### distributions.
+####
+sub trim_the_fat
+{
+ my $the_fat= shift;
+ my $cwd= getcwd();
+
+ system("rm -rf $destdir/${the_fat}");
+ if ($win_flag)
+ {
+ chdir("$destdir") or die "Unable to change directory to $destdir!: $!\n";
+ }
+ else
+ {
+ chdir("$destdir");
+ unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
+ open(CONFIGURE,"<configure.in") or die "Unable to open configure.in for read: $!\n";
+ undef $/;
+ my $configure= <CONFIGURE>;
+ close(CONFIGURE);
+ $configure=~ s|${the_fat}/Makefile dnl\n?||g;
+ open(CONFIGURE,">configure.in") or die "Unable to open configure.in for write: $!\n";
+ print CONFIGURE $configure;
+ close(CONFIGURE);
+ `autoconf`;
+ die "'./configure' was not produced!" unless (-f "configure");
+ chdir("$cwd");
+ }
+}
+
+
+####
#### mysqld and MySQL client programs have a usage printed with --help.
#### This usage includes a copyright, which needs to be modified
####
-
sub fix_usage_copyright
{
- my @Cfiles = `find . -type f -name \"*.c*\"`;
- foreach my $Cfile (@Cfiles)
+ my $findlist = `find . -type f -name \"*.c*\"`;
+ my @files = split("\n", $findlist);
+ my $cwd = getcwd();
+
+ foreach my $file (@files)
{
- chop $Cfile;
- `replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file MySQLEULA.txt for details" -- $Cfile`;
+ next if ! -f $file;
+ print "processing file $file in cwd $cwd\n" if $opt_verbose;
+ `replace "This is free software," "This is commercial software," "and you are welcome to modify and redistribute it under the GPL license" "please see the file MySQLEULA.txt for details" -- "$file"` ;
}
}
@@ -148,11 +197,16 @@ sub fix_usage_copyright
sub add_copyright
{
- my @files = `find . -type f -name "*"`;
+ my $findlist = `find . -type f -name "*"`;
+ my @files = split("\n", $findlist);
+ my $cwd = getcwd();
+
foreach my $file (@files)
{
- chop $file;
- `$WD/Build-tools/mysql-copyright-2 $file`;
+ next if ! -f $file;
+ next if -B $file;
+ print "processing file $file in cwd $cwd\n" if $opt_verbose;
+ `$WD/Build-tools/mysql-copyright-2 "$file"`;
}
}
diff --git a/Build-tools/mysql-copyright-2 b/Build-tools/mysql-copyright-2
index e946ed217d1..a1a870526da 100755
--- a/Build-tools/mysql-copyright-2
+++ b/Build-tools/mysql-copyright-2
@@ -89,6 +89,7 @@ sub add_copyright
elsif ($ARGV =~ /\.c$/ ||
$ARGV =~ /\.cc$/ ||
$ARGV =~ /\.h$/ ||
+ $ARGV =~ /\.cpp$/ ||
$ARGV =~ /\.yy$/)
{
$start_copyright="/* ";