Commit 7d3d862f authored by unknown's avatar unknown

see notes for mysql-copyright scripts


Build-tools/mysql-copyright-2:
  small fix
Build-tools/mysql-copyright:
  deals with windows src file now
parent ca96a3b4
...@@ -3,8 +3,11 @@ ...@@ -3,8 +3,11 @@
# 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.2"; $VER="1.3";
use Cwd;
use File::Basename;
use File::Copy;
use Getopt::Long; use Getopt::Long;
$opt_help = 0; $opt_help = 0;
...@@ -17,8 +20,8 @@ GetOptions("help","version","target=s") || error(); ...@@ -17,8 +20,8 @@ GetOptions("help","version","target=s") || error();
# fix the directory prefix for target dir # fix the directory prefix for target dir
$WD= `pwd`; $WD= cwd();
chop $WD; my $win_flag = 0;
$opt_target= $WD . '/' . $opt_target; $opt_target= $WD . '/' . $opt_target;
&main(); &main();
...@@ -48,6 +51,7 @@ sub main ...@@ -48,6 +51,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-";
...@@ -64,20 +68,24 @@ sub main ...@@ -64,20 +68,24 @@ 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)([\-\_]) print "distfile $distfile\n";
($REG_VERSION){1}([\.\-\+]) if ($distfile =~
(.*)?$/xo) m/^($REG_BASENAME)([\-\_])($REG_VERSION){1}([\.\-\+]\w+\-\w+)?[\.\-\+](.*)?$/xo)
{ {
$distname= $1.$2.$3; $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= $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!)
$destdir= `tar tvzf ../$distfile | head -1`; chomp($destdir= `tar ztf ../$distfile | head -1`);
# remove leading crab # remove slash from the end
$destdir =~ s/.*\d+:\d+:\d+[ ]//; $destdir= substr($destdir, 0, -1);
# remove newline and slash from the end print "destdir: $destdir\n";
$destdir= substr($destdir, 0, -2); print "distname: $distname\n";
if ("$destdir" ne "$distname") if ("$destdir" ne "$distname")
{ {
...@@ -96,18 +104,34 @@ sub main ...@@ -96,18 +104,34 @@ sub main
# remove the 'PUBLIC' file from distribution and copy MySQLEULA.txt # remove the 'PUBLIC' file from distribution and copy MySQLEULA.txt
# on the toplevel of the directory instead. file 'PUBLIC' shouldn't # on the toplevel of the directory instead. file 'PUBLIC' shouldn't
# exist in the new mysql distributions, but let's be sure.. # exist in the new mysql distributions, but let's be sure..
`rm -f $destdir/PUBLIC $destdir/README`; unlink("$destdir/PUBLIC", "$destdir/README");
`cp -p $WD/Docs/MySQLEULA.txt $destdir/`; 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 file copyrights
&fix_usage_copyright(); &fix_usage_copyright();
&add_copyright(); &add_copyright();
#chdir("..");
my $cwd = `pwd`;
print "current dir is $cwd\n" ;
# rename the directory with new distribution name # rename the directory with new distribution name
`mv -f $destdir $newdistname`; print "renaming $destdir $newdistname\n";
rename($destdir, $newdistname);
# tar the new distribution # tar the new distribution
`tar cz -f $opt_target/$newdistname.tar.gz *`; `tar cz -f $opt_target/$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);
...@@ -129,7 +153,7 @@ sub fix_usage_copyright ...@@ -129,7 +153,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"`;
} }
} }
...@@ -143,7 +167,9 @@ sub add_copyright ...@@ -143,7 +167,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"`;
} }
} }
......
...@@ -93,7 +93,7 @@ sub add_copyright ...@@ -93,7 +93,7 @@ sub add_copyright
{ {
$start_copyright="/* "; $start_copyright="/* ";
$line_copyright= " "; $line_copyright= " ";
$end_copyright= " */"; $end_copyright= "*/";
} }
elsif ($ARGV =~ /-x86\.s$/) elsif ($ARGV =~ /-x86\.s$/)
{ {
......
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