Commit 87a8e833 authored by joerg@mysql.com's avatar joerg@mysql.com

When coyright text is changed, autotools must be run after all

other actions, as otherwise timestamps of "config.h.in" will 
cause re-run on compilation machine (fatal version problem!).
parent 5cf8e9d7
#!/usr/bin/perl -i #!/usr/bin/perl -wi
# Untar a MySQL distribution, change the copyright texts, # Untar a MySQL distribution, change the copyright texts,
# pack it up again to a given directory # pack it up again to a given directory
$VER="1.3"; $VER="1.4";
use Cwd; use Cwd;
use File::Basename; use File::Basename;
...@@ -79,7 +79,7 @@ sub main ...@@ -79,7 +79,7 @@ sub main
$newdistname .= $suffix if $win_flag; $newdistname .= $suffix if $win_flag;
} }
# find out the extract path (should be same as distname!) # find out the extract path (should be same as distname!)
chomp($destdir = `tar ztf ../$distfile | head -1`); chomp($destdir= `tar ztf ../$distfile | head -1`);
# remove slash from the end # remove slash from the end
$destdir= substr($destdir, 0, -1); $destdir= substr($destdir, 0, -1);
...@@ -104,37 +104,25 @@ sub main ...@@ -104,37 +104,25 @@ sub main
unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT"); unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT");
copy("$WD/Docs/MySQLEULA.txt", "$destdir"); copy("$WD/Docs/MySQLEULA.txt", "$destdir");
# remove readline subdir and update configure accordingly # remove subdirectories 'bdb', 'cmd-line-utils/readline'
system("rm -rf $destdir/cmd-line-utils/readline"); # (latter does not apply to 4.0, but is in different place there!)
if ($win_flag) { my @extra_fat= ('bdb', 'cmd-line-utils/readline');
chdir("$destdir") or (print "$! Unable to change directory to $destdir!\n" && exit(0));
} else { foreach my $fat (@extra_fat)
chdir("$destdir"); {
unlink ("configure") or die "Can't delete $destdir/configure: $!\n"; &trim_the_fat($fat);
open(CONFIGURE,"<configure.in") or die "$! Unable to open configure.in to read from!\n";
local $/;
undef $/;
my $configure = <CONFIGURE>;
close(CONFIGURE);
$configure =~ s|cmd\-line\-utils/readline/Makefile dnl\n?||g;
open(CONFIGURE,">configure.in") or die "$! Unable to open configure.in to write to!\n";
print CONFIGURE $configure;
close(CONFIGURE);
`aclocal && autoheader && aclocal && automake && autoconf`;
if (! -f "configure") {
print "\"./configure\" was not produced, exiting!\n";
exit(0);
}
if (-d "autom4te.cache") {
print "Trying to delete autom4te.cache dir\n" if $opt_verbose;
system("rm -rf autom4te.cache") or print "Unable to delete autom4te.cache dir: $!\n";
}
} }
# fix file copyrights # fix file copyrights
&fix_usage_copyright(); &fix_usage_copyright();
&add_copyright(); &add_copyright();
# fix LICENSE tag in include/mysql_version.h
&fix_mysql_version();
# apply "autotools" - must be last to ensure proper timestamps
&run_autotools();
# rename the directory with new distribution name # rename the directory with new distribution name
chdir("$WD/$dir"); chdir("$WD/$dir");
print "renaming $destdir $newdistname\n" if $opt_verbose; print "renaming $destdir $newdistname\n" if $opt_verbose;
...@@ -160,6 +148,101 @@ sub main ...@@ -160,6 +148,101 @@ sub main
exit(0); exit(0);
} }
####
#### This function will s/GPL/Commercial/ in include/mysql_version.h for the
#### LICENSE tag.
####
sub fix_mysql_version
{
my $cwd= getcwd();
chdir("$destdir");
my $header_file= (-f 'include/mysql_version.h.in')? 'include/mysql_version.h.in' : 'include/mysql_version.h';
open(MYSQL_VERSION,"<$header_file") or die "Unable to open $header_file for read: $!\n";
undef $/;
my $mysql_version= <MYSQL_VERSION>;
close(MYSQL_VERSION);
$mysql_version=~ s/\#define LICENSE[\s\t]+GPL/#define LICENSE Commercial/;
open(MYSQL_VERSION,">$header_file") or die "Unable to open $header_file for write: $!\n";
print MYSQL_VERSION $mysql_version;
close(MYSQL_VERSION);
chdir("$cwd");
}
####
#### 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();
chdir("$destdir");
if ( -d "${the_fat}" )
{
system("rm -rf ${the_fat}");
if (!$win_flag)
{
open(CONFIG_IN,"<configure.in") or die "Unable to open configure.in for read: $!\n";
undef $/;
my $config_in= <CONFIG_IN>;
close(CONFIG_IN);
#
# If $the_fat Makefile line closes the parenthesis, then
# replace that line with just the closing parenthesis.
#
if ($config_in=~ m|${the_fat}/Makefile\)\n?|)
{
$config_in=~ s|${the_fat}/Makefile(\)\n?)|$1|;
}
#
# Else just delete the line
#
else
{
$config_in=~ s|${the_fat}/Makefile dnl\n?||;
}
open(CONFIG_IN,">configure.in") or die "Unable to open configure.in for write: $!\n";
print CONFIG_IN $config_in;
close(CONFIG_IN);
}
}
chdir("$cwd");
}
####
#### This function will run the autotools on the reduced source tree.
####
sub run_autotools
{
my $cwd= getcwd();
if (!$win_flag)
{
chdir("$destdir");
unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
# File "configure.in" has already been modified by "trim_the_fat()"
`aclocal && autoheader && aclocal && automake && autoconf`;
die "'./configure' was not produced!" unless (-f "configure");
if (-d "autom4te.cache") {
print "Trying to delete autom4te.cache dir\n" if $opt_verbose;
system("rm -rf autom4te.cache") or print "Unable to delete autom4te.cache dir: $!\n";
}
chdir("$cwd");
}
}
#### ####
#### mysqld and MySQL client programs have a usage printed with --help. #### mysqld and MySQL client programs have a usage printed with --help.
#### This usage includes a copyright, which needs to be modified #### This usage includes a copyright, which needs to be modified
...@@ -191,6 +274,7 @@ sub add_copyright ...@@ -191,6 +274,7 @@ sub add_copyright
foreach my $file (@files) foreach my $file (@files)
{ {
next if ! -f $file; next if ! -f $file;
next if -B $file;
print "processing file $file in cwd $cwd\n" if $opt_verbose; print "processing file $file in cwd $cwd\n" if $opt_verbose;
`$WD/Build-tools/mysql-copyright-2 "$file"`; `$WD/Build-tools/mysql-copyright-2 "$file"`;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment