mirror of https://github.com/CGAL/cgal
Remove those awfully obsoleted scripts!
This commit is contained in:
parent
d26c3b4caa
commit
8ee24ddb99
|
|
@ -1,356 +0,0 @@
|
|||
#!/sw/bin/perl -w
|
||||
|
||||
use strict;
|
||||
#use Cwd;
|
||||
use File::Copy;
|
||||
#use File::Basename;
|
||||
#use File::Find;
|
||||
use Getopt::Std;
|
||||
|
||||
#
|
||||
# This script Checks if a file header complies to the CGAL rules.
|
||||
|
||||
sub usage()
|
||||
{
|
||||
print STDERR<<"EOF";
|
||||
usage:
|
||||
$0 (-h|-u|-c) [-v version] [-d date] [-p package] [-m maintainer] file1 ...
|
||||
|
||||
Exactly one of the options -h, -u and -c must be present.
|
||||
-h show this message and quit
|
||||
-u update headers
|
||||
-c check but do no updates
|
||||
|
||||
The following options are only effective in combination with -u.
|
||||
They give some data that is filled in in the header.
|
||||
-v version of the release (default: empty string)
|
||||
-d date of the release (default: today)
|
||||
-p package (default: leave it as specified in the file)
|
||||
-m maintainer (default: no maintainer line)
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
sub gjmove($$)
|
||||
{
|
||||
return 1 if rename($_[0], $_[1] );
|
||||
return (system('mv', "$_[0]", "$_[1]") == 0);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# initialization #
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
my $TEMPFILE;
|
||||
|
||||
|
||||
sub print_license()
|
||||
{
|
||||
print TEMPFILE <<'END_OF_LICENSE';
|
||||
//
|
||||
// This software and related documentation is part of an INTERNAL release
|
||||
// of the Computational Geometry Algorithms Library (CGAL). It is not
|
||||
// intended for general use.
|
||||
//
|
||||
END_OF_LICENSE
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# add_header #
|
||||
#
|
||||
#
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
sub add_header($$$$$)
|
||||
{
|
||||
my ($version, $date, $package, $maintainer, $filename) = @_;
|
||||
$version = "" if (!defined($version));
|
||||
$package = "" if (!defined($package));
|
||||
$maintainer = "" if (!defined($maintainer));
|
||||
my $year = `date '+%Y'`;
|
||||
chomp $year;
|
||||
print TEMPFILE "// ", '=' x 70,"\n";
|
||||
print TEMPFILE "//\n";
|
||||
print TEMPFILE "// Copyright \(c\) $year The CGAL Consortium\n";
|
||||
print_license;
|
||||
print TEMPFILE "// ", '-' x 70,"\n";
|
||||
print TEMPFILE <<"END_OF_HEADER";
|
||||
//
|
||||
// release : $version
|
||||
// release_date : $date
|
||||
//
|
||||
// file : ?/$filename
|
||||
// package : $package
|
||||
// maintainer : $maintainer
|
||||
// author(s) : ?
|
||||
// coordinator : ?
|
||||
//
|
||||
END_OF_HEADER
|
||||
print TEMPFILE "// ", '=' x 70,"\n";
|
||||
while(<SOURCE_FILE>) {
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# check_and_update_2 #
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
sub check_and_update_2($$$$$)
|
||||
{
|
||||
my ($version, $date, $package, $maintainer, $filename) = @_;
|
||||
my $warnings = 0;
|
||||
my $header_position = 1;
|
||||
# 1:before header; 2: in first part; 3: in second part 4: after header.
|
||||
|
||||
my $text_before_header = 0;
|
||||
while ( <SOURCE_FILE> ) {
|
||||
if ( m|^\s*//\s*={10,}\s*$| ) {
|
||||
$header_position = 2;
|
||||
last;
|
||||
}
|
||||
if ( $_ !~ m|^\s*$| ) {
|
||||
$text_before_header = 1;
|
||||
}
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
if ($header_position != 2) {
|
||||
print FILE_CHECKS "$filename has no header.\n";
|
||||
return 0;
|
||||
}
|
||||
if ($text_before_header) {
|
||||
print FILE_CHECKS "$filename has text before the header.\n";
|
||||
}
|
||||
print TEMPFILE "// ", '=' x 70,"\n";
|
||||
print TEMPFILE "//\n";
|
||||
$_ = <SOURCE_FILE>;
|
||||
$_ = <SOURCE_FILE> while (m|^\s*//\s*$|);
|
||||
if ($_ !~ m<^\s*//\s*Copyright\s*\(c\)\s*\d{4}([-,]\s?\d{4})*\s+(t|T)he CGAL Consortium\s*$> ) {
|
||||
print FILE_CHECKS "$filename has no valid copyright notice.\n";
|
||||
return 0;
|
||||
}
|
||||
print TEMPFILE $_;
|
||||
print_license;
|
||||
while ( <SOURCE_FILE> ) {
|
||||
if (m|^\s*//\s*-{10,}\s*$|) {
|
||||
$header_position = 3;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ($header_position != 3) {
|
||||
print FILE_CHECKS "$filename has an incorrect header.\n";
|
||||
print FILE_CHECKS "The line with dashes (----) is missing.\n";
|
||||
return 0;
|
||||
}
|
||||
print TEMPFILE "// ", '-' x 70,"\n";
|
||||
|
||||
my ($release_seen, $release_date_seen, $file_seen, $package_seen,
|
||||
$authors_seen, $coordinator_seen) = (0,0,0,0,0,0);
|
||||
while ( <SOURCE_FILE> ) {
|
||||
if ( m|^\s*//\s*={10,}\s*$| ) {
|
||||
$header_position = 4;
|
||||
last;
|
||||
}
|
||||
next if ($_ !~ m|^\s*//| );
|
||||
if ( m<^\s*//\s*release\s*:> ) {
|
||||
++$release_seen;
|
||||
print TEMPFILE "// release : $version\n";
|
||||
next;
|
||||
}
|
||||
if ( m<^\s*//\s*release_date\s*:> ) {
|
||||
++$release_date_seen;
|
||||
print TEMPFILE "// release_date : $date\n";
|
||||
next;
|
||||
}
|
||||
if ( m<^\s*//\s*file\s*:\s*(.*?)\s*$> ) {
|
||||
++$file_seen;
|
||||
my ($short_filename1, $short_filename2) = ($1,$filename);
|
||||
$short_filename1 =~ s|^.*/||;
|
||||
$short_filename1 =~ s|\s*$||;
|
||||
$short_filename2 =~ s|^.*/||;
|
||||
$short_filename2 =~ s|\s*$||;
|
||||
if ($short_filename1 ne $short_filename2) {
|
||||
$warnings = 1;
|
||||
print FILE_CHECKS
|
||||
"$filename: File name mentioned in header",
|
||||
" ($short_filename1) is incorrect.\n";
|
||||
}
|
||||
print TEMPFILE $_;
|
||||
if (defined($package) and $file_seen==1) {
|
||||
print TEMPFILE "// package : $package\n";
|
||||
if (defined($maintainer)) {
|
||||
print TEMPFILE "// maintainer : $maintainer\n";
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
if ( m<^\s*//\s*package\s*:>i ) {
|
||||
++$package_seen;
|
||||
if (!defined($package)) {
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
next;
|
||||
}
|
||||
if ( m<^\s*//\s*maintainer\s*:>i ) {
|
||||
next;
|
||||
}
|
||||
++$authors_seen if m<^\s*//\s*author(s|\(s\))?\s*:>;
|
||||
++$coordinator_seen if m<^\s*//\s*coordinator\s*:>;
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
if ($header_position != 4) {
|
||||
print FILE_CHECKS "Header of $filename does not end.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($release_seen == 0) {
|
||||
print FILE_CHECKS
|
||||
"$filename: release field missing in header.\n";
|
||||
$warnings = 1;
|
||||
print TEMPFILE "// release : $version\n";
|
||||
} elsif ($release_seen > 1) {
|
||||
print FILE_CHECKS
|
||||
"$filename: Multiple release fields in header.\n";
|
||||
$warnings = 1;
|
||||
}
|
||||
if ($release_date_seen == 0) {
|
||||
print FILE_CHECKS
|
||||
"$filename: release_date field missing in header.\n";
|
||||
$warnings = 1;
|
||||
print TEMPFILE "// release_date : $date\n";
|
||||
} elsif ($release_date_seen > 1) {
|
||||
print FILE_CHECKS
|
||||
"$filename: Multiple release_date fields in header.\n";
|
||||
$warnings = 1;
|
||||
}
|
||||
if ($file_seen == 0) {
|
||||
print FILE_CHECKS
|
||||
"$filename: file field missing in header.\n";
|
||||
$warnings = 1;
|
||||
print TEMPFILE "// file : ?\n";
|
||||
if (defined($package)) {
|
||||
print TEMPFILE "// package : $package\n";
|
||||
} elsif ($package_seen == 0) {
|
||||
print FILE_CHECKS "$filename: Unknown package.\n";
|
||||
print TEMPFILE "// package : ?\n";
|
||||
}
|
||||
} elsif ($file_seen > 1) {
|
||||
print FILE_CHECKS
|
||||
"$filename: Multiple file fields in header.\n";
|
||||
$warnings = 1;
|
||||
}
|
||||
if ($package_seen > 1) {
|
||||
print FILE_CHECKS
|
||||
"$filename: Multiple package fields in header.\n";
|
||||
$warnings = 1;
|
||||
}
|
||||
if ($authors_seen == 0) {
|
||||
print FILE_CHECKS
|
||||
"$filename: authors field missing in header.\n";
|
||||
$warnings = 1;
|
||||
print TEMPFILE "// author(s) : ?\n";
|
||||
} elsif ($authors_seen > 1) {
|
||||
print FILE_CHECKS
|
||||
"$filename: Multiple authors fields in header.\n";
|
||||
$warnings = 1;
|
||||
}
|
||||
if ($coordinator_seen == 0) {
|
||||
print FILE_CHECKS
|
||||
"$filename: coordinator field missing in header.\n";
|
||||
$warnings = 1;
|
||||
print TEMPFILE "// coordinator : ?\n";
|
||||
} elsif ($coordinator_seen > 1) {
|
||||
print FILE_CHECKS
|
||||
"$filename: Multiple coordinator fields in header.\n";
|
||||
$warnings = 1;
|
||||
}
|
||||
print TEMPFILE "// ", '=' x 70,"\n";
|
||||
|
||||
|
||||
my ($lines_exceeding_length, $has_line_directives) = (0, 0);
|
||||
while ( <SOURCE_FILE> ) {
|
||||
$lines_exceeding_length +=1 if length $_ > 80;
|
||||
$has_line_directives = 1 if m|^\s*#\s*line\s|;
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
if ($lines_exceeding_length) {
|
||||
print FILE_CHECKS
|
||||
"$filename has $lines_exceeding_length",
|
||||
" lines over 80 characters.\n";
|
||||
}
|
||||
if ($has_line_directives) {
|
||||
print FILE_CHECKS "$filename has line directives.\n";
|
||||
}
|
||||
return ($warnings ? 1 : 2);
|
||||
}
|
||||
|
||||
sub check_and_update_file($$$$$)
|
||||
{
|
||||
my ($filename, $version, $date, $package, $maintainer) = @_;
|
||||
my $check_status;
|
||||
open SOURCE_FILE, "<$filename" || die "Error opening $filename: $!\n";
|
||||
open TEMPFILE, ">$TEMPFILE" || die;
|
||||
$check_status =check_and_update_2(
|
||||
$version, $date, $package, $maintainer, $filename);
|
||||
close SOURCE_FILE || die "Error closing $filename: $!";
|
||||
close TEMPFILE || die "Error closing temporary file: $!\n";
|
||||
if ($check_status == 0) {
|
||||
print FILE_CHECKS "Header check failed for $filename.\n";
|
||||
print FILE_CHECKS "Creating a default header.\n";
|
||||
open SOURCE_FILE, "<$filename"
|
||||
|| die "Error opening $filename: $!\n";
|
||||
open TEMPFILE, ">$TEMPFILE" || die;
|
||||
add_header($version, $date, $package, $maintainer, $filename);
|
||||
close SOURCE_FILE || die "Error closing $filename: $!";
|
||||
close TEMPFILE || die "Error closing temporary file: $!\n";
|
||||
}
|
||||
if ($::opt_u) {
|
||||
gjmove($TEMPFILE, $filename )
|
||||
|| warn "Could not update file $filename\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#$::PARENT_DIR=cwd();
|
||||
|
||||
sub main()
|
||||
{
|
||||
umask(002);
|
||||
|
||||
getopts('hucv:d:p:m:');
|
||||
if ($::opt_h ) {
|
||||
usage;
|
||||
return;
|
||||
}
|
||||
$::opt_h = 0;
|
||||
if ($::opt_u and $::opt_c) {
|
||||
usage;
|
||||
die "Both -c and -u option present\n";
|
||||
}
|
||||
if ($::opt_u ) {
|
||||
$TEMPFILE="tmp.$$";
|
||||
$::opt_v = "" if !$::opt_v;
|
||||
if ( ! $::opt_d ) {
|
||||
$::opt_d = `date '+%Y, %B %d'`;
|
||||
chomp $::opt_d;
|
||||
}
|
||||
} else { # no updates, only checking
|
||||
die if !$::opt_c; # mainly put here for shutting up warnings
|
||||
$TEMPFILE="/dev/null";
|
||||
$::opt_v = "";
|
||||
$::opt_d = "";
|
||||
undef $::opt_p;
|
||||
undef $::opt_m;
|
||||
}
|
||||
|
||||
open FILE_CHECKS, ">-";
|
||||
my $filename;
|
||||
foreach $filename (@ARGV) {
|
||||
check_and_update_file($filename, $::opt_v, $::opt_d,
|
||||
$::opt_p, $::opt_m);
|
||||
}
|
||||
close FILE_CHECKS;
|
||||
}
|
||||
|
||||
main;
|
||||
|
||||
|
|
@ -1,208 +0,0 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
use strict;
|
||||
#use Cwd;
|
||||
use File::Copy;
|
||||
#use File::Basename;
|
||||
#use File::Find;
|
||||
use Getopt::Std;
|
||||
|
||||
# This script updated (a) file(s) to the new style header.
|
||||
# The precondition is that is has a valid (old) header.
|
||||
|
||||
sub usage()
|
||||
{
|
||||
print STDERR<<"EOF";
|
||||
usage:
|
||||
$0 [-h] [-q owner] file1 ...
|
||||
|
||||
-h show this message and quit
|
||||
-q owner (default: LGPL,
|
||||
otherwise it's QPL, with choices among :
|
||||
UU, INRIA, ETHZ, MPI, TAU, TRIER,
|
||||
which will be expanded)
|
||||
EOF
|
||||
}
|
||||
|
||||
my $lgpl_owner="Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbruecken (Germany),
|
||||
// and Tel-Aviv University (Israel).";
|
||||
|
||||
my %qpl_owners=("UU" => "Utrecht University (The Netherlands)",
|
||||
"INRIA" => "INRIA Sophia-Antipolis (France)",
|
||||
"ETHZ" => "ETH Zurich (Switzerland)",
|
||||
"MPI" => "Max-Planck-Institute Saarbruecken (Germany)",
|
||||
"TAU" => "Tel-Aviv University (Israel)",
|
||||
"TRIER" => "University of Trier (Germany)"
|
||||
);
|
||||
|
||||
sub gjmove($$)
|
||||
{
|
||||
return 1 if rename($_[0], $_[1] );
|
||||
return (system('mv', "$_[0]", "$_[1]") == 0);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# initialization #
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
my $TEMPFILE;
|
||||
|
||||
|
||||
sub print_qpl_license()
|
||||
{
|
||||
print TEMPFILE <<'END_OF_LICENSE';
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
END_OF_LICENSE
|
||||
}
|
||||
|
||||
sub print_lgpl_license()
|
||||
{
|
||||
print TEMPFILE <<'END_OF_LICENSE';
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
END_OF_LICENSE
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# check_and_update_2 #
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
sub check_and_update_2($$)
|
||||
{
|
||||
my ($filename, $owner) = @_;
|
||||
my $header_position = 1;
|
||||
# 1:before header; 2: in first part; 3: in second part 4: after header.
|
||||
|
||||
my $text_before_header = 0;
|
||||
while ( <SOURCE_FILE> ) {
|
||||
if ( m|^\s*//\s*={10,}\s*$| ) {
|
||||
$header_position = 2;
|
||||
last;
|
||||
}
|
||||
if ( $_ !~ m|^\s*$| ) {
|
||||
$text_before_header = 1;
|
||||
}
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
if ($header_position != 2) {
|
||||
print FILE_CHECKS "$filename has no header.\n";
|
||||
return 0;
|
||||
}
|
||||
if ($text_before_header) {
|
||||
print FILE_CHECKS "$filename has text before the header.\n";
|
||||
}
|
||||
$_ = <SOURCE_FILE>;
|
||||
$_ = <SOURCE_FILE> while (m|^\s*//\s*$|);
|
||||
if ($_ !~ m<^\s*//\s*Copyright\s*\(c\)\s*\d{4}([-,]\s?\d{4})*\s+(t|T)he CGAL Consortium\s*$> ) {
|
||||
print FILE_CHECKS "$filename has no valid copyright notice.\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (defined($owner)) {
|
||||
# QPL case.
|
||||
my $qpl_owner=$qpl_owners{$owner};
|
||||
s/(t|T)he CGAL Consortium\s*$/ $qpl_owner/;
|
||||
print TEMPFILE $_;
|
||||
print TEMPFILE ".\n// All rights reserved.\n//\n";
|
||||
print_qpl_license;
|
||||
} else {
|
||||
# LGPL case.
|
||||
s/(t|T)he CGAL Consortium\s*$/ $lgpl_owner/;
|
||||
print TEMPFILE $_;
|
||||
print TEMPFILE " All rights reserved.\n//\n";
|
||||
print_lgpl_license;
|
||||
}
|
||||
|
||||
print TEMPFILE <<'END_OF_DISCLAIMER';
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
END_OF_DISCLAIMER
|
||||
|
||||
my ($authors_seen) = (0);
|
||||
while ( <SOURCE_FILE> ) {
|
||||
next if ($_ !~ m|^\s*//| );
|
||||
++$authors_seen if m<^\s*//\s*author(s|\(s\))?\s*:>;
|
||||
if ($authors_seen > 0) {
|
||||
if (m<^\s*//\s*(coordinator|package|release|maintainer)(s|\(s\))?\s*:>) {
|
||||
--$authors_seen;
|
||||
} else {
|
||||
if (! m|//\s*$|) {
|
||||
s/author/Author/;
|
||||
print TEMPFILE $_; # we keep the authors
|
||||
}
|
||||
}
|
||||
}
|
||||
last if /======/;
|
||||
}
|
||||
|
||||
while ( <SOURCE_FILE> ) {
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub check_and_update_file($$)
|
||||
{
|
||||
my ($filename, $owner) = @_;
|
||||
open SOURCE_FILE, "<$filename" || die "Error opening $filename: $!\n";
|
||||
open TEMPFILE, ">$TEMPFILE" || die;
|
||||
check_and_update_2($filename, $owner);
|
||||
close SOURCE_FILE || die "Error closing $filename: $!";
|
||||
close TEMPFILE || die "Error closing temporary file: $!\n";
|
||||
gjmove($TEMPFILE, $filename )
|
||||
|| warn "Could not update file $filename\n";
|
||||
}
|
||||
|
||||
|
||||
#$::PARENT_DIR=cwd();
|
||||
|
||||
sub main()
|
||||
{
|
||||
umask(002);
|
||||
|
||||
getopts('hq:');
|
||||
if ($::opt_h ) {
|
||||
usage;
|
||||
return;
|
||||
}
|
||||
$::opt_h = 0;
|
||||
|
||||
if ($::opt_q and not $qpl_owners{$::opt_q}) {
|
||||
print "Unknown QPL owner\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$TEMPFILE="tmp.$$";
|
||||
|
||||
open FILE_CHECKS, ">-";
|
||||
my $filename;
|
||||
foreach $filename (@ARGV) {
|
||||
print "new_headers acting on $filename.\n";
|
||||
check_and_update_file($filename, $::opt_q);
|
||||
}
|
||||
close FILE_CHECKS;
|
||||
}
|
||||
|
||||
main;
|
||||
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
# This script applies the new_headers script to all packages.
|
||||
#
|
||||
# - It must be run from inside a "All" working copy.
|
||||
# - The "new_headers" script must be in $PATH.
|
||||
# - This file must be checkout from CVS with the "-kk" option to prevent
|
||||
# expansion of the flags... (it's not that a big deal anyway)
|
||||
|
||||
# Strangely, to run the script, I need to copy both in All/, and have "." in my
|
||||
# $PATH, otherwise some old version of new_headers is selected (don't know why)
|
||||
|
||||
# Currently still not passing "grep 'CGAL Consortium'" :
|
||||
# grep 'CGAL Consortium' */include/CGAL/*.[hC] */include/CGAL/*/*.[hC] */include/CGAL/*/*/*.[hC] */src/*.[hC] */src/*/*.[hC] | cut -d'/' -f1 | sort | uniq
|
||||
#
|
||||
# The following are probably not part of CGAL 3.0, so don't bother.
|
||||
# - Segment_Voronoi_diagram_2 -> asked Menelaos
|
||||
# - Coin -> asked Andreas et Mariette
|
||||
# - GeoWin -> asked Mariette and Matthias
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
#use File::Copy;
|
||||
#use File::Basename;
|
||||
#use File::Find;
|
||||
#use Getopt::Std;
|
||||
|
||||
my %packages=(
|
||||
"Alpha_shapes_2" => "INRIA",
|
||||
"Alpha_shapes_3" => "INRIA",
|
||||
"Apollonius_graph_2" => "INRIA",
|
||||
"Arrangement" => "TAU",
|
||||
"Benchmark" => "TAU",
|
||||
"Cartesian_kernel" => "",
|
||||
"Circulator" => "",
|
||||
"Configuration" => "",
|
||||
"Convex_hull_2" => "MPI",
|
||||
"Convex_hull_3" => "MPI",
|
||||
"Distance_2" => "",
|
||||
"Distance_3" => "",
|
||||
"Fixed_precision_nt" => "",
|
||||
"Generator" => "",
|
||||
"Geomview" => "",
|
||||
"H2" => "",
|
||||
"H3" => "",
|
||||
"HalfedgeDS" => "",
|
||||
"Hash_map" => "",
|
||||
"Installation" => "",
|
||||
"Intersections_2" => "",
|
||||
"Intersections_3" => "",
|
||||
"Interval_arithmetic" => "",
|
||||
"Inventor" => "",
|
||||
"Kernel_23" => "",
|
||||
"Kernel_d" => "",
|
||||
"LEDA" => "",
|
||||
"Largest_empty_rect_2" => "TAU",
|
||||
"Map_overlay_2" => "TAU",
|
||||
"Matrix_search" => "ETHZ",
|
||||
"Min_annulus_d" => "ETHZ",
|
||||
"Min_circle_2" => "FUB",
|
||||
"Min_ellipse_2" => "FUB",
|
||||
"Min_quadrilateral_2" => "ETHZ",
|
||||
"Min_sphere_d" => "ETHZ",
|
||||
"Min_sphere_d_new" => "ETHZ",
|
||||
"Min_sphere_of_spheres_d" => "ETHZ",
|
||||
"Modifier" => "",
|
||||
"Nef_2" => "MPI",
|
||||
"Number_types" => "",
|
||||
"Partition_2" => "MPI",
|
||||
"Planar_map" => "TAU",
|
||||
"Point_set_2" => "HW",
|
||||
"Polygon" => "",
|
||||
"Polyhedron" => "ETHZ",
|
||||
"Polyhedron_IO" => "ETHZ",
|
||||
"Polytope_distance_d" => "ETHZ",
|
||||
"Qt_widget" => "",
|
||||
"Random_numbers" => "",
|
||||
"Robustness" => "MPI",
|
||||
"STL_Extension" => "",
|
||||
"Scripts" => "",
|
||||
"SearchStructures" => "ETHZ",
|
||||
"Spatial_searching" => "UU",
|
||||
"Stream_support" => "",
|
||||
"Sweep_line_2" => "TAU",
|
||||
"Timer" => "",
|
||||
"Trapezoidal_decomposition" => "TAU",
|
||||
"Triangulation_2" => "INRIA",
|
||||
"Triangulation_3" => "INRIA",
|
||||
"Union_find" => "",
|
||||
"Width_3" => "ETHZ",
|
||||
"_QP_solver" => "ETHZ",
|
||||
"cgal_window" => "HW",
|
||||
"iostream" => "",
|
||||
"kdtree" => "TAU",
|
||||
"window" => "",
|
||||
"wininst" => "",
|
||||
|
||||
# Plus the following :
|
||||
"Optimisation_basic" => "",
|
||||
"ExternalMemoryStructures" => "ETHZ",
|
||||
"Snap_rounding_2" => "TAU",
|
||||
"PS_Stream" => "", # Should this be LGPL + INRIA only ?
|
||||
"Viewer_3" => "", # idem
|
||||
"Nef_3" => "MPI",
|
||||
"Nef_S2" => "MPI"
|
||||
|
||||
);
|
||||
|
||||
sub main()
|
||||
{
|
||||
my $package;
|
||||
foreach $package (sort (keys %packages)) {
|
||||
if (!-d $package) {
|
||||
warn $package." IS NOT A DIRECTORY\n";
|
||||
next;
|
||||
}
|
||||
|
||||
print "Going on with : $package : ";
|
||||
|
||||
my @license_opts;
|
||||
if ($packages{$package}) {
|
||||
@license_opts=("-q", $packages{$package}); # QPL
|
||||
}
|
||||
|
||||
print "License opts : @license_opts\n";
|
||||
|
||||
my $regexp="$package/include/CGAL/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/src/*.[hC]";
|
||||
$regexp.=" $package/src/*/*.[hC]";
|
||||
$regexp.=" $package/src/*/*/*.[hC]";
|
||||
$regexp.=" $package/src/*/*/*/*.[hC]";
|
||||
|
||||
my @files = glob($regexp);
|
||||
# print "acting on : @files\n";
|
||||
|
||||
my @args=("new_headers", @license_opts, @files);
|
||||
system(@args) == 0
|
||||
or die "system @args failed: $?";
|
||||
|
||||
# Then cgal_submit the package.
|
||||
}
|
||||
}
|
||||
|
||||
main;
|
||||
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
# This script applies the new_headers_v2 script to all packages.
|
||||
#
|
||||
# - It must be run from inside a "All" working copy.
|
||||
# - The "new_headers_v2" script must be in $PATH.
|
||||
# - This file must be checkout from CVS with the "-kk" option to prevent
|
||||
# expansion of the flags... (it's not that a big deal anyway)
|
||||
|
||||
# Strangely, to run the script, I need to copy both in All/, and have "." in my
|
||||
# $PATH, otherwise some old version of new_headers_v2 is selected (don't know
|
||||
# why)
|
||||
|
||||
use strict;
|
||||
use Cwd;
|
||||
#use File::Copy;
|
||||
#use File::Basename;
|
||||
#use File::Find;
|
||||
#use Getopt::Std;
|
||||
|
||||
my %packages=(
|
||||
"Cartesian_kernel" => "",
|
||||
"Circulator" => "",
|
||||
"Configuration" => "",
|
||||
"Distance_2" => "",
|
||||
"Distance_3" => "",
|
||||
"Fixed_precision_nt" => "",
|
||||
"Generator" => "",
|
||||
"Geomview" => "",
|
||||
"H2" => "",
|
||||
"H3" => "",
|
||||
"HalfedgeDS" => "",
|
||||
"Hash_map" => "",
|
||||
"Installation" => "",
|
||||
"Intersections_2" => "",
|
||||
"Intersections_3" => "",
|
||||
"Interval_arithmetic" => "",
|
||||
"Inventor" => "",
|
||||
"Kernel_23" => "",
|
||||
"Kernel_d" => "",
|
||||
"LEDA" => "",
|
||||
"Modifier" => "",
|
||||
"Number_types" => "",
|
||||
"Polygon" => "",
|
||||
"Qt_widget" => "",
|
||||
"Random_numbers" => "",
|
||||
"STL_Extension" => "",
|
||||
"Scripts" => "",
|
||||
"Stream_support" => "",
|
||||
"Timer" => "",
|
||||
"Union_find" => "",
|
||||
"iostream" => "",
|
||||
"window" => "",
|
||||
"wininst" => "",
|
||||
|
||||
# Plus the following :
|
||||
"Optimisation_basic" => "",
|
||||
"PS_Stream" => "", # Should this be LGPL + INRIA only ?
|
||||
"Viewer_3" => "" # idem
|
||||
|
||||
);
|
||||
|
||||
sub main()
|
||||
{
|
||||
my $package;
|
||||
foreach $package (sort (keys %packages)) {
|
||||
if (!-d $package) {
|
||||
warn $package." IS NOT A DIRECTORY\n";
|
||||
next;
|
||||
}
|
||||
|
||||
print "Going on with : $package : ";
|
||||
|
||||
my @license_opts;
|
||||
if ($packages{$package}) {
|
||||
@license_opts=("-q", $packages{$package}); # QPL
|
||||
}
|
||||
|
||||
print "License opts : @license_opts\n";
|
||||
|
||||
my $regexp="$package/include/CGAL/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/include/CGAL/*/*/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/src/*.[hC]";
|
||||
$regexp.=" $package/src/*/*.[hC]";
|
||||
$regexp.=" $package/src/*/*/*.[hC]";
|
||||
$regexp.=" $package/src/*/*/*/*.[hC]";
|
||||
$regexp.=" $package/config/testfiles/*.[hC]";
|
||||
|
||||
my @files = glob($regexp);
|
||||
# print "acting on : @files\n";
|
||||
|
||||
my @args=("new_headers_v2", @license_opts, @files);
|
||||
system(@args) == 0
|
||||
or die "system @args failed: $?";
|
||||
|
||||
# Then cgal_submit the package.
|
||||
}
|
||||
}
|
||||
|
||||
main;
|
||||
|
||||
|
|
@ -1,214 +0,0 @@
|
|||
#!/usr/local/bin/perl -w
|
||||
|
||||
use strict;
|
||||
#use Cwd;
|
||||
use File::Copy;
|
||||
#use File::Basename;
|
||||
#use File::Find;
|
||||
use Getopt::Std;
|
||||
|
||||
# This script updates (a) file(s) from the pure LGPL header version
|
||||
# to the one mentionning the commercial license too.
|
||||
# The precondition is that is has a valid (old) header.
|
||||
|
||||
sub usage()
|
||||
{
|
||||
print STDERR<<"EOF";
|
||||
usage:
|
||||
$0 [-h] [-q owner] file1 ...
|
||||
|
||||
-h show this message and quit
|
||||
-q owner (default: LGPL,
|
||||
otherwise it's QPL, with choices among :
|
||||
UU, INRIA, ETHZ, MPI, TAU, TRIER,
|
||||
which will be expanded)
|
||||
EOF
|
||||
}
|
||||
|
||||
my $lgpl_owner="Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland),
|
||||
// INRIA Sophia-Antipolis (France),
|
||||
// Max-Planck-Institute Saarbrucken (Germany),
|
||||
// and Tel-Aviv University (Israel).";
|
||||
|
||||
my %qpl_owners=("UU" => "Utrecht University (The Netherlands)",
|
||||
"INRIA" => "INRIA Sophia-Antipolis (France)",
|
||||
"ETHZ" => "ETH Zurich (Switzerland)",
|
||||
"MPI" => "Max-Planck-Institute Saarbrucken (Germany)",
|
||||
"TAU" => "Tel-Aviv University (Israel)",
|
||||
"TRIER" => "University of Trier (Germany)"
|
||||
);
|
||||
|
||||
sub gjmove($$)
|
||||
{
|
||||
return 1 if rename($_[0], $_[1] );
|
||||
return (system('mv', "$_[0]", "$_[1]") == 0);
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# initialization #
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
my $TEMPFILE;
|
||||
|
||||
|
||||
sub print_qpl_license()
|
||||
{
|
||||
print TEMPFILE <<'END_OF_LICENSE';
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
// You can redistribute it and/or modify it under the terms of the GNU
|
||||
// General Public License as published by the Free Software Foundation,
|
||||
// either version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
END_OF_LICENSE
|
||||
}
|
||||
|
||||
sub print_lgpl_license()
|
||||
{
|
||||
print TEMPFILE <<'END_OF_LICENSE';
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; either version 3 of the License,
|
||||
// or (at your option) any later version.
|
||||
END_OF_LICENSE
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------#
|
||||
# check_and_update_2 #
|
||||
#----------------------------------------------------------------#
|
||||
|
||||
sub check_and_update_2($$)
|
||||
{
|
||||
# my ($filename, $owner) = @_;
|
||||
# my $header_position = 1;
|
||||
# 1:before header; 2: in first part; 3: in second part 4: after header.
|
||||
|
||||
my $old_sentence="See the file LICENSE.LGPL distributed with CGAL.";
|
||||
my $new_sentence=$old_sentence."\n"."//\n"."// Licensees holding a valid commercial license may use this file in\n"."// accordance with the commercial license agreement provided with the software.";
|
||||
#
|
||||
while ( <SOURCE_FILE> ) {
|
||||
s/$old_sentence/$new_sentence/;
|
||||
print TEMPFILE $_;
|
||||
}
|
||||
|
||||
# my $text_before_header = 0;
|
||||
# while ( <SOURCE_FILE> ) {
|
||||
# if ( m|^\s*//\s*={10,}\s*$| ) {
|
||||
# $header_position = 2;
|
||||
# last;
|
||||
# }
|
||||
# if ( $_ !~ m|^\s*$| ) {
|
||||
# $text_before_header = 1;
|
||||
# }
|
||||
# print TEMPFILE $_;
|
||||
# }
|
||||
# if ($header_position != 2) {
|
||||
# print FILE_CHECKS "$filename has no header.\n";
|
||||
# return 0;
|
||||
# }
|
||||
# if ($text_before_header) {
|
||||
# print FILE_CHECKS "$filename has text before the header.\n";
|
||||
# }
|
||||
# $_ = <SOURCE_FILE>;
|
||||
# $_ = <SOURCE_FILE> while (m|^\s*//\s*$|);
|
||||
# if ($_ !~ m<^\s*//\s*Copyright\s*\(c\)\s*\d{4}([-,]\s?\d{4})*\s+(t|T)he CGAL Consortium\s*$> ) {
|
||||
# print FILE_CHECKS "$filename has no valid copyright notice.\n";
|
||||
# return 0;
|
||||
# }
|
||||
#
|
||||
# if (defined($owner)) {
|
||||
# # QPL case.
|
||||
# my $qpl_owner=$qpl_owners{$owner};
|
||||
# s/(t|T)he CGAL Consortium\s*$/ $qpl_owner/;
|
||||
# print TEMPFILE $_;
|
||||
# print TEMPFILE ".\n// All rights reserved.\n//\n";
|
||||
# print_qpl_license;
|
||||
# } else {
|
||||
# # LGPL case.
|
||||
# s/(t|T)he CGAL Consortium\s*$/ $lgpl_owner/;
|
||||
# print TEMPFILE $_;
|
||||
# print TEMPFILE " All rights reserved.\n//\n";
|
||||
# print_lgpl_license;
|
||||
# }
|
||||
#
|
||||
# print TEMPFILE <<'END_OF_DISCLAIMER';
|
||||
#//
|
||||
#// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
#// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#//
|
||||
#// $URL$
|
||||
#// $Id$
|
||||
#//
|
||||
#//
|
||||
#END_OF_DISCLAIMER
|
||||
#
|
||||
# my ($authors_seen) = (0);
|
||||
# while ( <SOURCE_FILE> ) {
|
||||
# next if ($_ !~ m|^\s*//| );
|
||||
# ++$authors_seen if m<^\s*//\s*author(s|\(s\))?\s*:>;
|
||||
# if ($authors_seen > 0) {
|
||||
# if (m<^\s*//\s*(coordinator|package|release|maintainer)(s|\(s\))?\s*:>) {
|
||||
# --$authors_seen;
|
||||
# } else {
|
||||
# if (! m|//\s*$|) {
|
||||
# s/author/Author/;
|
||||
# print TEMPFILE $_; # we keep the authors
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
# last if /======/;
|
||||
# }
|
||||
#
|
||||
# while ( <SOURCE_FILE> ) {
|
||||
# print TEMPFILE $_;
|
||||
# }
|
||||
#
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub check_and_update_file($$)
|
||||
{
|
||||
my ($filename, $owner) = @_;
|
||||
open SOURCE_FILE, "<$filename" || die "Error opening $filename: $!\n";
|
||||
open TEMPFILE, ">$TEMPFILE" || die;
|
||||
check_and_update_2($filename, $owner);
|
||||
close SOURCE_FILE || die "Error closing $filename: $!";
|
||||
close TEMPFILE || die "Error closing temporary file: $!\n";
|
||||
gjmove($TEMPFILE, $filename )
|
||||
|| warn "Could not update file $filename\n";
|
||||
}
|
||||
|
||||
|
||||
#$::PARENT_DIR=cwd();
|
||||
|
||||
sub main()
|
||||
{
|
||||
umask(002);
|
||||
|
||||
getopts('hq:');
|
||||
if ($::opt_h ) {
|
||||
usage;
|
||||
return;
|
||||
}
|
||||
$::opt_h = 0;
|
||||
|
||||
if ($::opt_q and not $qpl_owners{$::opt_q}) {
|
||||
print "Unknown QPL owner\n";
|
||||
return;
|
||||
}
|
||||
|
||||
$TEMPFILE="tmp.$$";
|
||||
|
||||
open FILE_CHECKS, ">-";
|
||||
my $filename;
|
||||
foreach $filename (@ARGV) {
|
||||
print "new_headers acting on $filename.\n";
|
||||
check_and_update_file($filename, $::opt_q);
|
||||
}
|
||||
close FILE_CHECKS;
|
||||
}
|
||||
|
||||
main;
|
||||
|
||||
Loading…
Reference in New Issue