On 2006-10-26, Mark Baker wrote:
> Your plan sounds excellent! Have you uploaded the tests to SVN? I'd
> like to see if I can help improve them.
The right place for this is under 'hooks' in the repository directory,
but still we can also commit it into the repository, for development
purposes. Shall I create a top-level directory 'admin' for this? Maybe
this is meta enought that we could create an 'admin' or 'hooks'
directory at the top level, parallel to trunk, branches, and tags? In
that case people will not get it in a normal check-out, so it's more
clear that they should not mess with it.
In any case I attach the file. It remains to enter the MD5 sum, which
you will see in the error message when you try to commit. The script
must have the execute-bit set.
#! /usr/bin/env perl
# Copyright 2006 Traversal Technology
#
# This file is used for repository management. You should not change it
# unless you adminitrating the repositry or are helping the administrator.
#
# You may re-use a modified version of this in your own project under the
# terms of the General Public License version 2, or at your convenience, any
# later version as published by the Free Software Foundation.
#
# End of license.
use strict;
use Digest::MD5 qw/md5_hex/;
# Put MD5 sums of license(s) below. To determine the MD5 sum, you can try to
# commit a file with the correct license. The svn command will then print out
# an error message containing the correct MD5 sum.
my %license_md5_digests = (
rtl => ''
);
my $repo = $ARGV[0];
my $txn = $ARGV[1];
my $svnlook = "/usr/local/bin/svnlook";
sub fail($)
{
print STDERR <<__end__;
Error: $_[0]
The file does not match the license requirements. See LICENSE_POLICY in the
top-level directory for how to fix this.
__end__
exit 1;
}
sub c_comment_line($)
{
my ($is) = @_;
while (<$is>) {
chomp;
s/^[\s\/\*]*//;
s/\s+$//;
s/\s+/ /;
return $_ unless /^$/;
}
fail "Missing copyright notice.";
}
sub c_license_rest($$)
{
my ($is, $accu) = @_;
while (<$is>) {
chomp;
s/^[\s\/*]*//;
s/\s+$//;
s/\s+/ /;
return $accu if /End of license\./;
$accu .= ' ';
$accu .= $_;
}
fail "Missing 'End of license'";
}
sub check_rtl_license($$)
{
my ($is, $path) = @_;
my $ln = c_comment_line($is);
fail "Missing or misformed Traversal copyright." unless
$ln =~ /^Copyright ([0-9 ,]* )?Traversal Technology/;
do { $ln = c_comment_line($is); } while ($ln =~ /^Copyright/);
my $rest = c_license_rest($is, $ln);
my $md5 = md5_hex($rest);
if ($md5 ne $license_md5_digests{"rtl"}) {
fail "License digest does not match, got '$md5'.";
}
}
open CHANGED, "$svnlook changed -t $txn $repo |" or die $!;
foreach my $change (<CHANGED>) {
my ($tag, $path) = $change =~ /(\w+)\s*(.+)/;
next if $path =~ /\/$/;
my $is;
open $is, "$svnlook cat -t $txn $repo $path |" or die $!;
if ($path =~ /^trunk\/rtl\//) {
check_rtl_license($is, $path);
}
close $is;
}
close CHANGED or die;
exit 0;
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)