The following commit has been merged in the master branch:
commit 65a9efbb95deb22e7f4663f3423732578ccc7ebe
Author: Sylvain Le Gall <gil...@debian.org>
Date:   Sun Mar 24 01:22:31 2013 +0100

    Create a more precise test suite.
    
    Use tarballs to test, build the results and run lintian over it.

diff --git a/INSTALL.txt b/INSTALL.txt
index 357d694..2b72919 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -1,5 +1,5 @@
 (* OASIS_START *)
-(* DO NOT EDIT (digest: 96893f4af218c48c9d244581d361e83f) *)
+(* DO NOT EDIT (digest: b83bfe827d8d8aad6e30959d0c601d33) *)
 This is the INSTALL file for the oasis2debian distribution.
 
 This package uses OASIS to generate its build system. See section OASIS for
@@ -9,16 +9,18 @@ Dependencies
 ============
 
 In order to compile this package, you will need:
-* ocaml for all, test main, test ocaml-sqlexpr
+* ocaml for all, test main
 * findlib
-* oasis (>= 0.3.1) for executable oasis2debian
+* oasis (>= 0.3.1)
 * xstrp4 (>= 1.8) for executable oasis2debian
 * fileutils (>= 0.4.2)
 * pcre for executable oasis2debian
 * debian-formats (>= 0.0.1) for executable oasis2debian
 * xdg-basedir (>= 0.0.1) for executable oasis2debian
 * inifiles (>= 1.2) for executable oasis2debian
-* oUnit (>= 1.1.0) for executable test
+* oUnit (>= 2.0.0) for executable test
+* tar for test main
+* ocamlmod for test main
 
 Installing
 ==========
diff --git a/Makefile b/Makefile
index 8c9c3a3..12dfef1 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,6 @@ default: test reinstall
 #default: reinstall
 reinstall: build
 
-
 # OASIS_START
 # DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
 
diff --git a/_oasis b/_oasis
index 2950d5f..fc604f6 100644
--- a/_oasis
+++ b/_oasis
@@ -1,4 +1,4 @@
-OASISFormat: 0.2
+OASISFormat: 0.3
 Name:        oasis2debian
 Version:     0.1.0
 Synopsis:    Create and maintain Debian package for an OASIS package
@@ -24,14 +24,8 @@ Executable test
   Path:         test
   MainIs:       test.ml
   Install:      false
-  BuildDepends: oUnit (>= 1.1.0), fileutils (>= 0.4.2), unix
+  BuildDepends: oUnit (>= 2.0.0), fileutils (>= 0.4.2), unix, oasis
 
 Test main
   Command: $test -exec $oasis2debian
-  TestTools: oasis2debian, test
-  Run: false
-
-Test "ocaml-sqlexpr"
-  Command: $oasis2debian update
-  TestTools: oasis2debian
-  WorkingDirectory: /home/gildor/debian/pkg-ocaml-maint/packages/ocaml-sqlexpr
+  TestTools: oasis2debian, test, tar, ocamlmod
diff --git a/_tags b/_tags
index 560c39b..51e7d7a 100644
--- a/_tags
+++ b/_tags
@@ -20,7 +20,7 @@
 
################################################################################
 
 # OASIS_START
-# DO NOT EDIT (digest: 263ff8c84033e5bb80f738b31f25aa1e)
+# DO NOT EDIT (digest: d161ee651e970b488f7fbdded448d3cb)
 # Ignore VCS directories, you can use the same kind of rule outside 
 # OASIS_START/STOP if you want to exclude directories that contains 
 # useless stuff for the build process
@@ -55,9 +55,11 @@
 "test/test.byte": pkg_oUnit
 "test/test.byte": pkg_fileutils
 "test/test.byte": pkg_unix
+"test/test.byte": pkg_oasis
 <test/*.ml{,i}>: pkg_oUnit
 <test/*.ml{,i}>: pkg_fileutils
 <test/*.ml{,i}>: pkg_unix
+<test/*.ml{,i}>: pkg_oasis
 # OASIS_STOP
 
 "src/ActInit.ml": syntax_camlp4o
diff --git a/setup.ml b/setup.ml
index 9b146a4..10f535f 100644
--- a/setup.ml
+++ b/setup.ml
@@ -22,7 +22,7 @@
 (* setup.ml generated for the first time by OASIS v0.2.0 *)
 
 (* OASIS_START *)
-(* DO NOT EDIT (digest: cfc30cfd0f049b7818469a97793a903b) *)
+(* DO NOT EDIT (digest: 462168c2fc1d5b1fe5aa9f976b82e9c4) *)
 (*
    Regenerated by OASIS v0.3.1
    Visit http://oasis.forge.ocamlcore.org for more information and
@@ -5980,14 +5980,6 @@ let setup_t =
                    ];
                  cmd_clean = [(OASISExpr.EBool true, None)];
                  cmd_distclean = [(OASISExpr.EBool true, None)];
-                 });
-          ("ocaml-sqlexpr",
-            CustomPlugin.Test.main
-              {
-                 CustomPlugin.cmd_main =
-                   [(OASISExpr.EBool true, ("$oasis2debian", ["update"]))];
-                 cmd_clean = [(OASISExpr.EBool true, None)];
-                 cmd_distclean = [(OASISExpr.EBool true, None)];
                  })
        ];
      doc = [];
@@ -6006,14 +5998,6 @@ let setup_t =
                    ];
                  cmd_clean = [(OASISExpr.EBool true, None)];
                  cmd_distclean = [(OASISExpr.EBool true, None)];
-                 });
-          ("ocaml-sqlexpr",
-            CustomPlugin.Test.clean
-              {
-                 CustomPlugin.cmd_main =
-                   [(OASISExpr.EBool true, ("$oasis2debian", ["update"]))];
-                 cmd_clean = [(OASISExpr.EBool true, None)];
-                 cmd_distclean = [(OASISExpr.EBool true, None)];
                  })
        ];
      clean_doc = [];
@@ -6030,20 +6014,12 @@ let setup_t =
                    ];
                  cmd_clean = [(OASISExpr.EBool true, None)];
                  cmd_distclean = [(OASISExpr.EBool true, None)];
-                 });
-          ("ocaml-sqlexpr",
-            CustomPlugin.Test.distclean
-              {
-                 CustomPlugin.cmd_main =
-                   [(OASISExpr.EBool true, ("$oasis2debian", ["update"]))];
-                 cmd_clean = [(OASISExpr.EBool true, None)];
-                 cmd_distclean = [(OASISExpr.EBool true, None)];
                  })
        ];
      distclean_doc = [];
      package =
        {
-          oasis_version = "0.2";
+          oasis_version = "0.3";
           ocaml_version = None;
           findlib_version = None;
           name = "oasis2debian";
@@ -6161,11 +6137,12 @@ let setup_t =
                         [
                            FindlibPackage
                              ("oUnit",
-                               Some (OASISVersion.VGreaterEqual "1.1.0"));
+                               Some (OASISVersion.VGreaterEqual "2.0.0"));
                            FindlibPackage
                              ("fileutils",
                                Some (OASISVersion.VGreaterEqual "0.4.2"));
-                           FindlibPackage ("unix", None)
+                           FindlibPackage ("unix", None);
+                           FindlibPackage ("oasis", None)
                         ];
                       bs_build_tools = [ExternalTool "ocamlbuild"];
                       bs_c_sources = [];
@@ -6197,40 +6174,18 @@ let setup_t =
                            post_command = [(OASISExpr.EBool true, None)];
                            };
                       test_working_directory = None;
-                      test_run = [(OASISExpr.EBool true, false)];
-                      test_tools =
+                      test_run =
                         [
-                           ExternalTool "ocamlbuild";
-                           InternalExecutable "oasis2debian";
-                           InternalExecutable "test"
+                           (OASISExpr.ENot (OASISExpr.EFlag "tests"), false);
+                           (OASISExpr.EFlag "tests", true)
                         ];
-                      });
-               Test
-                 ({
-                     cs_name = "ocaml-sqlexpr";
-                     cs_data = PropList.Data.create ();
-                     cs_plugin_data = [];
-                     },
-                   {
-                      test_type = (`Test, "custom", Some "0.3");
-                      test_command =
-                        [
-                           (OASISExpr.EBool true,
-                             ("$oasis2debian", ["update"]))
-                        ];
-                      test_custom =
-                        {
-                           pre_command = [(OASISExpr.EBool true, None)];
-                           post_command = [(OASISExpr.EBool true, None)];
-                           };
-                      test_working_directory =
-                        Some
-                          
"/home/gildor/debian/pkg-ocaml-maint/packages/ocaml-sqlexpr";
-                      test_run = [(OASISExpr.EBool true, true)];
                       test_tools =
                         [
                            ExternalTool "ocamlbuild";
-                           InternalExecutable "oasis2debian"
+                           InternalExecutable "oasis2debian";
+                           InternalExecutable "test";
+                           ExternalTool "tar";
+                           ExternalTool "ocamlmod"
                         ];
                       })
             ];
@@ -6245,7 +6200,7 @@ let setup_t =
           };
      oasis_fn = Some "_oasis";
      oasis_version = "0.3.1";
-     oasis_digest = Some "���7���vM[\153~r�j�";
+     oasis_digest = Some "\141�Y�\129��=��ծ%\026�\031";
      oasis_exec = None;
      oasis_setup_args = ["-setup-update"; "weak"];
      setup_update = true;
@@ -6253,6 +6208,6 @@ let setup_t =
 
 let setup () = BaseSetup.setup setup_t;;
 
-# 6236 "setup.ml"
+# 6191 "setup.ml"
 (* OASIS_STOP *)
 let () = setup ();;
diff --git a/src/DhFiles.ml b/src/DhFiles.ml
index f23ea90..9332cd2 100644
--- a/src/DhFiles.ml
+++ b/src/DhFiles.ml
@@ -238,11 +238,12 @@ Section: Programming/OCaml");
   in
 
     begin
-      match t.deb_exec with 
-        | Some deb_pkg ->
+      match t.deb_exec, t.deb_dev with 
+        | Some deb_pkg, Some _ ->
             dh_with_fn deb_pkg "install"
               (output_content "usr/bin")
-        | None ->
+        | Some _, None 
+        | None, _ ->
             ()
     end;
 
diff --git a/src/Expr.ml b/src/Expr.ml
index 5645273..c4977d4 100644
--- a/src/Expr.ml
+++ b/src/Expr.ml
@@ -66,6 +66,17 @@ let create ~ctxt pkg =
         conf
         pkg.sections
     in
+    let conf = 
+      (* These are implicit flags.
+       * TODO: create a list of implicit flags in OASIS.
+       *)
+      List.fold_left
+        (fun conf (k, v) ->
+           MapString.add k v conf)
+        conf
+        ["tests", "true";
+         "docs", "true"]
+    in
       MapArch.add arch conf mp
   in
 
diff --git a/src/Rules.ml b/src/Rules.ml
index 3010a1c..a388bcf 100644
--- a/src/Rules.ml
+++ b/src/Rules.ml
@@ -37,6 +37,12 @@ let create t =
            *)
           "tmp"
   in
+  let has_bin = 
+    t.deb_exec <> None 
+  in
+  let has_lib =
+    t.deb_dev <> None 
+  in
 
   let docdir = 
     match docdir t with 
@@ -47,7 +53,7 @@ let create t =
   in
     debian_with_fn "rules"
       (output_content 
-         (interpolate "\
+         ((interpolate "\
 #!/usr/bin/make -f
 # -*- makefile -*-
 
@@ -68,7 +74,14 @@ export OCAMLFIND_LDCONF
 
 .PHONY: override_dh_auto_configure
 override_dh_auto_configure:
-       ocaml setup.ml -configure --prefix /usr --destdir '\$(DESTDIR)'$docdir
+       ocaml setup.ml -configure $docdir \\
+               --destdir '\$(DESTDIR)' \\
+               --prefix '/usr' \\
+               --mandir '\$\$prefix/share/man' \\
+               --infodir '\$\$prefix/share/info' \\
+               --sysconfdir '/etc' \\
+               --localstatedir '/var' \\
+               --libexecdir '\$\$prefix/lib/'
 
 .PHONY: override_dh_auto_build
 override_dh_auto_build:
@@ -80,9 +93,18 @@ override_dh_auto_test:
        ocaml setup.ml -test
 
 .PHONY: override_dh_auto_install
-override_dh_auto_install:
-       mkdir -p '\$(DESTDIR)/usr/bin'
-       mkdir -p '\$(OCAMLFIND_DESTDIR)'
+override_dh_auto_install:")^(
+  if has_bin then
+    interpolate "
+       mkdir -p '\$(DESTDIR)/usr/bin'"
+  else
+    "")^(
+  if has_lib then
+    "
+       mkdir -p '$(OCAMLFIND_DESTDIR)'"
+  else 
+    "")^(
+  interpolate "
        ocaml setup.ml -install 
 
 .PHONY: override_dh_install
@@ -91,5 +113,5 @@ override_dh_install:
 
 .PHONY: override_dh_auto_clean
 override_dh_auto_clean:
-       ocaml setup.ml -distclean"));
+       ocaml setup.ml -distclean")));
     Unix.chmod (debian_fn "rules") 0o0755 
diff --git a/test/data/oasis/_oasis b/test/data/oasis/_oasis
deleted file mode 100644
index fa73def..0000000
--- a/test/data/oasis/_oasis
+++ /dev/null
@@ -1,221 +0,0 @@
-OASISFormat:  0.1
-OCamlVersion: >= 3.11.0
-Name:         oasis
-Version:      0.2.0
-LicenseFile:  COPYING.txt
-License:      LGPL-2.1 with OCaml linking exception
-BuildType:    ocamlbuild (0.2)
-Authors:      Sylvain Le Gall
-Copyrights:   (C) 2008-2010 OCamlCore SARL
-Homepage:     http://oasis.forge.ocamlcore.org/
-Plugins:      DevFiles (0.2), StdFiles (0.2), META (0.2)
-FilesAB:      src/oasis/OASISConf.ml.ab
-BuildTools:   ocamlbuild, make
-
-Synopsis: Architecture for building OCaml libraries and applications
-Description:
-  OASIS generates a full configure, build and install system for your
-  application. It starts with a simple `_oasis` file at the toplevel of your
-  project and creates everything required.
-  .
-  It uses external tools like OCamlbuild and it can be considered as the glue
-  between various subsystems that do the job. It should support the following
-  tools: 
-  .
-  - OCamlbuild
-  - OMake (todo)
-  - OCamlMakefile (todo),
-  - ocaml-autoconf (todo)
-  .
-  It also features a do-it-yourself command line invocation and an internal 
-  configure/install scheme. Libraries are managed through findlib. It has been
-  tested on GNU Linux and Windows.
-  .
-  It also allows to have standard entry points and description. It helps to 
-  integrates your libraries and software with third parties tools like GODI.
-
-Flag libraries
-  Description: Install oasis and base libraries, for plugins development
-
-Flag gettext
-  Description: Use ocaml-gettext for i18n
-  Default: false
-
-if flag(gettext) 
-  PostBuildCommand: $make -C po all
-  PostCleanCommand: $make -C po clean
-  PostInstallCommand:   $make -C po install PODIR=$prefix/share/locale
-  PostUninstallCommand: $make -C po install PODIR=$prefix/share/locale
-
-Executable ocamlmod
-  Path:   src/tools
-  MainIs: ocamlmod.ml
-  BuildDepends: fileutils, pcre
-  Install: false
-  
-Library oasis
-  Path: src/oasis
-  Modules: FormatExt,
-           ODNFunc,
-           PropList,
-           OASISUtils,
-           OASISUnixPath,
-           OASISContext,
-           OASISGettext,
-           OASISMessage,
-           OASISTypes,
-           OASISParse,
-           OASISValues,
-           OASISExpr,
-           OASISVersion,
-           OASISLicense,
-           OASISFileTemplate,
-           OASISBuildSection,
-           OASISDocument,
-           OASISExecutable,
-           OASISFlag,
-           OASISLibrary,
-           OASISPackage,
-           OASISSourceRepository,
-           OASISTest,
-           OASISPlugin,
-           OASISSchema
-  InternalModules: OASISVersion_types,
-                   OASISVersion_lexer,
-                   OASISVersion_parser,
-                   OASISSection,
-                   OASISSchema,
-                   OASISConf,
-                   OASISAst,
-                   OASISCheck,
-                   OASISRecDescParser,
-                   OASISCustom,
-                   OASISQuickstart,
-                   OASISData,
-                   OASISHelp,
-                   OASISFormat,
-                   OASISBuildSection_intern,
-                   OASISDocument_intern,
-                   OASISExecutable_intern,
-                   OASISFlag_intern,
-                   OASISLibrary_intern,
-                   OASISPackage_intern,
-                   OASISSourceRepository_intern,
-                   OASISTest_intern,
-                   OASISSchema_intern
-  CompiledObject: Best
-  BuildDepends: fileutils (>= 0.4.2), unix, pcre, extlib, 
-                findlib, odn (>= 0.0.3), ocamlgraph
-  BuildTools+: ocamlmod, ocamlyacc, ocamllex, ocamlify
-  XMETADescription: _oasis file functions
-  Install$: flag(libraries)
-
-Library base
-  Path: src/base
-  Modules: BaseArgExt,
-           BaseBuilt,
-           BaseCheck,
-           BaseCustom,
-           BaseData,
-           BaseDev,
-           BaseDoc,
-           BaseEnvLight,
-           BaseEnv,
-           BaseExec,
-           BaseFileAB,
-           BaseFilePath,
-           BaseFileUtil,
-           BaseGenerate,
-           BaseLog,
-           BaseOCamlcConfig,
-           BaseSetup,
-           BaseStandardVar,
-           BaseTest,
-           BaseDynVar,
-           BaseMessage,
-           BaseContext
-  CompiledObject: Best
-  BuildDepends: oasis
-  BuildTools+: ocamlmod, ocamlify
-  FindlibParent: oasis
-  XMETADescription: 'setup.ml' modules for OASIS
-  Install$: flag(libraries)
-
-Library "builtin-plugins"
-  Path: src
-  Modules: OASISBuiltinPlugins
-  InternalModules: plugins/none/NonePlugin,
-                   plugins/none/NoneData,
-                   plugins/internal/InternalConfigurePlugin, 
-                   plugins/internal/InternalInstallPlugin,
-                   plugins/internal/InternalData,
-                   plugins/internal/InternalId,
-                   plugins/ocamlbuild/OCamlbuildPlugin,
-                   plugins/ocamlbuild/OCamlbuildDocPlugin,
-                   plugins/ocamlbuild/OCamlbuildData,
-                   plugins/ocamlbuild/OCamlbuildCommon,
-                   plugins/ocamlbuild/OCamlbuildId,
-                   plugins/ocamlbuild/MyOCamlbuildBase,
-                   plugins/ocamlbuild/MyOCamlbuildFindlib,
-                   plugins/custom/CustomPlugin,
-                   plugins/custom/CustomData,
-                   plugins/extra/META/METAPlugin,
-                   plugins/extra/META/METAData,
-                   plugins/extra/devfiles/DevFilesPlugin,
-                   plugins/extra/devfiles/DevFilesData,
-                   plugins/extra/stdfiles/StdFilesPlugin,
-                   plugins/extra/stdfiles/StdFilesData
-  CompiledObject: Best
-  BuildDepends: oasis, oasis.base
-  FindlibParent: oasis
-
-Library cli
-  Path:             src/cli
-  Modules:          SubCommand
-  CompiledObject:   byte
-  BuildDepends:     oasis
-  FindlibParent:    oasis
-  XMETADescription: 'setup.ml' modules for OASIS
-  Install$:         flag(libraries)
-
-
-Executable oasis
-  Path:   src/cli
-  MainIs: Main.ml
-  BuildDepends: oasis, oasis.base, oasis.cli, oasis.builtin-plugins
-
-Executable test
-  Path: test
-  MainIs: test.ml
-  Install: false
-  CompiledObject: byte
-  BuildDepends: oUnit (>= 1.1.0), oasis, oasis.base, oasis.builtin-plugins, 
expect.pcre (>= 0.0.2)
-
-Test main
-  Type: custom (0.2)
-  Command: $test -oasis-exec $oasis -has-ocamlopt $is_native
-  WorkingDirectory: test 
-  TestTools: oasis, test
-
-Document manual
-  Type: custom (0.2)
-  Title: OASIS User Manual
-  if flag(gettext) 
-    XCustom: env LANG=C $oasis manual > doc/MANUAL.mkd
-  else
-    XCustom: $oasis manual -o doc/MANUAL.mkd
-  XCustomClean: $rm doc/MANUAL.mkd
-  DataFiles: doc/MANUAL.mkd
-
-Document "api-oasis"
-  Title:                API reference for OASIS 
-  Type:                 ocamlbuild (0.2)
-  InstallDir:           $htmldir/oasis
-  BuildTools+:          ocamldoc
-  XOCamlbuildPath:      src/
-  XOCamlbuildLibraries: oasis, oasis.base, oasis.cli
-
-SourceRepository head
-  Type: darcs
-  Location: http://darcs.ocamlcore.org/repos/oasis
-  Browser: http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=oasis;a=summary
diff --git a/test/data/ocaml-data-notation/_oasis 
b/test/data/ocaml-data-notation/_oasis
deleted file mode 100644
index b7151d2..0000000
--- a/test/data/ocaml-data-notation/_oasis
+++ /dev/null
@@ -1,53 +0,0 @@
-OASISFormat:  0.1
-OCamlVersion: >= 3.10.2
-Name:         ocaml-data-notation
-Version:      0.0.2
-Synopsis:     Store data using OCaml notation
-Authors:      Sylvain Le Gall
-License:      LGPL-2.1 with OCaml linking exception
-LicenseFile:  COPYING.txt
-Plugins:      StdFiles (0.1.0), DevFiles (0.1.0), META (0.1.0)
-FilesAB:      tests/TestConf.ml.ab
-BuildTools:   ocamlbuild
-
-Library odn
-  Path:    src
-  Modules: ODN
-  
-Library pa_odn
-  Path:               src
-  Modules:            Pa_odn
-  FindlibParent:      odn
-  FindlibContainers:  with
-  FindlibName:        syntax
-  BuildDepends:       type-conv (>= 1.5.0), camlp4.lib, camlp4.quotations.o 
-  CompiledObject:     byte
-  XMETAType:          syntax
-  XMETARequires:      type-conv.syntax, camlp4, odn
-  XMETADescription:   Syntax extension for odn
-
-Library pa_noodn
-  Path:               src
-  Modules:            Pa_noodn
-  FindlibParent:      odn
-  FindlibContainers:  without
-  FindlibName:        syntax
-  BuildDepends:       type-conv, camlp4.lib, camlp4.quotations.o 
-  CompiledObject:     byte
-  XMETAType:          syntax
-  XMETARequires:      type-conv.syntax, camlp4
-  XMETADescription:   Syntax extension that removes 'with odn'
-
-Flag tests
-  Description: Build and run tests
-
-Executable test
-  Path:         tests
-  MainIs:       test.ml
-  Install:      false
-  Build$:       flag(tests)
-  BuildDepends: oUnit, fileutils (>= 0.4.0), odn, str
-  
-Test main
-  Run$:    flag(tests)
-  Command: $test
diff --git a/test/data/ocamlify-0.0.1.tar.gz b/test/data/ocamlify-0.0.1.tar.gz
new file mode 100644
index 0000000..421bd63
Binary files /dev/null and b/test/data/ocamlify-0.0.1.tar.gz differ
diff --git a/test/data/ocamlify/_oasis b/test/data/ocamlify/_oasis
deleted file mode 100644
index e229f2a..0000000
--- a/test/data/ocamlify/_oasis
+++ /dev/null
@@ -1,14 +0,0 @@
-OASISFormat: 0.1
-Name:        ocamlify
-Version:     0.0.1
-Synopsis:    include files in OCaml code
-Authors:     Sylvain Le Gall
-LicenseFile: COPYING.txt 
-License:     LGPL-2.1 with OCaml linking exception
-FilesAB:     src/OCamlifyConfig.ml.ab
-Plugins:     StdFiles (0.1.0), DevFiles (0.1.0)
-
-Executable ocamlify
-  Path:           src
-  CompiledObject: byte
-  MainIs:         ocamlify.ml
diff --git a/test/data/sekred-0.1.0.tar.gz b/test/data/sekred-0.1.0.tar.gz
new file mode 100644
index 0000000..d17372f
Binary files /dev/null and b/test/data/sekred-0.1.0.tar.gz differ
diff --git a/test/test.ml b/test/test.ml
index 1bedef6..2698598 100644
--- a/test/test.ml
+++ b/test/test.ml
@@ -19,48 +19,84 @@
 (* Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA              
*)
 
(******************************************************************************)
 
-open OUnit
+open OUnit2
 open FileUtil
 open FilePath
 
 let oasis2debian =
   ref "_build/src/oasis2debian"
 
-let args_for_dir =
-  ["ocamlify", 
+let args_for_tarball =
+  ["ocamlify-0.0.1.tar.gz", 
    ["--homepage"; "http://forge.ocamlcore.org/projects/ocamlify";];
+  
+   "ocamlmod-0.0.3.tar.gz",
+   ["--homepage"; "http://forge.ocamlcore.org/projects/ocamlmod";];
 
-   "ocaml-data-notation", 
-   ["--homepage"; "http://forge.ocamlcore.org/projects/odn";]]
+   "sekred-0.1.0.tar.gz",
+   ["--executable-name"; "sekred";
+               "--group"; "sekred,/var/lib/sekred";
+               "--dh-dirs"; "sekred,var/lib/sekred/domains";
+               "--dpkg-statoverride"; "/usr/bin/sekred,root,sekred,2755";
+               "--dpkg-statoverride"; 
"/var/lib/sekred/domains,root,sekred,1730"];
+  ]
 
 let tests = 
-  let dirs = 
-    ls (make_filename ["test"; "data"])
+  let pwd = pwd () in
+  let tarballs = 
+    filter 
+      (Has_extension "gz")
+      (ls (make_filename [pwd; "test"; "data"]))
   in
-  let pwd =
-    pwd ()
+  let topdir tarball =
+    chop_extension (chop_extension (basename tarball))
   in
     List.map 
-      (fun dn ->
-         dn >::
-         bracket 
-           (fun () ->
-              Sys.chdir dn)
-           (fun () ->
-              let args = 
-                try 
-                  List.assoc (basename dn) args_for_dir
-                with Not_found ->
-                  []
-              in
-                assert_command !oasis2debian args)
-           (fun () ->
-              rm ~recurse:true ["debian"];
-              Sys.chdir pwd))
-      dirs
+      (fun tarball ->
+         (basename tarball) >::
+         (fun ctxt ->
+           bracket_tmpdir
+             (fun dn ->
+                bracket
+                  (fun () -> Sys.chdir dn)
+                  (fun () ->
+                     let () = 
+                       assert_command ~ctxt "tar" ["xzf"; tarball];
+                     in
+                     let pkg =
+                       OASISParse.from_file 
+                         ~ctxt:{!OASISContext.default with 
+                                    OASISContext.ignore_plugins = true}
+                         (Filename.concat (topdir tarball) "_oasis")
+                     in
+                     let pkg_name = pkg.OASISTypes.name in
+                     let pkg_ver = OASISVersion.string_of_version 
pkg.OASISTypes.version in
+                     let () = 
+                       cp [tarball] 
+                         (Filename.concat 
+                            dn 
+                            (Printf.sprintf "%s_%s.orig.tar.gz" pkg_name 
pkg_ver));
+                       Sys.rename (topdir tarball) pkg_name;
+                       Sys.chdir pkg_name;
+                     in
+                     let args = 
+                       try 
+                         List.assoc (basename tarball) args_for_tarball
+                       with Not_found ->
+                         []
+                     in
+                       assert_command ~ctxt !oasis2debian ("init" :: args);
+                       assert_command ~ctxt "debuild" ["-uc"; "-us"];
+                       Sys.chdir "..";
+                       assert_command ~ctxt "lintian" ("--fail-on-warnings" :: 
(filter (Has_extension "changes") (ls ".")))
+                  )
+                  (fun () -> Sys.chdir pwd)
+                  ())
+             ()))
+      tarballs
       
 
-let _ =
+let () =
   Unix.putenv "EDITOR" "true";
   run_test_tt_main
     ~arg_specs:["-exec",

-- 
oasis2debian project

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to