[Pkg-ocaml-maint-commits] r6361 - in /trunk/packages/edos-debcheck/trunk/debian/edos-future: Makefile upclose.ml

treinen at users.alioth.debian.org treinen at users.alioth.debian.org
Mon May 11 15:38:52 UTC 2009


Author: treinen
Date: Mon May 11 15:38:52 2009
New Revision: 6361

URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/?sc=1&rev=6361
Log:
printing stuff has to go into a dose library

Modified:
    trunk/packages/edos-debcheck/trunk/debian/edos-future/Makefile
    trunk/packages/edos-debcheck/trunk/debian/edos-future/upclose.ml

Modified: trunk/packages/edos-debcheck/trunk/debian/edos-future/Makefile
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/edos-debcheck/trunk/debian/edos-future/Makefile?rev=6361&op=diff
==============================================================================
--- trunk/packages/edos-debcheck/trunk/debian/edos-future/Makefile (original)
+++ trunk/packages/edos-debcheck/trunk/debian/edos-future/Makefile Mon May 11 15:38:52 2009
@@ -1,16 +1,28 @@
-OCAMLC=ocamlc
-OCAMLOPT=ocamlopt
-FLAVOUR=byte
+FLAVOUR=native
 MAIN=upclose
+PKG=dose2.progress,dose2.ocamldeb
 
 $(MAIN): $(MAIN).$(FLAVOUR)
 	ln -sf $(MAIN).$(FLAVOUR) $(MAIN)
 
-$(MAIN).byte: $(MAIN).ml
-	$(OCAMLC) -I /usr/local/lib/ocaml/3.10.2/dose2 -o $(MAIN).byte nums.cma unix.cma zip/zip.cma str.cma util.cma pcre/pcre.cma ocamldeb.cma io.cma progress.cma napkin.cma upclose.ml
+$(MAIN).cmo: $(MAIN).ml
+	ocamlfind ocamlc -package dose2 -c $(MAIN).ml
 
-$(MAIN).native: $(MAIN).ml
-	$(OCAMLOPT) -I /usr/local/lib/ocaml/3.10.2/dose2 -I +zip -o $(MAIN).native nums.cmxa unix.cmxa zip/zip.cmxa str.cmxa dose2/util.cmxa ocamldeb.cmxa io.cmxa napkin.cmxa upclose.ml
+$(MAIN).cmx: $(MAIN).ml
+	ocamlfind ocamlopt -package dose2 -c $(MAIN).ml
+
+$(MAIN).byte: $(MAIN).cmo
+	ocamlfind ocamlc -package $(PKG) -linkpkg $(MAIN).cmo \
+		 -o $(MAIN).byte
+
+$(MAIN).native: $(MAIN).cmx
+	ocamlfind ocamlopt -package $(PKG) -linkpkg $(MAIN).cmx \
+		 -o $(MAIN).native
+
+test: $(MAIN)
+	./$(MAIN) -i ../../../test/Packages.sid
 
 clean:
 	-rm -f *.{cmo,cmi,cmx,o} $(MAIN).{byte,native} $(MAIN)
+
+.phony: clean test

Modified: trunk/packages/edos-debcheck/trunk/debian/edos-future/upclose.ml
URL: http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/packages/edos-debcheck/trunk/debian/edos-future/upclose.ml?rev=6361&op=diff
==============================================================================
--- trunk/packages/edos-debcheck/trunk/debian/edos-future/upclose.ml (original)
+++ trunk/packages/edos-debcheck/trunk/debian/edos-future/upclose.ml Mon May 11 15:38:52 2009
@@ -22,39 +22,90 @@
 (* the data from the Packages file *)
 let packages = read_pool_file !inputfile Progress.dummy;;
 
-(* associates to package names the list of versions with which the package is *)
-(* mentioned in conflicts and depends relations. *)
-let versions = Hashtbl.create 10000;;
+(* associates to binary package names the (unique) available version *)
+let available_version = Hashtbl.create 30000;;
+
+(* asociates to source package names the list of all binary packages *)
+(* having that source.                                               *)
+let binary_packages = Hashtbl.create 30000;; 
+
+(* associates to package names the list of versions with which the   *)
+(* package is mentioned in Conflicts and Depends relations           *)
+let mentionend_versions = Hashtbl.create 10000;;
 
 (* c is a Napkin.versionend. Add it to the hashtable versions *)
-(* if it isn't already there.                                 *)
+(* if it isn't already there                                  *)
 let store_versionend = function
   | Glob_pattern _glob -> failwith "this cannot happen"
-  | Unit_version(package,versionend) -> match versionend with
+  | Unit_version(unit,versionend) -> match versionend with
 	Sel_ANY -> ()
       | Sel_LEQ version | Sel_GEQ version | Sel_EQ version | Sel_LT version
       | Sel_GT version ->
-	  try
-	    let oldversions = Hashtbl.find versions package
-	    in
-	      if not (List.mem version oldversions)
-	      then Hashtbl.replace versions package (version::oldversions)
-	  with
-	      Not_found -> Hashtbl.add versions package [version]
+	  let oldversions = Hashtbl.find mentionend_versions unit
+	  in
+	    if not (List.mem version oldversions)
+	    then Hashtbl.replace
+	      mentionend_versions unit (version::oldversions)
 ;;
 
+(* populate hashtables available_versions, binary_packages, and *)
+(* mentionend_versions.                                         *)
 List.iter
   (function p ->
-     List.iter store_versionend p.pk_conflicts;
-     List.iter (List.iter store_versionend) p.pk_depends)
-packages
+     let unit=p.pk_unit
+     and source=(fst p.pk_source)
+     in
+       if Hashtbl.mem available_version unit
+       then
+	 failwith ("Package "^unit^" occurs more than once.") 
+       else begin
+	 (* store version of binary package *)
+	 Hashtbl.add available_version unit p.pk_version;
+	 (* register binary package with its source *)
+	 Hashtbl.add binary_packages source unit;
+	 (* register versions of thet package in Conflicts *)
+	 List.iter store_versionend p.pk_conflicts;
+	 (* register versipns of that package in Depends *)
+	 List.iter (List.iter store_versionend) p.pk_depends;
+       end
+  )
+  packages
 ;;
 
+
+
+let print_string_sp s = (print_string s; print_char ' ')
+;;
+
+
+(*
+if 
+	    not (Hashtbl.mem available_version unit) ||
+	      (compare_versions
+		 (Hashtbl.find available_version unit)
+		 version) <=  0
+	  then
+	
+*)  
+
+(*
+Hashtbl.iter
+  (fun source binaries -> 
+     print_string source;
+     print_string ":";
+     print_string_sp binaries;
+     print_string "\n"
+  )
+  binary_packages
+*)
+
+(*
 Hashtbl.iter
   (fun package versionlist ->
      print_string package;
      print_string ": ";
-     List.iter print_string versionlist;
+     List.iter print_string_sp 
+       (List.sort compare_versions versionlist);
      print_newline())
-  versions
-
+  mentionend_versions
+*)




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