tag 657110 + patch
thanks

Paul Wise <p...@debian.org> writes:

> Package: lintian
> Severity: wishlist
>
> dh_make creates lines like this in debian/control by default:
>
> #Vcs-Git: git://git.debian.org/collab-maint/<pkg>.git
> #Vcs-Browser: http://git.debian.org/?p=collab-maint/<pkg>.git;a=summary
>
> I think lintian should check for these lines and warn if they are still
> commented out since they are probably invalid and if they are valid they
> should not be commented out.

Patch that does just that is attached (and another to update
debian/changelog). I haven't tested it with a real dh-make template, nor
did I verify that the Vcs-* lines are all catched (if dh-make emits
anything else than git URIs, those are not caught).

The test is very simple to extend to catch pretty much anything, though.

-- 
|8]

>From f7defef4e0bf66c8e6e1dd2b029e043dd31ff605 Mon Sep 17 00:00:00 2001
From: Gergely Nagy <alger...@balabit.hu>
Date: Tue, 24 Jan 2012 10:30:28 +0100
Subject: [PATCH 1/2] Check for commented out collab-maint Vcs-* headers.

dh_make adds commented out Vcs-* header boilerplate to debian/control,
which should either be removed, or changed to be a valid location.

This check implements just that.

Requested-By: Paul Wise <p...@debian.org>
Signed-off-by: Gergely Nagy <alger...@balabit.hu>
---
 checks/control-file                                |    6 ++++++
 checks/control-file.desc                           |    7 +++++++
 .../control-file-general/debian/debian/control.in  |    2 ++
 t/tests/control-file-general/desc                  |    4 +++-
 t/tests/control-file-general/tags                  |    2 ++
 5 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/checks/control-file b/checks/control-file
index 1a6475b..2837335 100644
--- a/checks/control-file
+++ b/checks/control-file
@@ -56,6 +56,12 @@ open (CONTROL, '<', $dcontrol)
     or fail "Couldn't read debfiles/control: $!";
 while (<CONTROL>) {
     s/\s*\n$//;
+
+    if (/^#(Vcs-(Git|Browser)): (git|http):\/\/git\.debian\.org\/(\?p=)?collab-maint\/<pkg>\.git/) {
+        tag 'control-contains-dh_make-vcs-comment';
+        next;
+    }
+
     next if /^\#/;
 
     #Reset seen_fields if we enter a new section:
diff --git a/checks/control-file.desc b/checks/control-file.desc
index 189a4be..53813ac 100644
--- a/checks/control-file.desc
+++ b/checks/control-file.desc
@@ -201,3 +201,10 @@ Info: The control file contains a syntax error.
  .
  This issue may hide other issues as Lintian skips some checks on the
  file in this case.
+
+Tag: control-contains-dh_make-vcs-comment
+Severity: normal
+Certainty: certain
+Info: The control file contains commented-out VCS-* lines, most
+ probably a result of dh_make. These URLs should either be valid and
+ uncommented, or removed.
diff --git a/t/tests/control-file-general/debian/debian/control.in b/t/tests/control-file-general/debian/debian/control.in
index 58e7522..e4f0cb6 100644
--- a/t/tests/control-file-general/debian/debian/control.in
+++ b/t/tests/control-file-general/debian/debian/control.in
@@ -11,6 +11,8 @@ Build-Depends: debhelper (>= 7.0.50~),
  ]
 Build-Depends-Indep: perl (> 5.8)
 XS-Vcs-Svn: svn://svn.example.com/{$srcpkg}/trunk
+#Vcs-Git: git://git.debian.org/collab-maint/<pkg>.git
+#Vcs-Browser: http://git.debian.org/?p=collab-maint/<pkg>.git;a=summary
 
 
 Package: {$srcpkg}
diff --git a/t/tests/control-file-general/desc b/t/tests/control-file-general/desc
index 99c6d58..9cb91fe 100644
--- a/t/tests/control-file-general/desc
+++ b/t/tests/control-file-general/desc
@@ -13,5 +13,7 @@ Test-For:
  package-depends-on-itself
  stronger-dependency-implies-weaker
  xs-vcs-header-in-debian-control
+ control-contains-dh_make-vcs-comment
 References: Debian Bug#30020, Debian Bug#409099, Debian Bug#516706,
- Debian Bug#533202, Debian Bug#557971, Debian Bug#573399, Debian Bug#580494
+ Debian Bug#533202, Debian Bug#557971, Debian Bug#573399, Debian Bug#580494,
+ Debian Bug#657110
diff --git a/t/tests/control-file-general/tags b/t/tests/control-file-general/tags
index 82fd675..60f5074 100644
--- a/t/tests/control-file-general/tags
+++ b/t/tests/control-file-general/tags
@@ -4,6 +4,8 @@ I: control-file-general source: binary-control-field-duplicates-source field "ma
 I: control-file-general source: duplicate-long-description control-file-general control-file-general-1 control-file-general-2 control-file-general-3 control-file-general-4
 I: control-file-general source: duplicate-short-description control-file-general control-file-general-1
 I: control-file-general source: xs-vcs-header-in-debian-control xs-vcs-svn
+W: control-file-general source: control-contains-dh_make-vcs-comment
+W: control-file-general source: control-contains-dh_make-vcs-comment
 W: control-file-general source: no-section-field-for-source
 W: control-file-general source: obsolete-relation-form-in-source in control-file-general-1 breaks: libsqlite3-0 (< 3.6.12)
 W: control-file-general source: obsolete-relation-form-in-source in source build-depends-indep: perl (> 5.8)
-- 
1.7.8.3

>From 370d1fe94dab2eae7d613c52046e63bf9d452e1a Mon Sep 17 00:00:00 2001
From: Gergely Nagy <alger...@balabit.hu>
Date: Tue, 24 Jan 2012 10:36:07 +0100
Subject: [PATCH 2/2] debian/changelog update

---
 debian/changelog |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 44f98e2..c262152 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,7 @@ lintian (2.5.5) UNRELEASED; urgency=low
       - shlib-in-multi-arch-foreign-package
       - syntax-error-in-control-file
       - syntax-error-in-debconf-template
+      - control-contains-dh_make-vcs-comment
     + Removed:
       - dh_dhelp-is-deprecated
       - maintainer-script-calls-deprecated-wm-menu-config
@@ -31,6 +32,8 @@ lintian (2.5.5) UNRELEASED; urgency=low
       to David Bremner for the report.  (Closes: #652602)
     + [NT] Emit a tag if there is a syntax error in d/control rather
       than just aborting the rest of the check.
+    + [GN] check for commented-out Vcs-Git/Vcs-Browser pointing at
+      collab-maint.  (Closes: #657110)
   * checks/cruft:
     + [NT] Added dh-autoreconf as a build-depends alternative to
       libtool for suppressing ancient-libtool warning.  Thanks to
-- 
1.7.8.3

Reply via email to