New Upstream Release - cudf

Ready changes

Summary

Merged new upstream version: 0.10 (was: 0.9).

Diff

diff --git a/.gitignore b/.gitignore
index 6185d87..65b32f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
-_build/
-*.byte
-*.native
-cudf_822_parser.ml
-cudf_822_parser.mli
+/c-lib/_build
+/_opam/
+/_build/
+/cudf.install
diff --git a/.ocamlinit-cudf b/.ocamlinit-cudf
index 74609ed..834d304 100644
--- a/.ocamlinit-cudf
+++ b/.ocamlinit-cudf
@@ -1,8 +1,7 @@
 #use "topfind";;
 #require "extlib";;
 #require "oUnit";;
-#load "_build/cudf.cma";;
-#load "_build/tests.cmo";;
+#use_output "dune top";;
 open ExtLib;;
 
 open Cudf;;
@@ -11,10 +10,10 @@ open Cudf_parser;;
 open Cudf_printer;;
 open Cudf_types_pp;;
 
-let p = Cudf_parser.from_in_channel (open_in "tests/legacy.cudf")
+let p = Cudf_parser.from_in_channel (open_in "tests/data/legacy.cudf")
 
 let (pre, pkgs, req) as cudf_doc =
-  match Cudf_parser.parse_from_file "examples/legacy.cudf" with
+  match Cudf_parser.parse_from_file "tests/data/legacy.cudf" with
     | Some pre, pkgs, Some req -> pre, pkgs, req
     | _ -> assert false ;;
 let (univ, _) as cudf = Cudf.load_universe pkgs, req
diff --git a/BUGS b/BUGS
index 46c2578..848203e 100644
--- a/BUGS
+++ b/BUGS
@@ -1,3 +1,3 @@
 See issue tracker at:
 
-   https://gforge.inria.fr/tracker/?atid=13811&group_id=4385&func=browse
+   https://gitlab.com/irill/cudf/-/issues
diff --git a/ChangeLog b/ChangeLog
index 112ed0c..b1291f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-07-23  Kate Deplaix  <kit.ty.kate@disroot.org>
+	* ALL release 0.10
+	* Build: Add support for OCaml 5.0
+	* Build: Drop support for OCaml < 4.07
+	* Build: Switch from ocamlbuild & ocamlfind to dune to build the OCaml library
+	* testsuite: Switch from ounit to ounit2
+
 2017-03-21  Stefano Zacchiroli  <zack@upsilon.cc>
 	* ALL release 0.9
 	* Build: remove spurious dependencies on no longer used camlp4
diff --git a/META b/META
deleted file mode 100644
index 6ebf449..0000000
--- a/META
+++ /dev/null
@@ -1,5 +0,0 @@
-description = "CUDF library"
-version = "placeholder"
-archive(byte) = "cudf.cma"
-archive(native) = "cudf.cmxa"
-requires = "extlib"
diff --git a/Makefile b/Makefile
index edf24c4..a43ac9f 100644
--- a/Makefile
+++ b/Makefile
@@ -2,45 +2,25 @@ include Makefile.config
 
 NAME = cudf
 
-ifeq ("$(shell (ocamlc -config 2>/dev/null || ocamlopt -config) | fgrep os_type)","os_type: Win32")
-EXE=.exe
-OCAMLLIBDIR := $(shell cygpath $(OCAMLLIBDIR))
-else
-EXE=
-endif
-
-LIBS = _build/cudf.cma
-LIBS_OPT = _build/cudf.cmxa
-PROGS = _build/main_cudf_check _build/main_cudf_parse_822
-PROGS_BYTE = $(addsuffix .byte,$(PROGS))
-PROGS_OPT = $(addsuffix .native,$(PROGS))
 DOC = doc/cudf-check.1
-RESULTS = $(DOC) $(LIBS) $(PROGS_BYTE) _build/cudf_c.cmo
-RESULTS_OPT = $(DOC) $(LIBS_OPT) $(PROGS_OPT) _build/cudf_c.cmx
-SOURCES = $(wildcard *.ml *.mli *.mll *.mly)
+SOURCES = $(wildcard */*.ml */*.mli */*.mll */*.mly)
 C_LIB_DIR = c-lib
 C_LIB_SOURCES = $(wildcard $(C_LIB_DIR)/*.c $(C_LIB_DIR)/*.h)
 
-OCAMLBUILD = ocamlbuild
-OBFLAGS =
-OCAMLFIND = ocamlfind
-
 ifeq ($(DESTDIR),)
-INSTALL = $(OCAMLFIND) install
-UNINSTALL = $(OCAMLFIND) remove
+INSTALL = dune install
+UNINSTALL = dune uninstall
 else
 DESTDIR:=$(DESTDIR)/
-INSTALL = $(OCAMLFIND) install -destdir $(DESTDIR)$(OCAMLLIBDIR)
-UNINSTALL = $(OCAMLFIND) remove -destdir $(DESTDIR)$(OCAMLLIBDIR)
+INSTALL = dune install --destdir=$(DESTDIR)
+UNINSTALL = dune uninstall --destdir=$(DESTDIR)
 endif
 
 DIST_DIR = $(NAME)-$(VERSION)
 DIST_TARBALL = $(DIST_DIR).tar.gz
 
-all: $(RESULTS)
-opt: $(RESULTS_OPT)
-$(RESULTS): $(SOURCES)
-$(RESULTS_OPT): $(SOURCES)
+all: doc/cudf-check.1
+	dune build
 
 doc/cudf-check.1: doc/cudf-check.pod
 	$(MAKE) -C doc/
@@ -54,64 +34,32 @@ c-lib-opt:
 clean:
 	make -C $(C_LIB_DIR) clean
 	make -C doc/ clean
-	$(OCAMLBUILD) $(OBFLAGS) -clean
+	dune clean
 	rm -rf $(NAME)-*.gz $(NAME)_*.gz $(NAME)-*/
 
-_build/%:
-	$(OCAMLBUILD) $(OBFLAGS) $*
-	@touch $@
-
-# top-level: _build/cudf.cma _build/tests.cmo
-top-level: _build/cudf.cma
-	ledit ocaml -I ./_build/ -init ./.ocamlinit-cudf
+top-level:
+	ledit ocaml -init ./.ocamlinit-cudf
 
 headers: header.txt .headache.conf
 	headache -h header.txt -c .headache.conf $(SOURCES) $(C_LIB_SOURCES)
 
-test: test.byte
-	./$< -verbose
-	@echo
+test:
+	dune runtest
 c-lib-test:
 	make -C $(C_LIB_DIR) test
-test.byte: $(SOURCES)
-	ocamlbuild $@
 
 tags: TAGS
 TAGS: $(SOURCES)
 	otags $^
 
-INSTALL_STUFF = META
-INSTALL_STUFF += $(wildcard _build/*.cma _build/*.cmxa _build/cudf.a)
-INSTALL_STUFF += $(wildcard _build/cudf_*.cmi) $(wildcard _build/*.mli)
-INSTALL_STUFF += $(wildcard _build/cudf_*.cmx _build/cudf_*.o _build/cudf_*.a)
-INSTALL_STUFF += $(wildcard _build/cudf.o _build/cudf.cmx _build/cudf.cmi)
-
 install:
-	test -d $(DESTDIR)$(OCAMLLIBDIR) || mkdir -p $(DESTDIR)$(OCAMLLIBDIR)
-	$(INSTALL) -patch-version $(VERSION) $(NAME) $(INSTALL_STUFF)
-	test -d $(DESTDIR)$(BINDIR) || mkdir -p $(DESTDIR)$(BINDIR)
-	for p in $(notdir $(PROGS)) ; do \
-		tgt=`echo $$p | sed -e 's/^main.//' -e 's/_/-/g'`$(EXE) ; \
-		if [ -f _build/$$p.native ] ; then \
-			cp _build/$$p.native $(DESTDIR)$(BINDIR)/$$tgt ; \
-		else \
-			cp _build/$$p.byte $(DESTDIR)$(BINDIR)/$$tgt ; \
-		fi ; \
-		echo "Installed $(DESTDIR)$(BINDIR)/$$tgt" ; \
-	done
+	$(INSTALL)
 	if [ -f $(C_LIB_DIR)/cudf.o ] ; then \
 		$(MAKE) -C c-lib/ -e install ; \
 	fi
 
 uninstall:
-	$(UNINSTALL) $(NAME)
-	for p in $(notdir $(PROGS)) ; do \
-		tgt=`echo $$p | sed -e 's/^main.//' -e 's/_/-/g'`$(EXE) ; \
-		if [ -f $(DESTDIR)$(BINDIR)/$$tgt ] ; then \
-			rm $(DESTDIR)$(BINDIR)/$$tgt ; \
-		fi ; \
-		echo "Removed $(DESTDIR)$(BINDIR)/$$tgt" ; \
-	done
+	$(UNINSTALL)
 	-rmdir -p $(DESTDIR)$(OCAMLLIBDIR) $(DESTDIR)$(BINDIR)
 
 dist: ./$(DIST_TARBALL)
@@ -125,17 +73,16 @@ rpm: ./$(DIST_TARBALL)
 distcheck: ./$(DIST_TARBALL)
 	tar xzf $<
 	$(MAKE) -C ./$(DIST_DIR) all
-	if which ocamlopt > /dev/null ; then $(MAKE) -C ./$(DIST_DIR) opt ; fi
 	$(MAKE) -C ./$(DIST_DIR) test
 	$(MAKE) -C ./$(DIST_DIR)/$(C_LIB_DIR)/ all
 	$(MAKE) -C ./$(DIST_DIR) install DESTDIR=$(CURDIR)/$(DIST_DIR)/tmp
 	rm -rf ./$(DIST_DIR)
 
 doc:
-	$(OCAMLBUILD) $(OBFLAGS) cudf.docdir/index.html
+	dune build @doc
 
-world: all opt c-lib c-lib-opt doc
+world: all c-lib c-lib-opt doc
 
-.PHONY: all opt world clean top-level headers test tags install uninstall
+.PHONY: all world clean top-level headers test tags install uninstall
 .PHONY: dep rpm c-lib c-lib-opt dist doc
 .NOTPARALLEL:
diff --git a/Makefile.config b/Makefile.config
index 86fa0e1..dc58e73 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -1,4 +1,4 @@
-VERSION = 0.9
+VERSION = 0.10
 
 export DESTDIR =
 
diff --git a/README b/README
index ba811e5..4990963 100644
--- a/README
+++ b/README
@@ -1,10 +1,9 @@
 libCUDF - CUDF (Common Upgradeability Description Format) library
 =================================================================
 
-libCUDF is a library to manipulate so called CUDF documents. A CUDF
-(Common Upgradeability Description Format) document describes an
-"upgrade scenario", as faced by package managers in popular
-package-based FOSS (Free and Open Source Software) distributions.
+libCUDF is a reference implementation of CUDF (Common Upgradeability
+Description Format), a document format to describe package upgrade scenarios,
+in a package manager agnostic way.  distributions.
 
 A CUDF document consists of an optional leading "preamble", a "package
 universe", and a trailing "user request":
@@ -30,25 +29,24 @@ libCUDF enables manipulation of CUDF and related documents.
 Development
 -----------
 
-Development happens on the INRIA Forge, in the [cudf project][1]. There you can
-find:
+Development happens on GitLab, in the [CUDF project][1]. There you can find:
 
 * [releases][4]
 * [Git repository][5]
 * [bug reports][6]
 
-[1]: https://gforge.inria.fr/projects/cudf/
-[4]: https://gforge.inria.fr/frs/?group_id=4385
-[5]: https://gforge.inria.fr/scm/?group_id=4385
-[6]: https://gforge.inria.fr/tracker/?group_id=4385
+[1]: https://gitlab.com/irill/cudf
+[4]: https://gitlab.com/irill/cudf/-/tags
+[5]: https://gitlab.com/irill/cudf/-/tree/master
+[6]: https://gitlab.com/irill/cudf/-/issues
 
-Please report bugs using the forge [bug tracker][6] rather than mailing me
-directly.
+Please report bugs using the [bug tracker][6].
+Patches are welcome!, just submit a merge request on GitLab.
 
 If you're in a hurry and just want to get the latest version of the code, here
 is the command you're looking for:
 
-    $ git clone https://gforge.inria.fr/git/cudf/cudf.git
+    $ git clone https://gitlab.com/irill/cudf/
 
 
 Reference
@@ -62,4 +60,3 @@ libCUDF implements the Common Upgradeability Description Format (CUDF)
 
 
  -- Stefano Zacchiroli <zack@upsilon.cc>  Sun, 14 Oct 2012 16:28:32 +0100
-
diff --git a/TODO b/TODO
deleted file mode 100644
index 46c2578..0000000
--- a/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-See issue tracker at:
-
-   https://gforge.inria.fr/tracker/?atid=13811&group_id=4385&func=browse
diff --git a/_tags b/_tags
deleted file mode 100644
index c03c0dd..0000000
--- a/_tags
+++ /dev/null
@@ -1,9 +0,0 @@
-<test.ml> or <tests.ml> : pkg_oUnit
-<test.byte> or <test.native> : pkg_oUnit
-
-<*.ml> or <*.mli> : pkg_extlib
-<*.byte> or <*.native> : pkg_extlib
-
-
-<c-lib/*>: not_hygienic
-<java-lib/*>: not_hygienic
diff --git a/bin/dune b/bin/dune
new file mode 100644
index 0000000..86ba70e
--- /dev/null
+++ b/bin/dune
@@ -0,0 +1,11 @@
+(executable
+ (public_name cudf-check)
+ (name main_cudf_check)
+ (modules main_cudf_check)
+ (libraries cudf))
+
+(executable
+ (public_name cudf-parse-822)
+ (name main_cudf_parse_822)
+ (modules main_cudf_parse_822)
+ (libraries cudf))
diff --git a/main_cudf_check.ml b/bin/main_cudf_check.ml
similarity index 97%
rename from main_cudf_check.ml
rename to bin/main_cudf_check.ml
index 0f3c5f9..1f4bf3b 100644
--- a/main_cudf_check.ml
+++ b/bin/main_cudf_check.ml
@@ -13,7 +13,6 @@
 open ExtLib
 open Printf
 
-open Cudf
 open Cudf_checker
 
 let cudf_arg = ref ""
@@ -71,14 +70,14 @@ let print_sol_info inst sol =
         false
 
 let pp_loc (start_pos, end_pos) =
-  let line { Lexing.pos_lnum = l } = l in
+  let line { Lexing.pos_lnum = l; _ } = l in
   if line start_pos = line end_pos
   then sprintf "line: %d" (line start_pos)
   else sprintf "lines: %d-%d" (line start_pos) (line end_pos)
 
 let main () =
   let load_univ p = 
-    let pre,univ,req = Cudf_parser.load p in
+    let _pre,univ,_req = Cudf_parser.load p in
     univ
   in
   let fail_parse source msg loc =
@@ -92,7 +91,7 @@ let main () =
       let p = Cudf_parser.from_in_channel (open_in !cudf_arg) in
       eprintf "loading CUDF ...\n%!";
       (match Cudf_parser.load p with
-	 | pre, univ, None ->
+	 | _pre, _univ, None ->
              eprintf "Error: missing request description item.\n%!";
 	     exit (-1)
 	 | pre, univ, Some req -> cudf := Some (pre, univ, req))
diff --git a/main_cudf_parse_822.ml b/bin/main_cudf_parse_822.ml
similarity index 97%
rename from main_cudf_parse_822.ml
rename to bin/main_cudf_parse_822.ml
index ac7f5c5..51f7b7f 100644
--- a/main_cudf_parse_822.ml
+++ b/bin/main_cudf_parse_822.ml
@@ -43,7 +43,7 @@ let main () =
   try
     let stanzas = Cudf_822_parser.doc_822 Cudf_822_lexer.token_822 lexbuf in
     pp_822 stanzas
-  with Parse_error_822 (msg, (startpos, endpos)) ->
+  with Parse_error_822 (_msg, (startpos, endpos)) ->
     failwith (sprintf "Parse error on file %s:%s--%s" !file_arg
 		(pp_lpos startpos) (pp_lpos endpos))
 
diff --git a/c-lib/Makefile b/c-lib/Makefile
index e7bd1a3..cc9301e 100644
--- a/c-lib/Makefile
+++ b/c-lib/Makefile
@@ -26,13 +26,15 @@ libcudf-opt.a: cudf-caml-opt.o cudf.o
 	cp $(OCAML_LIBDIR)/libasmrun.a $@
 	ar r $@ $^
 
-../_build/%:
-	cd .. && ocamlbuild $*
+cudf_c.cmo: cudf_c.ml
+	$(OCAMLC) -linkpkg -I ../_build/install/default/lib/cudf/ ../_build/install/default/lib/cudf/cudf.cma $^
+cudf_c.cmx: cudf_c.ml
+	$(OCAMLOPT) -linkpkg -I ../_build/install/default/lib/cudf/ ../_build/install/default/lib/cudf/cudf.cmxa $^
 
-cudf-caml.o: ../_build/cudf.cma ../_build/cudf_c.cmo
-	$(OCAMLC) -linkpkg -output-obj -o $@ $^
-cudf-caml-opt.o: ../_build/cudf.cmxa ../_build/cudf_c.cmx
-	$(OCAMLOPT) -linkpkg -output-obj -o $@ $^
+cudf-caml.o: cudf_c.cmo
+	$(OCAMLC) -linkpkg -output-obj -o $@ ../_build/install/default/lib/cudf/cudf.cma $^
+cudf-caml-opt.o: cudf_c.cmx
+	$(OCAMLOPT) -linkpkg -output-obj -o $@ ../_build/install/default/lib/cudf/cudf.cmxa $^
 
 cudf.o: cudf.c cudf.h cudf-variants.h
 
@@ -45,8 +47,8 @@ c-test-opt: c-test.o libcudf-opt.a
 	$(CC) $(PROG_CFLAGS) -o $@ $(INCLUDES) $(CUDF_LDFLAGS) $< \
 		$(subst -lcudf,-lcudf-opt,$(CUDF_CLIBS))
 
-test: ../tests/legacy.cudf ../tests/legacy-sol.cudf c-test
-	./c-test ../tests/legacy.cudf ../tests/legacy-sol.cudf > /dev/null
+test: ../tests/data/legacy.cudf ../tests/data/legacy-sol.cudf c-test
+	./c-test ../tests/data/legacy.cudf ../tests/data/legacy-sol.cudf > /dev/null
 
 cudf.pc: cudf.pc.in
 	cat $< | sed -e "s,@OCAMLLIBDIR@,$(OCAMLLIBDIR),g" \
diff --git a/c-lib/caml_hash_variant.c b/c-lib/caml_hash_variant.c
index 854a457..e06f5a3 100644
--- a/c-lib/caml_hash_variant.c
+++ b/c-lib/caml_hash_variant.c
@@ -10,6 +10,8 @@
 /*  library, see the COPYING file for more information.                      */
 /*****************************************************************************/
 
+#define CAML_NAME_SPACE
+
 #include <caml/mlvalues.h>
 #include <stdio.h>
 
diff --git a/c-lib/cudf.c b/c-lib/cudf.c
index af9fe0e..fa688b8 100644
--- a/c-lib/cudf.c
+++ b/c-lib/cudf.c
@@ -17,6 +17,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#define CAML_NAME_SPACE
+
 #include <caml/alloc.h>
 #include <caml/callback.h>
 #include <caml/memory.h>
diff --git a/cudf_c.ml b/c-lib/cudf_c.ml
similarity index 100%
rename from cudf_c.ml
rename to c-lib/cudf_c.ml
diff --git a/cudf.mllib b/cudf.mllib
deleted file mode 100644
index f3e5a30..0000000
--- a/cudf.mllib
+++ /dev/null
@@ -1,11 +0,0 @@
-Cudf_types
-Cudf_conf
-Cudf_822_parser
-Cudf_type_parser
-Cudf_types_pp
-Cudf_822_lexer
-Cudf_type_lexer
-Cudf
-Cudf_parser
-Cudf_checker
-Cudf_printer
diff --git a/cudf.odocl b/cudf.odocl
deleted file mode 100644
index 9e1d828..0000000
--- a/cudf.odocl
+++ /dev/null
@@ -1,7 +0,0 @@
-Cudf_types
-Cudf_conf
-Cudf_types_pp
-Cudf
-Cudf_parser
-Cudf_checker
-Cudf_printer
diff --git a/cudf.opam b/cudf.opam
new file mode 100644
index 0000000..b4f9746
--- /dev/null
+++ b/cudf.opam
@@ -0,0 +1,26 @@
+opam-version: "2.0"
+version: "0.10"
+license: "LGPL-3.0-or-later WITH OCaml-LGPL-linking-exception"
+maintainer: "roberto@dicosmo.org"
+authors: [
+  "Roberto di Cosmo <roberto@dicosmo.org>"
+  "Stefano Zacchiroli"
+  "Pietro Abate"
+]
+homepage: "http://www.mancoosi.org/cudf/"
+bug-reports: "https://gitlab.com/irill/cudf/-/issues"
+dev-repo: "git+https://gitlab.com/irill/cudf.git"
+build: ["dune" "build" "-p" name "-j" jobs]
+run-test: ["dune" "runtest" "-p" name "-j" jobs]
+depends: [
+  "ocaml" {>= "4.07"}
+  "dune" {>= "2.0"}
+  ("extlib" | "extlib-compat")
+  "ounit2" {with-test & >= "2.0.0"}
+  "odoc" {with-doc}
+]
+synopsis: "CUDF library (part of the Mancoosi tools)"
+description: """
+CUDF (for Common Upgradeability Description Format) is a format for
+describing upgrade scenarios in package-based Free and Open Source
+Software distribution."""
diff --git a/debian/changelog b/debian/changelog
index 9b093a2..190d0ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+cudf (0.10-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk>  Mon, 27 Feb 2023 06:06:53 -0000
+
 cudf (0.9-2) unstable; urgency=medium
 
   * debian/watch:
diff --git a/dune b/dune
new file mode 100644
index 0000000..c70173e
--- /dev/null
+++ b/dune
@@ -0,0 +1 @@
+(dirs :standard \ c-lib doc)
diff --git a/dune-project b/dune-project
new file mode 100644
index 0000000..ffc8981
--- /dev/null
+++ b/dune-project
@@ -0,0 +1,5 @@
+(lang dune 2.0)
+(name cudf)
+(version 0.10)
+
+(formatting disabled)
diff --git a/examples/_tags b/examples/_tags
deleted file mode 100644
index 1ad41a0..0000000
--- a/examples/_tags
+++ /dev/null
@@ -1 +0,0 @@
-<*.byte> or <*.native> : pkg_cudf
diff --git a/examples/cudf-sort.ml b/examples/cudf_sort.ml
similarity index 72%
rename from examples/cudf-sort.ml
rename to examples/cudf_sort.ml
index 3b83ff0..9294d90 100644
--- a/examples/cudf-sort.ml
+++ b/examples/cudf_sort.ml
@@ -15,18 +15,28 @@
 open Cudf
 
 let pkg_compare p1 p2 =
-  Pervasives.compare (p1.package, p1.version) (p2.package, p2.version)
+  Stdlib.compare (p1.package, p1.version) (p2.package, p2.version)
+
+let string_of_packages pkgs =
+  let o = IO.output_string () in
+  Cudf_printer.pp_io_packages o pkgs;
+  IO.close_out o
+
+let string_of_doc doc =
+  let o = IO.output_string () in
+  Cudf_printer.pp_io_doc o doc;
+  IO.close_out o
 
 let main () =
   let ic = open_in Sys.argv.(1) in
   let p = Cudf_parser.from_in_channel ic in
-  let pkgs, req = Cudf_parser.parse p in
+  let pre, pkgs, req = Cudf_parser.parse p in
   let pkgs' = List.fast_sort pkg_compare pkgs in
   let s =
     match req with
-      | None -> Cudf_printer.string_of_packages pkgs'
-      | Some req -> Cudf_printer.string_of_doc (pkgs', req)
+      | None -> string_of_packages pkgs'
+      | Some req -> string_of_doc (pre, pkgs', req)
   in
     print_endline s
 
-let _ = main ()
+let () = main ()
diff --git a/examples/dune b/examples/dune
new file mode 100644
index 0000000..5b196d4
--- /dev/null
+++ b/examples/dune
@@ -0,0 +1,3 @@
+(executables
+ (names cudf_sort)
+ (libraries cudf))
diff --git a/cudf.ml b/lib/cudf.ml
similarity index 97%
rename from cudf.ml
rename to lib/cudf.ml
index d82359d..ad509f9 100644
--- a/cudf.ml
+++ b/lib/cudf.ml
@@ -73,10 +73,10 @@ let (=%) pkg1 pkg2 =
   pkg1.package = pkg2.package && pkg1.version = pkg2.version
 
 let (<%) pkg1 pkg2 =
-  Pervasives.compare (pkg1.package, pkg1.version) (pkg2.package, pkg2.version)
+  Stdlib.compare (pkg1.package, pkg1.version) (pkg2.package, pkg2.version)
 
 let (>%) pkg1 pkg2 =
-  Pervasives.compare (pkg2.package, pkg2.version) (pkg1.package, pkg1.version)
+  Stdlib.compare (pkg2.package, pkg2.version) (pkg1.package, pkg1.version)
 
 let default_preamble = {
   preamble_id = "" ;
@@ -238,7 +238,7 @@ let status univ =
   let univ' = empty_universe () in
   Hashtbl.iter
     (fun id pkg -> match pkg with
-    | { installed = true } ->
+    | { installed = true; _ } ->
       Hashtbl.add univ'.id2pkg id pkg;
       add_to_hash_list univ'.name2pkgs pkg.package pkg;
       expand_features pkg univ'.features
@@ -255,7 +255,7 @@ let lookup_packages ?(filter=None) univ pkgname =
       | Some _ as pred -> List.filter (fun p -> p.version |= pred) packages
 
 let get_installed univ pkgname =
-  List.filter (fun { installed = i } -> i) (lookup_packages univ pkgname)
+  List.filter (fun { installed = i; _ } -> i) (lookup_packages univ pkgname)
 
 let mem_installed ?(include_features = true) ?(ignore = fun _ -> false)
     univ (name, constr) =
diff --git a/cudf.mli b/lib/cudf.mli
similarity index 98%
rename from cudf.mli
rename to lib/cudf.mli
index 93fee10..899c4e7 100644
--- a/cudf.mli
+++ b/lib/cudf.mli
@@ -63,9 +63,14 @@ type preamble = {
   req_checksum: string ;	(** request checksum *)
 }
 
-val default_preamble : preamble	(** implement preamble defaults *)
-val default_package : package	(** implement package defaults *)
-val default_request : request	(** implement request defaults *)
+val default_preamble : preamble
+(** implement preamble defaults *)
+
+val default_package : package
+(** implement package defaults *)
+
+val default_request : request
+(** implement request defaults *)
 
 (** {6 Syntactic CUDF representation} *)
 
diff --git a/cudf_822_lexer.mll b/lib/cudf_822_lexer.mll
similarity index 98%
rename from cudf_822_lexer.mll
rename to lib/cudf_822_lexer.mll
index dd92ac3..105896d 100644
--- a/cudf_822_lexer.mll
+++ b/lib/cudf_822_lexer.mll
@@ -17,7 +17,7 @@
   open Cudf_822_parser
 
   let get_range { Lexing.lex_start_p = start_pos;
-		  Lexing.lex_curr_p = end_pos } =
+		  Lexing.lex_curr_p = end_pos; _ } =
     (start_pos, end_pos)
 
   (* Lexing.new_line is only available in OCaml 3.11 or greater *)
diff --git a/cudf_822_parser.mly b/lib/cudf_822_parser.mly
similarity index 100%
rename from cudf_822_parser.mly
rename to lib/cudf_822_parser.mly
diff --git a/cudf_checker.ml b/lib/cudf_checker.ml
similarity index 100%
rename from cudf_checker.ml
rename to lib/cudf_checker.ml
diff --git a/cudf_checker.mli b/lib/cudf_checker.mli
similarity index 100%
rename from cudf_checker.mli
rename to lib/cudf_checker.mli
diff --git a/cudf_conf.ml b/lib/cudf_conf.ml
similarity index 100%
rename from cudf_conf.ml
rename to lib/cudf_conf.ml
diff --git a/cudf_conf.mli b/lib/cudf_conf.mli
similarity index 100%
rename from cudf_conf.mli
rename to lib/cudf_conf.mli
diff --git a/cudf_parser.ml b/lib/cudf_parser.ml
similarity index 97%
rename from cudf_parser.ml
rename to lib/cudf_parser.ml
index 5b4e966..2ac128b 100644
--- a/cudf_parser.ml
+++ b/lib/cudf_parser.ml
@@ -81,7 +81,7 @@ let loc_lookuper locs =
 let type_check_stanza ?locs stanza types =
   let lookup_loc =
     match locs with
-      | None -> (fun p -> dummy_loc)
+      | None -> (fun _p -> dummy_loc)
       | Some locs -> loc_lookuper locs in
   let typed_stanza =
     List.map
@@ -103,7 +103,7 @@ let type_check_stanza ?locs stanza types =
 	match value_of_typedecl ty1, List.mem_assoc name typed_stanza with
 	  | None, true -> defaults, missing             (* mandatory, present *)
 	  | None, false -> defaults, (name :: missing)  (* mandatory, missing *)
-	  | Some v, true -> defaults, missing           (* optional,  present *)
+	  | Some _v, true -> defaults, missing          (* optional,  present *)
 	  | Some v, false ->                            (* optional,  missing *)
 	    (name, v) :: defaults, missing)
       ([], []) types
@@ -211,8 +211,8 @@ let parse p =
   let pre, pkgs, req = ref None, ref [], ref None in
   let rec aux_pkg () =
     match parse_item' p with
-      | locs, `Package pkg -> pkgs := pkg :: !pkgs ; aux_pkg ()
-      | locs, `Request req' -> req := Some req'	(* stop recursion after req *)
+      | _locs, `Package pkg -> pkgs := pkg :: !pkgs ; aux_pkg ()
+      | _locs, `Request req' -> req := Some req'	(* stop recursion after req *)
       | locs, `Preamble pre ->
 	  parse_error (loc_lookuper locs pre.preamble_id) "late preamble"
   in
diff --git a/cudf_parser.mli b/lib/cudf_parser.mli
similarity index 100%
rename from cudf_parser.mli
rename to lib/cudf_parser.mli
diff --git a/cudf_printer.ml b/lib/cudf_printer.ml
similarity index 100%
rename from cudf_printer.ml
rename to lib/cudf_printer.ml
diff --git a/cudf_printer.mli b/lib/cudf_printer.mli
similarity index 100%
rename from cudf_printer.mli
rename to lib/cudf_printer.mli
diff --git a/cudf_type_lexer.mll b/lib/cudf_type_lexer.mll
similarity index 100%
rename from cudf_type_lexer.mll
rename to lib/cudf_type_lexer.mll
diff --git a/cudf_type_parser.mly b/lib/cudf_type_parser.mly
similarity index 100%
rename from cudf_type_parser.mly
rename to lib/cudf_type_parser.mly
diff --git a/cudf_types.ml b/lib/cudf_types.ml
similarity index 94%
rename from cudf_types.ml
rename to lib/cudf_types.ml
index 03323cf..f0c0f1b 100644
--- a/cudf_types.ml
+++ b/lib/cudf_types.ml
@@ -11,7 +11,6 @@
 (*****************************************************************************)
 
 open ExtLib
-open Printf
 
 type version = int
 type relop = [`Eq|`Neq|`Geq|`Gt|`Leq|`Lt]
@@ -128,20 +127,20 @@ let value_of_typedecl = function
   | _ -> None
 
 let type_of_value = function
-  | `Int n -> `Int
-  | `Posint n -> `Posint
-  | `Nat n -> `Nat
-  | `Bool b -> `Bool
-  | `String s -> `String
-  | `Pkgname s -> `Pkgname
-  | `Ident s -> `Ident
-  | `Enum (enums, s) -> `Enum enums
-  | `Vpkg p -> `Vpkg
-  | `Vpkgformula f -> `Vpkgformula
-  | `Vpkglist l -> `Vpkglist
-  | `Veqpkg p -> `Veqpkg
-  | `Veqpkglist l -> `Veqpkglist
-  | `Typedecl l -> `Typedecl
+  | `Int _n -> `Int
+  | `Posint _n -> `Posint
+  | `Nat _n -> `Nat
+  | `Bool _b -> `Bool
+  | `String _s -> `String
+  | `Pkgname _s -> `Pkgname
+  | `Ident _s -> `Ident
+  | `Enum (enums, _s) -> `Enum enums
+  | `Vpkg _p -> `Vpkg
+  | `Vpkgformula _f -> `Vpkgformula
+  | `Vpkglist _l -> `Vpkglist
+  | `Veqpkg _p -> `Veqpkg
+  | `Veqpkglist _l -> `Veqpkglist
+  | `Typedecl _l -> `Typedecl
 
 let rec cast typ v =
   let type_error () = raise (Type_error (typ, v, dummy_loc)) in
@@ -192,7 +191,7 @@ let rec cast typ v =
     | typ, v when type_of_value v = typ -> v	(* identity cast *)
     | _ -> type_error ()
 
-let rec is_eq_formula f =
+let is_eq_formula f =
   not (List.exists
 	 (fun vpkgs ->
 	    List.exists
diff --git a/cudf_types.mli b/lib/cudf_types.mli
similarity index 100%
rename from cudf_types.mli
rename to lib/cudf_types.mli
diff --git a/cudf_types_pp.ml b/lib/cudf_types_pp.ml
similarity index 96%
rename from cudf_types_pp.ml
rename to lib/cudf_types_pp.ml
index d0f0b05..07a2ac9 100644
--- a/cudf_types_pp.ml
+++ b/lib/cudf_types_pp.ml
@@ -22,7 +22,7 @@ let lexbuf_wrapper type_parser typ =
   fun s ->
     try
       type_parser Cudf_type_lexer.token_cudf (Lexing.from_string s)
-    with Cudf_types.Syntax_error (_msg, loc) ->
+    with Cudf_types.Syntax_error (_msg, _loc) ->
       raise (Type_error (typ, `String s))
 
 let lexbuf_wrapper' type_parser =
@@ -89,7 +89,7 @@ let parse_value ty s =
     | `Nat -> `Nat (parse_nat s)
     | `Bool -> `Bool (parse_bool s)
     | `String -> `String (parse_string s)
-    | `Enum l -> `Enum (l, parse_enum l s)
+    | `Enum l -> `Enum (l, parse_enum ~enums:l s)
     | `Pkgname -> `Pkgname (parse_pkgname s)
     | `Ident -> `Ident (parse_ident s)
     | `Vpkg -> `Vpkg (parse_vpkg s)
@@ -101,10 +101,10 @@ let parse_value ty s =
 
 (** Pretty printers *)
 
-let string_of_int = Pervasives.string_of_int
+let string_of_int = Stdlib.string_of_int
 let string_of_posint = string_of_int
 let string_of_nat = string_of_int
-let string_of_bool = Pervasives.string_of_bool
+let string_of_bool = Stdlib.string_of_bool
 
 let string_of_keep = function
     `Keep_version -> "version"
@@ -147,7 +147,7 @@ let string_of_list string_of_item sep l =
 let string_of_vpkglist = string_of_list string_of_vpkg " , "
 
 (** ASSUMPTION: formula is in CNF *)
-let rec string_of_vpkgformula = function
+let string_of_vpkgformula = function
   | [] -> "true!"
   | [ [] ] -> "false!"
   | [] :: _ ->
diff --git a/cudf_types_pp.mli b/lib/cudf_types_pp.mli
similarity index 100%
rename from cudf_types_pp.mli
rename to lib/cudf_types_pp.mli
diff --git a/lib/dune b/lib/dune
new file mode 100644
index 0000000..e3749be
--- /dev/null
+++ b/lib/dune
@@ -0,0 +1,7 @@
+(library
+ (public_name cudf)
+ (wrapped false)
+ (libraries extlib))
+
+(ocamllex cudf_822_lexer cudf_type_lexer)
+(ocamlyacc cudf_822_parser cudf_type_parser)
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
deleted file mode 100644
index cb394f5..0000000
--- a/myocamlbuild.ml
+++ /dev/null
@@ -1,86 +0,0 @@
-(*****************************************************************************)
-(*  libCUDF - CUDF (Common Upgrade Description Format) manipulation library  *)
-(*  Copyright (C) 2009-2012  Stefano Zacchiroli <zack@upsilon.cc>            *)
-(*                                                                           *)
-(*  This library is free software: you can redistribute it and/or modify     *)
-(*  it under the terms of the GNU Lesser General Public License as           *)
-(*  published by the Free Software Foundation, either version 3 of the       *)
-(*  License, or (at your option) any later version.  A special linking       *)
-(*  exception to the GNU Lesser General Public License applies to this       *)
-(*  library, see the COPYING file for more information.                      *)
-(*****************************************************************************)
-
-open Ocamlbuild_plugin
-
-(* these functions are not really officially exported *)
-let run_and_read = Ocamlbuild_pack.My_unix.run_and_read
-let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings
-
-let split s ch =
-  let x = ref [] in
-  let rec go s =
-    let pos = String.index s ch in
-    x := (String.before s pos)::!x;
-    go (String.after s (pos + 1))
-  in
-  try
-    go s
-  with Not_found -> !x
-
-let split_nl s = split s '\n'
-
-let before_space s =
-  try
-    String.before s (String.index s ' ')
-  with Not_found -> s
-
-(* this lists all supported packages *)
-let find_packages () =
-  List.map before_space (split_nl & run_and_read "ocamlfind list")
-
-(* ocamlfind command *)
-let ocamlfind x = S[A"ocamlfind"; x]
-
-let _ = dispatch begin function
-   | Before_options ->
-       (* by using Before_options one let command line options have an
-	  higher priority on the contrary using After_options will
-	  guarantee to have the higher priority *)
-
-       (* override default commands by ocamlfind ones *)
-       Options.ocamlc     := ocamlfind & A"ocamlc";
-       Options.ocamlopt   := ocamlfind & A"ocamlopt";
-       Options.ocamldep   := ocamlfind & A"ocamldep";
-       Options.ocamldoc   := ocamlfind & A"ocamldoc";
-       Options.ocamlmktop := ocamlfind & A"ocamlmktop"
-
-   | After_rules ->
-
-       (* When one link an OCaml library/binary/package, one should
-	  use -linkpkg *)
-       flag ["ocaml"; "link"] & A"-linkpkg";
-
-       (* For each ocamlfind package one inject the -package option
-       	  when compiling, computing dependencies, generating
-       	  documentation and linking. *)
-       List.iter begin fun pkg ->
-         flag ["ocaml"; "compile";  "pkg_"^pkg] & S[A"-package"; A pkg];
-         flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg];
-         flag ["ocaml"; "doc";      "pkg_"^pkg] & S[A"-package"; A pkg];
-         flag ["ocaml"; "link";     "pkg_"^pkg] & S[A"-package"; A pkg];
-       end (find_packages ());
-
-       (* The default "thread" tag is not compatible with ocamlfind.
-          Indeed, the default rules add the "threads.cma" or
-          "threads.cmxa" options when using this tag. When using the
-          "-linkpkg" option with ocamlfind, this module will then be
-          added twice on the command line.
-	  
-          To solve this, one approach is to add the "-thread" option
-          when using the "threads" package using the previous
-          plugin.  *)
-       flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
-       flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"])
-       
-   | _ -> ()
-end
diff --git a/tests/assert-false.cudf b/tests/data/assert-false.cudf
similarity index 100%
rename from tests/assert-false.cudf
rename to tests/data/assert-false.cudf
diff --git a/tests/assert-true.cudf b/tests/data/assert-true.cudf
similarity index 100%
rename from tests/assert-true.cudf
rename to tests/data/assert-true.cudf
diff --git a/tests/comment-at-eof.cudf b/tests/data/comment-at-eof.cudf
similarity index 100%
rename from tests/comment-at-eof.cudf
rename to tests/data/comment-at-eof.cudf
diff --git a/tests/comment-within-stanza.cudf b/tests/data/comment-within-stanza.cudf
similarity index 100%
rename from tests/comment-within-stanza.cudf
rename to tests/data/comment-within-stanza.cudf
diff --git a/tests/conflict-comma-sep.cudf b/tests/data/conflict-comma-sep.cudf
similarity index 100%
rename from tests/conflict-comma-sep.cudf
rename to tests/data/conflict-comma-sep.cudf
diff --git a/tests/default-type-check-error.cudf b/tests/data/default-type-check-error.cudf
similarity index 100%
rename from tests/default-type-check-error.cudf
rename to tests/data/default-type-check-error.cudf
diff --git a/tests/direct-self-conflict.cudf b/tests/data/direct-self-conflict.cudf
similarity index 100%
rename from tests/direct-self-conflict.cudf
rename to tests/data/direct-self-conflict.cudf
diff --git a/tests/dup-property.cudf b/tests/data/dup-property.cudf
similarity index 100%
rename from tests/dup-property.cudf
rename to tests/data/dup-property.cudf
diff --git a/tests/empty-vpkglist-default.cudf b/tests/data/empty-vpkglist-default.cudf
similarity index 100%
rename from tests/empty-vpkglist-default.cudf
rename to tests/data/empty-vpkglist-default.cudf
diff --git a/tests/empty-vpkglist-explicit.cudf b/tests/data/empty-vpkglist-explicit.cudf
similarity index 100%
rename from tests/empty-vpkglist-explicit.cudf
rename to tests/data/empty-vpkglist-explicit.cudf
diff --git a/tests/empty.cudf b/tests/data/empty.cudf
similarity index 100%
rename from tests/empty.cudf
rename to tests/data/empty.cudf
diff --git a/tests/fresher-sol-bad.cudf b/tests/data/fresher-sol-bad.cudf
similarity index 100%
rename from tests/fresher-sol-bad.cudf
rename to tests/data/fresher-sol-bad.cudf
diff --git a/tests/fresher-sol-good.cudf b/tests/data/fresher-sol-good.cudf
similarity index 100%
rename from tests/fresher-sol-good.cudf
rename to tests/data/fresher-sol-good.cudf
diff --git a/tests/fresher.cudf b/tests/data/fresher.cudf
similarity index 100%
rename from tests/fresher.cudf
rename to tests/data/fresher.cudf
diff --git a/tests/indirect-self-conflict.cudf b/tests/data/indirect-self-conflict.cudf
similarity index 100%
rename from tests/indirect-self-conflict.cudf
rename to tests/data/indirect-self-conflict.cudf
diff --git a/tests/keep-sol-bad.cudf b/tests/data/keep-sol-bad.cudf
similarity index 100%
rename from tests/keep-sol-bad.cudf
rename to tests/data/keep-sol-bad.cudf
diff --git a/tests/keep-sol-bad2.cudf b/tests/data/keep-sol-bad2.cudf
similarity index 100%
rename from tests/keep-sol-bad2.cudf
rename to tests/data/keep-sol-bad2.cudf
diff --git a/tests/keep-sol-bad3.cudf b/tests/data/keep-sol-bad3.cudf
similarity index 100%
rename from tests/keep-sol-bad3.cudf
rename to tests/data/keep-sol-bad3.cudf
diff --git a/tests/keep-sol-good.cudf b/tests/data/keep-sol-good.cudf
similarity index 100%
rename from tests/keep-sol-good.cudf
rename to tests/data/keep-sol-good.cudf
diff --git a/tests/keep-uninst-good.cudf b/tests/data/keep-uninst-good.cudf
similarity index 100%
rename from tests/keep-uninst-good.cudf
rename to tests/data/keep-uninst-good.cudf
diff --git a/tests/keep-uninst.cudf b/tests/data/keep-uninst.cudf
similarity index 100%
rename from tests/keep-uninst.cudf
rename to tests/data/keep-uninst.cudf
diff --git a/tests/keep.cudf b/tests/data/keep.cudf
similarity index 100%
rename from tests/keep.cudf
rename to tests/data/keep.cudf
diff --git a/tests/legacy-sol.cudf b/tests/data/legacy-sol.cudf
similarity index 100%
rename from tests/legacy-sol.cudf
rename to tests/data/legacy-sol.cudf
diff --git a/tests/legacy.cudf b/tests/data/legacy.cudf
similarity index 100%
rename from tests/legacy.cudf
rename to tests/data/legacy.cudf
diff --git a/tests/legacy.pp.cudf b/tests/data/legacy.pp.cudf
similarity index 100%
rename from tests/legacy.pp.cudf
rename to tests/data/legacy.pp.cudf
diff --git a/tests/line-111.cudf b/tests/data/line-111.cudf
similarity index 100%
rename from tests/line-111.cudf
rename to tests/data/line-111.cudf
diff --git a/tests/miss-mandatory-prop.cudf b/tests/data/miss-mandatory-prop.cudf
similarity index 100%
rename from tests/miss-mandatory-prop.cudf
rename to tests/data/miss-mandatory-prop.cudf
diff --git a/tests/missing-stanza-sep-1.cudf b/tests/data/missing-stanza-sep-1.cudf
similarity index 100%
rename from tests/missing-stanza-sep-1.cudf
rename to tests/data/missing-stanza-sep-1.cudf
diff --git a/tests/missing-stanza-sep-2.cudf b/tests/data/missing-stanza-sep-2.cudf
similarity index 100%
rename from tests/missing-stanza-sep-2.cudf
rename to tests/data/missing-stanza-sep-2.cudf
diff --git a/tests/multi-versions.cudf b/tests/data/multi-versions.cudf
similarity index 100%
rename from tests/multi-versions.cudf
rename to tests/data/multi-versions.cudf
diff --git a/tests/multiline-error.cudf b/tests/data/multiline-error.cudf
similarity index 100%
rename from tests/multiline-error.cudf
rename to tests/data/multiline-error.cudf
diff --git a/tests/only-request.cudf b/tests/data/only-request.cudf
similarity index 100%
rename from tests/only-request.cudf
rename to tests/data/only-request.cudf
diff --git a/tests/or-dep.cudf b/tests/data/or-dep.cudf
similarity index 100%
rename from tests/or-dep.cudf
rename to tests/data/or-dep.cudf
diff --git a/tests/plus-in-pkgname.cudf b/tests/data/plus-in-pkgname.cudf
similarity index 100%
rename from tests/plus-in-pkgname.cudf
rename to tests/data/plus-in-pkgname.cudf
diff --git a/tests/unknown-pkg.cudf b/tests/data/unknown-pkg.cudf
similarity index 100%
rename from tests/unknown-pkg.cudf
rename to tests/data/unknown-pkg.cudf
diff --git a/tests/unknown-pkg.sol.cudf b/tests/data/unknown-pkg.sol.cudf
similarity index 100%
rename from tests/unknown-pkg.sol.cudf
rename to tests/data/unknown-pkg.sol.cudf
diff --git a/tests/upgrade-singleton-sol-bad.cudf b/tests/data/upgrade-singleton-sol-bad.cudf
similarity index 100%
rename from tests/upgrade-singleton-sol-bad.cudf
rename to tests/data/upgrade-singleton-sol-bad.cudf
diff --git a/tests/upgrade-singleton-sol-good.cudf b/tests/data/upgrade-singleton-sol-good.cudf
similarity index 100%
rename from tests/upgrade-singleton-sol-good.cudf
rename to tests/data/upgrade-singleton-sol-good.cudf
diff --git a/tests/upgrade-singleton.cudf b/tests/data/upgrade-singleton.cudf
similarity index 100%
rename from tests/upgrade-singleton.cudf
rename to tests/data/upgrade-singleton.cudf
diff --git a/tests/virt-upgrade-sol-bad.cudf b/tests/data/virt-upgrade-sol-bad.cudf
similarity index 100%
rename from tests/virt-upgrade-sol-bad.cudf
rename to tests/data/virt-upgrade-sol-bad.cudf
diff --git a/tests/virt-upgrade-sol-bad2.cudf b/tests/data/virt-upgrade-sol-bad2.cudf
similarity index 100%
rename from tests/virt-upgrade-sol-bad2.cudf
rename to tests/data/virt-upgrade-sol-bad2.cudf
diff --git a/tests/virt-upgrade-sol-bad3.cudf b/tests/data/virt-upgrade-sol-bad3.cudf
similarity index 100%
rename from tests/virt-upgrade-sol-bad3.cudf
rename to tests/data/virt-upgrade-sol-bad3.cudf
diff --git a/tests/virt-upgrade-sol-good.cudf b/tests/data/virt-upgrade-sol-good.cudf
similarity index 100%
rename from tests/virt-upgrade-sol-good.cudf
rename to tests/data/virt-upgrade-sol-good.cudf
diff --git a/tests/virt-upgrade.cudf b/tests/data/virt-upgrade.cudf
similarity index 100%
rename from tests/virt-upgrade.cudf
rename to tests/data/virt-upgrade.cudf
diff --git a/tests/vpkgformula-prop.cudf b/tests/data/vpkgformula-prop.cudf
similarity index 100%
rename from tests/vpkgformula-prop.cudf
rename to tests/data/vpkgformula-prop.cudf
diff --git a/tests/dune b/tests/dune
new file mode 100644
index 0000000..9625bda
--- /dev/null
+++ b/tests/dune
@@ -0,0 +1,5 @@
+(tests
+ (names test)
+ (modules test tests)
+ (deps (source_tree data))
+ (libraries cudf ounit2))
diff --git a/test.ml b/tests/test.ml
similarity index 99%
rename from test.ml
rename to tests/test.ml
index ef3c3b3..dd3c09e 100644
--- a/test.ml
+++ b/tests/test.ml
@@ -11,4 +11,3 @@
 (*****************************************************************************)
 
 let _ = OUnit.run_test_tt_main Tests.all
-
diff --git a/tests.ml b/tests/tests.ml
similarity index 95%
rename from tests.ml
rename to tests/tests.ml
index 5d2457c..8746e04 100644
--- a/tests.ml
+++ b/tests/tests.ml
@@ -17,7 +17,7 @@ open Printf
 open Cudf_types
 open Cudf
 
-let cudf_test_path name = sprintf "./tests/%s.cudf" name
+let cudf_test_path name = sprintf "./data/%s.cudf" name
 
 let good_cudfs = [	(* CUDF whose parsing must suceed *)
   "empty-vpkglist-default" ;
@@ -91,19 +91,19 @@ let parse_test ~parse_fun name =
 let parse_cudf_wrapper p =
   match Cudf_parser.parse p with
     | pre, pkgs, Some req -> pre, pkgs, req
-    | pre, pkgs, None -> raise (Cudf_parser.Parse_error ("", dummy_loc))
+    | _pre, _pkgs, None -> raise (Cudf_parser.Parse_error ("", dummy_loc))
 let parse_pkgs_wrapper p =
   match Cudf_parser.parse p with
-    | pre, pkgs, Some req -> raise (Cudf_parser.Parse_error ("", dummy_loc))
-    | pre, pkgs, None -> pkgs
+    | _pre, _pkgs, Some _req -> raise (Cudf_parser.Parse_error ("", dummy_loc))
+    | _pre, pkgs, None -> pkgs
 let load_cudf_wrapper p =
   match Cudf_parser.load p with
     | pre, pkgs, Some req -> pre, pkgs, req
-    | pre, pkgs, None -> raise (Cudf_parser.Parse_error ("", dummy_loc))
+    | _pre, _pkgs, None -> raise (Cudf_parser.Parse_error ("", dummy_loc))
 let load_pkgs_wrapper p =
   match Cudf_parser.load p with
-    | pre, pkgs, Some req -> raise (Cudf_parser.Parse_error ("", dummy_loc))
-    | pre, pkgs, None -> pkgs
+    | _pre, _pkgs, Some _req -> raise (Cudf_parser.Parse_error ("", dummy_loc))
+    | _pre, pkgs, None -> pkgs
 
 let parse_cudf_test = parse_test ~parse_fun:parse_cudf_wrapper
 let parse_pkgs_test = parse_test ~parse_fun:parse_pkgs_wrapper
@@ -125,7 +125,7 @@ let string_of_int_list l =
 (** {5 Test builders} *)
 
 let good_parse ~parse_fun name = TestCase (fun _ ->
-  assert_no_exn (fun () -> parse_test ~parse_fun name))
+  assert_no_exn (fun () -> ignore (parse_test ~parse_fun name)))
 
 let bad_parse ~parse_fun name (l1, l2) = TestCase (fun _ ->
   assert_raises'
@@ -136,7 +136,7 @@ let bad_parse ~parse_fun name (l1, l2) = TestCase (fun _ ->
 		  loc1.Lexing.pos_lnum = l1 && loc2.Lexing.pos_lnum = l2
 	      | _ -> false)
     ~exn:(Cudf_parser.Parse_error ("", dummy_loc))
-    (fun () -> parse_test ~parse_fun name))
+    (fun () -> ignore (parse_test ~parse_fun name)))
 
 let good_solution prob_name sol_name = TestCase (fun _ ->
   let (_,univ,req), sol = load_cudf_test prob_name, load_univ_test sol_name in
@@ -186,7 +186,7 @@ let value_parse_suite =
 		| Cudf_types_pp.Type_error _, Cudf_types_pp.Type_error _ -> true
 		| _ -> e1 = e2)
       ~exn:(Cudf_types_pp.Type_error (`Int, `Int ~-1))
-      (fun () -> Cudf_types_pp.parse_value typ s))
+      (fun () -> ignore (Cudf_types_pp.parse_value typ s)))
   in
   "value parsing" >::: [
     "good" >::: List.map value_parse_ok [
@@ -357,12 +357,12 @@ let value_pp_suite =
     ] ;
     "bad vpkgformula" >:: (fun () ->
       assert_exn (fun () -> (* should "assert false" *)
-	Cudf_types_pp.string_of_vpkgformula [ []; [] ]))
+	ignore (Cudf_types_pp.string_of_vpkgformula [ []; [] ])))
   ]
 
 let cudf_pp_suite =
-  (** check that the pretty printing roundtrip (parse -> pp -> parse) returns
-      the same document than plain parsing *)
+  (* check that the pretty printing roundtrip (parse -> pp -> parse) returns
+     the same document than plain parsing *)
   let cudf_pp_roundtrip name =
     name >: TestCase (fun _ ->
       let (pre, univ, req) as doc = parse_cudf_test name in
@@ -377,12 +377,12 @@ let cudf_pp_suite =
 	  assert_equal doc doc')
 	())
   in
-  (** check that pretty printing of a document returns some canonical pretty
-      printed document (hence, this test is more fragile than
-      [cudf_pp_roundtrip] above) *)
+  (* check that pretty printing of a document returns some canonical pretty
+     printed document (hence, this test is more fragile than
+     [cudf_pp_roundtrip] above) *)
   let cudf_pp_canonical name =
     name >: TestCase (fun _ ->
-      let (pre, univ, req) as doc = parse_cudf_test name in
+      let (_pre, _univ, _req) as doc = parse_cudf_test name in
       let fname, oc = Filename.open_temp_file "libcudf-test." ".cudf" in
       finally
 	(fun () -> Sys.remove fname)
@@ -462,7 +462,7 @@ let status_filtering =
     "status projection returned an \"installed: false\" package" @?
       let _, univ, _ = load_cudf_test "legacy" in
       List.for_all
-        (fun { installed = i } -> i)
+        (fun { installed = i; _ } -> i)
         (get_packages (status univ)))
 
 let status_sizes =

More details

Full run details

Historical runs