File: dh_listmissing.pl

package info (click to toggle)
gtk+2.0 2.24.31-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 127,432 kB
  • ctags: 74,609
  • sloc: ansic: 573,219; makefile: 5,155; sh: 4,417; xml: 1,193; python: 891; perl: 749; awk: 72; cpp: 34
file content (79 lines) | stat: -rw-r--r-- 1,952 bytes parent folder | download | duplicates (18)
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
#!/bin/false /usr/bin/perl -w
# shebang disabled while this script resides in debian/

# similar to dh_install; needs some documentation

use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;

init();

# list of sourcedirs
my @sourcedirs = @ARGV;

my @installed;

my $srcdir = '.';

# dh_install code, but not doing any installation, just building @installed
# and stripping sourcedirs from these
foreach my $package (@{$dh{DOPACKAGES}}) {
    my $tmp=tmpdir($package);
    my $file=pkgfile($package,"install");

    my @install;
    if ($file) {
        @install=filedoublearray($file); # no globbing yet
    }

    # Support for -X flag.
    my $exclude = '';
    if ($dh{EXCLUDE_FIND}) {
        $exclude = '! \( '.$dh{EXCLUDE_FIND}.' \)';
    }

    foreach my $set (@install) {
        if (! defined $dh{AUTODEST} && @$set > 1) {
            pop @$set;
        }
        foreach my $src (map { glob "$srcdir/$_" } @$set) {
            next if excludefile($src);

            # strip source dir
            foreach my $d (@sourcedirs) {
                $src=~s/^\Q$srcdir\E\/\Q$d\E\///;
            }

            # Keep track of what's installed.
            # Kill any extra slashes. Makes the @installed stuff more robust.
            $src=~y:/:/:s;
            $src=~s:/+$::;
            $src=~s:^(\./)*::;
            push @installed, "\Q$src\E\/.*|\Q$src\E";
        }
    }
}

# dh_install code, but stripping sourcedirs
my @missing;
my $installed=join("|", @installed);
$installed=qr{^($installed)$};
find(sub {
    -f || -l || return;
    $_="$File::Find::dir/$_";
    foreach my $d (@sourcedirs) {
        s/^\Q$d\E\///;
    }
    if (! /$installed/ && ! excludefile($_)) {
        my $file=$_;
        push @missing, $file;
    }
}, @sourcedirs);
if (@missing) {
    warning "$_ has been installed upstream but is not in any package" foreach @missing;
    if ($dh{FAIL_MISSING}) {
        error("missing files, aborting");
    }
}