diff options
Diffstat (limited to 'Build-tools')
-rwxr-xr-x | Build-tools/mysql-copyright | 62 | ||||
-rwxr-xr-x | Build-tools/mysql-copyright-2 | 2 |
2 files changed, 45 insertions, 19 deletions
diff --git a/Build-tools/mysql-copyright b/Build-tools/mysql-copyright index 70b65d3f2cf..4c40908e7ed 100755 --- a/Build-tools/mysql-copyright +++ b/Build-tools/mysql-copyright @@ -3,8 +3,11 @@ # Untar a MySQL distribution, change the copyright texts, # pack it up again to a given directory -$VER="1.2"; +$VER="1.3"; +use Cwd; +use File::Basename; +use File::Copy; use Getopt::Long; $opt_help = 0; @@ -17,8 +20,8 @@ GetOptions("help","version","target=s") || error(); # fix the directory prefix for target dir -$WD= `pwd`; -chop $WD; +$WD= cwd(); +my $win_flag = 0; $opt_target= $WD . '/' . $opt_target; &main(); @@ -48,6 +51,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-"; @@ -64,20 +68,24 @@ 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) + print "distfile $distfile\n"; + if ($distfile =~ + m/^($REG_BASENAME)([\-\_])($REG_VERSION){1}([\.\-\+]\w+\-\w+)?[\.\-\+](.*)?$/xo) { $distname= $1.$2.$3; - $suffix= $5.$6; + print "distname $distname\n"; + $suffix= $5; + $fileext = $6; + print "suffix $suffix fileext $fileext\n"; $newdistname= $1."com".$2.$3; + $newdistname .= $suffix if $win_flag; } # 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); + 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") { @@ -96,18 +104,34 @@ sub main # remove the 'PUBLIC' file from distribution and copy MySQLEULA.txt # 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 $destdir/README`; - `cp -p $WD/Docs/MySQLEULA.txt $destdir/`; + 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"); + if ($win_flag) { + #`(cd $destdir)`; + 'cd $destdir'; + } else { + 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)`; + } + # fix file copyrights &fix_usage_copyright(); &add_copyright(); + #chdir(".."); + my $cwd = `pwd`; + print "current dir is $cwd\n" ; # rename the directory with new distribution name - `mv -f $destdir $newdistname`; + print "renaming $destdir $newdistname\n"; + rename($destdir, $newdistname); # tar the new distribution - `tar cz -f $opt_target/$newdistname.tar.gz *`; + `tar cz -f $opt_target/$newdistname.tar.gz $newdistname`; $pec= $? >> 8; abort($dir, "Making new tar archive failed!\n") if ($pec); @@ -129,7 +153,7 @@ sub fix_usage_copyright foreach my $Cfile (@Cfiles) { 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"`; } } @@ -143,7 +167,9 @@ sub add_copyright foreach my $file (@files) { chop $file; - `$WD/Build-tools/mysql-copyright-2 $file`; + next if ! -f $file; + next if -B $file; + `$WD/Build-tools/mysql-copyright-2 "$file"`; } } diff --git a/Build-tools/mysql-copyright-2 b/Build-tools/mysql-copyright-2 index 447a2d7c164..e946ed217d1 100755 --- a/Build-tools/mysql-copyright-2 +++ b/Build-tools/mysql-copyright-2 @@ -93,7 +93,7 @@ sub add_copyright { $start_copyright="/* "; $line_copyright= " "; - $end_copyright= " */"; + $end_copyright= "*/"; } elsif ($ARGV =~ /-x86\.s$/) { |