View | Details | Raw Unified | Return to bug 40419
Collapse All | Expand All

(-)a/xt/find-license-problems.t (-8 / +7 lines)
Lines 33-38 my @files = map { Link Here
33
    !(     $name =~ m{^koha-tmpl/}
33
    !(     $name =~ m{^koha-tmpl/}
34
        || $name =~ m{\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip)$}
34
        || $name =~ m{\.(gif|jpg|odt|ogg|pdf|png|po|psd|svg|swf|zip)$}
35
        || $name =~ m{xt/find-license-problems|xt/fix-old-fsf-address|misc/translator/po2json}
35
        || $name =~ m{xt/find-license-problems|xt/fix-old-fsf-address|misc/translator/po2json}
36
        || $name =~ m[t/mock_templates/intranet-tmpl/prog]
36
        || !-f $name )
37
        || !-f $name )
37
        ? $_
38
        ? $_
38
        : ()
39
        : ()
Lines 43-56 plan tests => scalar(@files) + 1; Link Here
43
foreach my $name (@files) {
44
foreach my $name (@files) {
44
    open( my $fh, '<', $name ) || die "cannot open file $name $!";
45
    open( my $fh, '<', $name ) || die "cannot open file $name $!";
45
    my (
46
    my (
46
        $hascopyright,  $hasgpl, $hasv3, $hasorlater, $haslinktolicense,
47
        $hasgpl,        $hasv3, $hasorlater, $haslinktolicense,
47
        $hasfranklinst, $is_not_us
48
        $hasfranklinst, $is_not_us
48
    ) = (0) x 7;
49
    ) = (0) x 7;
49
    while ( my $line = <$fh> ) {
50
    while ( my $line = <$fh> ) {
50
        $hascopyright = 1 if ( $line =~ /^(#|--)?\s*Copyright.*\d\d/ );
51
        $hasgpl     = 1 if ( $line =~ /GNU General Public License/ );
51
        $hasgpl       = 1 if ( $line =~ /GNU General Public License/ );
52
        $hasv3      = 1 if ( $line =~ /either version 3/ );
52
        $hasv3        = 1 if ( $line =~ /either version 3/ );
53
        $hasorlater = 1
53
        $hasorlater   = 1
54
            if ( $line =~ /any later version/
54
            if ( $line =~ /any later version/
55
            || $line =~ /at your option/ );
55
            || $line =~ /at your option/ );
56
        $haslinktolicense = 1 if $line =~ m|http://www\.gnu\.org/licenses|;
56
        $haslinktolicense = 1 if $line =~ m|http://www\.gnu\.org/licenses|;
Lines 59-70 foreach my $name (@files) { Link Here
59
    }
59
    }
60
    close $fh;
60
    close $fh;
61
61
62
    if ( !$hascopyright || $is_not_us ) {
62
    if ( $is_not_us || !$hasgpl ) {
63
        pass();
63
        pass();
64
        next;
64
        next;
65
    }
65
    }
66
66
67
    is( $hasgpl && $hasv3 && $hasorlater && $haslinktolicense && !$hasfranklinst, 1 )
67
    ok( $hasgpl && $hasv3 && $hasorlater && $haslinktolicense && !$hasfranklinst )
68
        or diag(
68
        or diag(
69
        sprintf
69
        sprintf
70
            "File %s has wrong copyright: hasgpl=%s, hasv3=%s, hasorlater=%s, haslinktolicense=%s, hasfranklinst=%s",
70
            "File %s has wrong copyright: hasgpl=%s, hasv3=%s, hasorlater=%s, haslinktolicense=%s, hasfranklinst=%s",
71
- 

Return to bug 40419