mirror of https://github.com/CGAL/cgal
147 lines
3.5 KiB
Perl
Executable File
147 lines
3.5 KiB
Perl
Executable File
#!/sw/bin/perl -w
|
|
|
|
use strict;
|
|
|
|
$ENV{PATH}=
|
|
'/sw/bin:/sbin:/usr/sbin:/usr/bsd:/bin:/usr/bin';
|
|
|
|
my $scriptsdir = "/projects/CGAL/admin_scripts";
|
|
my $mail_prog="$scriptsdir/send_cgal_mail";
|
|
my $unpack_dir_base= "/tmp";
|
|
my $unpack_dir;
|
|
my $testresult_dir = "/users/www/CGAL/Members/Develop/testsuite";
|
|
#my $testresult_dir = "/users/geert/tmp/tr";
|
|
my $result_url;
|
|
my $lockfile="/private/cgal_testannounce.lock";
|
|
my $announcements_dir="/private/CGAL/testannouncements";
|
|
my $lock_cmd= "/sw/bin/lockfile -r 10 -l 600 $lockfile";
|
|
|
|
my ($cgal_version,$tarname,@results);
|
|
|
|
sub usage()
|
|
{
|
|
print STDERR "usage: $0 URL\n";
|
|
}
|
|
|
|
sub make_unpackdir()
|
|
{
|
|
my $dirno = 1;
|
|
my $TMPDIR;
|
|
$TMPDIR = "$unpack_dir_base/TMP$dirno";
|
|
while ( -f $TMPDIR or -d $TMPDIR ) {
|
|
++$dirno;
|
|
$TMPDIR = "$unpack_dir_base/TMP$dirno";
|
|
}
|
|
mkdir($TMPDIR,0770) or die "Cannot create temporary directory $TMPDIR\n";
|
|
$unpack_dir = $TMPDIR;
|
|
}
|
|
|
|
sub unpack_results()
|
|
{
|
|
chdir $unpack_dir or die;
|
|
if (system("$scriptsdir/get_cgal_html", $result_url) != 0) {
|
|
chdir('..');
|
|
system('rm','-rf',$unpack_dir);
|
|
die "Could not get URL $result_url\n";
|
|
}
|
|
system("gunzip", "${tarname}.gz")== 0
|
|
or die "Could not gunzip ${tarname}.gz\n";
|
|
@results=grep /tar$|tar\.gz$/, `tar tf ${tarname}`;
|
|
chomp @results;
|
|
system("tar", "xf", ${tarname}, @results);
|
|
system("$scriptsdir/to_zipped_format", "-v", $cgal_version, @results)==0
|
|
or die "to_zipped_format failed. Test collection not installed.\n";
|
|
}
|
|
|
|
sub oldnotify()
|
|
{
|
|
my $resultfile;
|
|
open NOTICE,
|
|
"|$mail_prog \"New test results for $cgal_version\" 'geert\@cs.uu.nl'";
|
|
print NOTICE <<"TOTHIER";
|
|
Results for the following platforms have been installed on
|
|
http://www.cs.uu.nl/CGAL/Members/Develop/testsuite/results.html
|
|
|
|
TOTHIER
|
|
|
|
for $resultfile (@results) {
|
|
$resultfile =~ s/\.tar//;
|
|
$resultfile =~ s/^results_//;
|
|
print NOTICE $resultfile, "\n";
|
|
}
|
|
close NOTICE;
|
|
}
|
|
|
|
sub notify()
|
|
{
|
|
my $resultfile;
|
|
|
|
# new notification method
|
|
|
|
if (system($lock_cmd)==0) {
|
|
my $announcement_file;
|
|
$announcement_file = "$announcements_dir/$cgal_version";
|
|
if ( -w $announcement_file ) {
|
|
open NOTICE, ">> $announcement_file";
|
|
} else {
|
|
open NOTICE, "> $announcement_file";
|
|
print NOTICE <<"TOTHIER";
|
|
Results for the following platforms have been installed on
|
|
http://www.cs.uu.nl/CGAL/Members/Develop/testsuite/results.html
|
|
|
|
TOTHIER
|
|
}
|
|
for $resultfile (@results) {
|
|
$resultfile =~ s/\.tar//;
|
|
$resultfile =~ s/^results_//;
|
|
print NOTICE $resultfile, "\n";
|
|
}
|
|
close NOTICE;
|
|
unlink $lockfile;
|
|
}
|
|
|
|
}
|
|
|
|
sub install_results()
|
|
{
|
|
chdir $testresult_dir;
|
|
chdir $cgal_version;
|
|
my $resultfile;
|
|
for $resultfile (@results) {
|
|
$resultfile =~ s/\.gz//;
|
|
system("tar", "xf", "${unpack_dir}/$resultfile");
|
|
unlink "${unpack_dir}/$resultfile";
|
|
}
|
|
chdir "..";
|
|
system("./create_testresult_page", $cgal_version);
|
|
|
|
# clean up stuff in UNPACK_DIR
|
|
|
|
chdir $unpack_dir;
|
|
unlink $tarname;
|
|
notify();
|
|
|
|
}
|
|
|
|
# check if there is one param
|
|
if ( $#ARGV != 0) {
|
|
usage();
|
|
die;
|
|
}
|
|
|
|
$result_url = $ARGV[0];
|
|
$tarname=`basename $result_url .gz`;
|
|
chomp $tarname;
|
|
|
|
if ( $tarname =~ m/^(CGAL-\d+\.\d+-I-\d+)-/ ) {
|
|
$cgal_version=$1;
|
|
} else {
|
|
die "$tarname is not a valid name for a testresult collection.\n";
|
|
}
|
|
|
|
make_unpackdir();
|
|
eval {unpack_results()} && eval{install_results()};
|
|
$@ && warn $@;
|
|
chdir($unpack_dir_base);
|
|
system('rm','-rf',$unpack_dir);
|