This is an automated email from the git hooks/post-receive script.

treinen pushed a commit to branch experimental/master
in repository dose3.

commit 2f72a6d9b2c9e5620292e31c1157a71a164eb705
Author: Ralf Treinen <trei...@free.fr>
Date:   Sun May 4 22:36:26 2014 +0200

    Imported Upstream version 3.2~rc2
---
 INSTALL                        |  24 ++++++-
 _tags.in                       |   1 +
 algo/depsolver.mli             |   6 ++
 algo/diagnostic.ml             |   2 +
 algo/diagnostic.mli            | 108 +++++++++++++++++++++++++++++
 applications/deb-buildcheck.ml |  39 ++++++++---
 applications/deb-coinstall.ml  |  17 +++++
 applications/dose-tests.list   |   8 +++
 common/cudfSolver.ml           |  17 +++--
 configure                      |  36 +++++-----
 configure.ac                   |   2 +-
 deb/architecture.ml            | 151 +++++++++++++++++++++++++++++++++++------
 deb/architecture.mli           |   7 ++
 deb/debcudf.ml                 |  49 +++++++------
 deb/printer.ml                 |   2 +
 deb/sources.ml                 |   2 +-
 deb/tests.ml                   |  24 ++++---
 doc/manpages/ceve.pod          |   3 +-
 18 files changed, 407 insertions(+), 91 deletions(-)

diff --git a/INSTALL b/INSTALL
index 08f48e9..ce8a2ef 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,3 +1,6 @@
+
+==== Dependencies ====
+
 Dose3 needs ocaml >= 3.11.2
 On debian, dose3 **does not compile** on debian lenny.
 
@@ -17,7 +20,18 @@ additional libraries (enable compilation with 
--with-<library>) :
  - libbenchmark-ocaml-dev (for --with-benchmark)
 
 To use rpm support, dose3 needs librpm > 4.6
-To use ocamlgraph support, dose3 needs libocamlgraph-ocaml-dev >= 1.8.4
+To use ocamlgraph support, dose3 needs libocamlgraph-ocaml-dev >= 1.8.5
+
+opam users need the following packages to compile dose with the default
+options :
+
+- opam install extlib camlbz2 camlzip ocamlgraph extlib ounit re cudf
+
+OR 
+
+- opam install extlib re cudf
+
+to compile the core dose library.
 
 To compile from git :
 aclocal -I m4
@@ -41,7 +55,7 @@ not in the dose3 release tarball. By default dose3 uses the 
system
 wide version of libcudf. To use the version of libcudf in the source
 tree you can specify --without-libcudf as configure option. If using
 an independently installed version of libcudf you'll need version >=
-0.6.2.
+0.7.
 
 
 Example:
@@ -131,7 +145,11 @@ make
 make dist
 
 How to run the tests
-----------------
+--------------------
+The test script of the applications needs:
+python
+python-yaml
+
 ./configure --without-libcudf --with-xml --with-curl --with-ocamlgraph \
   --with-zip --with-oUnit --with-bz2 --with-rpm4
 make
diff --git a/_tags.in b/_tags.in
index fb97216..65e7576 100644
--- a/_tags.in
+++ b/_tags.in
@@ -64,6 +64,7 @@ true: -traverse
 <experimental/strongpreds.*>: @USE_RPM@, use_algo, use_boilerplate
 <experimental/cudftodeb.*>: use_boilerplateNoRpm
 <experimental/cudf-solver.*>: use_algo, use_boilerplateNoRpm
+<experimental/test-solver.*>: use_algo, use_boilerplateNoRpm
 <experimental/treinen-test.*>: use_algo, use_boilerplateNoRpm
 <experimental/partition.*>: use_algo, package(buddy), use_boilerplateNoRpm
 <experimental/cnftocudf.*>: use_boilerplateNoRpm
diff --git a/algo/depsolver.mli b/algo/depsolver.mli
index 681fc05..6c6c397 100644
--- a/algo/depsolver.mli
+++ b/algo/depsolver.mli
@@ -19,6 +19,12 @@ type solver
     for universe consistency (cf. Cudf_checker.is_consistent) *)
 val load : ?check : bool -> Cudf.universe -> solver
 
+(** Turn a result from Diagnostic_int into one of Diagnostic *)
+val result : Depsolver_int.identity -> Cudf.universe -> Diagnostic_int.result 
-> Diagnostic.result
+
+(** Turn a request from Diagnostic_int into one of Diagnostic *)
+val request : Cudf.universe -> Diagnostic_int.request -> Diagnostic.request
+
 (** check if the given package can be installed in the universe 
  
     @param global_constraints : enforce global constraints on the given
diff --git a/algo/diagnostic.ml b/algo/diagnostic.ml
index eb56bb3..c016fde 100644
--- a/algo/diagnostic.ml
+++ b/algo/diagnostic.ml
@@ -50,6 +50,8 @@ type result =
 
 type diagnosis = { result : result ; request : request }
 
+type pp = (Cudf.package -> string * string * (string * string) list)
+
 module ResultHash = OcamlHash.Make (
   struct
     type t = reason
diff --git a/algo/diagnostic.mli b/algo/diagnostic.mli
new file mode 100644
index 0000000..73d6fc2
--- /dev/null
+++ b/algo/diagnostic.mli
@@ -0,0 +1,108 @@
+(**************************************************************************************)
+(*  Copyright (C) 2009 Pietro Abate <pietro.ab...@pps.jussieu.fr>              
       *)
+(*  Copyright (C) 2009 Mancoosi Project                                        
       *)
+(*                                                                             
       *)
+(*  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.                        
       *)
+(**************************************************************************************)
+
+
+(** One un-installability reason for a package *)
+type reason =
+  |Dependency of (Cudf.package * Cudf_types.vpkg list * Cudf.package list)
+  (** Not strictly a un-installability, Dependency (a,vpkglist,pkglist) is used
+      to recontruct the the dependency path from the root package to the
+      offending un-installable package *)
+  |Missing of (Cudf.package * Cudf_types.vpkg list)
+  (** Missing (a,vpkglist) means that the dependency
+      [vpkglist] of package [a] cannot be satisfied *)
+  |Conflict of (Cudf.package * Cudf.package * Cudf_types.vpkg)
+  (** Conflict (a,b,vpkg) means that the package [a] is in conflict
+      with package [b] because of vpkg *)
+
+(** The request provided to the solver *)
+type request =
+  |Package of Cudf.package
+  (** Check the installability of one package *)
+  |PackageList of Cudf.package list
+  (** Check the installability of a list of packages *)
+
+(** The result of an installability query *)
+type result =
+  |Success of (?all:bool -> unit -> Cudf.package list)
+  (** If successfull returns a function that will
+      return the installation set for the given query. Since
+      not all packages are tested for installability directly, the
+      installation set might be empty. In this case, the solver can
+      be called again to provide the real installation set 
+      using the parameter [~all:true] *)
+  |Failure of (unit -> reason list)
+  (** If unsuccessful returns a function containing the list of reason *)
+
+type diagnosis = { result : result; request : request; }
+
+module ResultHash : Hashtbl.S with type key = reason
+
+type summary = {
+  mutable missing : int;
+  mutable conflict : int;
+  mutable unique_missing : int;
+  mutable unique_conflict : int;
+  summary : Cudf.package list ref ResultHash.t;
+}
+val default_result : int -> summary
+
+val collect : summary -> diagnosis -> unit
+
+type pp = (Cudf.package -> string * string * (string * string) list)
+
+val pp_summary :
+  ?pp:(Cudf.package -> Cudf_types.pkgname * string * (string * string) list) ->
+  ?explain:bool -> unit -> Format.formatter -> summary -> unit
+
+val pp_package : ?source:bool -> pp -> Format.formatter -> Cudf.package -> unit
+
+val pp_vpkglist : pp -> Format.formatter -> Cudf_types.vpkglist -> unit
+
+val pp_dependency :
+  pp ->
+  ?label:string ->
+  Format.formatter ->
+  Cudf.package * Cudf_types.vpkglist -> unit
+
+val pp_dependencies : pp ->
+  Format.formatter -> (Cudf.package * Cudf_types.vpkglist) list list -> unit
+
+val pp_list :
+  (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a list -> unit
+
+val print_error : pp ->
+  Cudf.package -> Format.formatter -> reason list -> unit
+
+val get_installationset : ?minimal:bool -> diagnosis -> Cudf.package list
+val is_solution : diagnosis -> bool
+val default_pp : Cudf.package -> Cudf_types.pkgname * string * 'a list
+
+val print_error_human :
+  ?prefix:string -> pp ->
+  Cudf.package -> Format.formatter -> reason list -> unit
+
+val fprintf_human :
+  ?pp:pp ->
+  ?prefix:string -> Format.formatter -> diagnosis -> unit
+
+val fprintf :
+  ?pp:pp ->
+  ?failure:bool ->
+  ?success:bool ->
+  ?explain:bool -> ?minimal:bool -> Format.formatter -> diagnosis -> unit
+
+val printf :
+  ?pp:pp ->
+  ?failure:bool -> ?success:bool -> ?explain:bool -> diagnosis -> unit
+
+
diff --git a/applications/deb-buildcheck.ml b/applications/deb-buildcheck.ml
index d2ab5ae..6d02291 100644
--- a/applications/deb-buildcheck.ml
+++ b/applications/deb-buildcheck.ml
@@ -34,17 +34,22 @@ module Options = struct
   Boilerplate.InputOptions.add_options options ;;
 
   include Boilerplate.DistribOptions;;
-  Boilerplate.DistribOptions.add_options options ;;
+  let default = 
["deb-triplettable";"deb-cputable"]@Boilerplate.DistribOptions.default_options 
in
+  Boilerplate.DistribOptions.add_options ~default options ;;
 
   let dump = StdOpt.str_option ()
   let maforeign = StdOpt.store_true ()
   let noindep = StdOpt.store_true ()
   let includextra = StdOpt.store_true ()
+  let triplettable = StdOpt.str_option ()
+  let cputable = StdOpt.str_option ()
 
   open OptParser
   add options ~long_name:"defaultedMAforeign" ~help:"Convert Arch:all packages 
to Multi-Arch: foreign" maforeign;
   add options ~long_name:"DropBuildIndep" ~help:"Drop Build-Indep 
dependencies" noindep;
   add options ~long_name:"IncludeExtraSource" ~help:"Include packages with 
Extra-Source-Only:yes (dropped by default)" includextra;
+  add options ~long_name:"deb-triplettable" ~help:"Path to an architecture 
triplet table like /usr/share/dpkg/triplettable" triplettable;
+  add options ~long_name:"deb-cputable" ~help:"Path to a cpu table like 
/usr/share/dpkg/cputable" cputable;
   add options ~long_name:"dump" ~help:"dump the cudf file" dump;
 
 end
@@ -65,6 +70,18 @@ let main () =
   let hostarch = options.Debian.Debcudf.host in
   let noindep = OptParse.Opt.get Options.noindep in
 
+  let fmt = Format.std_formatter in
+  if OptParse.Opt.is_set Options.deb_native_arch then
+    Format.fprintf fmt "native-architecture: %s@." (OptParse.Opt.get 
Options.deb_native_arch)
+  else
+    fatal "You must at least specify the native architecture";
+
+  if OptParse.Opt.is_set Options.deb_foreign_archs then
+    Format.fprintf fmt "foreign-architecture: %s@." (String.concat "," 
(OptParse.Opt.get Options.deb_foreign_archs));
+
+  if OptParse.Opt.is_set Options.deb_host_arch then
+    Format.fprintf fmt "host-architecture: %s@." (OptParse.Opt.get 
Options.deb_host_arch);
+
   let filter_external_sources par =
     if (OptParse.Opt.get Options.includextra) then true
     else
@@ -72,6 +89,17 @@ let main () =
       with Not_found -> true
   in
 
+  if (OptParse.Opt.is_set Options.triplettable)
+  || OptParse.Opt.is_set Options.cputable then begin
+    let ttfile = if OptParse.Opt.is_set Options.triplettable then
+        Some (OptParse.Opt.get Options.triplettable)
+      else None in
+    let ctfile = if OptParse.Opt.is_set Options.cputable then
+        Some (OptParse.Opt.get Options.triplettable)
+      else None in
+    Architecture.read_triplettable ~ttfile ~ctfile ()
+  end;
+
   let pkglist, srclist =
     match posargs with
     |[] | [_] -> fatal 
@@ -130,18 +158,9 @@ let main () =
     end else sl
   in
 
-  let fmt = Format.std_formatter in
 
   let results = Diagnostic.default_result universe_size in
 
-  Format.fprintf fmt "native-architecture: %s@." (OptParse.Opt.get 
Options.deb_native_arch);
-
-  if OptParse.Opt.is_set Options.deb_foreign_archs then
-    Format.fprintf fmt "foreign-architecture: %s@." (String.concat "," 
(OptParse.Opt.get Options.deb_foreign_archs));
-
-  if OptParse.Opt.is_set Options.deb_host_arch then
-    Format.fprintf fmt "host-architecture: %s@." (OptParse.Opt.get 
Options.deb_host_arch);
-
   if failure || success then Format.fprintf fmt "@[<v 1>report:@,";
   let callback d = 
     if summary then Diagnostic.collect results d ;
diff --git a/applications/deb-coinstall.ml b/applications/deb-coinstall.ml
index c4131ad..cab2130 100644
--- a/applications/deb-coinstall.ml
+++ b/applications/deb-coinstall.ml
@@ -41,14 +41,19 @@ module Options = struct
   include Boilerplate.DistribOptions;;
   (* remove other not used --deb options *)
   let default = List.remove Boilerplate.DistribOptions.default_options 
"deb-host-arch" in
+  let default = ["deb-triplettable";"deb-cputable"]@default in
   Boilerplate.DistribOptions.add_options ~default options ;;
   
   let sources = StdOpt.str_option ()
   let dump = StdOpt.str_option ()
+  let triplettable = StdOpt.str_option ()
+  let cputable = StdOpt.str_option ()
 
   open OptParser
   add options ~long_name:"src" ~help:"Associate Sources file" sources;
   add options ~long_name:"dump" ~help:"dump the cudf file" dump;
+  add options ~long_name:"deb-triplettable" ~help:"Path to an architecture 
triplet table like /usr/share/dpkg/triplettable" triplettable;
+  add options ~long_name:"deb-cputable" ~help:"Path to a cpu table like 
/usr/share/dpkg/cputable" cputable;
 
 end
 
@@ -68,6 +73,18 @@ let main () =
 
   let (fg,bg) = Options.parse_cmdline (`Deb,false) posargs in
 
+  if (((OptParse.Opt.is_set Options.triplettable)
+       || OptParse.Opt.is_set Options.cputable)
+      && (OptParse.Opt.is_set Options.sources)) then begin
+    let ttfile = if OptParse.Opt.is_set Options.triplettable then
+        Some (OptParse.Opt.get Options.triplettable)
+      else None in
+    let ctfile = if OptParse.Opt.is_set Options.cputable then
+        Some (OptParse.Opt.get Options.cputable)
+      else None in
+    Architecture.read_triplettable ~ttfile ~ctfile ()
+  end;
+
   let cudftodeb_table = Hashtbl.create 30000 in
   let cudftosrc_table = Hashtbl.create 30000 in
 
diff --git a/applications/dose-tests.list b/applications/dose-tests.list
index 3407249..4a1e21e 100644
--- a/applications/dose-tests.list
+++ b/applications/dose-tests.list
@@ -79,6 +79,14 @@ Cmd: ./apt-cudf.native -e --conf doc/apt-cudf/apt-cudf.conf 
--solver=aspcud
 Type: 822
 Printer: 822
 
+Name: apt_cudf_multiarch_same_conflicts_virtual_malformed
+Group: apt-cudf
+Expected: 
tests/applications/dose-tests/multiarch-same-conflicts-virtual-malformed
+Input: tests/deb/edsp/multiarch-same-conflicts-virtual-malformed.edsp
+Cmd: ./apt-cudf.native -e --conf doc/apt-cudf/apt-cudf.conf --solver=aspcud
+Type: 822
+Printer: 822
+
 Name: apt_cudf_multiarch_same_no_deps
 Group: apt-cudf
 Expected: tests/applications/dose-tests/multiarch-same-no-deps
diff --git a/common/cudfSolver.ml b/common/cudfSolver.ml
index d5e2b4a..41958f7 100644
--- a/common/cudfSolver.ml
+++ b/common/cudfSolver.ml
@@ -96,14 +96,23 @@ let execsolver exec_pat criteria cudf =
 
   notice "%s" cmd;
 
+  (* Tell OCaml we want to capture SIGCHLD                       *)
+  (* In case the external solver fails before reading its input, *)
+  (* this will raise a Unix.EINTR error which is captured below  *)
+  Sys.set_signal Sys.sigchld (Sys.Signal_handle (fun _ -> ()));
+
   let env = Unix.environment () in
   let (cin,cout,cerr) = Unix.open_process_full cmd env in
 
   Util.Timer.start timer3;
-  let solver_in_fd = Unix.openfile solver_in [Unix.O_WRONLY;Unix.O_SYNC] 0 in
-  let oc = Unix.out_channel_of_descr solver_in_fd in
-  Cudf_printer.pp_cudf oc cudf;
-  close_out oc ;
+  begin
+    try
+      let solver_in_fd = Unix.openfile solver_in [Unix.O_WRONLY;Unix.O_SYNC] 0 
in
+      let oc = Unix.out_channel_of_descr solver_in_fd in
+      Cudf_printer.pp_cudf oc cudf;
+      close_out oc
+    with Unix.Unix_error (Unix.EINTR,_,_) ->  info "Interrupted by EINTR while 
executing command '%s'" cmd
+  end;
   Util.Timer.stop timer3 ();
 
   Util.Timer.start timer4;
diff --git a/configure b/configure
index 3a613fd..36e5014 100755
--- a/configure
+++ b/configure
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for dose3 3.1.5.
+# Generated by GNU Autoconf 2.69 for dose3 3.2-rc2.
 #
-# Report bugs to <pietro.ab...@pps.jussieu.fr>.
+# Report bugs to <pietro.ab...@pps.univ-paris-diderot.fr>.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -267,8 +267,8 @@ fi
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
     $as_echo "$0: Please tell bug-autoc...@gnu.org and
-$0: pietro.ab...@pps.jussieu.fr about your system,
-$0: including any error possibly output before this
+$0: pietro.ab...@pps.univ-paris-diderot.fr about your
+$0: system, including any error possibly output before this
 $0: message. Then install a modern shell, or manually run
 $0: the script under such a shell if you do have one."
   fi
@@ -580,9 +580,9 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='dose3'
 PACKAGE_TARNAME='dose3'
-PACKAGE_VERSION='3.1.5'
-PACKAGE_STRING='dose3 3.1.5'
-PACKAGE_BUGREPORT='pietro.ab...@pps.jussieu.fr'
+PACKAGE_VERSION='3.2-rc2'
+PACKAGE_STRING='dose3 3.2-rc2'
+PACKAGE_BUGREPORT='pietro.ab...@pps.univ-paris-diderot.fr'
 PACKAGE_URL=''
 
 # Factoring default headers for most tests.
@@ -1307,7 +1307,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures dose3 3.1.5 to adapt to many kinds of systems.
+\`configure' configures dose3 3.2-rc2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1368,7 +1368,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of dose3 3.1.5:";;
+     short | recursive ) echo "Configuration of dose3 3.2-rc2:";;
    esac
   cat <<\_ACEOF
 
@@ -1402,7 +1402,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to <pietro.ab...@pps.jussieu.fr>.
+Report bugs to <pietro.ab...@pps.univ-paris-diderot.fr>.
 _ACEOF
 ac_status=$?
 fi
@@ -1465,7 +1465,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-dose3 configure 3.1.5
+dose3 configure 3.2-rc2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1666,9 +1666,9 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf 
documentation" >&2;}
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" 
>&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the 
compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ------------------------------------------ ##
-## Report this to pietro.ab...@pps.jussieu.fr ##
-## ------------------------------------------ ##"
+( $as_echo "## ----------------------------------------------------- ##
+## Report this to pietro.ab...@pps.univ-paris-diderot.fr ##
+## ----------------------------------------------------- ##"
      ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
@@ -1721,7 +1721,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by dose3 $as_me 3.1.5, which was
+It was created by dose3 $as_me 3.2-rc2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -6521,7 +6521,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by dose3 $as_me 3.1.5, which was
+This file was extended by dose3 $as_me 3.2-rc2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6568,13 +6568,13 @@ Usage: $0 [OPTION]... [TAG]...
 Configuration files:
 $config_files
 
-Report bugs to <pietro.ab...@pps.jussieu.fr>."
+Report bugs to <pietro.ab...@pps.univ-paris-diderot.fr>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; 
s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-dose3 config.status 3.1.5
+dose3 config.status 3.2-rc2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index e14a0dd..a98a3d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(dose3, 3.2-rc1, pietro.ab...@pps.jussieu.fr)
+AC_INIT(dose3, 3.2-rc2, pietro.ab...@pps.univ-paris-diderot.fr)
 
 AC_PROG_OCAML
 if test "$OCAMLC" = "no"; then
diff --git a/deb/architecture.ml b/deb/architecture.ml
index 03e1601..1d4c580 100644
--- a/deb/architecture.ml
+++ b/deb/architecture.ml
@@ -15,23 +15,136 @@
 (*                                                                            
*)
 
(******************************************************************************)
 
-let src_matches_arch source host =
-  (* matching of an OS or CPU component *)
-  let component_matches source host = (source="any" || source=host)
-  (* split an architecture string into OS and CPU, linux is default when
-     no OS is given. *)
-  and split arch =
-    try
-      let dash=String.index arch '-' in
-      (String.sub arch 0 dash,
-       String.sub arch (dash+1) ((String.length arch)-dash-1))
-    with
-       Not_found -> ("linux",arch)
-  in
-  if source="all" || source="any"  then true
-  else
-    let source_os,source_cpu = split source
-    and host_os,host_cpu = split host in
-    (component_matches source_os host_os) &&
-      (component_matches source_cpu host_cpu)
+module Pcre = Re_pcre
+open ExtLib
+open Common
+
+include Util.Logging(struct let label = __FILE__ end) ;;
+
+(* first column of /usr/share/dpkg/cputable *)
+let cpulist = ref [ "i386"; "ia64"; "alpha"; "amd64"; "armeb"; "arm"; "arm64"; 
"avr32";
+                    "hppa"; "m32r"; "m68k"; "mips"; "mipsel"; "mips64"; 
"mips64el or1k"; "powerpc";
+                    "ppc64"; "ppc64el"; "s390"; "s390x"; "sh3"; "sh3eb"; 
"sh4"; "sh4eb"; "sparc";
+                    "sparc64" ]
+
+(* from /usr/share/dpkg/triplettable 
+ *
+ *   debian triplet (abi,os,cpu)  debian arch *)
+let triplettable = [
+  (("uclibceabi","linux","arm"),     "uclibc-linux-armel");
+  (("uclibc","linux","<cpu>"),       "uclibc-linux-<cpu>");
+  (("musleabihf","linux","arm"),     "musl-linux-armhf");
+  (("musl","linux","<cpu>"),         "musl-linux-<cpu>");
+  (("gnueabihf","linux","arm"),      "armhf");
+  (("gnueabi","linux","arm"),        "armel");
+  (("gnuabin32","linux","mips64el"), "mipsn32el");
+  (("gnuabin32","linux","mips64"),   "mipsn32");
+  (("gnuabi64","linux","mips64el"),  "mips64el");
+  (("gnuabi64","linux","mips64"),    "mips64");
+  (("gnuspe","linux","powerpc"),     "powerpcspe");
+  (("gnux32","linux","amd64"),       "x32");
+  (("gnulp","linux","i386"),         "lpia");
+  (("gnu","linux","<cpu>"),          "<cpu>");
+  (("gnu","kfreebsd","<cpu>"),       "kfreebsd-<cpu>");
+  (("gnu","knetbsd","<cpu>"),        "knetbsd-<cpu>");
+  (("gnu","kopensolaris","<cpu>"),   "kopensolaris-<cpu>");
+  (("gnu","hurd","<cpu>"),           "hurd-<cpu>");
+  (("bsd","freebsd","<cpu>"),        "freebsd-<cpu>");
+  (("bsd","openbsd","<cpu>"),        "openbsd-<cpu>");
+  (("bsd","netbsd","<cpu>"),         "netbsd-<cpu>");
+  (("bsd","darwin","<cpu>"),         "darwin-<cpu>");
+  (("sysv","solaris","<cpu>"),       "solaris-<cpu>");
+  (("uclibceabi","uclinux","arm"),   "uclinux-armel");
+  (("uclibc","uclinux","<cpu>"),     "uclinux-<cpu>");
+  (("tos","mint","m68k"),            "mint-m68k");
+  (("gnu","linux","<cpu>"),          "linux-<cpu>") (* this entry is not from 
/usr/share/dpkg/triplettable *)
+  (* the "linux-" prefix is commented in scripts/Dpkg/Arch.pm with "XXX: Might 
disappear in the future, not sure yet." *)
+]
+
+let debarch_to_debtriplet = Hashtbl.create ((List.length 
triplettable)*(List.length !cpulist))
+let triplettable_done = ref false
+
+let read_triplettable ?(ttfile=None) ?(ctfile=None) () =
+  if !triplettable_done && ttfile = None && ctfile = None then () else begin
+    (* add additional cpus *)
+    begin match ctfile with
+      | Some fn -> begin
+          let ic = open_in fn in
+          (* to stay most compatible with dpkg, it would be best to use its
+           * regex from from scripts/Dpkg/Arch.pm to parse this file.
+           * Unfortunately Re.pcre doesnt support look-ahead/look-behind
+           * assertions *)
+          let aux line =
+            if line.[0] = '#' || not (String.contains line '\t') then ()
+            else begin
+              let spacei = String.index line '\t' in
+              let cpu = String.sub line 0 spacei in
+              if not (List.mem cpu !cpulist) then cpulist := cpu::!cpulist;
+            end;
+          in
+          List.iter aux (Std.input_list ic);
+          close_in ic;
+        end
+      | None -> () end;
+    (* fill from hardcoded values *)
+    List.iter (fun ((abi,os,cpu),debarch) ->
+        if cpu = "<cpu>" then begin
+          List.iter (fun c ->
+              let dt = (abi,os,c) in
+              let _,da = String.replace ~str:debarch ~sub:"<cpu>" ~by:c in
+              Hashtbl.replace debarch_to_debtriplet da dt
+            ) !cpulist
+        end else begin
+          Hashtbl.replace debarch_to_debtriplet debarch (abi,os,cpu)
+        end
+      ) triplettable;
+    (* fill from supplied file *)
+    begin match ttfile with
+      | Some fn -> begin
+          let ic = open_in fn in
+          (* to stay most compatible with dpkg, it would be best to use its
+           * regex from from scripts/Dpkg/Arch.pm to parse this file.
+           * Unfortunately Re.pcre doesnt support look-ahead/look-behind
+           * assertions *)
+          let aux line =
+            if line.[0] = '#' || not (String.contains line '\t') then ()
+            else begin
+              let spaceli = String.index line '\t' in
+              let spaceri = String.rindex line '\t' in
+              let debtriplet = String.sub line 0 spaceli in
+              let debarch = String.sub line (spaceri+1) ((String.length 
line)-spaceri-1) in
+              match String.nsplit debtriplet "-" with
+              | [abi;os;cpu] -> Hashtbl.replace debarch_to_debtriplet debarch 
(abi,os,cpu)
+              | _ -> fatal "Cannot parse debtriplet: %s" debtriplet
+            end
+          in
+          List.iter aux (Std.input_list ic);
+          close_in ic;
+        end
+      | None -> () end;
+    triplettable_done := true;
+  end
+;;
+
+let src_matches_arch alias real =
+  read_triplettable ();
+  if alias=real || alias="any" || alias="all" then true else begin
+    let real = Hashtbl.find_option debarch_to_debtriplet real in
+    let alias = match String.nsplit alias "-" with
+      | ["any";os;cpu] ->  Some ("any",os,cpu)
+      | [abi;"any";cpu] -> Some (abi,"any",cpu)
+      | [abi;os;"any"] ->  Some (abi,os,"any")
+      | ["any";cpu] ->     Some ("any","any",cpu)
+      | [os;"any"] ->      Some ("any",os,"any")
+      | ["any"] ->         Some ("any","any","any")
+      | _ -> begin
+          (* only look up in the table if none of the parts is "any" *)
+          Hashtbl.find_option debarch_to_debtriplet alias
+        end
+    in
+    match real,alias with
+    | Some (r1,r2,r3), Some (a1,a2,a3) ->
+      ((a1=r1 || a1="any") && (a2=r2 || a2="any") && (a3=r3 || a3="any"))
+    | _ -> false
+  end
 ;;
diff --git a/deb/architecture.mli b/deb/architecture.mli
index 4f12995..656f646 100644
--- a/deb/architecture.mli
+++ b/deb/architecture.mli
@@ -26,3 +26,10 @@
 *)
 val src_matches_arch: string -> string -> bool
 
+(** fill the lookup table mapping debian architectures to debian triplets
+ *  this function is called by src_matches_arch without supplying anything
+ *  for the optional ttfile and ctfile arguments. If they are not None,
+ *  then they can point to a file like /usr/share/dpkg/triplettable or
+ *  /usr/share/dpkg/cputable respectively.
+ *)
+val read_triplettable: ?ttfile:(string option) -> ?ctfile:(string option) -> 
unit -> unit
diff --git a/deb/debcudf.ml b/deb/debcudf.ml
index c6dfe47..ebfc168 100644
--- a/deb/debcudf.ml
+++ b/deb/debcudf.ml
@@ -463,34 +463,33 @@ let tocudf tables ?(options=default_options) 
?(inst=false) pkg =
             bind (options.native::options.foreign) (fun arch ->
               let l =
                 bind originalconflicts (fun ((n,a),c) ->
-                 debug "M-A-Same: examining pkg %s, conflicting with package 
%s (self confl = %b)" pkg.name n (selfconflict ((n,a),c));
-                 match realpackage n, selfconflict ((n,a),c) with
-                   true,false  -> [((n,a),c)]     (* real conflict *)
-                 | true, true  -> []            (* self conflict on real 
package, drop it *)
-                 | false,false -> 
-                     begin
-                       match c with 
-                         None -> [((n,a),None)] (* virtual conflict *)
-                       | _ -> []                (* real conflict on 
non-existent package, drop it *)
-                     end
-                 | false, true ->               (* a virtual package and a 
self conflict *)
-                    begin
-                     debug "M-A-Same: pkg %s has a self-conflict via virtual 
package: %s" pkg.name n;
-                     try
-                       List.filter_map 
-                         (fun pn ->
-                            if pn <> pkg.name 
-                           then (debug "M-A-Same: adding conflict on real 
package %s for %s" pn pkg.name; Some((pn,a),None) )
-                           else None
-                         ) (SSet.elements !(Util.StringHashtbl.find 
tables.virtual_table n))
-                      with Not_found -> []
-                   end
+                  debug "M-A-Same: examining pkg %s, conflicting with package 
%s (self confl = %b)" pkg.name n (selfconflict ((n,a),c));
+                  match realpackage n, selfconflict ((n,a),c) with
+                  |true,false  -> [((n,a),c)]  (* real conflict *)
+                  |true, true  -> []           (* self conflict on real 
package, drop it *)
+                  |false,false ->
+                      begin match c with 
+                      |None -> [((n,a),None)] (* virtual conflict *)
+                      |_ -> []                (* real conflict on non-existent 
package, drop it *)
+                      end
+                  |false, true ->              (* a virtual package and a self 
conflict *)
+                      begin
+                        debug "M-A-Same: pkg %s has a self-conflict via 
virtual package: %s" pkg.name n;
+                        try
+                          List.filter_map (fun pn ->
+                            if pn <> pkg.name then begin
+                              debug "M-A-Same: adding conflict on real package 
%s for %s" pn pkg.name; 
+                              Some((pn,a),None)
+                            end else None
+                          ) (SSet.elements !(Util.StringHashtbl.find 
tables.virtual_table n))
+                        with Not_found -> []
+                      end
                 )
               in
-             debug "M-A-Same : %s produces (Debian) conflicts: %s" pkg.name 
(Printer.string_of_vpkglist l);
+              debug "M-A-Same : %s produces (Debian) conflicts: %s" pkg.name 
(Printer.string_of_vpkglist l);
               let l' = add_arch_l options.native arch (loadl tables l) in
-             debug "M-A-Same : %s produces (CUDF) conflicts: %s" pkg.name 
(Cudf_types_pp.string_of_vpkglist l');
-             l'
+              debug "M-A-Same : %s produces (CUDF) conflicts: %s" pkg.name 
(Cudf_types_pp.string_of_vpkglist l');
+              l'
             )
       in
       multiarchconflicts @ multiarchconstraints
diff --git a/deb/printer.ml b/deb/printer.ml
index 8a75ba3..60474d0 100644
--- a/deb/printer.ml
+++ b/deb/printer.ml
@@ -68,6 +68,8 @@ let pp_package oc pkg =
     Printf.fprintf oc "Provides: %a\n" pp_vpkglist pkg.provides;
   if List.length pkg.depends > 0 then
     Printf.fprintf oc "Depends: %a\n" pp_vpkgformula pkg.depends;
+  if List.length pkg.pre_depends > 0 then
+    Printf.fprintf oc "Pre-Depends: %a\n" pp_vpkgformula pkg.pre_depends;
   if List.length pkg.conflicts > 0 then
     Printf.fprintf oc "Conflicts: %a\n" pp_vpkglist pkg.conflicts;
   if List.length pkg.breaks > 0 then
diff --git a/deb/sources.ml b/deb/sources.ml
index a3c6415..73c2bb0 100644
--- a/deb/sources.ml
+++ b/deb/sources.ml
@@ -218,7 +218,7 @@ let sources2packages ?(profiles=false) ?(noindep=false) 
?(src="src") buildarch h
      * and crossbuild-essential-$hostarch. When compiling natively, implicitly
      * depend on build-essential *)
     let build_essential = if buildarch<>hostarch then
-      [[(("build-essential", Some buildarch), 
None)];[(("crossbuild-essential-"^hostarch, None), None)]]
+      [[(("build-essential", Some buildarch), 
None)];[(("crossbuild-essential-"^hostarch, Some buildarch), None)]]
     else
       [[(("build-essential", Some buildarch), None)]]
     in
diff --git a/deb/tests.ml b/deb/tests.ml
index 0f8687f..365ff44 100644
--- a/deb/tests.ml
+++ b/deb/tests.ml
@@ -138,7 +138,11 @@ let architecture_test_cases = [
   ("linux-any", "netbsd-alpha", false);
   ("any-any", "linux-i386", true);     (* OS and CPU pattern *)
   ("any-any", "hurd-i386", true);
-  ("any-any", "amd64", true)
+  ("any-any", "amd64", true);
+  ("any-arm", "armhf", true);          (* arch name is not equal cpu name *)
+  ("any-i386", "lpia", true);
+  ("any-amd64", "x32", true);
+  ("any-powerpc", "powerpcspe", true)
 ];;
 
 let test_architecture_matching =
@@ -531,8 +535,8 @@ let test_mapping =
 
 (* Useful test functions *)
 
-let returns_result function_to_test expected_result =
-  (fun args () -> assert_equal (function_to_test args) expected_result)
+let returns_result ?(printer=(fun _ -> "(FIXME)")) function_to_test 
expected_result =
+  (fun args () -> assert_equal ~printer (function_to_test args) 
expected_result)
 and raises_failure function_to_test failure_text =
   (fun args () -> assert_raises (Failure failure_text) (fun () -> 
function_to_test args) )
 
@@ -792,16 +796,18 @@ let test_sources2packages =
   let data = IO.input_string test_sources_input in
   let packagelist = Sources.parse_sources_in "" data in
   let hostarch = "amd64" in
-  let sources = Sources.sources2packages ~profiles:true hostarch packagelist in
+  let buildarch = "amd64" in
+  let sources = Sources.sources2packages ~profiles:true buildarch hostarch 
packagelist in
   let function_to_test src =
     let src = List.find (fun s -> s.Packages.name = src) sources in
     src.Packages.depends
   in
-  let returns = returns_result function_to_test in
+  let printer = Printer.string_of_vpkgformula in
+  let returns = returns_result ~printer function_to_test in
   [
     (
       "any/native", "src:source1", returns [
-        [(("build-essential", Some "native"), None)];
+        [(("build-essential", Some hostarch), None)];
         [(("bin1", None), None)];
         [(("bin2", Some "any"), None)];
         [(("bin3", Some "native"), None)]
@@ -809,14 +815,14 @@ let test_sources2packages =
     );
     (
       "default", "src:source2", returns [
-        [(("build-essential", Some "native"), None)];
+        [(("build-essential", Some hostarch), None)];
         [(("bin1", None), None)];
         [(("bin2", None), None)]
       ]
     );
     (
       "stage1", "src-stage1:source2", returns [
-        [(("build-essential", Some "native"), None)];
+        [(("build-essential", Some hostarch), None)];
         [
           (("bin2", None), None);
           (("bin3", None), None)
@@ -825,7 +831,7 @@ let test_sources2packages =
     );
     (
       "indep", "src:source3", returns [
-        [(("build-essential", Some "native"), None)];
+        [(("build-essential", Some hostarch), None)];
         [(("bin3", Some "native"), None)];
         [(("bin1",None), None)];
         [(("bin2",None), None)]
diff --git a/doc/manpages/ceve.pod b/doc/manpages/ceve.pod
index 97d5404..8db8182 100644
--- a/doc/manpages/ceve.pod
+++ b/doc/manpages/ceve.pod
@@ -50,7 +50,8 @@ as --rcone=I<pkgspec>.I<>
 =item B<--depth >I<n> 
 
 In combination with the B<-e>, B<-c> or B<-r> options, this
-specifies the maximum depth for the transitive closure. 
+specifies the maximum depth for the transitive closure.
+ 
 =item B<-T >I<format> 
 
 Specifies the output format to use. Possible values are B<dot> for a graph

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-ocaml-maint/packages/dose3.git

_______________________________________________
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