File: debian-dpkg-copyright-test-conf.pl

package info (click to toggle)
libconfig-model-perl 2.021-3%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,104 kB
  • sloc: perl: 20,550; makefile: 11
file content (215 lines) | stat: -rw-r--r-- 8,028 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#
# This file is part of Config-Model
#
# This software is Copyright (c) 2012 by Dominique Dumont, Krzysztof Tyszecki.
#
# This is free software, licensed under:
#
#   The GNU Lesser General Public License, Version 2.1, February 1999
#
use Data::Dumper;
use IO::File;
use utf8; 

$conf_file_name = "copyright";
$conf_dir       = 'debian';
$model_to_test  = "Debian::Dpkg::Copyright";

eval { require AptPkg::Config ;} ;
$skip = ( $@ or not -r '/etc/debian_version') ? 1 : 0 ;

@tests = (
    { # t0
        load_warnings => [ qr/Missing/, (qr/deprecated/) x 3 , ],
        load_check => 'no',
        check => {
            'Files:"*" License full_license' => "[PSF LICENSE TEXT]",
            'Files:"*" Copyright' => "2008, John Doe <john.doe\@example.com>\n2007, Jane Smith <jane.smith\@example.com>",
            'Files:"*" License short_name' => "PsF",
            '"Xtest"'                     => "yada yada\n\nyada",
            '"Upstream-Name"'              => "xyz",
            '"Upstream-Contact:0"' => "Jane Smith <jane.smith\@example.com>",
        },
    },

    { #t1
        load_warnings => [ (qr/deprecated/) x 3 ],

        check => {
            'License:"MPL-1.1" text'     => "[MPL-1.1 LICENSE TEXT]",
            'License:"GPL-2+" text'    => "[GPL-2 LICENSE TEXT]",
            'License:"LGPL-2.1+" text' => "[LGPL-2.1 plus LICENSE TEXT]",
            'Files:"src/js/editline/*" License short_name' =>
              "MPL-1.1 or GPL-2+ or LGPL-2.1+"
        },

    },
    { # t2
        load_warnings => [ (qr/deprecated/) x 1 ],

        check => {
            'License:MPL-1.1 text' => "[MPL-1.1 LICENSE TEXT]",
            'Files:"*" License short_name' => "MPL-1.1",
            'Files:"src/js/fdlibm/*" License short_name'   => "MPL-1.1",
        },
        file_contents_like => {
            'debian/copyright' => qr/Format: http/ ,
        }
    },

    # the empty license will default to 'other'
    { # t3
        load_warnings => [ (qr/deprecated/) x 3 ],

        check => {
            'Comment' => "\nHeader comment 1/2\nHeader comment 2/2",
            'Files:"*" Comment' => "\n Files * comment 1/2\nFiles * comment 2/2",
            'Files:"planet/vendor/compat_logging/*" Comment' 
                => "\nFiles logging * comment 1/2\n Files logging * comment 2/2",
            'Files:"planet/vendor/compat_logging/*" License short_name' => "MIT",
        },
    },
    { # t4
        load_warnings => [ (qr/deprecated/) x 1 ],

        check => {
            'Source'                       => "http:/some.where.com",
            'Files:"*" License short_name' => "GPL-2+",
            'Files:"*" License exception'  => "OpenSSL",
            'Files:"*" License full_license' =>
              "This program is free software; you can redistribute it\n"
              . " and/or modify it under the terms of the [snip]",
        },
    },
    { #t5

        load_warnings => [ (qr/deprecated/) x 3 ],
        check => {
            'Files:"*" License short_name' => "LGPL-2+",
            'Source' => 'http://search.cpan.org/dist/Config-Model-CursesUI/',
            'License:"LGPL-2+" text' =>
"   [snip]either version 2.1 of\n   the License, or (at your option) any later version.\n"
              . "   [snip again]",
        },
    },
    { # t6

        load_warnings => [ (qr/deprecated/) x 3 ],

        check => {
            'Upstream-Contact:0' => 'Ignace Mouzannar <mouzannar at gmail.com>',
            'Files:"Embedded_Display/remoteview.cpp Embedded_Display/remoteview.h" License short_name'
              => "GPL-2",
        },
    },
    { # t7
        # example from CANDIDATE DEP-5 spec (nb 7)
        load_warnings => [ (qr/Adding/) x 1 , qr/Format does not match/ ],
        load_check => 'no',
        apply_fix => 1,
        check => { 
            Format => "http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/", 
            'Files:"*" Copyright' => 'Copyright 1998 John Doe <jdoe@example.com>',
            'Files:"debian/*" License short_name' => 'other',
            },
    },
    {
        # test nb 8
        load_warnings => [ qr/Format does not match/ ],
        apply_fix => 1,
        check => { 
            Format => "http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/", 
            'Files:"*" Copyright' => "2008, John Doe <jdoe\@example.com>\n2007, Jane Smith <jsmith\@example.org>\n2007, Joe Average <joe\@example.org>\n2007, J. Random User <jr\@users.example.com>",
            },
        },
    {
        load_warnings => [ qr/Format does not match/ ,qr/should not match/ ],
        apply_fix => 1,
        load => 'Files~"*/share/web/static/[css|js|images]/yui/*"',
        check => {
            'Files:"*" Copyright' => 'foo',
            'Files:"*" License short_name' => 'BSD',
            'Files:"*" License full_license' => ' foo bar',
        },
    },
    { # t10
        load_warnings => [ (qr/deprecated/) x 2 ],

        check => { 
            Format => "http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/", 
            # something's wrong with utf8 string checks
            #'Debianized-By' => 'Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>',
            Source => 'http://tango-controls.org/download',
            #'Files:"*" Copyright:0' => '© 2010, The Tango team <tango@esrf.fr>',
            'Files:"debian/*" License short_name' => 'GPL-3+',
        },
    },

    { # t11 Debian bug #610231
        load_warnings => [ qr/Format does not match/ ],
        apply_fix => 1,
        dump_errors =>  [ 
            qr/mandatory/ => 'Files:"*" Copyright:0="(c) foobar"',
            qr/mandatory/ => ' License:FOO text="foo bar" ! Files:"*" License short_name="FOO" '
        ],
    },
    
    { # t12
        load_warnings => [ qr/Adding/, (qr/deprecated/) x 3, ],
        load_check => 'no',
        dump_errors =>  [ 
            qr/not declared/ => 'License:Expat text="Expat license foobar"',
        ],
    },

    { # t13 Debian bug #624305
        load_warnings => [ qr/Format does not match/ ],
        apply_fix => 1,
    },
    { # t14 Debian bug #633847
        # need to change License model from Hash of leaves to hash of nodes 
        load_warnings => [ qr/Format does not match/ ],
        apply_fix => 1,
        check => { 
            'Comment' => "On Debian systems, copies of the GNU General Public License version 1
and Lesser General Public License version 2.1 can be found respectively in
‘/usr/share/common-licenses/GPL-1’ and ‘/usr/share/common-licenses/LGPL-2.1’.",
            'License:Perl Comment',"On Debian systems, the complete text of the Artistic License can be
found in ‘/usr/share/common-licenses/Artistic’, and the complete text of
the latest version of the GNU General Public License version 1 can be found
in ‘/usr/share/common-licenses/GPL-1’." } , 
    },       
    
    {
        name => 'libpadre-plugin-perltidy-perl',
        load_warnings => [ (qr/deprecated/) x 4  ],
        check => { 
            'Files:"*" License short_name' => "Artistic or GPL-1+" ,
            'Files:"*" License-Alias' => { qw/check no value Perl/}, # deprecated but not yet removed
        },
        wr_check => { 
            'Files:"*" License short_name' => "Artistic or GPL-1+" ,
            'Files:"*" License-Alias' => { check => 'no' },
        },
    },
    {
        name => 'migrate-license-alias',
        load_check => 'no', # missing Files: * in 2nd section
        load_warnings => [ qr/Missing/, (qr/deprecated/) x 4  ],
        check => { 
            'Files:"*" License short_name' => "Artistic or GPL-1+" ,
            'Files:"*" License-Alias' => { qw/check no value Perl/},
        },
        wr_check => { 
            'Files:"*" License short_name' => "Artistic or GPL-1+" ,
            'Files:"*" License-Alias' => { check => 'no' },
        },
    },
    {
        name => 'oar',
        'File:"sources/extra/orpheus/modules/lua-signal/lsignal.c" License short_name'
            => 'MIT/X11'
    },
);

1;