lintian: r175 - in trunk: checks debian
Author: jeroen
Date: 2004-04-18 01:12:37 +0200 (Sun, 18 Apr 2004)
New Revision: 175
Added:
trunk/checks/nmu
trunk/checks/nmu.dsc
Modified:
trunk/debian/changelog
Log:
checks/nmu{,desc}:
+ [JvW] New series of checks: Check whether NMU's have correct NMU version
number, and whether maintainer uploads have correct maintainer version.
Also, check whether NMU's and QA uploads are identified as such in the
changelog.
Added: trunk/checks/nmu
===================================================================
--- trunk/checks/nmu 2004-04-17 22:48:08 UTC (rev 174)
+++ trunk/checks/nmu 2004-04-17 23:12:37 UTC (rev 175)
@@ -0,0 +1,102 @@
+#!/usr/bin/perl -w
+# nmu -- lintian check script
+
+# Copyright (C) 2004 Jeroen van Wolffelaar
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, you can find it on the World Wide
+# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+use strict;
+
+($#ARGV == 1) or fail("syntax: nmu <pkg> <type>");
+my $pkg = shift;
+my $type = shift;
+my $changelog_mentions_nmu = 0;
+my $changelog_mentions_qa = 0;
+my $uploader = undef;
+
+open CHANGELOG, "changelog" or fail "Failed opening changelog";
+<CHANGELOG>;
+my $firstline = 1;
+while (<CHANGELOG>) {
+ if ($firstline) {
+ $changelog_mentions_nmu = 1 if /nmu/i or /non-maintainer upload/i;
+ $changelog_mentions_qa = 1 if /orphan/i or /qa (?:group )?upload/i;
+ $firstline = 0 if /^\s+\S/
+ }
+ if (/^ -- ([^>]+>)/) {
+ $uploader = $1;
+ last;
+ }
+}
+close CHANGELOG;
+
+my $version = getfield "version";
+my $maintainer = getfield "maintainer";
+my $uploaders = getfield "uploaders";
+
+my $version_nmuness = 0;
+if ($version =~ /-[^.-]+(\.[^.-]+)?(\.[^.-]+)?$/) {
+ $version_nmuness = 1 if defined $1;
+ $version_nmuness = 2 if defined $2;
+}
+
+my $upload_is_nmu = $uploader ne $maintainer;
+if (defined $uploaders) {
+ my @uploaders = split /,/, $uploaders;
+ $upload_is_nmu = 0 if grep /^\s*\Q$uploader\E\s*$/, @uploaders;
+}
+
+if ($maintainer =~ /packages\@qa.debian.org/) {
+ print "E: $pkg $type: orphaned-package-should-not-have-uploaders\n"
+ if defined $uploaders;
+ print "W: $pkg $type: qa-upload-has-incorrect-version-number $version\n"
+ if $version_nmuness;
+ print "W: $pkg $type: changelog-should-mention-qa\n";
+} else {
+ print "W: $pkg $type: changelog-should-mention-nmu\n"
+ if $upload_is_nmu || $version_nmuness;
+ print "W: $pkg $type: source-nmu-has-incorrect-version-number $version\n"
+ if $upload_is_nmu && $version_nmuness != 1;
+ print "W: $pkg $type: maintainer-upload-has-incorrect-version-number $version\n"
+ if !$upload_is_nmu && $version_nmuness;
+}
+
+exit 0;
+
+# -----------------------------------
+
+sub fail {
+ if ($_[0]) {
+ warn "internal error: $_[0]\n";
+ } elsif ($!) {
+ warn "internal error: $!\n";
+ } else {
+ warn "internal error.\n";
+ }
+ exit 1;
+}
+
+sub getfield {
+ return undef if not open FIELD, "fields/".shift;
+ my $field = <FIELD>;
+ close FIELD;
+ my $field = shift;
+ $field =~ s/\n$//;
+ return $field;
+}
+
+# vim: ts=4 sw=4
Added: trunk/checks/nmu.dsc
===================================================================
--- trunk/checks/nmu.dsc 2004-04-17 22:48:08 UTC (rev 174)
+++ trunk/checks/nmu.dsc 2004-04-17 23:12:37 UTC (rev 175)
@@ -0,0 +1,43 @@
+Check-Script: nmu
+Author: Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+Abbrev: nmu
+Standards-Version: 3.6.1
+Type: source
+Unpack-Level: 1
+Needs-Info: debfiles, changelog-file
+Info: This script checks if a source package is consequent about its NMU-ness.
+
+Tag: orphaned-package-should-not-have-uploaders
+Type: error
+Info: Packages which their maintainer set to packages@qa.debian.org, i.e.
+ orphaned packages, should not have uploaders. Properly adopt the package if
+ you want to resume its maintainance.
+
+Tag: qa-upload-has-incorrect-version-number
+Type: warning
+Info: A QA upload (uploading an orphaned package without adopting it) is
+ always a maintainer upload: it should not get a NMU revision number.
+
+Tag: source-nmu-has-incorrect-version-number
+Type: warning
+Info: A source NMU should have a Debian revision of '-x.x'. This is to prevent
+ stealing version numbers from the maintainer (and the -x.x.x version numbers
+ are reserved for binary-only NMU's).
+
+Tag: maintainer-upload-has-incorrect-version-number
+Type: warning
+Info: A maintainer upload should have a Debian revision without dots.
+ Revisions with dots are reserverd for Non-Maintainer Uploads (NMU's), if you
+ do a maintainer-upload with dots, a potential NMU'er has problems choosing a
+ correct version number.
+
+Tag: changelog-should-mention-qa
+Type: warning
+Info: If this upload is to orphan this package, please mention this fact on
+ the first line of the changelog. If this is a QA upload, please mention "QA
+ (group) upload" there.
+
+Tag: changelog-should-mention-nmu
+Type: warning
+Info: When you NMU a package, that fact should be mentioned on the first line
+ in the changelog entry.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2004-04-17 22:48:08 UTC (rev 174)
+++ trunk/debian/changelog 2004-04-17 23:12:37 UTC (rev 175)
@@ -126,6 +126,11 @@
+ [FL] Only issue one warning about needs=dwww, not two
+ [HE] Check if the command given with command= is in the package
(Closes: #199346)
+ * checks/nmu{,desc}:
+ + [JvW] New series of checks: Check whether NMU's have correct NMU version
+ number, and whether maintainer uploads have correct maintainer version.
+ Also, check whether NMU's and QA uploads are identified as such in the
+ changelog.
* checks/scripts:
+ [FL] Add /usr/bin/php as valid interpreter. (Closes: #239115)
Thanks to Peter Eisentraut for pointing this change out
Reply to: