mirror of
https://github.com/MariaDB/server.git
synced 2025-05-28 13:01:41 +03:00
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!). Build-tools/mysql-copyright: 1) Ensure that autotools are run as last action, after copyright change, for proper timestamps. 2) Move the trimming of subtrees to an own function "trim_the_fat". 3) Align 4.0 and 4.1 versions.
This commit is contained in:
parent
799505216f
commit
e4e919f99f
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/perl -i
|
||||
#!/usr/bin/perl -wi
|
||||
|
||||
# Untar a MySQL distribution, change the copyright texts,
|
||||
# pack it up again to a given directory
|
||||
|
||||
$VER="1.3";
|
||||
$VER="1.4";
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
@ -79,7 +79,7 @@ sub main
|
||||
$newdistname .= $suffix if $win_flag;
|
||||
}
|
||||
# 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
|
||||
$destdir= substr($destdir, 0, -1);
|
||||
|
||||
@ -104,37 +104,25 @@ sub main
|
||||
unlink("$destdir/COPYING", "$destdir/EXCEPTIONS-CLIENT");
|
||||
copy("$WD/Docs/MySQLEULA.txt", "$destdir");
|
||||
|
||||
# remove readline subdir and update configure accordingly
|
||||
system("rm -rf $destdir/cmd-line-utils/readline");
|
||||
if ($win_flag) {
|
||||
chdir("$destdir") or (print "$! Unable to change directory to $destdir!\n" && exit(0));
|
||||
} else {
|
||||
chdir("$destdir");
|
||||
unlink ("configure") or die "Can't delete $destdir/configure: $!\n";
|
||||
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";
|
||||
}
|
||||
# remove subdirectories 'bdb', 'cmd-line-utils/readline'
|
||||
# (latter does not apply to 4.0, but is in different place there!)
|
||||
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();
|
||||
|
||||
# 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
|
||||
chdir("$WD/$dir");
|
||||
print "renaming $destdir $newdistname\n" if $opt_verbose;
|
||||
@ -160,6 +148,101 @@ sub main
|
||||
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.
|
||||
#### This usage includes a copyright, which needs to be modified
|
||||
@ -191,6 +274,7 @@ sub add_copyright
|
||||
foreach my $file (@files)
|
||||
{
|
||||
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"`;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user