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

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



Package: lintian
Version: 2.5.4
Severity: wishlist

The way Alioth is setup, using ~user/project.git as the path for the
git:// URI accesses wagner.d.o:~user/public_git/project.git.  This
directory isn't automatically updated by pushes (which go to
vasks.d.o:~user/public_git/project.git and are synchronized to
wagner:/srv/git.debian.org/users/user/project.git).  The URI has to be
git://anonscm.debian.org/users/user/project.git.

Attached patch adds a check for this, in a way that could potentially be
expanded to add other checks for valid URIs, as well as a test for the
addition.

Thanks for your consideration.

James

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.1.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils                       2.22-2
ii  bzip2                          1.0.6-1
ii  diffstat                       1.54-1
ii  file                           5.09-2
ii  gettext                        0.18.1.1-5
ii  intltool-debian                0.35.0+20060710.1
ii  libapt-pkg-perl                0.1.25+b1
ii  libclass-accessor-perl         0.34-1
ii  libclone-perl                  0.31-1+b2
ii  libdpkg-perl                   1.16.1.2
ii  libemail-valid-perl            0.185-1
ii  libipc-run-perl                0.90-1
ii  libparse-debianchangelog-perl  1.2.0-1
ii  libtimedate-perl               1.2000-1
ii  liburi-perl                    1.59-1
ii  locales                        2.13-23
ii  man-db                         2.6.0.2-3
ii  patchutils                     0.3.2-1
ii  perl [libdigest-sha-perl]      5.14.2-6
ii  unzip                          6.0-5

lintian recommends no packages.

Versions of packages lintian suggests:
ii  binutils-multiarch     <none>
ii  dpkg-dev               1.16.1.2
ii  libhtml-parser-perl    3.69-1+b1
ii  libtext-template-perl  <none>
ii  man-db                 2.6.0.2-3
ii  xz-utils               5.1.1alpha+20110809-3

-- no debconf information

-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <jamessan@debian.org>
From 417ca4a0c297685c87ed33e7ed22bac3f6884e7b Mon Sep 17 00:00:00 2001
From: James McCoy <jamessan@debian.org>
Date: Sun, 18 Dec 2011 18:50:02 -0500
Subject: [PATCH] Added check for ~user/project.git Alioth Vcs-Git URIs

git:// URIs for Alioth repositories need to use users/user/project.git.
~user/project.git accesses the user's public_git repository on wagner instead
of the directory that's synchronized from vasks (git.d.o).  Unless the user
goes through extra steps, ~user/project.git will not contain current
information.

Signed-off-by: James McCoy <jamessan@debian.org>
---
 checks/fields                 |   13 +++++++++++++
 checks/fields.desc            |    9 +++++++++
 testset/fields/debian/control |    1 +
 testset/tags.fields           |    1 +
 4 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/checks/fields b/checks/fields
index 882e5e2..a0bb58f 100644
--- a/checks/fields
+++ b/checks/fields
@@ -145,6 +145,12 @@ my %VCS_VALID_URIS = (
     svn     => qr;^(?:svn\+)?ssh://;,
 );
 
+# Checks for invalid Vcs-* formats.  Key must start with ${vcs}_ and Value is
+# [ regex, tag ].
+my %VCS_INVALID_URIS = (
+    git_alioth_user => [ qr;^git://(?:git|anonscm).debian.org/~;, 'vcs-git-uses-invalid-user-uri' ],
+);
+
 # Python development packages that are used almost always just for building
 # architecture-dependent modules.  Used to check for unnecessary build
 # dependencies for architecture-independent source packages.
@@ -958,6 +964,13 @@ while (my ($vcs, $regex) = each %VCS_RECOMMENDED_URIS) {
     if (defined $info->field("vcs-$vcs")) {
         my $uri = $info->field("vcs-$vcs");
         unfold("vcs-$vcs", \$uri);
+        for my $vcs_check (grep { /^${vcs}_/ } keys %VCS_INVALID_URIS) {
+            if (my $invalid = $VCS_INVALID_URIS{$vcs_check}) {
+                if ($uri =~ $invalid->[0]) {
+                    tag $invalid->[1], "vcs-$vcs", $uri;
+                }
+            }
+        }
         if ($uri !~ $regex) {
             if ($VCS_VALID_URIS{$vcs} and $uri =~ $VCS_VALID_URIS{$vcs}) {
                 tag 'vcs-field-uses-not-recommended-uri-format', "vcs-$vcs", $uri;
diff --git a/checks/fields.desc b/checks/fields.desc
index 6b503c9..5ca1a72 100644
--- a/checks/fields.desc
+++ b/checks/fields.desc
@@ -1007,6 +1007,15 @@ Certainty: possible
 Info: The VCS-* field uses an URI which doesn't match any known format.
  You might have forgotten the protocol before the hostname.
 
+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/testset/fields/debian/control b/testset/fields/debian/control
index d980a6e..ad4f6a7 100644
--- a/testset/fields/debian/control
+++ b/testset/fields/debian/control
@@ -3,6 +3,7 @@ Section: does-not-exist
 Priority: standard
 Maintainer: Lintian Maintainers <lintian-maint@debian.org>
 Standards-Version: 3.9.2
+Vcs-Git: git://git.debian.org/~user/project.git
 
 Package: fields
 Essential: no
diff --git a/testset/tags.fields b/testset/tags.fields
index 1c5a102..78f77cc 100644
--- a/testset/tags.fields
+++ b/testset/tags.fields
@@ -15,6 +15,7 @@ W: fields source: native-package-with-dash-version
 W: fields source: no-debian-copyright
 W: fields source: package-uses-deprecated-debhelper-compat-version 1
 W: fields source: source-nmu-has-incorrect-version-number 1.5-.3
+W: fields source: vcs-git-uses-invalid-user-uri vcs-git git://git.debian.org/~user/project.git
 W: fields: debian-revision-not-well-formed 1.5-.3
 W: fields: essential-no-not-needed
 W: fields: unknown-section does-not-exist
-- 
1.7.7.3

Attachment: signature.asc
Description: Digital signature


Reply to: