tags 386646 patch
kthxbye

On Sat, Sep  9, 2006 at 04:57:56 +0200, Julien Cristau wrote:

> edos-debcheck doesn't seem to grok Version headers using "~":
> $ zcat debian/mirror/dists/testing/main/binary-sparc/Packages.gz | 
> edos-debcheck -explain -failures
> Warning: package disjunction not allowed in field 'Enhances'
> Warning: bad version 'upl102-35'        
> Warning: bad version 'upl102-35'        
> Warning: bad version '3.0~beta4-1'      
> Parsing package file...     400 packagesFatal error: exception Failure("Bad 
> version 3.0~beta4-1")
> 
> The regexp used to validate this field probably needs to be extended.
> 
Here is a patch which allows the tilde character in the upstream_version
and debian_revision fields of Version headers, so that debcheck is happy
with the current Debian archive.  This change will be made soon to the
Debian policy manual (see http://bugs.debian.org/382612 and
http://lists.debian.org/debian-devel-announce/2006/08/msg00006.html).

Cheers,
Julien
Index: deb.ml
===================================================================
--- deb.ml      (revision 1959)
+++ deb.ml      (working copy)
@@ -103,19 +103,19 @@
 let strict_version_re_1 =
   Str.regexp
   ("^\\(\\([0-9]+\\):\\)?" ^
-   "\\([0-9][A-Za-z0-9.:+-]*\\)" ^
-   "-\\([A-Za-z0-9.+]+\\)$")
+   "\\([0-9][A-Za-z0-9.:+~-]*\\)" ^
+   "-\\([A-Za-z0-9.+~]+\\)$")
 let strict_version_re_2 =
   Str.regexp
   ("^\\(\\([0-9]+\\):\\)?" ^
-   "\\([0-9][A-Za-z0-9.:+]*\\)\\( \\)?$")
+   "\\([0-9][A-Za-z0-9.:+~]*\\)\\( \\)?$")
 (* Some upstream version do not start with a digit *)
 let version_re_1 =
   Str.regexp
-  "^\\(\\([0-9]+\\):\\)?\\([A-Za-z0-9._:+-]+\\)-\\([A-Za-z0-9.+]+\\)$"
+  "^\\(\\([0-9]+\\):\\)?\\([A-Za-z0-9._:+~-]+\\)-\\([A-Za-z0-9.+~]+\\)$"
 let version_re_2 =
   Str.regexp
-  "^\\(\\([0-9]+\\):\\)?\\([A-Za-z0-9._:+]+\\)\\( \\)?$"
+  "^\\(\\([0-9]+\\):\\)?\\([A-Za-z0-9._:+~]+\\)\\( \\)?$"
 
 let split_version s =
   if not (Str.string_match strict_version_re_1 s 0 ||
@@ -144,7 +144,7 @@
     ("[ \t]+\\|\\(" ^
      String.concat "\\|"
        [","; "|"; "("; ")"; "<<"; "<="; "="; ">="; ">>"; "<"; ">";
-        "[A-Za-z0-9.:_+-]+"] ^
+        "[A-Za-z0-9.:_+~-]+"] ^
      "\\)")
 
 let rec next_token s p =

Reply via email to