mirror of https://github.com/CGAL/cgal
95 lines
2.1 KiB
Plaintext
Executable File
95 lines
2.1 KiB
Plaintext
Executable File
#!/sw/bin/perl5 -w
|
|
|
|
use strict;
|
|
|
|
my $tmpdir;
|
|
|
|
sub usage {
|
|
print STDERR "$0: usage\n";
|
|
print STDERR "$0 result1.tar[.gz] ...\n";
|
|
}
|
|
|
|
sub make_tempdir()
|
|
{
|
|
my $dirno = 1;
|
|
$tmpdir = "TMP$dirno";
|
|
while ( -f $tmpdir or -d $tmpdir ) {
|
|
++$dirno;
|
|
$tmpdir = "TMP$dirno";
|
|
}
|
|
mkdir($tmpdir,0770) or die "Cannot create temporary directory $tmpdir\n";
|
|
}
|
|
|
|
sub one_archive($)
|
|
{
|
|
my $archive = shift;
|
|
make_tempdir();
|
|
if (! -f $archive) {
|
|
print STDERR "$archive is not a valid filename\n";
|
|
return 0;
|
|
}
|
|
if ( $archive =~ m/\.gz$/ ) {
|
|
system("/sw/bin/gunzip", "$archive") == 0 or return 0;
|
|
$archive =~ s/\.gz$//;
|
|
}
|
|
if ( $archive =~ m/.*\.tgz$/ ) {
|
|
system("gunzip", "$archive") == 0 or return 0;
|
|
$archive =~ s/\.tgz$/.tar/;
|
|
}
|
|
if ( $archive !~ /\.tar$/) {
|
|
print STDERR "$0: $archive not a tar file\n";
|
|
return 0;
|
|
}
|
|
rename("$archive","$tmpdir/$archive") or die;
|
|
chdir("$tmpdir") or die;
|
|
system("tar", "xf", "$archive") == 0 or die;
|
|
unlink($archive);
|
|
system('gzip',glob("*/*"));
|
|
system('chmod','-R','a+r,og+w','.');
|
|
system('tar', 'cf', "../$archive", glob("*")) == 0 or die;
|
|
chdir('..') or die;
|
|
system('rm', '-rf', "$tmpdir")== 0 or die;
|
|
return 1;
|
|
}
|
|
|
|
sub all_archives() {
|
|
my $archive;
|
|
foreach $archive (@ARGV) {
|
|
if (one_archive($archive)) {
|
|
print STDERR "$archive succesfully reformatted.\n";
|
|
} else {
|
|
print STDERR "Could not reformat $archive\n";
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($#ARGV < 0) {
|
|
usage;
|
|
exit 1;
|
|
}
|
|
|
|
all_archives();
|
|
|
|
|
|
|
|
#--------------------------
|
|
# parse_mail such that you get
|
|
# $test_url ==
|
|
# (http://)($host_and_directory)/($release_version)(-test)($number)(.tar.gz)
|
|
# make tmpdir under /private/CGAL and go there
|
|
# wget $test_url
|
|
# gunzip $name == ${release_version}-test${number}.tar.gz
|
|
# rm *.txt
|
|
# $unpack_dir = cwd
|
|
# $testresult_dir = $CGWW/testsuite/$release_version
|
|
# test if $testresult_dir exists.
|
|
# foreach $name.gz in result*gz {
|
|
# to_zipped_format $name.gz
|
|
# cd $testresult_dir
|
|
# tar xf $unpack_dir/$name
|
|
# cd $unpack_dir
|
|
# }
|
|
# cd $testresult_dir/..
|
|
# make_www_page ${release_version}
|
|
|