Debian Codegraph @

dh_octave_changelogs

raw
1 #!/usr/bin/perl
2
3 # Copyright © 2018, 2020 Rafael Laboisière <[email protected]>
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, see <https://www.gnu.org/licenses/>.
17
18 =encoding utf8
19
20 =head1 NAME
21
22 dh_octave_changelogs - install symlinks to Octave add-on package documentation
23
24 =head1 SYNOPSIS
25
26 B<dh_octave_changelogs>
27
28 =head1 DESCRIPTION
29
30 B<dh_octave_changelogs> is intended to be run from the
31 top-level source directory of an Octave add-on package. It installs
32 symlinks for the upstream files F<NEWS> and F<ChangeLog>.
33
34 =head1 SEE ALSO
35
36 L<debhelper(7)>, L<dh(1)>, L<dh_octave_substvar(1)>,
37 L<dh_octave_clean(1)>, L<dh_octave_check(1)>, L<dh_octave_version(1)>,
38 L<dh_octave_examples(1)>
39
40 This program is meant to be used together with debhelper for Debian
41 packages derived from Octave add-on packages.
42 It is recommended to enable it by adding the dh-sequence-octave
43 virtual package to Build-Depends, Build-Depends-Arch or
44 Build-Depends-Indep.
45 This is equivalent to adding dh-octave to the same field and adding
46 --with=octave to the dh sequencer in debian/rules, except that only
47 -arch/-indep/profiled builds are affected.
48
49 =head1 AUTHOR
50
51 Rafael Laboissière <[email protected]>
52
53 =cut
54
55 use strict;
56 use Debian::Debhelper::Dh_Lib;
57
58 init ();
59
60 ### Install symlinks for the NEWS and ChangeLog files
61
62 my @pkgs = @{$dh{DOPACKAGES}};
63
64 ### Loop over all binary packages
65 for my $p (@pkgs) {
66 ## Directory for looking for the upstream changelog
67 my $d = "debian/$p/usr/share/octave";
68 next if ! -d $d;
69 ## Look for it
70 my $out = qx{find $d -name "NEWS"};
71 chomp $out;
72
73 if ($out ne "") {
74 ## Link to the /usr/share/doc dir, with appropriate name
75 $out =~ s:debian/$p/usr/share/::;
76 doit ("ln", "-fs", "../../$out",
77 "debian/$pkgs[0]/usr/share/doc/$pkgs[0]/");
78 ## Do it only once
79 last;
80 }
81 }
82
83 ### Loop over all binary packages
84 for my $p (@pkgs) {
85 ## Remove upstream changelog installed by dh_installchangelogs
86 doit ("rm", "-rf", "debian/$p/usr/share/doc/$p/changelog");
87 ## Directory where to look for the upstream changelog
88 my $d = "debian/$p/usr/share/octave";
89 next if ! -d $d;
90 ## Look for it
91 my $out = qx{find $d -name "ChangeLog"};
92 chomp $out;
93
94 if ($out ne "") {
95 ## Compress it
96 doit ("gzip", "-9", $out);
97 ## Link to the /usr/share/doc dir, with appropriate name
98 $out =~ s:debian/$p/usr/share/::;
99 doit ("ln", "-fs", "../../$out.gz",
100 "debian/$pkgs[0]/usr/share/doc/$pkgs[0]/changelog.gz");
101 ## Do it only once
102 last;
103 }
104 }
105
106 # Local Variables:
107 # indent-tabs-mode: nil
108 # tab-width: 4
109 # End: