diff options
author | bk@work.mysql.com <> | 2000-07-31 21:29:14 +0200 |
---|---|---|
committer | bk@work.mysql.com <> | 2000-07-31 21:29:14 +0200 |
commit | f4c589ff6c653d1d2a09c26e46ead3c8a15655d8 (patch) | |
tree | d253a359142dfc1ed247d5d4365d86972ea31109 /Build-tools | |
parent | 7eec25e393727b16bb916b50d82b0aa3084e065c (diff) | |
download | mariadb-git-f4c589ff6c653d1d2a09c26e46ead3c8a15655d8.tar.gz |
Import changeset
Diffstat (limited to 'Build-tools')
-rwxr-xr-x | Build-tools/Do-all-build-steps | 74 | ||||
-rwxr-xr-x | Build-tools/Do-compile | 421 | ||||
-rwxr-xr-x | Build-tools/Do-create-perl-rpms | 64 | ||||
-rwxr-xr-x | Build-tools/Do-local-patch-file | 37 | ||||
-rwxr-xr-x | Build-tools/Do-patch-file | 41 | ||||
-rwxr-xr-x | Build-tools/Do-rpm | 127 | ||||
-rwxr-xr-x | Build-tools/cvs-sanity-check | 15 | ||||
-rwxr-xr-x | Build-tools/mysql-copyright | 212 | ||||
-rwxr-xr-x | Build-tools/mysql-copyright-2 | 162 | ||||
-rw-r--r-- | Build-tools/newest | 116 |
10 files changed, 1269 insertions, 0 deletions
diff --git a/Build-tools/Do-all-build-steps b/Build-tools/Do-all-build-steps new file mode 100755 index 00000000000..8e1d01232f8 --- /dev/null +++ b/Build-tools/Do-all-build-steps @@ -0,0 +1,74 @@ +#!/bin/bash + +WD=`pwd` +TMP_SCRIPT=$WD/Logs/00-temp-for-do-all-build-steps.$$ + +# We build on work +to_host=`hostname` +cc=gcc +ccc=gcc +EXTRA_CONFIG="--without-perl" + +echo "Building on $to_host" + +cat > $TMP_SCRIPT <<END +# Show executed commands +set -x +# Move to the right place +cd "$WD" + +CC=$cc CXX=$ccc +export CC CXX + +gmake -k distclean +rm -f NEW-RPMS/* + +# Stop on error +set -e + +# Make everything readable for user and group +# chmod -R u+rw,g+rw . + +/bin/rm -f */.deps/*.P +/bin/rm -f config.cache + +aclocal; autoheader; aclocal; automake; autoconf + +# Since we have moved the configure.in stuff from readline to the +# toplevel why do this? David 990630 +# (cd readline; aclocal; autoheader; aclocal; automake; autoconf) + +# A normal user starts here. We must use mit-threads. Otherwise it +# does not end up in the distribution. +./configure \ + --with-unix-socket-path=/var/tmp/mysql.sock \ + --with-low-memory \ + --with-mit-threads=yes $EXTRA_CONFIG + +gmake # --jobs=4 does not work. + +time gmake distcheck \ + EXTRA_CONF_ARGS="--with-unix-socket-path=/var/tmp/mysql.sock --with-low-memory $EXTRA_CONFIG" + +$WD/Build-tools/Do-rpm + +rm -f $TMP_SCRIPT +END + +mkdir -p $WD/Logs +log=$WD/Logs/Log-distcheck-`date +%y%m%d-%H%M` + +if test $to_host = "mysql-work" +then + # Try to get the right user for MySQL builds on work so that all + # files is owned by the same user (mysql) + ssh -n $to_host -l my "time bash $TMP_SCRIPT" > $log 2>&1 +else + time bash $TMP_SCRIPT > $log 2>&1 +fi + +# Create a commercial MySQL distribution (mysqlcom-VER.tar.gz) from +# the newly made source distribution + +DIST=`ls -t mysql-*.tar.gz | head -1` +$WD/Build-tools/mysql-copyright --target=. $DIST diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile new file mode 100755 index 00000000000..50d2fcd7977 --- /dev/null +++ b/Build-tools/Do-compile @@ -0,0 +1,421 @@ +#!/usr/bin/perl + +use Getopt::Long; +$opt_distribution=$opt_user=$opt_result=$opt_config_options=$opt_config_env=""; +$opt_dbd_options=$opt_perl_options=""; +$opt_tmp=""; +$opt_help=$opt_Information=$opt_no_delete=$opt_debug=$opt_stage=$opt_rsh_mail=$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=0; +GetOptions("Information","help","distribution=s","user=s","result=s","no-delete","no-test","perl-files=s","debug","config-options=s","config-env=s","stage=i","rsh-mail","with-low-memory","fast-benchmark","tmp=s","static-client","static-server","static-perl","no-perl","local-perl","perl-options=s","sur","with-small-disk","dbd-options=s") || usage(); + +usage() if ($opt_help || $opt_Information); +usage() if (!$opt_distribution); + +chomp($host=`hostname`); +print "$host: Compiling MySQL at $host, stage: $opt_stage\n" if ($opt_debug); +$host =~ /^([^.-]*)/; +$host=$1; +$email="$opt_user\@mysql.com"; +$pwd = `pwd`; chomp($pwd); +$log="$pwd/Logs/$host.log"; +$opt_distribution =~ /(mysql-[^\/]*)\.tar/; +$ver=$1; +$gcc_version=which("gcc"); +if (defined($gcc_version) && ! $opt_config_env) +{ + $tmp=`$gcc_version -v 2>&1`; + if ($tmp =~ /version 2\.7\./) + { + $opt_config_env= 'CC=gcc CFLAGS="-O2 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O2 -fomit-frame-pointer"'; + } + else + { + $opt_config_env= 'CC=gcc CFLAGS="-O3 -fomit-frame-pointer" CXX=gcc CXXFLAGS="-O3 -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti"'; + } +} +if ($opt_tmp) +{ + $ENV{'TMPDIR'}=$opt_tmp; +} +else +{ + $opt_tmp="/tmp"; +} +$ENV{'PATH'}= "$pwd/$host/bin:" . $ENV{'PATH'}; +$rsh=which("rcmd","rsh"); +$make=which("gmake","make"); +$tar=which("gtar","tar"); +$sendmail=find("/usr/lib/sendmail","/usr/sbin/sendmail"); +$sur= $opt_sur ? "/my/local/bin/sur" : ""; +delete $ENV{'MYSQL_PWD'}; # Reset possibly password +delete $ENV{'MY_BASEDIR_VERSION'}; +$ENV{'MYSQL_TCP_PORT'}="3334"; +$ENV{'MYSQL_UNIX_PORT'}=$mysql_unix_port="$opt_tmp/mysql.build"; +$ENV{"PERL5LIB"}="$pwd/$host/perl5:$pwd/$host/perl5/site_perl"; + +if ($opt_stage == 0) +{ + print "$host: Removing old distribution\n" if ($opt_debug); + if (-x "$host/bin/mysqladmin") + { + log_system("$host/bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown"); + } + system("touch $host/mysql-fix-for-glob"); + rm_all(<$host/mysql-*>); + rm_all("$host/test"); + system("mkdir $host") if (! -d $host); + system("mkdir $host/test") if (! -d "$host/test"); + system("mkdir $host/bin") if (! -d "$host/bin"); + system("mkdir Logs") if (! -d "Logs"); + unlink($log); +} + +open(LOG,">>$log") || abort("Can't open log file, error $?"); +select LOG; +$|=1; +select STDOUT; +$|=1; + +safe_cd("$host"); +if ($opt_stage == 0) +{ + safe_system("gunzip < $opt_distribution | $tar xf -"); +} +safe_cd($ver); +if ($opt_stage <= 1) +{ + $opt_config_options.=" --with-low-memory" if ($opt_with_low_memory); + unlink("config.cache"); + if ($opt_static_server) + { + $opt_config_options.=" --with-mysqld-ldflags=-all-static"; + } + if ($opt_static_client) + { + $opt_config_options.=" --with-client-ldflags=-all-static"; + } + $opt_config_options.= " --disable-shared"; # Default for binary versions + check_system("$opt_config_env ./configure --prefix=/usr/local/mysql \"--with-comment=Official MySQL binary\" --with-extra-charsets=complex $opt_config_options","Thank you for choosing MySQL"); + if (-d "$pwd/$host/include-mysql") + { + safe_system("cp -r $pwd/$host/include-mysql/* $pwd/$host/$ver/include"); + } +} + +if ($opt_stage <= 2) +{ + unlink($opt_distribution) if (!$opt_no_delete); + safe_system("$make"); +} + +# +# Create a binary distrubtion +# +if ($opt_stage <= 3) +{ + log_system("rm -fr mysql-* $pwd/$host/*.tar.gz"); + log_system("strip sql/mysqld extra/comp_err client/mysql sql/mysqld client/mysqlshow extra/replace isam/isamchk client/mysqladmin client/mysqldump extra/perror"); + check_system("scripts/make_binary_distribution $opt_tmp",".tar.gz created"); + safe_system("mv mysql*.tar.gz $pwd/$host"); + safe_system("cp client/mysqladmin $pwd/$host/bin"); + safe_system("make clean") if ($opt_with_small_disk); +} + +# +# Unpack and test the binary distrubtion +# + +if ($opt_stage <= 4 && !$opt_no_test) +{ + rm_all(<$pwd/$host/test/*>); + safe_cd("$pwd/$host/test"); + $tar_file=<$pwd/$host/*.tar.gz>; + if (!defined($tar_file)) + { + $tar_file=<$pwd/$host/*.tgz>; + } + safe_system("gunzip < $tar_file | $tar xf -"); +} + +$test_dir=<$pwd/$host/test/$ver-*>; +if ($opt_stage <= 5 && !$opt_no_test) +{ + safe_cd($test_dir); + log_system("./bin/mysqladmin --no-defaults -u root -S $mysql_unix_port -s shutdown") || info("There was no mysqld running\n"); + sleep(2); + log_system("rm -f ./data/mysql/*"); + check_system("scripts/mysql_install_db --skip-locking","com/license"); + safe_system("./bin/mysqld --no-defaults --basedir . --datadir ./data --skip-locking >> $log 2>&1 &"); + sleep(2); +} + +if ($opt_stage <= 6 && $opt_perl_files && !$opt_no_perl && !$opt_no_test) +{ + safe_cd($test_dir); + rm_all("perl"); + safe_system("mkdir perl"); + $ENV{'IN_MYSQL_DISTRIBUTION'}=1; + $ENV{'MYSQL_BUILD'}=$test_dir; + + foreach $module (split(/,/,$opt_perl_files)) + { + my $options; + safe_cd("$test_dir/perl"); + if ($opt_debug) + { + safe_system("gunzip < $pwd/$module | tar xvf -"); + } + else + { + safe_system("gunzip < $pwd/$module | tar xf -"); + } + $module =~ m|([^/]+)\.tar\.gz|; + $module = $1; + safe_cd($module); + $options=""; + $options= "--mysql-install --noprompt --mysql-incdir=$test_dir/include --mysql-libdir=$test_dir/lib -nomsql-install -nomsql1-install --mysql-test-db=test $opt_dbd_options" if ($module =~ /Msql-Mysql/); + $options.= " PREFIX=$pwd/$host INSTALLPRIVLIB=$pwd/$host/perl5 INSTALLSCRIPT=$pwd/$host/bin INSTALLSITELIB=$pwd/$host/perl5/site_perl INSTALLBIN=$pwd/$host/bin INSTALLMAN1DIR=$pwd/$host/man INSTALLMAN3DIR=$pwd/$host/man/man3" if ($opt_local_perl); + $options.= " $opt_perl_options" if (defined($opt_perl_options)); + safe_system($opt_static_perl ? "perl Makefile.PL -static $options" : "perl Makefile.PL $options"); + safe_system("$make ; $sur $make install"); + } +} + + +if ($opt_stage <= 7 && !$opt_no_test) +{ + safe_cd("$test_dir/sql-bench"); + log_system("rm -f limits/mysql.cfg"); + safe_system("perl ./crash-me --force --batch-mode"); +} + +if ($opt_stage <= 8 && !$opt_no_test) +{ + safe_cd("$test_dir/sql-bench"); + log_system("rm -f output/*"); + $tmp= $opt_fast_benchmark ? "--fast --user root --small-test" : ""; + check_system("perl ./run-all-tests --log --die-on-errors $tmp","RUN-mysql"); +} + +if ($opt_stage <= 9 && $opt_result) +{ + safe_system("rcp $pwd/$host/*.tar.gz $opt_result"); +} + +log_system("$pwd/$host/$ver/client/mysqladmin --no-defaults -S $mysql_unix_port -u root shutdown"); +print LOG "ok\n"; +close LOG; +print "$host: ok\n"; + +exit 0; + + +sub usage +{ +print <<EOF; +$0 version 1.1 + +$0 takes the following options: + +--help or --Information +Show this help + +--user 'user_name' +Mail 'user_name'\@analytikerna.se if something went wrong. +If user is empty then no mail is sent. + +--distribution 'distribution_file' +Name of the MySQL distribution file. + +--result 'result_dir' +Send binary distribution to result_dir + +--no-delete +Do not delete the distribution file. + +--perl-files=list of files +Compile and install the given perl modules. + +--no-test +Don not run crash-me or the benchmarks. + +--config-options 'some extra configure options' +To add some extra options, like '--with-perl=yes' + +--config-env 'environment for configure' +To set up the environment, like 'CC=cc CXX=gcc CXXFLAGS=-O3' + +--dbd-options 'options' +Options for Makefile.PL when configuring msql-mysql-modules. + +--with-low-memory +Use less memory when compiling. + +-- stage (1-6) +Start script from some specific point. + +-- debug +Print all shell commands on stdout. +EOF +exit 1; +} + +sub abort +{ + my($message)=@_; + my($command,$mail_header_file); + print LOG "\n$message\n"; + print "$host: $message\n" if ($opt_debug); + close LOG; + + if ($opt_user) + { + $mail_header_file="$opt_tmp/do-command.$$"; + open(TMP,">$mail_header_file"); + print TMP "From: mysql\@$host.se\n"; + print TMP "To: $email\n"; + print TMP "Subject: MySQL compilation failed again\n\n"; + close TMP; + $command=($opt_rsh_mail) ? "$rsh analytik" : ""; + system("tail -30 $log > $log.mail"); + system("cat $mail_header_file $log.mail | $command $sendmail -t -f $email"); + unlink($mail_header_file); + unlink("$log.mail"); + } + print LOG "Aborting\n"; + exit 1; +} + +sub info +{ + my($message)=@_; + print LOG "$message\n"; + print "$host: $message\n"; +} + +sub log_system +{ + my($com)=@_; + print "$host: $com\n" if ($opt_debug); + if (defined($log)) + { + print LOG "$com\n"; + system("$com >> $log 2>&1") && + print LOG ("Info: couldn't execute command, error: " . ($? / 256) ."\n"); + } + else + { + system($com) && print "$host: Couldn't execute command, error: " . ($? / 256) ."\n"; + } +} + + +sub safe_system +{ + my($com,$res)=@_; + print LOG "$com\n"; + print "$host: $com\n" if ($opt_debug); + system("$com >> $log 2>&1") && abort("error: Couldn't execute command, error: " . ($? / 256)); +} + +sub check_system +{ + my($com,$res)=@_; + my ($error,$found); + print LOG "$com\n"; + print "$host: $com\n" if ($opt_debug); + open (COM, "$com 2>&1 < /dev/null|") || abort("Got error " . ($?/256) ." opening pipe"); + $found=0; + while (<COM>) + { + print LOG $_; + if (index($_,$res) >= 0) + { + $found=1; + last; + } + } + close COM; + abort("Couldn't find '$res' in the command result") if (!$found); + print "$host: Command ok\n" if ($opt_debug); +} + +sub safe_cd +{ + my($dir)=@_; + print LOG "cd $dir\n"; + print "$host: cd $dir\n" if ($opt_debug); + chdir($dir) || abort("Can't cd to $dir"); +} + +sub which +{ + my(@progs)=@_; + foreach $prog (@progs) + { + chomp($found=`which $prog | head -1`); + if ($? == 0 && $found ne "" && index($found," ") == -1) + { + $found =~ s|/+|/|g; # Make nicer output + return $found; + } + } + return undef(); +} + +sub find +{ + my (@progs)=@_; + foreach $prog (@progs) + { + return $prog if (-x $prog); + } + return undef(); +} + +# +# Remove recursively all from a directory +# This is needed because problems with NFS and open files +# + +sub rm_all +{ + my(@rm_files)=@_; + my($dir,$current_dir,@files,@dirs); + $current_dir = `pwd`; chomp($current_dir); + + foreach $dir (@rm_files) + { + if (-d $dir) + { + chdir($dir) || abort("Can't cd to $dir"); + print "$host: Removing from $dir\n" if ($opt_debug); + while (<* .*>) + { + next if ($_ eq "." x (length($_))); + if (-d $_) + { +# die "Can't remove directory that starts with ." if ($_ =~ /^\./ && $_ ne ".libs"); # Safety + push (@dirs,$_); + } + else + { + push (@files,$_); + } + } + if ($#files >= 0) + { + system("rm -f " . join(" ",@files)) && abort("Can't remove files from $dir"); + } + foreach $dir (@dirs) + { + rm_all($dir); + } + chdir($current_dir) || abort("Can't cd to $current_dir"); + log_system("rmdir $dir"); + } + else + { + system("rm -f $dir") && abort("Can't remove file $dir"); + } + } +} diff --git a/Build-tools/Do-create-perl-rpms b/Build-tools/Do-create-perl-rpms new file mode 100755 index 00000000000..2aa71740b58 --- /dev/null +++ b/Build-tools/Do-create-perl-rpms @@ -0,0 +1,64 @@ +#!/bin/bash + + +PM_FILES='Data-Dumper Data-ShowTable DBI Msql-Mysql-modules' +FILE_EXT='tar.gz' +ARCH=`uname -m | perl -p -e 's/^i[0-9]86$/i386/'` + +# directories +[ -d /usr/src/redhat ] && RPM_SRC=/usr/src/redhat +[ -d /usr/src/packages ] && RPM_SRC=/usr/src/packages +SRC_DIR=/home/matt/work/pm_rpm/tarballs # pristine tarballs +DEST_DIR=${RPM_SRC}/SOURCES # RPM SOURCES (building area) +RPM_DEPOSIT=/var/tmp/ftp/RPMS # RPM production deposit +SRPM_DEPOSIT=/var/tmp/ftp/SRPMS # SRPM production deposit + +# keyword replacement for SPEC templates +REPLACE_KEY='REPLACE_VERSION' + +# paths to beloved programs +NEWEST=/home/matt/work/build_pm_rpms/newest +REPLACE=/usr/local/bin/replace + + +#++ +# Copy the source tarballs up to staging area for RPM building. +#-- +cd $SRC_DIR +for i in $PM_FILES +do + echo Copying $i... + cp ${SRC_DIR}/`$NEWEST -s $SRC_DIR -b $i -t $FILE_EXT` $DEST_DIR +done + + +#++ +# Do keyword replacements on the SPEC templates, and build RPMS +#-- +cd ${RPM_SRC}/SPECS +for i in $PM_FILES +do + cat ${i}.spec.template | $REPLACE $REPLACE_KEY `$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT -v` > ${i}.spec + rpm -ba ${i}.spec + rm ${i}.spec +done + + +#++ +# Copy new RPMS and SRPMS to production deposit +#-- +cd $RPM_SRC + +# kludge code +PM_FILES=`echo $PM_FILES | $REPLACE Msql-Mysql-modules DBD-Mysql` +tmpv=`$NEWEST -s $DEST_DIR -b Msql-Mysql-modules -t $FILE_EXT -v` +mv SOURCES/Msql-Mysql-modules-${tmpv}.${FILE_EXT} SOURCES/DBD-Mysql-${tmpv}.${FILE_EXT} + + +for i in $PM_FILES +do + cp RPMS/${ARCH}/${i}-`$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT -v`-1.${ARCH}.rpm $RPM_DEPOSIT + cp SRPMS/${i}-`$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT -v`-1.src.rpm $SRPM_DEPOSIT + rm SOURCES/`$NEWEST -s $DEST_DIR -b $i -t $FILE_EXT` +done + diff --git a/Build-tools/Do-local-patch-file b/Build-tools/Do-local-patch-file new file mode 100755 index 00000000000..708d06966d3 --- /dev/null +++ b/Build-tools/Do-local-patch-file @@ -0,0 +1,37 @@ +#!/bin/sh +# make a patch file of a mysql distribution +# takes as argument the previous version + +case $# in +0) echo Usage: $0 previous_version; exit 1;; +esac + +PVER=$1; +VER=`grep SERVER_VERSION include/mysql_version.h | cut -d'"' -f2` +NEW="mysql-$VER.tar.gz" +OLD="mysql-$PVER.tar.gz" +RESULT="mysql-$PVER-$VER.patch.gz" +PATCH_DIR=/my/data/tcxwww/html/Downloads/Patches +RESULT_DIR=/my/data/tcxwww/html/Downloads/MySQL-3.22 + +if test ! -f $NEW +then + echo "$NEW doesn't exist"; + exit 1; +fi + +if test ! -f $RESULT_DIR/$OLD +then + echo "$RESULT_DIR/$OLD doesn't exist"; + exit 1; +fi + +mkdir patch +cd patch +gtar xfz ../$NEW +gtar xfz $RESULT_DIR/$OLD +cd mysql-$PVER +diff --context --new-file --recursive . ../mysql-$VER | gzip -9 > ../../$RESULT +cd ../.. +/bin/rm -rf patch + diff --git a/Build-tools/Do-patch-file b/Build-tools/Do-patch-file new file mode 100755 index 00000000000..f5f2910bc71 --- /dev/null +++ b/Build-tools/Do-patch-file @@ -0,0 +1,41 @@ +#!/bin/sh +# make a patch file of a mysql distribution +# takes as argument the previous version + +case $# in +0) echo Usage: $0 previous_version; exit 1;; +esac + +PVER=$1; +VER=`grep SERVER_VERSION include/mysql_version.h | cut -d'"' -f2` +NEW="mysql-$VER.tar.gz" +OLD="mysql-$PVER.tar.gz" +RESULT="mysql-$PVER-$VER.patch.gz" +PATCH_DIR=/my/web/Site/html/Downloads/Patches +RESULT_DIR=/my/web/Site/html/Downloads/MySQL-3.23 + +if test ! -f $NEW +then + echo "$NEW doesn't exist"; + exit 1; +fi + +if test ! -f $RESULT_DIR/$OLD +then + echo "$RESULT_DIR/$OLD doesn't exist"; + exit 1; +fi + +mkdir patch +cd patch +gtar xfz ../$NEW +gtar xfz $RESULT_DIR/$OLD +cd mysql-$PVER +diff --context --new-file --recursive . ../mysql-$VER | gzip -9 > ../../$RESULT +cd ../.. +/bin/rm -rf patch +#chown mysql $RESULT $NEW binary/* +chmod a+r,o-w $RESULT $NEW binary/* +mv $RESULT $PATCH_DIR +mv $NEW $RESULT_DIR +cp binary/* NEW-RPMS/* $RESULT_DIR diff --git a/Build-tools/Do-rpm b/Build-tools/Do-rpm new file mode 100755 index 00000000000..f1847604840 --- /dev/null +++ b/Build-tools/Do-rpm @@ -0,0 +1,127 @@ +#!/bin/bash + +# We built on one of two machines +bmachine=work +smachine=work +owner=my + +# Hard path!! +bpath=`/bin/pwd` +rpmdir="/usr/src/redhat" + +###### Perl STUFF ##### + +# Perl version numbers. Should be autodetected from the files in the +# Perl-mysql-modules/ directory. +DBI_VERSION="1.11" +DATA_SHOWTABLE_VERSION="3.3" +DBD_MYSQL_VERSION="1.2209" +MAKERPM="$rpmdir/SOURCES/makerpm.pl" + +####################### + +VER=`grep "AM_INIT_AUTOMAKE(mysql, " $bpath/configure.in | \ + sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;'` +VER_NO_DASH=`echo $VER | sed -e "s|-.*$||"` + +echo "Building RPM for MySQL version $VER on $bmachine" + +log=$bpath/Logs/Log-RPM-`date +%y%m%d-%H%M` + +( +set -x +# Copy MySQL source and spec files +scp $bpath/mysql-$VER.tar.gz $owner@$bmachine:$rpmdir/SOURCES +scp $bpath/Docs/Images/mysql-logo.gif $owner@$bmachine:$rpmdir/SOURCES/mysql.gif +scp $bpath/support-files/mysql-$VER.spec $owner@$bmachine:$rpmdir/SPECS + +# Copy perl things. Has to be uncompressed since Compress.pm is not +# installed yet. Set CEXT to .gz when we support compression. +CEXT= +#scp $bpath/Perl-mysql-modules/To-SOURCES/* $owner@$bmachine:$rpmdir/SOURCES + +# This had to be installed on the target machince! +# http://www.perl.com/CPAN/modules/by-module/Archive/Archive-Tar-0.21.tar.gz +# cd /usr/lib/perl5/site_perl/5.005; ln -s ../* .; rm -f 5.005 + +TMP_SCRIPT_MYSQL=00-temp-for-do-rpm.$$ +cat > $bpath/Logs/$TMP_SCRIPT_MYSQL <<END +set -x + +# Check environment +export MYSQL_BUILD_PATH="/usr/cygnus/redhat-980810/H-i386-pc-linux-gnu/bin/:/usr/bin:/bin" +export MYSQL_BUILD_CFLAGS="-O6 -fomit-frame-pointer -mpentium" +export MYSQL_BUILD_CXXFLAGS="-O6 -fomit-frame-pointer \ + -felide-constructors -fno-exceptions -fno-rtti -mpentium" +gcc -v + +# Make RPM +rpm -ba $rpmdir/SPECS/mysql-$VER.spec +rm -f /tmp/$TMP_SCRIPT_MYSQL +END + +TMP_SCRIPT_PERL=00-temp-for-perl-rpm.$$ +cat > $bpath/Logs/$TMP_SCRIPT_PERL <<END +set -x + +# First clean up so we do not get old versions when wildcard matching +rm -f $rpmdir/SOURCES/DBI-*.spec +rm -f $rpmdir/RPMS/i386/Perl-*.rpm +rm -f $rpmdir/SRPMS/Perl-*.rpm +rm -f $rpmdir/RPMS/i386/MySQL*-$VER_NO_DASH*.rpm +rm -f $rpmdir/SRPMS/MySQL*-$VER_NO_DASH*.rpm + +chmod a+x ${MAKERPM} +rm + +${MAKERPM} --verbose --package-name=DBI --package-version ${DBI_VERSION} \ + --specs --source=DBI-${DBI_VERSION}.tar$CEXT + +rpm -ba $rpmdir/SPECS/DBI-${DBI_VERSION}.spec + +${MAKERPM} --verbose --package-name=Data-ShowTable \ + --package-version ${DATA_SHOWTABLE_VERSION} \ + --specs --source=Data-ShowTable-${DATA_SHOWTABLE_VERSION}.tar$CEXT + +rpm -ba $rpmdir/SPECS/Data-ShowTable-${DATA_SHOWTABLE_VERSION}.spec + +for v in ${DBD_MYSQL_VERSION}; do + ${MAKERPM} + --specs \ + --source=Msql-Mysql-modules-$v.tar$CEXT \ + --setup-dir=Msql-Mysql-modules-$v \ + --package-name=DBD-mysql \ + --package-version=$v \ + --makemakeropts='--noprompt --mysql-install --mysql-install-nodbd \ + --nomsql-install --nomsql1-install' \ + --require=perl-Data-ShowTable --require=perl-DBI + rpm -ba $rpmdir/SPECS/DBD-mysql-$v.spec +done + +for srcrpm in $rpmdir/SRPMS/perl-*.src.rpm +do + rpm --rebuild $srcrpm +done + +rm -f /tmp/$TMP_SCRIPT_PERL +END + +# scp $bpath/Logs/$TMP_SCRIPT_MYSQL $owner@$bmachine:/tmp/$TMP_SCRIPT_MYSQL + +ssh $bmachine -l $owner bash $bpath/Logs/$TMP_SCRIPT_MYSQL + +# Build perl RPM (we currently need to be root to do this and that is +# not possible) + +#scp $bpath/Logs/$TMP_SCRIPT_PERL $owner@$bmachine:/tmp/$TMP_SCRIPT_PERL +#ssh $bmachine -l root bash /tmp/$TMP_SCRIPT_PERL + +# Copy RPMs back to the source dir. We must do this here since the +# $bmachine may not have permission to access $smachine. +scp $owner@$bmachine:$rpmdir/RPMS/i386/MySQL*-$VER_NO_DASH*.rpm $bpath/NEW-RPMS +scp $owner@$bmachine:$rpmdir/SRPMS/MySQL*-$VER_NO_DASH*.rpm $bpath/NEW-RPMS + +# And the perl ones +#scp $owner@$bmachine:$rpmdir/RPMS/i386/Perl*-*.rpm $bpath/NEW-RPMS +#scp $owner@$bmachine:$rpmdir/SRPMS/Perl*-*.rpm $bpath/NEW-RPMS +) > $log 2>&1 diff --git a/Build-tools/cvs-sanity-check b/Build-tools/cvs-sanity-check new file mode 100755 index 00000000000..b3d57e98033 --- /dev/null +++ b/Build-tools/cvs-sanity-check @@ -0,0 +1,15 @@ +#! /bin/sh + +CVSROOT=my@work.mysql.com:/home/cvs +CVS_RSH=ssh +TMPDIR=/tmp +cd $TMPDIR +[ -d mysql ] && rm -rf mysql +CVSROOT=$CVSROOT CVS_RSH=$CVS_RSH cvs -z 9 co mysql && cd mysql && \ + chmod u+w -R * && BUILD/compile-pentium +if test $? = 0 +then +cd $TMPDIR && rm -rf mysql +fi + + diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright new file mode 100755 index 00000000000..a4eac33ded8 --- /dev/null +++ b/Build-tools/mysql-copyright @@ -0,0 +1,212 @@ +#!/usr/bin/perl -i + +# Untar a MySQL distribution, change the copyright texts, +# pack it up again to a given directory + +$VER="1.1"; + +use Getopt::Long; + +$opt_help= 0; +$opt_target= "mysql-copyright-target-"; +$opt_target.= `date +%d%m%y-%H%M%S`; +chop $opt_target; + +GetOptions("help","target=s") || usage(); + +# fix the directory prefix for target dir + +$WD= `pwd`; +chop $WD; +$opt_target= $WD . '/' . $opt_target; + +&main(); + +#### +#### main +#### + +sub main +{ + my $REG_BASENAME = '[a-z0-9A-Z\-\_\+]+'; + my $REG_VERSION = '[0-9\.\-]+[a-z]?[0-9\.\-]+?(.alpha|.beta|.gamma|pre\d|[0-9\.\-a-z])?'; + my $target; + + usage() if (!$ARGV[0] || $opt_help); + + `mkdir -p $opt_target`; + $pec= $? >> 8; + die "Couldn't make the target directory!\n" if ($pec); + + for ($i=0; $ARGV[$i]; $i++) + { + my $distfile= $ARGV[$i]; + my $dir; + + $dir= "mysql-copyright-"; + $dir.= `date +%d%m%y-%H%M%S`; + chop $dir; + + if (!(mkdir "$dir", 0700)) + { + die "Couldn't make directory $dir!"; + } + if (!(chdir "$dir")) + { + abort($dir, "Couldn't cd to $dir!"); + } + # 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) + { + $distname= $1.$2.$3; + $suffix= $5.$6; + $newdistname= $1."com".$2.$3; + } + # find out the extract path (should be same as distname!) + $destdir= `tar tvzf ../$distfile | head -1`; + # remove leading crab + $destdir =~ s/.*\d+:\d+:\d+[ ]//; + # remove newline and slash from the end + $destdir= substr($destdir, 0, -2); + + if ("$destdir" ne "$distname") + { + print "Destination directory (the directory that will be extracted\n"; + print "from the original distribution file) differs from the\n"; + print "distribution name! Are you sure you want to continue? (Y/N) [N]:"; + $ans= my_read(1); + abort($dir, "Aborted!") if ("$ans" ne "Y" && "$ans" ne "y"); + } + + # everything should be ok, continue with extracting.. + `gtar xfz ../$distfile`; + $pec= $? >> 8; + abort($dir, "Extracting from tar failed!\n") if ($pec); + + # remove the 'PUBLIC' file from distribution and copy LICENSE + # on the toplevel of the directory instead. file 'PUBLIC' shouldn't + # exist in the new mysql distributions, but let's be sure.. + `rm -f $destdir/PUBLIC`; + `cp -a $WD/Docs/LICENSE $destdir/`; + + # fix file copyrights + &fix_usage_copyright(); + &add_copyright(); + + # rename the directory with new distribution name + `mv -f $destdir $newdistname`; + + # tar the new distribution + `gtar cz -f $opt_target/$newdistname.tar.gz *`; + $pec= $? >> 8; + abort($dir, "Making new tar archive failed!\n") if ($pec); + + # remove temporary directory + chdir ".."; + `rm -rf $dir/`; + } + exit(0); +} + +#### +#### 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) + { + chop $Cfile; + `replace \"This is free software,\\\\\\nand you are welcome to modify and redistribute it under the GPL license\" \"This is commercial software,\\\\nplease see the file LICENSE for details\" -- $Cfile`; + } +} + +#### +#### change the copyright text in the beginning of the files +#### + +sub add_copyright +{ + my @files = `find . -type f -name "*"`; + foreach my $file (@files) + { + chop $file; + `$WD/Build-tools/mysql-copyright-2 $file`; + } +} + +#### +#### read stdin +#### + +sub my_read +{ + ($length)= @_; # Max allowed length for the string. + + $input= getc(STDIN); + if($input eq "\n") + { + return "\n"; + } + for($new_input= getc(STDIN); $new_input ne "\n" ;) + { + if(length($input) < $length) + { + $input.= $new_input; + } + $new_input= getc(STDIN); + } + return $input; +} + +#### +#### abort +#### + +sub abort +{ + my ($dir, $errstr)= @_; + # remove newly made directory and it's contents + print "$errstr\n"; + chdir ".."; + print "Removing directory $dir...\n"; + `rm -rf $dir`; + exit(0); +} + +#### +#### usage +#### + +sub usage +{ + print <<EOF; +$0 version $VER by Jani Tolonen + +Description: The program takes one or more MySQL distributions as an +argument(s), extracts them, changes the copyright text in the +distribution files and makes a new distribution with suffix "com" in +the basename to directory mysql-copyright-target-DATE, where the +command was issued. For example: mysql-3.23.18-beta.tar.gz -> +mysqlcom-3.23.18-beta.tar.gz. DATE is of form DDMMYY-HHMMSS. The +target directory can be changed with option +--target=... mysql-copyright consists of two perl programs, this one +and another, mysql-copyright-2. Make sure the second part of the +script is available to the main script. + +Usage: +$0 [options] file1 [file2 file3...] + +Options: +--help Show this help and exit. +--target Target directory for new distribution files. + '.' can be used for the current directory. + (Default: $opt_target) +EOF + exit(0); +} diff --git a/Build-tools/mysql-copyright-2 b/Build-tools/mysql-copyright-2 new file mode 100755 index 00000000000..5aeb4bb81db --- /dev/null +++ b/Build-tools/mysql-copyright-2 @@ -0,0 +1,162 @@ +#!/usr/bin/perl -i + +# Add the header to all given files +# This program asumes that after the copyright there is a empty line +# + +$opt_v= 0; +require "getopts.pl"; +Getopts("v") || die "Aborted"; + +@copyright= +( + "Copyright (C) 2000 MySQL AB & MySQL Finland AB", + "", + "This software is distributed with NO WARRANTY OF ANY KIND. No author or", + "distributor accepts any responsibility for the consequences of using it, or", + "for whether it serves any particular purpose or works at all, unless he or", + "she says so in writing. Refer to the LICENSE file for details.", + "", + "Every copy of this file must include a copy of the License, normally in a", + "plain ASCII text file named LICENSE. The License grants you the right to", + "copy, modify and redistribute this file, but only under certain conditions", + "described in the License. Among other things, the License requires that", + "the copyright notice and this notice be preserved on all copies" +); + +while (<>) +{ + if (!$first++) + { + add_copyright($_); + } + if ($in_copyright) + { + $in_copyright=check_in_copyright($_); + } + print $_ if (!$in_copyright); + if (eof) + { + $first=0; $in_copyright=1; + } +} + +exit 0; + +sub add_copyright +{ + my ($line)=@_; + my ($row); + + $in_copyright= $line =~ /copyright/i; + $found_end_copyright=$skip_this_line=0; + + if (!($line =~ /Monty/ || $line =~ /MySQL AB/)) + { + $in_copyright=0; + print STDERR "File with unknown copyright ", $ARGV,"\n" if ($opt_v); + return; + } + else + { + print STDERR "To be Changed: ", $ARGV, "\n" if ($opt_v); + } + if ($ARGV =~ /Makefile/ || + $ARGV =~ /makefile/) + { # Makefile + $start_copyright="# "; + $line_copyright= "# "; + $end_copyright= ""; + } + elsif ($line =~ "^#!") + { # Shell script + $start_copyright="# "; + $line_copyright= "# "; + $end_copyright= ""; + $skip_this_line=1; + print $line; + while ($line=<>) # Copy all until new line or copyright + { + if ($line =~ /copyright/i) + { + last; + } + print $line; + last if ($line =~ /^(\s|\n)*$/); + } + $in_copyright=1; + } + elsif ($ARGV =~ /\.c$/ || + $ARGV =~ /\.cc$/ || + $ARGV =~ /\.h$/ || + $ARGV =~ /\.yy$/ || + $ARGV =~ /-x86\.s$/) + { + $start_copyright="/* "; + $line_copyright= " "; + $end_copyright= " */"; + } + elsif ($ARGV =~ /\.s$/) + { + $start_copyright="! "; + $line_copyright= "! "; + $end_copyright= ""; + } + elsif ($ARGV =~ /\.asm$/) + { + $start_copyright="; "; + $line_copyright= "; "; + $end_copyright= ""; + } + else # Unknown file + { + $in_copyright=0; + print STDERR "Unknown file type ", $ARGV,"\n" if ($opt_v); + return; + } + $data=\@copyright; + + for ($row=0 ; $row <= $#$data ; $row++) + { + print $row == 0 ? $start_copyright : $line_copyright; + print $data->[$row]; + print $row != $#$data ? "\n" : $end_copyright . "\n"; + } + print "\n"; + $end_copyright =~ /\s*([^\s]+)\s*(([^\s].*)|)$/; # Remove pre and post spaces +} + +# +# Return 1 if in copyright +# + +sub check_in_copyright +{ + my ($line)=@_; + $line =~ /^(.*[^\s])(\s|\n|\r)*$/; # Remove end space and newline + $line=$1; + if (!$line) + { + $found_end_copyright=1 if (!length($end_copyright)); + return 1; # Skip empty lines + } + return 0 if ($found_end_copyright); + if ($end_copyright) + { + if (index($line,$end_copyright) != -1) + { + $found_end_copyright=1; + } + return 1; + } + if ($line =~ /copyright/i || index($line . " ",$line_copyright) == 0) + { + return 1; + } + if ($skip_this_line) + { + $skip_this_line=0; + return 1; + } + return 0; # Can't trust the empty copyright line yet +} diff --git a/Build-tools/newest b/Build-tools/newest new file mode 100644 index 00000000000..367c9bd1f1b --- /dev/null +++ b/Build-tools/newest @@ -0,0 +1,116 @@ +#!/usr/bin/perl + +package NEWEST; + +use Getopt::Long; +use File::Basename; + +my $src_dir; +my $basename; +my $type = "tar.gz"; +my $versions; +my $help; +my %KEEPER; + + +GetOptions( + "src_dir=s" => \$src_dir, + "basename=s" => \$basename, + "type=s" => \$type, + "versions!" => \$versions, + "help!" => \$help + ); + +if (!defined $src_dir || !defined $basename) { + $help = 1; +} + +if ($help) { + &help(); + exit; +} + + +&extract_version(\$src_dir, \$basename, \$type, \%KEEPER); +&print_max(\%KEEPER, \$type, \$versions, &find_max(\%KEEPER)); + + + +sub extract_version { + my $src_dir = shift; + my $basename = shift; + my $type = shift; + my $KEEPER = shift; + + while (glob("$${src_dir}/$${basename}*")) { + my $base = basename("$_",".$${type}"); + my @ver = split /-/, $base; + my @nums = split /\./, $ver[$#ver]; + + my $new; + for (my $i=0; $i<$#nums+1; $i++) { + $new =~ s/^([0-9]*)([a-zA-Z]*)$/$1/; + $new .= 10000+$nums[$i]; + $new .= $2; + } + $KEEPER->{"$new"} = [$base,$ver[$#ver]]; + } + + return; +} + + + +sub find_max { + my $KEEPER = shift; + + return reverse sort (keys %$KEEPER); +} + + + +sub print_max { + my $KEEPER = shift; + my $type = shift; + my $versions = shift; + my $max_key = shift; + + if ($${versions}) { + print "$KEEPER->{$max_key}->[1]\n"; + } + else { + print "$KEEPER->{$max_key}->[0]" . ".$${type}\n"; + } + + return; +} + + + +sub help { + + print qq("newest" finds the tarball in a given directory with the newest version number +and returns it's filename. "newest" is meant to be embedded in UNIX shell +scripts. + +Usage: + +newest -(src_dir | s) /path/to/dir/with/tarballs + -(basename | b) BaseName (ex. BaseName-2.10.tar.gz) + -(type | t) Type of file (default: tar.gz) + -(versions | v) Print only version information + -(help | h) Prints usage help + +Ex: \$ /opt/bin/newest -s /opt/incoming/pm_modules -b Data-Dumper + Data-Dumper-2.101.tar.gz + +Both arguments, '-s' and '-b' are required; '-t' and '-v' are optional. + +); + + return; +} + + + + |