[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#652595: lintian: Add check for invalid Alioth Vcs-Git URI



Here's an new patch that outputs both paths, puts its tests in the
*new* testsuite, and also upgrades some (5?) problematic instances of
'vcs-field-not-canonical' to a new 'vcs-field-bitrotted' warning.

You can probably get the same code from:

  https://github.com/SamB/lintian.git -b vcs-bad-uri

>From 8de410a27b953e07dd76f3c1ecf7cd39f3a64b37 Mon Sep 17 00:00:00 2001
From: Samuel Bronson <naesten@gmail.com>
Date: Wed, 16 Jan 2013 22:50:24 -0500
Subject: [PATCH] c/fields: Warn on some broken alioth paths in Vcs-Cvs and
 Vcs-Git

Involves a slight generalization of VCS_CANONIFY to allow custom tags.

Also includes tests.

Closes: #652595
Signed-off-by: Samuel Bronson <naesten@gmail.com>
---
 checks/fields                                           |   13 +++++++++----
 checks/fields.desc                                      |   15 +++++++++++++++
 .../debian/debian/control.in                            |    2 +-
 t/tests/fields-uncanonical-vcs-fields/desc              |    2 ++
 t/tests/fields-uncanonical-vcs-fields/tags              |    4 ++--
 t/tests/fields-vcs-fields/desc                          |    2 ++
 6 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/checks/fields b/checks/fields
index c8f3d29..88352ed 100644
--- a/checks/fields
+++ b/checks/fields
@@ -125,9 +125,10 @@ my %VCS_CANONIFY = (
         $_[0] =~ s{http://bzr.debian.org/loggerhead/}{http://anonscm.debian.org/loggerhead/};
     },
     cvs      => sub {
-	$_[0] =~ s{\@cvs.alioth.debian.org:/cvsroot/}{\@anonscm.debian.org:/cvs/};
+        if ($_[0] =~ s{\@(?:cvs.alioth|anonscm).debian.org:/cvsroot/}{\@anonscm.debian.org:/cvs/}) {
+            $_[1] = 'vcs-field-bitrotted';
+        }
 	$_[0] =~ s{\@cvs.alioth.debian.org:/cvs/}{\@anonscm.debian.org:/cvs/};
-	$_[0] =~ s{\@anonscm.debian.org:/cvsroot/}{\@anonscm.debian.org:/cvs/};
     },
     arch     => sub {
         $_[0] =~ s{http://arch.debian.org/arch/}{http://anonscm.debian.org/arch/};
@@ -137,6 +138,9 @@ my %VCS_CANONIFY = (
         $_[0] =~ s{http://anonscm.debian.org/bzr/bzr/}{http://anonscm.debian.org/bzr/};
     },
     git     => sub {
+        if ($_[0] =~ s{git://(?:git|anonscm).debian.org/~}{git://anonscm.debian.org/users/}) {
+            $_[1] = 'vcs-git-uses-invalid-user-uri';
+        }
         $_[0] =~ s{http://git.debian.org/}{http://anonscm.debian.org/git/};
         $_[0] =~ s{http://anonscm.debian.org/git/git/}{http://anonscm.debian.org/git/};
         $_[0] =~ s{git://git.debian.org/}{git://anonscm.debian.org/};
@@ -1014,11 +1018,12 @@ while (my ($vcs, $splitter) = each %VCS_EXTRACT) {
         }
         if ($VCS_CANONIFY{$vcs}) {
             my $canonicalized = $parts[0];
+            my $tag = 'vcs-field-not-canonical';
             foreach my $canonify ($VCS_CANONIFY{$vcs}) {
-                &$canonify($canonicalized);
+                &$canonify($canonicalized, $tag);
             }
             if ($canonicalized ne $parts[0]) {
-                tag 'vcs-field-not-canonical', $parts[0], $canonicalized;
+                tag $tag, $parts[0], $canonicalized;
             }
         }
     }
diff --git a/checks/fields.desc b/checks/fields.desc
index ef0a7fe..978a7e2 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -995,6 +995,21 @@ Info: The VCS-* field contains an uncanonical URI. Please update to use
  and makes debcheckout work independent of the port forwarding and
  redirections properly working.
 
+Tag: vcs-field-bitrotted
+Severity: normal
+Certainty: certain
+Info: The VCS-* field uses a form which no longer works. Update it to use
+ the current canonical URI instead, or <tt>debcheckout</tt> will <i>not</i> work.
+
+Tag: vcs-git-uses-invalid-user-uri
+Severity: normal
+Certainty: certain
+Info: The Vcs-Git field is pointing to a personal repository using
+ a git://(git|anonscm).debian.org/~$login/$PRJ.git style URI.  This is not
+ recommended since the repository this points is not automatically updated
+ when pushing to the personal repository.  The recommended URI for anonymous
+ access is git://anonscm.debian.org/users/$login/$PRJ.git.
+
 Tag: lib-recommends-documentation
 Severity: normal
 Certainty: possible
diff --git a/t/tests/fields-uncanonical-vcs-fields/debian/debian/control.in b/t/tests/fields-uncanonical-vcs-fields/debian/debian/control.in
index c37d538..2c53535 100644
--- a/t/tests/fields-uncanonical-vcs-fields/debian/debian/control.in
+++ b/t/tests/fields-uncanonical-vcs-fields/debian/debian/control.in
@@ -8,7 +8,7 @@ Vcs-Browser: https://svn.debian.org/wsvn/foobar/trunk
 Vcs-Svn: svn://svn.debian.org/svn/foobar/trunk
 Vcs-Mtn: www.example.org org.debian.foobar
 Vcs-Hg: http://hg.debian.org/hg/foobar/pkg/foobar
-Vcs-Git: git://git.debian.org/git/users/djpig/foobar.git -b master
+Vcs-Git: git://git.debian.org/~djpig/foobar.git -b master
 Vcs-Cvs: :pserver:anonymous@cvs.alioth.debian.org:/cvsroot/foobar module
 Vcs-Bzr: nosmart+http://bzr.debian.org/bzr/collab-maint/foobar
 
diff --git a/t/tests/fields-uncanonical-vcs-fields/desc b/t/tests/fields-uncanonical-vcs-fields/desc
index c55751a..8ca8aaf 100644
--- a/t/tests/fields-uncanonical-vcs-fields/desc
+++ b/t/tests/fields-uncanonical-vcs-fields/desc
@@ -4,3 +4,5 @@ Description: Test for vcs fields needing canonication
 Version: 1.0
 Test-For:
  vcs-field-not-canonical
+ vcs-field-bitrotted
+ vcs-git-uses-invalid-user-uri
diff --git a/t/tests/fields-uncanonical-vcs-fields/tags b/t/tests/fields-uncanonical-vcs-fields/tags
index 5631249..05df936 100644
--- a/t/tests/fields-uncanonical-vcs-fields/tags
+++ b/t/tests/fields-uncanonical-vcs-fields/tags
@@ -1,6 +1,6 @@
-I: fields-uncanonical-vcs-fields source: vcs-field-not-canonical :pserver:anonymous@cvs.alioth.debian.org:/cvsroot/foobar :pserver:anonymous@anonscm.debian.org:/cvs/foobar
-I: fields-uncanonical-vcs-fields source: vcs-field-not-canonical git://git.debian.org/git/users/djpig/foobar.git git://anonscm.debian.org/users/djpig/foobar.git
 I: fields-uncanonical-vcs-fields source: vcs-field-not-canonical http://hg.debian.org/hg/foobar/pkg/foobar http://anonscm.debian.org/hg/foobar/pkg/foobar
 I: fields-uncanonical-vcs-fields source: vcs-field-not-canonical https://svn.debian.org/wsvn/foobar/trunk http://anonscm.debian.org/viewvc/foobar/trunk
 I: fields-uncanonical-vcs-fields source: vcs-field-not-canonical nosmart+http://bzr.debian.org/bzr/collab-maint/foobar nosmart+http://anonscm.debian.org/bzr/collab-maint/foobar
 I: fields-uncanonical-vcs-fields source: vcs-field-not-canonical svn://svn.debian.org/svn/foobar/trunk svn://anonscm.debian.org/foobar/trunk
+W: fields-uncanonical-vcs-fields source: vcs-field-bitrotted :pserver:anonymous@cvs.alioth.debian.org:/cvsroot/foobar :pserver:anonymous@anonscm.debian.org:/cvs/foobar
+W: fields-uncanonical-vcs-fields source: vcs-git-uses-invalid-user-uri git://git.debian.org/~djpig/foobar.git git://anonscm.debian.org/users/djpig/foobar.git
diff --git a/t/tests/fields-vcs-fields/desc b/t/tests/fields-vcs-fields/desc
index 171f8bd..3f3d19a 100644
--- a/t/tests/fields-vcs-fields/desc
+++ b/t/tests/fields-vcs-fields/desc
@@ -7,3 +7,5 @@ Test-Against:
  vcs-field-uses-unknown-uri-format
  vcs-field-has-unexpected-spaces
  vcs-field-not-canonical
+ vcs-field-bitrotted
+ vcs-git-uses-invalid-user-uri
-- 
1.7.10.4

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

Reply to: