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

[SCM] Debian package checker branch, master, updated. 2.5.7-14-ga6b636d



The following commit has been merged in the master branch:
commit 0a558beac49c5f876e9d9f4881fde309ad6fad60
Author: Niels Thykier <niels@thykier.net>
Date:   Wed May 23 15:37:40 2012 +0200

    c/scripts: Add data file for versioned interpreters
    
    Move the contents of %versioned_interpreters into a separate data
    file.  Include Python 2.7 in the data file.
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/checks/scripts b/checks/scripts
index 4520b09..15471d5 100644
--- a/checks/scripts
+++ b/checks/scripts
@@ -40,6 +40,21 @@ sub _parse_interpreters {
     return [$path, $dep];
 }
 
+sub _parse_versioned_interpreters {
+    my ($interpreter, $value) = @_;
+    my ($path, $regex, $deptmp, $vers, $deprel) = split m/\s*,\s*/, $value, 5;
+    my @versions = split m/\s++/, $vers;
+    $deprel = $interpreter if not $deprel;
+    if ($deprel eq '@NO_DEFAULT_DEPS@') {
+        $deprel = '';
+    } elsif ($deprel eq '@SKIP_UNVERSIONED@') {
+        $deprel = undef;
+    } elsif ($deprel =~ m/@/) {
+        fail "Unknown magic value $deprel for versioned interpreter $interpreter";
+    }
+    return [$path, $deprel, qr/^$regex$/, $deptmp, \@versions];
+}
+
 # This is a map of all known interpreters.  The key is the interpreter
 # name (the binary invoked on the #! line).  The value is an anonymous
 # array of two elements.  The first argument is the path on a Debian
@@ -52,79 +67,38 @@ sub _parse_interpreters {
 my $INTERPRETERS = Lintian::Data->new ('scripts/interpreters', qr/\s*=\>\s*/o,
                                        \&_parse_interpreters);
 
-
 # The more complex case of interpreters that may have a version number.
 #
 # This is a hash from the base interpreter name to a list.  The base
 # interpreter name may appear by itself or followed by some combination of
-# dashes, digits, and periods.  The values are the directory in which the
-# interpreter is found, the dependency to add for a version-less interpreter,
-# a regular expression to match versioned interpreters and extract the version
-# number, the package dependency for a versioned interpreter, and the list of
-# known versions.
+# dashes, digits, and periods.
+#
+# The list contains the following values:
+#  [<path>, <dependency-relation>, <regex>, <dependency-templatel>, <version-list>]
+#
+# Their meaning is documented in Lintian's scripts/versioned-interpreters
+# file, though they are ordered differently and there are a few differences
+# as described below:
 #
-# An interpreter with a version must have a dependency on the specific package
-# formed by taking the fourth element of the list and replacing $1 with the
-# version number.  An interpreter without a version is rejected if the second
-# element is undef; otherwise, the package must satisfy a dependency on the
-# disjunction of the second argument (if non-empty) and all the packages
-# formed by taking the list of known versions (the fifth element and on) and
-# replacing $1 in the fourth argument with them.
+# * <regex> has been passed through qr/^<value>$/
+# * If <dependency-relation> was left out, it has been substituted by the
+#   interpreter.
+# * The magic values of <dependency-relation> are represented as:
+#   @NO_DEFAULT_DEPS@  -> '' (i.e. an empty string)
+#   @SKIP_UNVERSIONED@ ->  undef (i.e the undefined value)
+# * <version-list> has been split into a list of versions.
+#   (e.g. "1.6 1.8" will be ["1.6", "1.8"])
 #
-# For example:
+# A full example is:
 #
-#    lua => [ '/usr/bin', 'lua', qr/^lua([\d.]+)$/, 'lua$1', qw(40 50 5.1) ]
+#    data:
+#        lua => /usr/bin, lua([\d.]+), 'lua$1', 40 50 5.1
 #
-# says that any lua interpreter must be in /usr/bin, a package using
-# /usr/bin/lua50 must depend on lua50, and a package using just /usr/bin/lua
-# must satisfy lua | lua40 | lusa50 | lua5.1.
+#    $VERSIONED_INTERPRETERS->value ('lua') is
+#       [ '/usr/bin', 'lua', qr/^lua([\d.]+)$/, 'lua$1', ["40", "50", "5.1"] ]
 #
-# The list of known versions is the largest maintenance headache here, but
-# it's only used for the unversioned dependency handling, and then only when
-# someone uses the unversioned script but depends on a specific version for
-# some reason.  So it's not a huge problem if it's a little out of date.
-my %versioned_interpreters =
-    (guile   => [ '/usr/bin', 'guile',
-                  qr/^guile-([\d.]+)$/, 'guile-$1', qw(1.6 1.8)
-                ],
-     jruby   => [ '/usr/bin', 'jruby',
-                  qr/^jruby([\d.]+)$/, 'jruby$1', qw(1.0 1.1 1.2)
-                ],
-     lua     => [ '/usr/bin', 'lua',
-                  qr/^lua([\d.]+)$/, 'lua$1', qw(40 50 5.1)
-                ],
-     octave  => [ '/usr/bin', 'octave',
-                  qr/^octave([\d.]+)$/, 'octave$1', qw(3.0 3.2)
-                ],
-     php     => [ '/usr/bin', '',
-                  qr/^php(\d+)$/, 'php$1-cli', qw(5)
-                ],
-     pike    => [ '/usr/bin', '',
-                  qr/^pike([\d.]+)$/, 'pike$1 | pike$1-core', qw(7.6 7.8)
-                ],
-     python  => [ '/usr/bin', undef,
-                  qr/^python([\d.]+)$/, 'python$1 | python$1-minimal',
-                  qw(2.4 2.5 2.6)
-                ],
-     rackup  => [ '/usr/bin', undef,
-                  qr/^rackup([\d.]+)$/, 'librack-ruby$1', qw(1.8 1.9)
-                ],
-     ruby    => [ '/usr/bin', undef,
-                  qr/^ruby([\d.]+)$/, 'ruby$1', qw(1.8 1.9)
-                ],
-     runghc  => [ '/usr/bin', 'ghc',
-                  qr/^runghc(\d+)$/, 'ghc$1', qw(6)
-                ],
-     scsh    => [ '/usr/bin', 'scsh',
-                  qr/^scsh-([\d.]+)$/, 'scsh-$1', qw(0.6)
-                ],
-     tclsh   => [ '/usr/bin', 'tclsh | tcl',
-                  qr/^tclsh([\d.]+)$/, 'tcl$1', qw(8.3 8.4 8.5 8.6)
-                ],
-     wish    => [ '/usr/bin', 'wish | tk',
-                  qr/^wish([\d.]+)$/, 'tk$1', qw(8.3 8.4 8.5 8.6)
-                ],
-    );
+my $VERSIONED_INTERPRETERS = Lintian::Data->new ('scripts/versioned-interpreters', qr/\s*=\>\s*/o,
+                                                 \&_parse_versioned_interpreters);
 
 # Any of the following packages can satisfy an update-inetd dependency.
 my $update_inetd
@@ -356,10 +330,10 @@ for my $filename (sort keys %{$info->scripts}) {
     my $data = $INTERPRETERS->value ($base);
     my $versioned = 0;
     if (not defined $data) {
-        $data = $versioned_interpreters{$base};
+        $data = $VERSIONED_INTERPRETERS->value ($base);
         undef $data if ($data and not defined ($data->[1]));
         if (not defined ($data) and $base =~ /^(.*[^\d.-])-?[\d.]+$/) {
-            $data = $versioned_interpreters{$1};
+            $data = $VERSIONED_INTERPRETERS->value ($1);
             undef $data unless ($data and $base =~ /$data->[2]/);
         }
         $versioned = 1 if $data;
@@ -426,8 +400,8 @@ for my $filename (sort keys %{$info->scripts}) {
                     "($filename)";
             }
         }
-    } elsif ($versioned_interpreters{$base}) {
-        my @versions = @$data[4 .. @$data - 1];
+    } elsif ($VERSIONED_INTERPRETERS->known ($base)) {
+        my @versions = @{ $data->[4] };
         my @depends = map {
             my $d = $data->[3];
             $d =~ s/\$1/$_/g;
@@ -522,8 +496,8 @@ while (<SCRIPTS>) {
 
         # Interpreters used by preinst scripts must be in Pre-Depends.
         # Interpreters used by postinst or prerm scripts must be in Depends.
-        unless (defined ($data->[1]) and not $data->[1]) {
-            my $depends = Lintian::Relation->new($data->[1] || $base);
+        unless (not $data->[1]) {
+            my $depends = Lintian::Relation->new($data->[1]);
             if ($file eq 'preinst') {
                 unless ($info->relation('pre-depends')->implies($depends)) {
                     tag 'preinst-interpreter-without-predepends',
diff --git a/debian/changelog b/debian/changelog
index 8c2d78d..d3f3cd8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ lintian (2.5.8) UNRELEASED; urgency=low
       (Closes: #673106)
     + [NT] Demote certainty of hardening-no-stackprotector to
       wild-guess and move it to debian/extra-hardening profile.
+  * checks/scripts:
+    + [NT] Refactor the %versioned_interpreters into a new
+      data file.
   * checks/shared-libs:
     + [NT] Fix false positive "dev-pkg-without-shlib-symlink"
       for shared libraries using "libtool -release X.Y".
@@ -22,6 +25,9 @@ lintian (2.5.8) UNRELEASED; urgency=low
   * data/scripts/interpreters:
     + [NT] Add gbr3 and jython as known interpreters.
       (Closes: #669911, #671387)
+  * data/scripts/versioned-interpreters:
+    + [NT] New file.
+    + [NT] Added python2.7 to the list of known Python 2 interpreters.
   * data/spelling/corrections:
     + [RA] Remove corrections for "writeable" and "overwriteable".  These
       spellings are permitted by the OED in UK English.  (Closes: #673611)
diff --git a/vendors/debian/ftp-master-auto-reject/data/scripts/interpreters b/vendors/debian/ftp-master-auto-reject/data/scripts/interpreters
index 9f7b8e3..a6a3984 100644
--- a/vendors/debian/ftp-master-auto-reject/data/scripts/interpreters
+++ b/vendors/debian/ftp-master-auto-reject/data/scripts/interpreters
@@ -12,9 +12,10 @@
 # be the same as the interpreter itself (saves some typing).
 #
 # Do NOT list versioned interpreters here (such as pythonX.Y,
-# rubyX.Y, etc.).  They are handled separately.
+# rubyX.Y, etc.).  These are handled by the file
+# scripts/versioned-interpreters.
 #
-# Manually maintained list - please keep it sorted (by key)!
+# Manually maintained table - please keep it sorted (by key)!
 #
 
 ash            => /bin
diff --git a/vendors/debian/ftp-master-auto-reject/data/scripts/versioned-interpreters b/vendors/debian/ftp-master-auto-reject/data/scripts/versioned-interpreters
new file mode 100644
index 0000000..304f9c6
--- /dev/null
+++ b/vendors/debian/ftp-master-auto-reject/data/scripts/versioned-interpreters
@@ -0,0 +1,85 @@
+# Map interpreter to installation placement (and optionally
+# the dependency relation required to obtain the interpreter)
+#
+# Entries in this file are generally used for versioned interpreters,
+# but can also be used for unversioned ones (when there is no
+# definition in scripts/interpreters).
+# syntax:
+#   <interpreter> => <path>, <regex>, <dependency-template>, <version-list>[, <dependency-relation>]
+#
+# <interpreter> is the "unversioned base name" of the interpreter.  It is computed by
+# stripping any trailing dashes ("-"), digits ([0-9]) and dots (".").  As an example,
+# the unversioned base name for:
+#   python2.6 is python
+#   guile-1.6 is guile
+#
+# NB: If the <interpreter> is not listed in scripts/interpreters, the unversioned
+# ones are also looked up in this data file.  For cases where this is undesired,
+# please use @SKIP_UNVERSIONED@ (as described below).
+#
+# <path> is the path in which the interpreter is installed (usually /usr/bin).
+#
+# <regex> is a regex for matching the full name of the interpreter *and* extracting
+# the version of it.  It should have exactly one capture group, which captures the
+# version.  If the regex does not match the interpreter or does not capture a version
+# in the <version-list>, the entry is assumed not to apply to this interpreter.
+# NB: The regex will be achored and must match the /entire/ interpreter with version.
+#   (e.g. guile-([\d\.]*) is matched as m/^guile-([\d\.]*)$/)
+#
+# <dependency-template> is a dependency template that will generate the dependency
+# relation from a version.  The token "$1" is replaced with the version of the
+# interpreter.  The template cannot contain commas (and therefore can only contain
+# predicates or "OR" relations).
+#
+# <version-list> is a space-separated list of known interpreter versions.  It is used
+# both to generate the dependency relation for uses of the unversioned interpreter and
+# (together with <regex>) for ensuring the entry applies to the interpreter.
+#
+# If <dependency-relation> is left out, its value is assumed to
+# be the same as the interpreter itself (saves some typing).
+#
+# NB: <dependency-relation> can be one of the following magic values:
+#   * @NO_DEFAULT_DEPS@
+#     - The interpreter has no "unversioned" dependency package.  (See below)
+#   * @SKIP_UNVERSIONED@
+#     - Do not use this entry for unversioned interpreters.  The common usage case
+#       for this is when the interpreter is also listed in scripts/interpreters.
+#
+# When used on a versioned interpreter, Lintian will check for a dependency satisfying
+# the dependency generated by applying the version to the <dependency-template>.
+# Example:
+#   Interpreter pike7.6 and template "pike$1 | pike$1-core" will make Lintian check
+#   for the dependency:
+#      "pike7.6 | pike7.6-core"
+#
+# When used on an unversionde interpreter, Lintian will check for a dependency satisfying
+# ANY of the versioned dependencies that can be generated from applying the versions from
+# <version-list> to <dependency-template>.  Furthermore, also check for the dependency on
+# the <dependency-relation> (assuming it is not one of the magic values).
+# Example:
+#   Interpreter guile, template guile-$1, version list 1.6 1.8 and the dependency relation
+#   guile will make Lintian check for the dependency:
+#       "guile | guile-1.6 | guile-1.8"
+#
+#   If the dependency relation had been @NO_DEFAULT_DEPS@, then the dependency check would
+#   have been for:
+#       "guile-1.6 | guile-1.8"
+#
+# Manually maintained table - please keep it sorted (by key)!
+#
+
+
+guile   => /usr/bin, guile-([\d.]+), guile-$1, 1.6 1.8,
+jruby   => /usr/bin, jruby([\d.]+), jruby$1, 1.0 1.1 1.2
+lua     => /usr/bin, lua([\d.]+), lua$1, 40 50 5.1
+octave  => /usr/bin, octave([\d.]+), octave$1, 3.0 3.2
+php     => /usr/bin, php(\d+), php$1-cli, 5, @NO_DEFAULT_DEPS@
+pike    => /usr/bin, pike([\d.]+), pike$1 | pike$1-core, 7.6 7.8, @NO_DEFAULT_DEPS@
+python  => /usr/bin, python([\d.]+), python$1 | python$1-minimal, 2.4 2.5 2.6, @SKIP_UNVERSIONED@
+rackup  => /usr/bin, rackup([\d.]+), librack-ruby$1, 1.8 1.9, @NO_DEFAULT_DEPS@
+ruby    => /usr/bin, ruby([\d.]+), ruby$1, 1.8 1.9, @SKIP_UNVERSIONED@
+runghc  => /usr/bin, runghc(\d+), ghc$1, 6, ghc
+scsh    => /usr/bin, scsh-([\d.]+), scsh-$1, 0.6
+tclsh   => /usr/bin, tclsh([\d.]+), tcl$1, 8.3 8.4 8.5 8.6, tclsh | tcl
+wish    => /usr/bin, wish([\d.]+), tk$1, 8.3 8.4 8.5 8.6, wish | tk
+

-- 
Debian package checker


Reply to: