public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-ml/opam-solver/, dev-ml/opam-solver/files/
@ 2021-06-06 23:55 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2021-06-06 23:55 UTC (permalink / raw
  To: gentoo-commits

commit:     44a31e3306b4435bc9250118a8f36c2c8b75bad1
Author:     Hank Leininger <hlein <AT> korelogic <DOT> com>
AuthorDate: Wed May  5 17:33:11 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun  6 23:55:15 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44a31e33

dev-ml/opam-solver: patch for dose3-6.x compat

Lifted from Debian, see https://bugs.debian.org/982733

Signed-off-by: Hank Leininger <hlein <AT> korelogic.com>
Closes: https://bugs.gentoo.org/788265
Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/debian-Port-to-Dose3-6.0.1.patch         | 142 +++++++++++++++++++++
 dev-ml/opam-solver/opam-solver-2.0.8-r1.ebuild     |  42 ++++++
 2 files changed, 184 insertions(+)

diff --git a/dev-ml/opam-solver/files/debian-Port-to-Dose3-6.0.1.patch b/dev-ml/opam-solver/files/debian-Port-to-Dose3-6.0.1.patch
new file mode 100644
index 00000000000..a8af27416df
--- /dev/null
+++ b/dev-ml/opam-solver/files/debian-Port-to-Dose3-6.0.1.patch
@@ -0,0 +1,142 @@
+From: Mehdi Dogguy <mehdi@debian.org>
+Date: Sun, 28 Feb 2021 19:27:24 +0100
+Subject: Port to Dose3 6.0.1
+
+---
+ src/client/opamAdminCheck.ml       | 2 ++
+ src/client/opamAdminRepoUpgrade.ml | 2 ++
+ src/solver/opamBuiltinMccs.ml.real | 2 +-
+ src/solver/opamCudf.ml             | 5 ++++-
+ src/solver/opamCudf.mli            | 4 ++--
+ src/solver/opamCudfSolver.ml       | 4 ++--
+ src/solver/opamSolver.ml           | 4 +++-
+ 7 files changed, 16 insertions(+), 7 deletions(-)
+
+diff --git a/src/client/opamAdminCheck.ml b/src/client/opamAdminCheck.ml
+index 05543a2..f23bfc4 100644
+--- a/src/client/opamAdminCheck.ml
++++ b/src/client/opamAdminCheck.ml
+@@ -8,6 +8,8 @@
+ (*                                                                        *)
+ (**************************************************************************)
+ 
++module Algo = Dose_algo
++
+ open OpamTypes
+ open OpamPackage.Set.Op
+ 
+diff --git a/src/client/opamAdminRepoUpgrade.ml b/src/client/opamAdminRepoUpgrade.ml
+index 0be53b2..635e792 100644
+--- a/src/client/opamAdminRepoUpgrade.ml
++++ b/src/client/opamAdminRepoUpgrade.ml
+@@ -8,6 +8,8 @@
+ (*                                                                        *)
+ (**************************************************************************)
+ 
++module Algo = Dose_algo
++
+ open OpamTypes
+ open OpamProcess.Job.Op
+ open OpamStd.Option.Op
+diff --git a/src/solver/opamBuiltinMccs.ml.real b/src/solver/opamBuiltinMccs.ml.real
+index ab39ab3..2b41982 100644
+--- a/src/solver/opamBuiltinMccs.ml.real
++++ b/src/solver/opamBuiltinMccs.ml.real
+@@ -35,7 +35,7 @@ let call solver_backend ext ~criteria ?timeout cudf =
+       ~verbose:OpamCoreConfig.(!r.debug_level >= 2)
+       ?timeout criteria cudf
+   with
+-  | None -> raise Common.CudfSolver.Unsat
++  | None -> raise Dose_common.CudfSolver.Unsat
+   | Some (preamble, univ) -> Some preamble, univ
+   | exception Mccs.Timeout -> raise Timeout
+ 
+diff --git a/src/solver/opamCudf.ml b/src/solver/opamCudf.ml
+index e07ff54..ad7293c 100644
+--- a/src/solver/opamCudf.ml
++++ b/src/solver/opamCudf.ml
+@@ -9,6 +9,9 @@
+ (*                                                                        *)
+ (**************************************************************************)
+ 
++module Common = Dose_common
++module Algo = Dose_algo
++
+ open OpamTypes
+ open OpamTypesBase
+ 
+@@ -634,7 +637,7 @@ let call_external_solver ~version_map univ req =
+       let r =
+         Algo.Depsolver.check_request_using
+           ~call_solver:(OpamSolverConfig.call_solver ~criteria)
+-          ~criteria ~explain:true cudf_request
++          ~explain:true cudf_request
+       in
+       log "Solver call done in %.3f" (chrono ());
+       r
+diff --git a/src/solver/opamCudf.mli b/src/solver/opamCudf.mli
+index cb8158d..c928ccf 100644
+--- a/src/solver/opamCudf.mli
++++ b/src/solver/opamCudf.mli
+@@ -24,7 +24,7 @@ module Map: OpamStd.MAP with type key = Cudf.package
+ module Graph: sig
+   (** Graph of cudf packages *)
+ 
+-  include module type of Algo.Defaultgraphs.PackageGraph.G
++  include module type of Dose_algo.Defaultgraphs.PackageGraph.G
+ 
+   (** Build a graph from a CUDF universe. Warning: dependency edges are towards
+       the dependency, which is the reverse of what happens in the action
+@@ -180,7 +180,7 @@ val string_of_vpkgs: Cudf_types.vpkg list -> string
+ 
+ val make_conflicts:
+   version_map:int package_map -> Cudf.universe ->
+-  Algo.Diagnostic.diagnosis -> ('a, conflict) result
++  Dose_algo.Diagnostic.diagnosis -> ('a, conflict) result
+ val cycle_conflict:
+   version_map:int package_map -> Cudf.universe ->
+   string list list -> ('a, conflict) result
+diff --git a/src/solver/opamCudfSolver.ml b/src/solver/opamCudfSolver.ml
+index 03486f1..2651373 100644
+--- a/src/solver/opamCudfSolver.ml
++++ b/src/solver/opamCudfSolver.ml
+@@ -57,7 +57,7 @@ let call_external_solver command ~criteria ?timeout (_, universe,_ as cudf) =
+     in
+     OpamFilename.remove solver_in;
+     if not (OpamFilename.exists solver_out) then
+-      raise (Common.CudfSolver.Error "no output")
++      raise (Dose_common.CudfSolver.Error "no output")
+     else if
+       (let ic = OpamFilename.open_in solver_out in
+        try
+@@ -65,7 +65,7 @@ let call_external_solver command ~criteria ?timeout (_, universe,_ as cudf) =
+          i = "FAIL"
+        with End_of_file -> close_in ic; false)
+     then
+-      raise Common.CudfSolver.Unsat
++      raise Dose_common.CudfSolver.Unsat
+     else
+     let r =
+       Cudf_parser.load_solution_from_file
+diff --git a/src/solver/opamSolver.ml b/src/solver/opamSolver.ml
+index 3748e75..bbf995f 100644
+--- a/src/solver/opamSolver.ml
++++ b/src/solver/opamSolver.ml
+@@ -9,6 +9,8 @@
+ (*                                                                        *)
+ (**************************************************************************)
+ 
++module Algo = Dose_algo
++
+ open OpamTypes
+ open OpamTypesBase
+ open OpamPackage.Set.Op
+@@ -84,7 +86,7 @@ let cudf_versions_map universe packages =
+     pmap OpamPackage.Map.empty
+ 
+ let name_to_cudf name =
+-  Common.CudfAdd.encode (OpamPackage.Name.to_string name)
++  Dose_common.CudfAdd.encode (OpamPackage.Name.to_string name)
+ 
+ let constraint_to_cudf version_map name (op,v) =
+   let nv = OpamPackage.create name v in

diff --git a/dev-ml/opam-solver/opam-solver-2.0.8-r1.ebuild b/dev-ml/opam-solver/opam-solver-2.0.8-r1.ebuild
new file mode 100644
index 00000000000..d520ec1b78c
--- /dev/null
+++ b/dev-ml/opam-solver/opam-solver-2.0.8-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit dune
+
+DESCRIPTION="opam solver"
+HOMEPAGE="https://opam.ocaml.org/ https://github.com/ocaml/opam"
+SRC_URI="https://github.com/ocaml/opam/archive/${PV/_/-}.tar.gz -> opam-${PV}.tar.gz"
+S="${WORKDIR}/opam-${PV/_/-}"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64"
+IUSE="+ocamlopt test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	~dev-ml/opam-format-${PV}:=
+	dev-ml/opam-file-format:=
+	dev-ml/re:=
+	>=dev-ml/mccs-1.1.4:=
+	>=dev-ml/dose3-6.0:=
+	dev-ml/cudf:=
+"
+DEPEND="${RDEPEND}
+	test? ( dev-ml/opam-client )"
+
+# Cherry-picked from https://deb.debian.org/debian/pool/main/o/opam/opam_2.0.8-1.debian.tar.xz
+PATCHES=( "${FILESDIR}/debian-Port-to-Dose3-6.0.1.patch" )
+
+src_prepare() {
+	default
+	cat <<- EOF >> "${S}/dune"
+		(env
+		 (dev
+		  (flags (:standard -warn-error -3-9-33)))
+		 (release
+		  (flags (:standard -warn-error -3-9-33))))
+	EOF
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-ml/opam-solver/, dev-ml/opam-solver/files/
@ 2021-10-02 21:10 Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2021-10-02 21:10 UTC (permalink / raw
  To: gentoo-commits

commit:     7e71a5c252b35f23048b617671b15e82e54f3dc9
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  2 05:51:11 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct  2 21:10:33 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e71a5c2

dev-ml/opam-solver: add 2.1.0

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-ml/opam-solver/Manifest                        |   2 +
 .../files/opam-solver-2.1.0-dose3-6.patch          | 526 +++++++++++++++++++++
 dev-ml/opam-solver/opam-solver-2.1.0.ebuild        |  46 ++
 3 files changed, 574 insertions(+)

diff --git a/dev-ml/opam-solver/Manifest b/dev-ml/opam-solver/Manifest
index a8c97c7a26f..0b145947da0 100644
--- a/dev-ml/opam-solver/Manifest
+++ b/dev-ml/opam-solver/Manifest
@@ -1,2 +1,4 @@
 DIST opam-2.0.8.tar.gz 643221 BLAKE2B 66510a18285f315fe95665e8ba2f334dd44211c716543cdc25f2951a7dfe537f115981046e5963fd08deea4c76f5672fa7cf8e7af2274a713a3165bdd0bac8c2 SHA512 14737dc994be2c54dfeaf2658d3713178033e1bc2b4b845a58b4bfc118bbbf12b502924add0ae32b4b2b6c1944462e5ee7143df3de362d9ee39573249d013bc9
 DIST opam-2.0.9.tar.gz 644429 BLAKE2B d96ee79685a8ee8ff82c7570a747c80e38d86e513736a27904a4e471d1eaf432db72998251ac786cb8fbf1ad425fff42b772c5d26934e0929aae75c0946d4659 SHA512 0d8ee19ac0f3df9de4fd9cfa8daab1f7228f090f5e2e7e26bedf24d8c2ab377aade95048f2d7cd9ee9dbbe738729e26dc99f41f730fa2252df74953362464a22
+DIST opam-2.1.0-dose3-6.patch.xz 5896 BLAKE2B f605064ebae7d327895729962a345a3c679519895aa2568f0c2d199d4ba9d6ae948a4fc418cfd26cc65079eb6ef3545f24a35e08c969d215529664a80d0c9147 SHA512 e00da74d7baef62319e884e3a05112bcf86a02d887c274bd15fb0d15bb8198e9a37a421f388bec3fce198e7a1b4d37024b18609dc65978c6ee8a7889df9bd608
+DIST opam-2.1.0.tar.gz 825966 BLAKE2B 42ab8ad2825e4e167618ece7bd2ce77ff055d584039fe2f644fa1c3e99d175cc7047f32bda53599af4fb177d844970883125cebca823024d1bc43a34857f20c5 SHA512 c0060e609c49a12dc8f64accef990aa593db818b72df3984fb9b4b22d8678b46c515916c84134a62dab614c716b61788eadc954d295f32c1f27d38aec22b3edf

diff --git a/dev-ml/opam-solver/files/opam-solver-2.1.0-dose3-6.patch b/dev-ml/opam-solver/files/opam-solver-2.1.0-dose3-6.patch
new file mode 100644
index 00000000000..fd613125eed
--- /dev/null
+++ b/dev-ml/opam-solver/files/opam-solver-2.1.0-dose3-6.patch
@@ -0,0 +1,526 @@
+https://github.com/ocaml/opam/commit/9082b989f1c039a006fd58672de41f620a330e80
+https://github.com/ocaml/opam/commit/2e03a20abedb40cccb5295361649c64a8df46505
+
+From: Kate <kit.ty.kate@disroot.org>
+Date: Fri, 29 Jan 2021 02:56:21 +0000
+Subject: [PATCH] Make opam-solver compatible with dose3 6.0
+
+Dose_algo.Depsolver.check_request_using actually never used its ~criteria argument(!!) :exploding_head:
+--- a/src/solver/opamBuiltin0install.ml.real
++++ b/src/solver/opamBuiltin0install.ml.real
+@@ -115,4 +115,4 @@ let call ~criteria ?timeout:_ (preamble, universe, request) =
+   | Error problem ->
+     log "No solution. Solve took %.2f s" (timer ());
+     log ~level:3 "%a" (OpamConsole.slog Opam_0install_cudf.diagnostics) problem;
+-    raise Common.CudfSolver.Unsat
++    raise Dose_common.CudfSolver.Unsat
+--- a/src/solver/opamBuiltinMccs.ml.real
++++ b/src/solver/opamBuiltinMccs.ml.real
+@@ -42,7 +42,7 @@ let call solver_backend ext ~criteria ?timeout cudf =
+       ~verbose:OpamCoreConfig.(abs !r.debug_level >= 2)
+       ?timeout criteria cudf
+   with
+-  | None -> raise Common.CudfSolver.Unsat
++  | None -> raise Dose_common.CudfSolver.Unsat
+   | Some (preamble, univ) -> Some preamble, univ
+   | exception Mccs.Timeout -> raise (Timeout None)
+ 
+--- a/src/solver/opamBuiltinZ3.ml.real
++++ b/src/solver/opamBuiltinZ3.ml.real
+@@ -416,7 +416,7 @@ let call ~criteria ?timeout (preamble, universe, _ as cudf) =
+   match Z3.Optimize.check opt with
+   | UNSATISFIABLE ->
+     log "UNSAT";
+-    raise Common.CudfSolver.Unsat
++    raise Dose_common.CudfSolver.Unsat
+   | UNKNOWN ->
+     log "UNKNOWN";
+     (try
+@@ -433,7 +433,7 @@ let call ~criteria ?timeout (preamble, universe, _ as cudf) =
+     in
+     Some preamble, universe
+   (* with
+-   * | (Timeout | Common.CudfSolver.Unsat | Failure _) as e -> raise e
++   * | (Timeout | Dose_common.CudfSolver.Unsat | Failure _) as e -> raise e
+    * | e ->
+    *   OpamConsole.error "Z3 error: %s" (Printexc.to_string e);
+    *   OpamConsole.errmsg "%s" (Printexc.get_backtrace ());
+--- a/src/solver/opamCudf.ml
++++ b/src/solver/opamCudf.ml
+@@ -24,7 +24,7 @@ let s_pinned = "pinned"
+ let s_version_lag = "version-lag"
+ 
+ let opam_invariant_package_name =
+-  Common.CudfAdd.encode "=opam-invariant"
++  Dose_common.CudfAdd.encode "=opam-invariant"
+ 
+ let opam_invariant_package_version = 1
+ 
+@@ -55,7 +55,7 @@ let cudfnv2opam ?version_map ?cudf_universe (name,v) =
+   match nv with
+   | Some nv -> nv
+   | None ->
+-    let name = OpamPackage.Name.of_string (Common.CudfAdd.decode name) in
++    let name = OpamPackage.Name.of_string (Dose_common.CudfAdd.decode name) in
+     match version_map with
+     | Some vmap ->
+       let nvset =
+@@ -394,7 +394,7 @@ let of_json = Json.package_of_json
+ (* Graph of cudf packages *)
+ module Package = struct
+   type t = Cudf.package
+-  include Common.CudfAdd
++  include Dose_common.CudfAdd
+   let to_string = string_of_package
+   let name_to_string t = t.Cudf.package
+   let version_to_string t = string_of_int t.Cudf.version
+@@ -414,7 +414,7 @@ exception Solver_failure of string
+ exception Cyclic_actions of Action.t list list
+ 
+ type conflict_case =
+-  | Conflict_dep of (unit -> Algo.Diagnostic.reason list)
++  | Conflict_dep of (unit -> Dose_algo.Diagnostic.reason list)
+   | Conflict_cycle of string list list
+ type conflict =
+   Cudf.universe * int package_map * conflict_case
+@@ -463,7 +463,7 @@ let strong_and_weak_deps u deps =
+ (* From a CUDF dependency CNF, extract the set of packages that can possibly be
+    part of a solution.
+ 
+-   This is much finer than [Common.CudfAdd.resolve_deps] which doesn't handle
++   This is much finer than [Dose_common.CudfAdd.resolve_deps] which doesn't handle
+    conjunctions of versions (see [Graph.of_universe] below) *)
+ let dependency_set u deps =
+   let strong_deps, weak_deps = strong_and_weak_deps u deps in
+@@ -517,18 +517,18 @@ let _rec_strong_dependency_set u deps =
+ module Graph = struct
+ 
+   module PG = struct
+-    include Algo.Defaultgraphs.PackageGraph.G
++    include Dose_algo.Defaultgraphs.PackageGraph.G
+     let succ g v =
+       try succ g v
+       with e -> OpamStd.Exn.fatal e; []
+   end
+ 
+-  module PO = Algo.Defaultgraphs.GraphOper (PG)
++  module PO = Dose_algo.Defaultgraphs.GraphOper (PG)
+ 
+   module Topo = Graph.Topological.Make (PG)
+ 
+   let of_universe u =
+-    (* {[Algo.Defaultgraphs.PackageGraph.dependency_graph u]}
++    (* {[Dose_algo.Defaultgraphs.PackageGraph.dependency_graph u]}
+        -> doesn't handle conjunctive dependencies correctly
+        (e.g. (a>3 & a<=4) is considered as (a>3 | a<=4) and results in extra
+        edges).
+@@ -537,7 +537,7 @@ module Graph = struct
+     let t = OpamConsole.timer () in
+     let g = PG.create ~size:(Cudf.universe_size u) () in
+     let iter_deps f deps =
+-      (* List.iter (fun d -> List.iter f (Common.CudfAdd.resolve_deps u d)) deps *)
++      (* List.iter (fun d -> List.iter f (Dose_common.CudfAdd.resolve_deps u d)) deps *)
+       Set.iter f (dependency_set u deps)
+     in
+     Cudf.iter_packages
+@@ -550,7 +550,7 @@ module Graph = struct
+ 
+   let output g filename =
+     let fd = open_out (filename ^ ".dot") in
+-    Algo.Defaultgraphs.PackageGraph.DotPrinter.output_graph fd g;
++    Dose_algo.Defaultgraphs.PackageGraph.DotPrinter.output_graph fd g;
+     close_out fd
+ 
+   let transitive_closure g =
+@@ -565,20 +565,20 @@ module Graph = struct
+ end
+ 
+ (** Special package used by Dose internally, should generally be filtered out *)
+-let dose_dummy_request = Algo.Depsolver.dummy_request.Cudf.package
++let dose_dummy_request = Dose_algo.Depsolver.dummy_request.Cudf.package
+ let is_artefact cpkg =
+   is_opam_invariant cpkg ||
+   cpkg.Cudf.package = dose_dummy_request
+ 
+ let dependencies universe packages =
+   Set.fixpoint (fun p -> dependency_set universe p.Cudf.depends) packages
+-(* similar to Algo.Depsolver.dependency_closure but with finer results on
++(* similar to Dose_algo.Depsolver.dependency_closure but with finer results on
+    version sets *)
+ 
+ let reverse_dependencies universe packages =
+   let graph = Graph.of_universe universe in
+   Set.fixpoint (fun p -> Set.of_list (Graph.pred graph p)) packages
+-(* similar to Algo.Depsolver.reverse_dependency_closure but more reliable *)
++(* similar to Dose_algo.Depsolver.reverse_dependency_closure but more reliable *)
+ 
+ let dependency_sort universe packages =
+   let graph = Graph.of_universe universe in
+@@ -595,12 +595,12 @@ let string_of_vpkgs constr =
+   OpamFormula.string_of_conjunction string_of_atom constr
+ 
+ let string_of_universe u =
+-  string_of_packages (List.sort Common.CudfAdd.compare (Cudf.get_packages u))
++  string_of_packages (List.sort Dose_common.CudfAdd.compare (Cudf.get_packages u))
+ 
+ let vpkg2atom cudfnv2opam (name,cstr) =
+   match cstr with
+   | None ->
+-    OpamPackage.Name.of_string (Common.CudfAdd.decode name), None
++    OpamPackage.Name.of_string (Dose_common.CudfAdd.decode name), None
+   | Some (relop,v) ->
+     let nv = cudfnv2opam (name,v) in
+     nv.name, Some (relop, nv.version)
+@@ -618,7 +618,7 @@ let vpkg2atom cudfnv2opam (name,cstr) =
+           (List.map (fun p -> OpamPackage.version (cudf2opam p)) l) in
+       let solutions = to_version_set solutions in
+       let others = OVS.Op.(to_version_set candidates -- solutions) in
+-      OpamPackage.Name.of_string (Common.CudfAdd.decode name),
++      OpamPackage.Name.of_string (Dose_common.CudfAdd.decode name),
+       match relop, OVS.is_empty solutions, OVS.is_empty others with
+       | _, true, true -> None
+       | `Leq, false, _ | `Lt, false, true -> Some (`Leq, OVS.max_elt solutions)
+@@ -636,9 +636,9 @@ let vpkg2atom cudfnv2opam (name,cstr) =
+ let conflict_empty ~version_map univ =
+   Conflicts (univ, version_map, Conflict_dep (fun () -> []))
+ let make_conflicts ~version_map univ = function
+-  | {Algo.Diagnostic.result = Algo.Diagnostic.Failure f; _} ->
++  | {Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Failure f; _} ->
+     Conflicts (univ, version_map, Conflict_dep f)
+-  | {Algo.Diagnostic.result = Algo.Diagnostic.Success _; _} ->
++  | {Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Success _; _} ->
+     raise (Invalid_argument "make_conflicts")
+ let cycle_conflict ~version_map univ cycle =
+   Conflicts (univ, version_map, Conflict_cycle cycle)
+@@ -655,7 +655,7 @@ let formula_of_vpkgl cudfnv2opam all_packages vpkgl =
+     List.map (fun vp ->
+         try vpkg2atom cudfnv2opam vp
+         with Not_found ->
+-          OpamPackage.Name.of_string (Common.CudfAdd.decode (fst vp)), None)
++          OpamPackage.Name.of_string (Dose_common.CudfAdd.decode (fst vp)), None)
+       vpkgl
+   in
+   let names = OpamStd.List.sort_nodup compare (List.map fst atoms) in
+@@ -727,7 +727,7 @@ type explanation =
+ 
+ let extract_explanations packages cudfnv2opam reasons : explanation list =
+   log "Conflict reporting";
+-  let open Algo.Diagnostic in
++  let open Dose_algo.Diagnostic in
+   let open Set.Op in
+   let module CS = ChainSet in
+   (* Definitions and printers *)
+@@ -1058,7 +1058,7 @@ let default_preamble =
+     (s_pinned,         `Bool (Some false));
+     (s_version_lag,    `Nat (Some 0));
+   ] in
+-  Common.CudfAdd.add_properties Cudf.default_preamble l
++  Dose_common.CudfAdd.add_properties Cudf.default_preamble l
+ 
+ let remove universe name constr =
+   let filter p =
+@@ -1091,7 +1091,7 @@ let remove_all_uninstalled_versions_but universe name constr =
+   Cudf.load_universe packages
+ 
+ let to_cudf univ req = (
+-  Common.CudfAdd.add_properties default_preamble
++  Dose_common.CudfAdd.add_properties default_preamble
+     (List.map (fun s -> s, `Int (Some 0)) req.extra_attributes),
+   univ,
+   { Cudf.request_id = "opam";
+@@ -1178,7 +1178,7 @@ let preprocess_cudf_request (props, univ, creq) criteria =
+   in
+   let univ =
+     let open Set.Op in
+-    let vpkg2set vp = Set.of_list (Common.CudfAdd.resolve_deps univ vp) in
++    let vpkg2set vp = Set.of_list (Dose_common.CudfAdd.resolve_deps univ vp) in
+     let to_install =
+       vpkg2set creq.Cudf.install
+       ++ Set.of_list (Cudf.lookup_packages univ opam_invariant_package_name)
+@@ -1305,7 +1305,7 @@ let preprocess_cudf_request (props, univ, creq) criteria =
+     (chrono ());
+   props, univ, creq
+ 
+-exception Timeout of Algo.Depsolver.solver_result option
++exception Timeout of Dose_algo.Depsolver.solver_result option
+ 
+ let call_external_solver ~version_map univ req =
+   let cudf_request = to_cudf univ req in
+@@ -1315,7 +1315,7 @@ let call_external_solver ~version_map univ req =
+     ignore (dump_cudf_request ~version_map cudf_request
+               criteria OpamSolverConfig.(!r.cudf_file));
+     (* Wrap a return of exn Timeout through Depsolver *)
+-    let check_request_using ~call_solver ~criteria ~explain req =
++    let check_request_using ~call_solver ~explain req =
+       let timed_out = ref false in
+       let call_solver args =
+         try call_solver args with
+@@ -1323,7 +1323,7 @@ let call_external_solver ~version_map univ req =
+         | OpamCudfSolver.Timeout None -> raise (Timeout None)
+       in
+       let r =
+-        Algo.Depsolver.check_request_using ~call_solver ~criteria ~explain req
++        Dose_algo.Depsolver.check_request_using ~call_solver ~explain req
+       in
+       if !timed_out then raise (Timeout (Some r)) else r
+     in
+@@ -1335,7 +1335,7 @@ let call_external_solver ~version_map univ req =
+       let r =
+         check_request_using
+           ~call_solver:(OpamSolverConfig.call_solver ~criteria)
+-          ~criteria ~explain:true cudf_request
++          ~explain:true cudf_request
+       in
+       log "Solver call done in %.3fs" (chrono ());
+       r
+@@ -1375,23 +1375,23 @@ let call_external_solver ~version_map univ req =
+       in
+       raise (Solver_failure msg)
+   else
+-    Algo.Depsolver.Sat(None,Cudf.load_universe [])
++    Dose_algo.Depsolver.Sat(None,Cudf.load_universe [])
+ 
+ let check_request ?(explain=true) ~version_map univ req =
+-  match Algo.Depsolver.check_request ~explain (to_cudf univ req) with
+-  | Algo.Depsolver.Unsat
+-      (Some ({Algo.Diagnostic.result = Algo.Diagnostic.Failure _; _} as r)) ->
++  match Dose_algo.Depsolver.check_request ~explain (to_cudf univ req) with
++  | Dose_algo.Depsolver.Unsat
++      (Some ({Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Failure _; _} as r)) ->
+     make_conflicts ~version_map univ r
+-  | Algo.Depsolver.Sat (_,u) ->
++  | Dose_algo.Depsolver.Sat (_,u) ->
+     Success (remove u dose_dummy_request None)
+-  | Algo.Depsolver.Error msg ->
++  | Dose_algo.Depsolver.Error msg ->
+     let f = dump_cudf_error ~version_map univ req in
+     let msg =
+       Printf.sprintf "Internal solver failed with %s Request saved to %S"
+         msg f
+     in
+     raise (Solver_failure msg)
+-  | Algo.Depsolver.Unsat _ -> (* normally when [explain] = false *)
++  | Dose_algo.Depsolver.Unsat _ -> (* normally when [explain] = false *)
+     conflict_empty ~version_map univ
+ 
+ (* Return the universe in which the system has to go *)
+@@ -1404,12 +1404,12 @@ let get_final_universe ~version_map univ req =
+     in
+     raise (Solver_failure msg) in
+   match call_external_solver ~version_map univ req with
+-  | Algo.Depsolver.Sat (_,u) -> Success (remove u dose_dummy_request None)
+-  | Algo.Depsolver.Error "(CRASH) Solution file is empty" ->
++  | Dose_algo.Depsolver.Sat (_,u) -> Success (remove u dose_dummy_request None)
++  | Dose_algo.Depsolver.Error "(CRASH) Solution file is empty" ->
+     (* XXX Is this still needed with latest dose? *)
+     Success (Cudf.load_universe [])
+-  | Algo.Depsolver.Error str -> fail str
+-  | Algo.Depsolver.Unsat r   ->
++  | Dose_algo.Depsolver.Error str -> fail str
++  | Dose_algo.Depsolver.Unsat r   ->
+     let msg =
+       Printf.sprintf
+         "The solver (%s) pretends there is no solution while that's apparently \
+@@ -1420,10 +1420,10 @@ let get_final_universe ~version_map univ req =
+          Solver.name)
+     in
+     match r with
+-    | Some ({Algo.Diagnostic.result = Algo.Diagnostic.Failure _; _} as r) ->
++    | Some ({Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Failure _; _} as r) ->
+       OpamConsole.error "%s" msg;
+       make_conflicts ~version_map univ r
+-    | Some {Algo.Diagnostic.result = Algo.Diagnostic.Success _; _}
++    | Some {Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Success _; _}
+     | None ->
+       raise (Solver_failure msg)
+ 
+@@ -1516,11 +1516,11 @@ let compute_root_causes g requested reinstall =
+   let module StringSet = OpamStd.String.Set in
+   let requested_pkgnames =
+     OpamPackage.Name.Set.fold (fun n s ->
+-        StringSet.add (Common.CudfAdd.encode (OpamPackage.Name.to_string n)) s)
++        StringSet.add (Dose_common.CudfAdd.encode (OpamPackage.Name.to_string n)) s)
+       requested StringSet.empty in
+   let reinstall_pkgnames =
+     OpamPackage.Set.fold (fun nv s ->
+-        StringSet.add (Common.CudfAdd.encode (OpamPackage.name_to_string nv)) s)
++        StringSet.add (Dose_common.CudfAdd.encode (OpamPackage.name_to_string nv)) s)
+       reinstall StringSet.empty in
+   let actions =
+     ActionGraph.fold_vertex (fun a acc -> Map.add (action_contents a) a acc)
+@@ -1711,10 +1711,10 @@ let atomic_actions ~simple_universe ~complete_universe root_actions =
+   (* conflicts *)
+   let conflicts_graph =
+     let filter p = Set.mem p to_remove || Set.mem p to_install in
+-    Algo.Defaultgraphs.PackageGraph.conflict_graph
++    Dose_algo.Defaultgraphs.PackageGraph.conflict_graph
+       (Cudf.load_universe (Cudf.get_packages ~filter complete_universe))
+   in
+-  Algo.Defaultgraphs.PackageGraph.UG.iter_edges (fun p1 p2 ->
++  Dose_algo.Defaultgraphs.PackageGraph.UG.iter_edges (fun p1 p2 ->
+       if Set.mem p1 to_remove && Set.mem p2 to_install then
+         ActionGraph.add_edge g (`Remove p1) (`Install ( p2))
+       else if Set.mem p2 to_remove && Set.mem p1 to_install then
+--- a/src/solver/opamCudf.mli
++++ b/src/solver/opamCudf.mli
+@@ -32,7 +32,7 @@ module Map: OpamStd.MAP with type key = Package.t
+ module Graph: sig
+   (** Graph of cudf packages *)
+ 
+-  include module type of Algo.Defaultgraphs.PackageGraph.G
++  include module type of Dose_algo.Defaultgraphs.PackageGraph.G
+ 
+   (** Build a graph from a CUDF universe. Warning: dependency edges are towards
+       the dependency, which is the reverse of what happens in the action
+@@ -198,7 +198,7 @@ val string_of_vpkgs: Cudf_types.vpkg list -> string
+ 
+ val make_conflicts:
+   version_map:int package_map -> Cudf.universe ->
+-  Algo.Diagnostic.diagnosis -> ('a, conflict) result
++  Dose_algo.Diagnostic.diagnosis -> ('a, conflict) result
+ val cycle_conflict:
+   version_map:int package_map -> Cudf.universe ->
+   string list list -> ('a, conflict) result
+--- a/src/solver/opamCudfSolver.ml
++++ b/src/solver/opamCudfSolver.ml
+@@ -57,7 +57,7 @@ let call_external_solver command ~criteria ?timeout (_, universe,_ as cudf) =
+     in
+     OpamFilename.remove solver_in;
+     if not (OpamFilename.exists solver_out) then
+-      raise (Common.CudfSolver.Error "no output")
++      raise (Dose_common.CudfSolver.Error "no output")
+     else if
+       (let ic = OpamFilename.open_in solver_out in
+        try
+@@ -65,7 +65,7 @@ let call_external_solver command ~criteria ?timeout (_, universe,_ as cudf) =
+          i = "FAIL"
+        with End_of_file -> close_in ic; false)
+     then
+-      raise Common.CudfSolver.Unsat
++      raise Dose_common.CudfSolver.Unsat
+     else
+     let r =
+       Cudf_parser.load_solution_from_file
+--- a/src/solver/opamSolver.ml
++++ b/src/solver/opamSolver.ml
+@@ -90,7 +90,7 @@ let cudf_versions_map universe packages =
+     pmap OpamPackage.Map.empty
+ 
+ let name_to_cudf name =
+-  Common.CudfAdd.encode (OpamPackage.Name.to_string name)
++  Dose_common.CudfAdd.encode (OpamPackage.Name.to_string name)
+ 
+ let constraint_to_cudf version_map name (op,v) =
+   let nv = OpamPackage.create name v in
+@@ -343,7 +343,7 @@ let load_cudf_universe
+       OpamConsole.error_and_exit `Solver_failure "Malformed CUDF universe (%s)" s
+   in
+   log ~level:3 "Secondary load of cudf universe: done in %.3fs" (chrono ());
+-  (* let universe = Algo.Depsolver.trim universe in *)
++  (* let universe = Dose_algo.Depsolver.trim universe in *)
+   cudf_universe
+ 
+ let string_of_request r =
+@@ -478,13 +478,13 @@ let installable universe =
+       universe.u_available ~build:true ~post:true ()
+   in
+   let trimmed_universe =
+-    (* Algo.Depsolver.trim simple_universe => this can explode memory, we need
++    (* Dose_algo.Depsolver.trim simple_universe => this can explode memory, we need
+        to specify [~explain:false] *)
+-    let open Algo in
++    let open Dose_algo in
+     let open Depsolver in
+     let trimmed_pkgs = ref [] in
+     let callback d =
+-      if Algo.Diagnostic.is_solution d then
++      if Dose_algo.Diagnostic.is_solution d then
+         match d.Diagnostic.request with
+         |[p] -> trimmed_pkgs := p::!trimmed_pkgs
+         |_ -> assert false
+@@ -515,12 +515,12 @@ let installable_subset universe packages =
+       simple_universe
+   in
+   let trimmed_universe =
+-    (* Algo.Depsolver.trimlist simple_universe with [~explain:false] *)
+-    let open Algo in
++    (* Dose_algo.Depsolver.trimlist simple_universe with [~explain:false] *)
++    let open Dose_algo in
+     let open Depsolver in
+     let trimmed_pkgs = ref [] in
+     let callback d =
+-      if Algo.Diagnostic.is_solution d then
++      if Dose_algo.Diagnostic.is_solution d then
+         match d.Diagnostic.request with
+         |[p] -> trimmed_pkgs := p::!trimmed_pkgs
+         |_ -> assert false
+@@ -619,10 +619,10 @@ let coinstallability_check universe packages =
+     opam2cudf universe ~depopts:false ~build:true ~post:true
+       version_map packages
+   in
+-  match Algo.Depsolver.edos_coinstall cudf_universe cudf_packages with
+-  | { Algo.Diagnostic.result = Algo.Diagnostic.Success _; _ } ->
++  match Dose_algo.Depsolver.edos_coinstall cudf_universe cudf_packages with
++  | { Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Success _; _ } ->
+     None
+-  | { Algo.Diagnostic.result = Algo.Diagnostic.Failure _; _ } as c ->
++  | { Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Failure _; _ } as c ->
+     match OpamCudf.make_conflicts ~version_map cudf_universe c with
+     | Conflicts cs -> Some cs
+     | _ -> None
+@@ -644,8 +644,8 @@ let atom_coinstallability_check universe atoms =
+        opam2cudf universe version_map universe.u_available
+          ~depopts:false ~build:true ~post:true)
+   in
+-  Algo.Depsolver.edos_install cudf_universe check_pkg
+-  |> Algo.Diagnostic.is_solution
++  Dose_algo.Depsolver.edos_install cudf_universe check_pkg
++  |> Dose_algo.Diagnostic.is_solution
+ 
+ let new_packages sol =
+   OpamCudf.ActionGraph.fold_vertex (fun action packages ->
+From 2e03a20abedb40cccb5295361649c64a8df46505 Mon Sep 17 00:00:00 2001
+From: Kate <kit.ty.kate@disroot.org>
+Date: Tue, 2 Feb 2021 17:59:10 +0000
+Subject: [PATCH] Make opam-client compatible with dose3 6.0
+
+--- a/admin-scripts/cudf-debug.ml
++++ b/admin-scripts/cudf-debug.ml
+@@ -32,11 +32,11 @@ let rebuild_version_map univ =
+ let _ =
+   match Cudf_parser.load_from_file Sys.argv.(1) with
+   | Some preamble, univ, Some req ->
+-    begin match Algo.Depsolver.check_request ~explain:true (preamble, univ, req) with
+-      | Algo.Depsolver.Unsat (Some f) -> 
++    begin match Dose_algo.Depsolver.check_request ~explain:true (preamble, univ, req) with
++      | Dose_algo.Depsolver.Unsat (Some f) ->
+         OpamConsole.msg "== DOSE MESSAGE ==\n";
+         flush stdout;
+-        Algo.Diagnostic.fprintf_human
++        Dose_algo.Diagnostic.fprintf_human
+           ~pp:cudf_pp
+           Format.err_formatter
+           f;
+--- a/src/client/opamAdminCheck.ml
++++ b/src/client/opamAdminCheck.ml
+@@ -110,9 +110,9 @@ let cycle_check univ =
+   in
+   (* conflicts break cycles *)
+   let conflicts =
+-    Algo.Defaultgraphs.PackageGraph.conflict_graph cudf_univ
++    Dose_algo.Defaultgraphs.PackageGraph.conflict_graph cudf_univ
+   in
+-  let module CGraph = Algo.Defaultgraphs.PackageGraph.UG in
++  let module CGraph = Dose_algo.Defaultgraphs.PackageGraph.UG in
+   CGraph.iter_edges (fun nv1 nv2 ->
+       OpamCudf.Graph.remove_edge graph nv1 nv2;
+       OpamCudf.Graph.remove_edge graph nv2 nv1)
+@@ -127,7 +127,7 @@ let cycle_check univ =
+         let univ = Cudf.load_universe pkgs in
+         let g = OpamCudf.Graph.of_universe univ in
+         let conflicts =
+-          Algo.Defaultgraphs.PackageGraph.conflict_graph univ
++          Dose_algo.Defaultgraphs.PackageGraph.conflict_graph univ
+         in
+         (* Simplify the graph by merging all equivalent versions of each
+            package *)

diff --git a/dev-ml/opam-solver/opam-solver-2.1.0.ebuild b/dev-ml/opam-solver/opam-solver-2.1.0.ebuild
new file mode 100644
index 00000000000..c4fc4cb7fca
--- /dev/null
+++ b/dev-ml/opam-solver/opam-solver-2.1.0.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit dune
+
+DESCRIPTION="opam solver"
+HOMEPAGE="https://opam.ocaml.org/ https://github.com/ocaml/opam"
+SRC_URI="https://github.com/ocaml/opam/archive/${PV/_/-}.tar.gz -> opam-${PV}.tar.gz"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/dev-ml/opam/opam-2.1.0-dose3-6.patch.xz"
+S="${WORKDIR}/opam-${PV/_/-}"
+
+LICENSE="LGPL-2.1"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+IUSE="+ocamlopt test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	~dev-ml/opam-format-${PV}:=
+	dev-ml/opam-file-format:=
+	dev-ml/re:=
+	>=dev-ml/mccs-1.1.4:=
+	>=dev-ml/dose3-6.0:=
+	dev-ml/cudf:=
+"
+DEPEND="${RDEPEND}
+	test? ( dev-ml/opam-client )"
+
+PATCHES=( "${WORKDIR}"/opam-2.1.0-dose3-6.patch )
+
+src_prepare() {
+	default
+	cat <<- EOF >> "${S}/dune"
+		(env
+		 (dev
+		  (flags (:standard -warn-error -3-9-33)))
+		 (release
+		  (flags (:standard -warn-error -3-9-33))))
+	EOF
+}
+
+src_compile() {
+	dune build @install --profile release || die
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-02 21:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-06 23:55 [gentoo-commits] repo/gentoo:master commit in: dev-ml/opam-solver/, dev-ml/opam-solver/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2021-10-02 21:10 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox