Author: rra
Date: 2006-08-20 03:14:01 +0200 (Sun, 20 Aug 2006)
New Revision: 724

Modified:
   trunk/checks/common_data.pm
   trunk/checks/fields
   trunk/checks/fields.desc
   trunk/debian/changelog
Log:
* checks/common_data.pm:
  + [RA] Add Python-Version as a known source and binary field.
  + [RA] Check the syntax of the new Python-Version field.

Modified: trunk/checks/common_data.pm
===================================================================
--- trunk/checks/common_data.pm 2006-08-19 15:05:05 UTC (rev 723)
+++ trunk/checks/common_data.pm 2006-08-20 01:14:01 UTC (rev 724)
@@ -65,13 +65,13 @@
     ('source', 'version', 'maintainer', 'binary', 'architecture',
      'standards-version', 'files', 'build-depends', 'build-depends-indep',
      'build-conflicts', 'build-conflicts-indep', 'format', 'origin',
-     'uploaders' );
+     'uploaders', 'python-version' );
 
 %known_binary_fields = map { $_ => 1 }
     ('package', 'version', 'architecture', 'depends', 'pre-depends',
      'recommends', 'suggests', 'enhances', 'conflicts', 'provides',
      'replaces', 'essential', 'maintainer', 'section', 'priority',
-     'source', 'description', 'installed-size');
+     'source', 'description', 'installed-size', 'python-version');
 
 %known_udeb_fields = map { $_ => 1 }
     ('package', 'version', 'architecture', 'subarchitecture', 'depends',

Modified: trunk/checks/fields
===================================================================
--- trunk/checks/fields 2006-08-19 15:05:05 UTC (rev 723)
+++ trunk/checks/fields 2006-08-20 01:14:01 UTC (rev 724)
@@ -710,6 +710,41 @@
        tag "redundant-bugs-field", "" if $bugs =~ 
m{^\s*debbugs://bugs.debian.org/?\s*$}i;
 }
 
+#----- Python-Version
+
+if (open(FH, "fields/python-version")) {
+       my $pyversion = <FH>;
+       close FH;
+
+       unfold('python-version', \$pyversion);
+
+       my @valid = ([ '\d+\.\d+', '\d+\.\d+' ],
+                    [ '\d+\.\d+' ],
+                    [ '\>=\s*\d+\.\d+', '\<\<\s*\d+\.\d+' ],
+                    [ '\>=\s*\d+\.\d+' ],
+                    [ 'current', '\>=\s*\d+\.\d+' ],
+                    [ 'current' ],
+                    [ 'all' ]);
+
+       my @pyversion = split(/\s*,\s*/, $pyversion);
+       if (@pyversion > 2) {
+               if (grep { !/^\d+\.\d+$/ } @pyversion) {
+                       tag "malformed-python-version", "$pyversion";
+               }
+       } else {
+               my $okay = 0;
+               for my $rule (@valid) {
+                       if ($pyversion[0] =~ /^$rule->[0]$/
+                           && (($pyversion[1] && $pyversion[1] =~ 
/^$rule->[1]$/)
+                                || (! $pyversion[1] && ! $rule->[1]))) {
+                               $okay = 1;
+                               last;
+                       }
+               }
+               tag "malformed-python-version", "$pyversion" unless $okay;
+       }
+}
+
 #----- Field checks (without checking the value)
 
 for my $field (glob("fields/*")) {

Modified: trunk/checks/fields.desc
===================================================================
--- trunk/checks/fields.desc    2006-08-19 15:05:05 UTC (rev 723)
+++ trunk/checks/fields.desc    2006-08-20 01:14:01 UTC (rev 724)
@@ -600,3 +600,19 @@
 Ref: 7.6
 Info: You depends on the build-essential package, which is only a meta-package
  depending on build tools that have to be installed in all build environments.
+
+Tag: malformed-python-version
+Type: error
+Ref: Python policy 2.3
+Info: The Python-Version control field is not in one of the valid
+ formats.  It should be in one of the following formats:
+ .
+     all
+     current
+     current, >= X.Y
+     >= X.Y
+     >= A.B, << X.Y
+     A.B, X.Y
+ .
+ (One or more specific versions may be listed with the last form.)  A.B
+ and X.Y should be Python versions.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2006-08-19 15:05:05 UTC (rev 723)
+++ trunk/debian/changelog      2006-08-20 01:14:01 UTC (rev 724)
@@ -7,6 +7,8 @@
   * checks/changelog-file{.desc,}:
     + [RA] Diagnose changelog files that are symlinks, using the new way
       the changelog-file collection script processes them.
+  * checks/common_data.pm:
+    + [RA] Add Python-Version as a known source and binary field.
   * checks/copyright-file:
     + [RA] Catch "<fill in http/ftp site>" as well as the string without
       "http/".  Thanks, Jari Aalto.  (Closes: #374167)
@@ -29,6 +31,7 @@
       from the clean target.  Thanks, James Westby.  (Closes: #380399)
     + [RA] Warn when encountering an aspell dictionary package that isn't
       arch: all.  Thanks, Piotr Engelking.  (Closes: #374899)
+    + [RA] Check the syntax of the new Python-Version field.
   * checks/files{.desc,}:
     + [RA] Provide a better explanation of why Debian packages shouldn't
       ship files in /srv.  (Closes: #379176)
@@ -102,7 +105,7 @@
     + [RA] Include the lintian version in HTML page footers.  Thanks,
       Thijs Kinkhorst.  (Closes: #377616)
 
- -- Russ Allbery <[EMAIL PROTECTED]>  Sat, 19 Aug 2006 08:04:53 -0700
+ -- Russ Allbery <[EMAIL PROTECTED]>  Sat, 19 Aug 2006 18:13:48 -0700
 
 lintian (1.23.22) unstable; urgency=low
 


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to