-
Notifications
You must be signed in to change notification settings - Fork 5
/
dh_epics_lintian
executable file
·129 lines (91 loc) · 3.49 KB
/
dh_epics_lintian
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
#!/usr/bin/perl
=head1 NAME
dh_epics_lintian - Install standard overrides for EPICS packages
=head1 SYNOPSIS
B<dh_epics_lintian> [S<I<debhelper options> >]
=head1 DESCRIPTION
The Lintian utility produces several false positives for
all EPICS module packages. This utility installs a standard overrides file
if not debian/packagename.lintian-overrides is provided.
The current list of overrides is:
=over 3
=item arch-independent-package-contains-binary-or-object
RTEMS packages can be marked "Architecture: all" as they should contain
no host binaries. Target binaries produced by a cross-compiler
do not depend on the host architecture.
=item statically-linked-binary
While RTEMS uses the ELF format for executables and object files, it
does not support shared libraries. Therefore executables
can only be statically linked.
=item unstripped-binary-or-object
RTEMS packages contain only static libraries, which don't support split debug.
Therefore binaries are left unstripped to allow the end user the option to debug.
For *-dev packages, won't strip for *-debug targets unless
a *-dbg package is also being produced.
=back
=cut
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
use Debian::Debhelper::Dh_Epics qw(setepicsenv);
init();
setepicsenv();
# Are we building any *-dbg package?
my $hasdbg = 0;
foreach my $pkg (getpackages()) {
$hasdbg = 1 if($pkg =~ m/-dbg$/);
}
verbose_print("Building -dbg") if($hasdbg);
verbose_print("Not building -dbg") unless($hasdbg);
foreach my $pkg (getpackages()) {
# skip if overrides provided explicitly
next if(-f "debian/$pkg.lintian-overrides" or
-f "debian/$pkg/usr/share/lintian/overrides/$pkg");
next if($pkg =~ m/-dbg$/);
my $overrides;
if($pkg =~ m/^rtems-.+-[^-]+$/) {
$overrides = << "OVERRIDE";
# Target binaries are independent of the host
$pkg: arch-independent-package-contains-binary-or-object
# Everything RTEMS is statically linked
$pkg: statically-linked-binary
# static linking means no split debug for libraries
# so leave stripping to end user
$pkg: unstripped-binary-or-object
OVERRIDE
} elsif($pkg =~ m/-dev$/ and !$hasdbg) {
my $comment = 0;
foreach my $file(glob("debian/$pkg/$ENV{EPICS_BASE}/*/linux-*/*")) {
$file =~ s|debian/$pkg/+||;
if(!$comment) {
$comment = 1;
$overrides = $overrides . "# No stripping for *-debug targets unless -dbg package is created\n";
}
$overrides = $overrides . "$pkg: unstripped-binary-or-object $file\n";
}
} elsif($pkg =~ m/^lib/) {
$overrides = << "OVERRIDE";
# To prevent accidental linking, but avoid the need for rpath.
# For host non-debug targets place the library w/ SONAME
# as eg. "/usr/lib/libmine.so.1" and place the
# symlink w/o SONAME "in /usr/lib/epics/lib/\$EPICS_HOST_ARCH/libmine.so"
$pkg: dev-pkg-without-shlib-symlink
OVERRIDE
}
next unless($overrides);
verbose_print("Overrides for $pkg");
verbose_print($overrides);
doit("install","-d","debian/$pkg/usr/share/lintian/overrides")
if(! -d "debian/$pkg/usr/share/lintian/overrides");
next if($dh{NO_ACT});
open(my $over, '>', "debian/$pkg/usr/share/lintian/overrides/$pkg") ||
error("failed to write override");
print {$over} $overrides;
close($over);
}
=head1 SEE ALSO
L<debhelper(7)>, L<epics-debhelper(7)>
This program is a not part of the official debhelper package.
=head1 AUTHOR
Michael Davidsaver <mdavidsaver@gmail.com>
=cut