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

[lintian] 01/01: c/obsolete-sites.*: New check with tag obsolete-url-in-packaging



This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch master
in repository lintian.

commit ee308bf64afa2d76c6137886ae4c92ae9b5983e5
Author: Axel Beckert <abe@deuxchevaux.org>
Date:   Thu Sep 3 04:11:51 2015 +0200

    c/obsolete-sites.*: New check with tag obsolete-url-in-packaging
    
    It checks for URLs of hosting sites with frozen contents or (soon to
    be) closed hosting sites (Google Code, Gitorious, Freshmeat, etc.)
    inside the packaging.
    
    Closes: #793503
---
 checks/obsolete-sites.desc                         | 21 ++++++
 checks/obsolete-sites.pm                           | 81 ++++++++++++++++++++++
 data/obsolete-sites/obsolete-sites                 |  9 +++
 debian/changelog                                   |  5 ++
 profiles/debian/main.profile                       |  6 +-
 t/tests/obsolete-sites/debian/debian/control.in    | 16 +++++
 t/tests/obsolete-sites/debian/debian/copyright     | 12 ++++
 .../obsolete-sites/debian/debian/upstream/metadata |  8 +++
 t/tests/obsolete-sites/debian/debian/watch         |  3 +
 t/tests/obsolete-sites/desc                        |  6 ++
 t/tests/obsolete-sites/tags                        |  6 ++
 11 files changed, 170 insertions(+), 3 deletions(-)

diff --git a/checks/obsolete-sites.desc b/checks/obsolete-sites.desc
new file mode 100644
index 0000000..b912e1a
--- /dev/null
+++ b/checks/obsolete-sites.desc
@@ -0,0 +1,21 @@
+Check-Script: obsolete-sites
+Author: Axel Beckert <abe@debian.org>
+Abbrev: obso
+Type: source
+Needs-Info: unpacked
+Experimental: yes
+Info: This script checks for obsolete (but still valid) URLs
+
+Tag: obsolete-url-in-packaging
+Severity: normal
+Certainty: certain
+Info: One of the package's packaging files points to a website or code
+ hoster known to have frozen contents, to be closed soon or to have
+ already closed.
+ .
+ Please look for the new upstream home of the package and update the
+ packaging accordingly.
+ .
+ Sites previously hosted on code.google.com were offered a migration
+ to github.com, sites previously on gitorious.org were offered a
+ migration to gitlab.com. You might want to look there first.
diff --git a/checks/obsolete-sites.pm b/checks/obsolete-sites.pm
new file mode 100644
index 0000000..e159854
--- /dev/null
+++ b/checks/obsolete-sites.pm
@@ -0,0 +1,81 @@
+# obsolete-sites -- lintian check script -*- perl -*-
+
+# Copyright (C) 2015 Axel Beckert <abe@debian.org>
+#
+# 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., 51 Franklin St, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+package Lintian::obsolete_sites;
+use strict;
+use warnings;
+use autodie;
+
+use Lintian::Tags qw(tag);
+use Lintian::Data ();
+
+our $OBSOLETE_SITES = Lintian::Data->new('obsolete-sites/obsolete-sites');
+my @interesting_files = qw(
+  control
+  copyright
+  watch
+  upstream
+  upstream-metadata.yaml
+);
+
+sub run {
+    my ($pkg, $type, $info, $proc) = @_;
+
+    my $debian_dir = $info->index_resolved_path('debian/');
+    return unless $debian_dir;
+    foreach my $file (@interesting_files) {
+        my $dfile = $debian_dir->child($file);
+        search_for_obsolete_sites($dfile, "debian/$file");
+    }
+
+    my $upstream_dir = $info->index_resolved_path('debian/upstream');
+    return unless $upstream_dir;
+
+    my $dfile = $upstream_dir->child('metadata');
+    search_for_obsolete_sites($dfile, 'debian/upstream/metadata');
+
+    return;
+}
+
+sub search_for_obsolete_sites {
+    my ($dfile, $file) = @_;
+
+    if (defined($dfile) and $dfile->is_regular_file() and $dfile->is_open_ok) {
+
+        my $dcontents = $dfile->file_contents;
+
+        foreach my $site ($OBSOLETE_SITES->all()) {
+            #warn "$file vs $site";
+            if ($dcontents =~ m((\w+://(?:[\w.]*\.)?\Q$site\E[/:]\S*))i) {
+                tag 'obsolete-url-in-packaging', $file, $1;
+            }
+        }
+    }
+
+    return;
+}
+
+1;
+
+# Local Variables:
+# indent-tabs-mode: nil
+# cperl-indent-level: 4
+# End:
+# vim: syntax=perl sw=4 sts=4 sr et
diff --git a/data/obsolete-sites/obsolete-sites b/data/obsolete-sites/obsolete-sites
new file mode 100644
index 0000000..cf307e1
--- /dev/null
+++ b/data/obsolete-sites/obsolete-sites
@@ -0,0 +1,9 @@
+# Known obsolete websites / hosters who closed down or have frozen
+# content, one hostname per line. Subdomains will be matched, too.
+
+code.google.com
+gitorious.org
+codehaus.org
+freshmeat.net
+freecode.com
+berlios.de
diff --git a/debian/changelog b/debian/changelog
index 1012308..3080b0f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,11 @@ lintian (2.5.37) UNRELEASED; urgency=medium
     + [JW] Use "an" (instead of "a") before "HTTP".
     + [NT] Assert that -dbgsym packages are in the "debug" section.
       Thanks to Jean-Michel Vourgère for reporting the issue.
+  * checks/obsolete-sites.{desc,pm}:
+    + [AB] New check with tag obsolete-url-in-packaging to check for URLs
+      of hosting sites with frozen contents or (soon to be) closed hosting
+      sites (Google Code, Gitorious, Freshmeat, etc.) inside the
+      packaging.  (Closes: #793503)
   * checks/scripts.pm:
     + [BR] Fix Unescaped left brace in regex.  (Closes: #788926)
   * checks/version-substvars.pm:
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
index 42617fd..d28bf3e 100644
--- a/profiles/debian/main.profile
+++ b/profiles/debian/main.profile
@@ -6,8 +6,8 @@ Enable-Tags-From-Check: apache2, application-not-library, automake, binaries,
  copyright-file, cruft, dbus, deb-format, debconf, debhelper, debian-readme,
  debian-source-dir, description, duplicate-files, fields, filename-length, files,
  group-checks, huge-usr-share, infofiles, init.d, java, lintian, manpages,
- md5sums, menu-format, menus, nmu, ocaml, patch-systems, phppear, po-debconf,
- rules, scripts, shared-libs, source-copyright, standards-version, symlinks,
- systemd, testsuite, version-substvars, watch-file
+ md5sums, menu-format, menus, nmu, obsolete-sites, ocaml, patch-systems, phppear,
+ po-debconf, rules, scripts, shared-libs, source-copyright, standards-version,
+ symlinks, systemd, testsuite, version-substvars, watch-file
 Disable-Tags: hardening-no-stackprotector
 
diff --git a/t/tests/obsolete-sites/debian/debian/control.in b/t/tests/obsolete-sites/debian/debian/control.in
new file mode 100644
index 0000000..75a0e05
--- /dev/null
+++ b/t/tests/obsolete-sites/debian/debian/control.in
@@ -0,0 +1,16 @@
+Source: {$source}
+Priority: extra
+Section: {$section}
+Maintainer: {$author}
+Standards-Version: {$standards_version}
+Build-Depends: debhelper (>= 9)
+Homepage: http://code.google.com/p/foo
+
+Package: foo
+Architecture: {$architecture}
+Depends: $\{shlibs:Depends\}, $\{misc:Depends\}
+Description: {$description}
+ This is a test package designed to exercise some feature or tag of
+ Lintian.  It is part of the Lintian test suite and may do very odd
+ things.  It should not be installed like a regular package.  It may
+ be an empty package.
diff --git a/t/tests/obsolete-sites/debian/debian/copyright b/t/tests/obsolete-sites/debian/debian/copyright
new file mode 100644
index 0000000..5733dce
--- /dev/null
+++ b/t/tests/obsolete-sites/debian/debian/copyright
@@ -0,0 +1,12 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: Foo
+Upstream-Contact: J. Random Hacker <j.r.hacker@example.com>
+Source: https://foo.berlios.de/
+
+Files: *
+Copyright: 2014, me
+License: Bla
+Comment: http://freshmeat.net/p/foo
+
+License: Bla
+ This is the Bla license.
diff --git a/t/tests/obsolete-sites/debian/debian/upstream/metadata b/t/tests/obsolete-sites/debian/debian/upstream/metadata
new file mode 100644
index 0000000..5459131
--- /dev/null
+++ b/t/tests/obsolete-sites/debian/debian/upstream/metadata
@@ -0,0 +1,8 @@
+%YAML 1.1
+---
+# https://wiki.debian.org/UpstreamMetadata
+Bug-Submit: http://github.com/foo/foo/issues/new
+FAQ: http://foo.sourceforge.net/faq/
+Homepage: http://freecode.com/p/foo
+Repository: git://gitorious.org/foo/foo.git
+Repository-Browse: http://sourceforge.net/p/foo/code/ci/master/tree/
diff --git a/t/tests/obsolete-sites/debian/debian/watch b/t/tests/obsolete-sites/debian/debian/watch
new file mode 100644
index 0000000..a8d6050
--- /dev/null
+++ b/t/tests/obsolete-sites/debian/debian/watch
@@ -0,0 +1,3 @@
+version=3
+
+http://gitorious.org/foo/foo/file-(.*)\.tar\.gz
diff --git a/t/tests/obsolete-sites/desc b/t/tests/obsolete-sites/desc
new file mode 100644
index 0000000..ef55e07
--- /dev/null
+++ b/t/tests/obsolete-sites/desc
@@ -0,0 +1,6 @@
+Testname: obsolete-sites
+Sequence: 6000
+Version: 1.0-1
+Type: non-native
+Description: Test cases where packages contain links to frozen, closing or closed hosters
+Test-For: obsolete-url-in-packaging
diff --git a/t/tests/obsolete-sites/tags b/t/tests/obsolete-sites/tags
new file mode 100644
index 0000000..36acffa
--- /dev/null
+++ b/t/tests/obsolete-sites/tags
@@ -0,0 +1,6 @@
+W: obsolete-sites source: obsolete-url-in-packaging debian/control http://code.google.com/p/foo
+W: obsolete-sites source: obsolete-url-in-packaging debian/copyright http://freshmeat.net/p/foo
+W: obsolete-sites source: obsolete-url-in-packaging debian/copyright https://foo.berlios.de/
+W: obsolete-sites source: obsolete-url-in-packaging debian/upstream/metadata git://gitorious.org/foo/foo.git
+W: obsolete-sites source: obsolete-url-in-packaging debian/upstream/metadata http://freecode.com/p/foo
+W: obsolete-sites source: obsolete-url-in-packaging debian/watch http://gitorious.org/foo/foo/file-(.*)\.tar\.gz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: