File: copyright.t

package info (click to toggle)
perl 5.24.1-3+deb9u5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 103,716 kB
  • sloc: perl: 559,611; ansic: 293,886; sh: 67,316; pascal: 7,632; cpp: 3,895; makefile: 2,436; xml: 2,410; yacc: 989; sed: 6; lisp: 1
file content (45 lines) | stat: -rw-r--r-- 1,516 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl -w
use strict;
use Test::More tests => 8;

my $upstream_version;
ok(open(P, "dpkg-parsechangelog |"), "successfully piping from dpkg-parsechangelog");
while (<P>) {
    /^Version: (.+)-[^-]+$/ or next;
    $upstream_version = $1;
    last;
}
isnt($upstream_version, "", "found upstream version from dpkg-parsechangelog output");
ok(close P, "dpkg-parsechangelog exited normally");

my $checked_version;
ok(open(C, "<debian/copyright"), "successfully opened debian/copyright");
while (<C>) {
    next if !/^ Last checked against: Perl (.+)/;
    $checked_version = $1;
    last;
}
isnt($checked_version, "", "found checked version from debian/copyright");
close C;

is($checked_version, $upstream_version,
    "debian/copyright last checked for the current upstream version");

SKIP: {
    system('which cme >/dev/null 2>&1');
    my $cmd;
    if ($?) {
        system('which config-edit >/dev/null 2>&1');
        skip('no cme or config-edit or available', 2) if $?;
        $cmd = 'config-edit -application dpkg-copyright -ui none';
    } else {
        skip('no cme dpkg-copyright application available (try installing libconfig-model-dpkg-perl)', 2)
            if qx/cme list/ !~ /dpkg-copyright/;
        $cmd = 'cme check dpkg-copyright';
    }
    diag("checking debian/copyright with copyright checker '$cmd'");
    unlike( qx/$cmd 2>&1/, qr/error/,
        'no error messages from copyright checker when parsing debian/copyright');
    is($?, 0, 'copyright checker exited successfully');
}