[Pkg-ocaml-maint-commits] r3328 - in /trunk/projects/ocaml-deblib: ChangeLog OMakefile deblib_822Lexer.ml deblib_822Parser.ml deblib_822Parser.mli deblib_Version.ml test.ml

mfurr at users.alioth.debian.org mfurr at users.alioth.debian.org
Mon Nov 6 21:16:00 CET 2006


Author: mfurr
Date: Mon Nov  6 21:16:00 2006
New Revision: 3328

URL: http://svn.debian.org/wsvn/?sc=1&rev=3328
Log:
Added support for ~ in package versions.  Added a ChangeLog and improved
OMakefile handling of .mly .mll targets.

Added:
    trunk/projects/ocaml-deblib/ChangeLog
Removed:
    trunk/projects/ocaml-deblib/deblib_822Lexer.ml
    trunk/projects/ocaml-deblib/deblib_822Parser.ml
    trunk/projects/ocaml-deblib/deblib_822Parser.mli
Modified:
    trunk/projects/ocaml-deblib/OMakefile
    trunk/projects/ocaml-deblib/deblib_Version.ml
    trunk/projects/ocaml-deblib/test.ml

Added: trunk/projects/ocaml-deblib/ChangeLog
URL: http://svn.debian.org/wsvn/trunk/projects/ocaml-deblib/ChangeLog?rev=3328&op=file
==============================================================================
--- trunk/projects/ocaml-deblib/ChangeLog (added)
+++ trunk/projects/ocaml-deblib/ChangeLog Mon Nov  6 21:16:00 2006
@@ -1,0 +1,4 @@
+2006-11-06 Mike Furr <mfurr at debian.org>
+
+	* Added Support for ~ in version numbers
+	* Updated OMakefile to properly handle generated files (.mll .mly targets)

Modified: trunk/projects/ocaml-deblib/OMakefile
URL: http://svn.debian.org/wsvn/trunk/projects/ocaml-deblib/OMakefile?rev=3328&op=diff
==============================================================================
--- trunk/projects/ocaml-deblib/OMakefile (original)
+++ trunk/projects/ocaml-deblib/OMakefile Mon Nov  6 21:16:00 2006
@@ -42,9 +42,11 @@
 
 OCamlProgram(test,test)
 
+LocalOCamlGeneratedFiles(deblib_822Parser.ml deblib_822Parser.mli deblib_822Lexer.ml)
+
 .DEFAULT: test
 
 .PHONY: clean
 clean:
-	rm -f *.o *.cm[aiox] *.cmxa *.a
-	rm -f *.omc .omakedb
+	rm -f $(filter-proper-targets $(ls R, .))
+	rm -f *.omc .omakedb *.annot

Modified: trunk/projects/ocaml-deblib/deblib_Version.ml
URL: http://svn.debian.org/wsvn/trunk/projects/ocaml-deblib/deblib_Version.ml?rev=3328&op=diff
==============================================================================
--- trunk/projects/ocaml-deblib/deblib_Version.ml (original)
+++ trunk/projects/ocaml-deblib/deblib_Version.ml Mon Nov  6 21:16:00 2006
@@ -17,10 +17,10 @@
 
 let err_int_expected s = raise (Malformed (sprintf "expecting an int: %s\n" s))
 
-let upstream_regexp = Str.regexp "^[0-9a-zA-Z.+:-]+$";;
+let upstream_regexp = Str.regexp "^[0-9a-zA-Z.+:~-]+$";;
 let check_upstream s = Str.string_match upstream_regexp s 0
   
-let debrev_regexp = Str.regexp "^\\(.*\\)-\\([0-9a-zA-Z.+]+\\)$";;
+let debrev_regexp = Str.regexp "^\\(.*\\)-\\([0-9a-zA-Z.+~]+\\)$";;
 let parse_debian epoch s = 
   if Str.string_match debrev_regexp s 0
   then 
@@ -66,18 +66,21 @@
   let chr_cmp c1 c2 = 
     match c1,c2 with
       | ('a'..'z'|'A'..'Z'),('a'..'z'|'A'..'Z') -> compare c1 c2
-      | ('+'|'-'|'.'|':'),('+'|'-'|'.'|':') -> compare c1 c2
+      | ('+'|'-'|'.'|':'|'~'),('+'|'-'|'.'|':'|'~') -> compare c1 c2
 	  (* letter comes before a symbol *)
-      | ('a'..'z'|'A'..'Z'),('+'|'-'|'.'|':') -> -1
-      | ('+'|'-'|'.'|':'),('a'..'z'|'A'..'Z') -> 1
+      | ('a'..'z'|'A'..'Z'),('+'|'-'|'.'|':'|'~') -> -1
+      | ('+'|'-'|'.'|':'|'~'),('a'..'z'|'A'..'Z') -> 1
       | _ -> assert false
   in
   let rec helper s1 s2 idx = 
     let l1 = String.length s1 in
     let l2 = String.length s2 in
       if (l1 <= idx) && (l2 <= idx) then 0
-      else if l1 <= idx then -1
-      else if l2 <= idx then 1
+      else if l1 <= idx then
+	(* ~ sorts before the empty string *)
+	if s2.[idx] = '~' then 1 else -1
+      else if l2 <= idx then 
+	if s1.[idx] = '~' then -1 else 1
       else 
 	let c = chr_cmp s1.[idx] s2.[idx] in
 	  if c <> 0 then c

Modified: trunk/projects/ocaml-deblib/test.ml
URL: http://svn.debian.org/wsvn/trunk/projects/ocaml-deblib/test.ml?rev=3328&op=diff
==============================================================================
--- trunk/projects/ocaml-deblib/test.ml (original)
+++ trunk/projects/ocaml-deblib/test.ml Mon Nov  6 21:16:00 2006
@@ -4,11 +4,11 @@
 
 
 
-let test_parser = 
+let test_parser () = 
   let ic = open_in "Sources" in
   let lexbuf = Lexing.from_channel ic in
   let lst = 
-    try Deblib_822Parser.main_822 Deblib_822Lexer.next lexbuf
+    try Deblib_822Parser.main Deblib_822Lexer.next lexbuf
     with Parsing.Parse_error ->
       let msg = sprintf "Parse error while parsing: Sources" in
 	raise (Failure msg)
@@ -21,9 +21,26 @@
 
 
 
+let tests = [|
+  "1.0~beta~svn123-1~unreleased.1";
+  "1.0~beta~svn123-1~unreleased.2";
+  "1.0~beta~svn123-1";
+  "1.0~beta~svn123-2";
+  "1.0~beta~svn124-1~unreleased.1";
+  "1.0~beta-1";
+  "1.0-1";
+  "1.0.svn130-1";
+  "1.1-1";
+|]
 
 let _ = 
-  let t1 = Deblib_Version.create "0:1.2-1" in
-  let t2 = Deblib_Version.create "1.2-1" in
-    fprintf stderr "version compare: %d\n" (Deblib_Version.compare t1 t2)
+  let t1 = Deblib_Version.create "0.9.0-7~pre1" in
+  let t2 = Deblib_Version.create "0.9.0-7" in
+  fprintf stderr "version compare: %d\n" (Deblib_Version.compare t1 t2);
 
+  for i = 0 to (Array.length tests) - 2 do
+    let t1 = Deblib_Version.create tests.(i) in
+    let t2 = Deblib_Version.create tests.(i+1) in
+      fprintf stderr "'%s' = '%s': %d\n" tests.(i) tests.(i+1) 
+	(Deblib_Version.compare t1 t2)
+  done




More information about the Pkg-ocaml-maint-commits mailing list