Bug#657110: lintian: please check for commented-out Vcs-Git/Vcs-Browser pointing at collab-maint

2012-01-24 Thread Gergely Nagy
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 ( 

Bug#657110: lintian: please check for commented-out Vcs-Git/Vcs-Browser pointing at collab-maint

2012-01-23 Thread Paul Wise
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.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise


signature.asc
Description: This is a digitally signed message part