Commit b975fd1c authored by unknown's avatar unknown

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-4.1

into poseidon.bredbandsbolaget.se:/home/tomas/mysql-4.1
parents 2ef21106 bb66cb34
...@@ -12,15 +12,17 @@ use Getopt::Long; ...@@ -12,15 +12,17 @@ use Getopt::Long;
$opt_help = 0; $opt_help = 0;
$opt_version = 0; $opt_version = 0;
$opt_verbose = 0;
$opt_target = "mysql-copyright-target-"; $opt_target = "mysql-copyright-target-";
$opt_target .= `date +%d%m%y-%H%M%S`; $opt_target .= `date +%d%m%y-%H%M%S`;
chop $opt_target; chop $opt_target;
GetOptions("help","version","target=s") || error(); GetOptions("help","version","target=s", "verbose") || error();
# fix the directory prefix for target dir # fix the directory prefix for target dir
$WD= cwd(); $WD= cwd();
my $win_flag = 0;
$opt_target= $WD . '/' . $opt_target; $opt_target= $WD . '/' . $opt_target;
&main(); &main();
...@@ -50,6 +52,7 @@ sub main ...@@ -50,6 +52,7 @@ sub main
for ($i=0; $ARGV[$i]; $i++) for ($i=0; $ARGV[$i]; $i++)
{ {
my $distfile= $ARGV[$i]; my $distfile= $ARGV[$i];
$win_flag = ($distfile =~ /win-src/) ? 1 : 0;
my $dir; my $dir;
$dir= "mysql-copyright-"; $dir= "mysql-copyright-";
...@@ -66,20 +69,19 @@ sub main ...@@ -66,20 +69,19 @@ sub main
} }
# if the distfile is mysql-3.22.22-alpha.tar.gz, then # if the distfile is mysql-3.22.22-alpha.tar.gz, then
# distname is 'mysql-3.22.22-alpha' and suffix '.tar.gz' # distname is 'mysql-3.22.22-alpha' and suffix '.tar.gz'
if ($distfile =~ m/^($REG_BASENAME)([\-\_]) if ($distfile =~
($REG_VERSION){1}([\.\-\+]) m/^($REG_BASENAME)([\-\_])($REG_VERSION){1}([\.\-\+]\w+\-\w+)?[\.\-\+](.*)?$/xo)
(.*)?$/xo)
{ {
$distname= $1.$2.$3; $distname= $1.$2.$3;
$suffix= $5.$6; $suffix= $5;
$fileext = $6;
$newdistname= $1."com".$2.$3; $newdistname= $1."com".$2.$3;
$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);
print "destdir: $destdir\n";
print "distname: $distname\n";
if ("$destdir" ne "$distname") if ("$destdir" ne "$distname")
{ {
...@@ -103,26 +105,49 @@ sub main ...@@ -103,26 +105,49 @@ sub main
# remove readline subdir and update configure accordingly # remove readline subdir and update configure accordingly
system("rm -rf $destdir/cmd-line-utils/readline"); system("rm -rf $destdir/cmd-line-utils/readline");
unlink ("$destdir/configure") or die "Can't delete $destdir/configure: $!\n"; if ($win_flag) {
`(cd $destdir ; sed -e 's!\ cmd-line-utils\/readline\/Makefile\ dnl!!g' < configure.in > configure.in.new)`; chdir("$destdir") or (print "$! Unable to change directory to $desdir!\n" && exit(0));
rename ("$destdir/configure.in.new","$destdir/configure.in") or die "Can't rename $destdir/configure.in.new: $!\n";; } else {
`(cd $destdir ; autoconf)`; 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";
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);
`autoconf`;
if (! -f "configure") {
print "\"./configure\" was not produced, exiting!\n";
exit(0);
}
}
# fix file copyrights # fix file copyrights
&fix_usage_copyright(); &fix_usage_copyright();
&add_copyright(); &add_copyright();
# rename the directory with new distribution name # rename the directory with new distribution name
chdir("$WD/$dir");
print "renaming $destdir $newdistname\n" if $opt_verbose;
rename($destdir, $newdistname); rename($destdir, $newdistname);
# tar the new distribution # tar the new distribution
`tar cz -f $opt_target/$newdistname.tar.gz *`; `tar cz -f $WD/$newdistname.tar.gz $newdistname`;
$pec= $? >> 8; $pec= $? >> 8;
abort($dir, "Making new tar archive failed!\n") if ($pec); abort($dir, "Making new tar archive failed!\n") if ($pec);
# remove temporary directory # remove temporary directory
chdir ".."; chdir($WD) or print "$! Unable to move up one dir\n";
`rm -rf $dir/`; my $cwd = getcwd();
print "current dir is $cwd\n" if $opt_verbose ;
print "deleting temp dir $dir\n" if $opt_verbose;
if (-d $dir) {
system("rm -rf $dir") or print "$! Unable to delete $dir!\n";
}
} }
exit(0); exit(0);
} }
...@@ -138,7 +163,7 @@ sub fix_usage_copyright ...@@ -138,7 +163,7 @@ sub fix_usage_copyright
foreach my $Cfile (@Cfiles) foreach my $Cfile (@Cfiles)
{ {
chop $Cfile; 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`; `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"` if -f $Cfile;
} }
} }
...@@ -152,7 +177,9 @@ sub add_copyright ...@@ -152,7 +177,9 @@ sub add_copyright
foreach my $file (@files) foreach my $file (@files)
{ {
chop $file; chop $file;
`$WD/Build-tools/mysql-copyright-2 $file`; next if ! -f $file;
next if -B $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