On Sat, Sep 9, 2006 at 18:52:40 +0200, Julien Cristau wrote: > Maybe something like the attached patch?
Sigh...
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 = @@ -344,7 +344,11 @@ let is_num c = c >= '0' && c <= '9' let char_map = - Array.init 256 (fun c -> if is_letter (Char.chr c) then c else c + 256) + Array.init 256 + (fun c -> + if Char.chr c = '~' then c - 256 else + if is_letter (Char.chr c) then c else + c + 256) let compare_ver_char c1 c2 = compare (char_map.(Char.code c1)) (char_map.(Char.code c2)) @@ -358,11 +362,16 @@ incr p1; incr p2 done; if !p1 = l1 then begin - if !p2 = l2 then 0 else -1 - end else if !p2 = l2 then - 1 - else - compare_ver_char s1.[!p1] s2.[!p2] + if !p2 = l2 then + 0 + else begin + if s2.[!p2] = '~' then 1 else -1 + end + end else + if !p2 = l2 then begin + if s1.[!p1] = '~' then -1 else 1 + end else + compare_ver_char s1.[!p1] s2.[!p2] let first_num s p l = let p = ref p in