1 # watch-file -- lintian check script -*- perl -*-
3 # Copyright (C) 2008 Patrick Schoenfeld
4 # Copyright (C) 2008 Russ Allbery
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, you can find it on the World Wide
18 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
19 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 package Lintian::watch_file;
34 if (! -f "debfiles/watch") {
35 tag 'debian-watch-file-is-missing' unless ($info->native);
39 # Perform the other checks even if it is a native package
40 tag 'debian-watch-file-in-native-package' if ($info->native);
42 # Check if the Debian version contains anything that resembles a repackaged
43 # source package sign, for fine grained version mangling check
44 my $version = $info->field('version');
46 if ($version =~ /(dfsg|debian|ds)/) {
50 # Gather information from the watch file and look for problems we can
51 # diagnose on the first time through.
52 open(WATCH, '<', 'debfiles/watch') or fail("cannot open watch file: $!");
54 my ($watchver, $mangle, $dmangle);
60 # This is caught by uscan.
65 if (/^version\s*=\s*(\d+)(\s|\Z)/) {
66 if (defined $watchver) {
67 tag 'debian-watch-file-declares-multiple-versions', "line $.";
70 if ($watchver ne '2' and $watchver ne '3') {
71 tag 'debian-watch-file-unknown-version', $watchver;
74 unless (defined($watchver)) {
75 tag 'debian-watch-file-missing-version';
83 if (s/^opt(ion)?s=\"([^\"]+)\"\s+// || s/^opt(ion)?s=(\S+)\s+//) {
85 @opts = split(',', $opts);
86 if (defined $repack) {
88 $mangle = 1 if /^[ud]versionmangle.*=.*($repack)/;
89 $dmangle = 1 if /^dversionmangle.*=.*($repack)/;
93 if (m%qa\.debian\.org/watch/sf\.php\?%) {
94 tag 'debian-watch-file-uses-deprecated-sf-redirector-method';
100 # If the version of the package contains dfsg, assume that it needs to be
101 # mangled to get reasonable matches with upstream.
102 if ($repack and not $mangle) {
103 tag 'debian-watch-file-should-mangle-version';
105 if ($repack and $mangle and not $dmangle) {
106 tag 'debian-watch-file-should-dversionmangle-not-uversionmangle';
114 # indent-tabs-mode: nil
115 # cperl-indent-level: 4
117 # vim: syntax=perl sw=4 sts=4 ts=4 et shiftround