Skip to content

Commit

Permalink
Merge pull request #28 from kit-ty-kate/rm-deps
Browse files Browse the repository at this point in the history
opam-0install-cudf: Remove unused and unnecessary dependencies for easier integration with opam
  • Loading branch information
kit-ty-kate authored Apr 21, 2021
2 parents 0512f1a + 191b3e9 commit f1183b5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 0 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ This package uses 0install's solver algorithm with opam packages using
the CUDF interface.
")
(depends
fmt
cmdliner
cudf
(ocaml (>= 4.08.0))
0install-solver))
2 changes: 1 addition & 1 deletion lib-cudf/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(library
(name opam_0install_cudf)
(public_name opam-0install-cudf)
(libraries cudf 0install-solver fmt))
(libraries cudf 0install-solver))
26 changes: 15 additions & 11 deletions lib-cudf/model.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,22 @@ module Make (Context : S.CONTEXT) = struct
| Dummy (* Used for diagnostics *)

let rec pp_version f = function
| RealImpl impl -> Fmt.int f impl.pkg.Cudf.version
| Reject pkg -> Fmt.int f (snd pkg)
| VirtualImpl (_i, deps) -> Fmt.string f (String.concat "&" (List.map (fun d -> Fmt.to_to_string pp_role d.drole) deps))
| Dummy -> Fmt.string f "(no version)"
| RealImpl impl -> Format.pp_print_int f impl.pkg.Cudf.version
| Reject pkg -> Format.pp_print_int f (snd pkg)
| VirtualImpl (_i, deps) ->
Format.pp_print_string f
(String.concat "&" (List.map (fun d -> Format.asprintf "%a" pp_role d.drole) deps))
| Dummy -> Format.pp_print_string f "(no version)"
and pp_impl f = function
| RealImpl impl -> Fmt.pf f "%s.%d" impl.pkg.Cudf.package impl.pkg.Cudf.version
| Reject pkg -> Fmt.pf f "%s.%d" (fst pkg) (snd pkg)
| RealImpl impl -> Format.fprintf f "%s.%d" impl.pkg.Cudf.package impl.pkg.Cudf.version
| Reject pkg -> Format.fprintf f "%s.%d" (fst pkg) (snd pkg)
| VirtualImpl _ as x -> pp_version f x
| Dummy -> Fmt.string f "(no solution found)"
| Dummy -> Format.pp_print_string f "(no solution found)"
and pp_role f = function
| Real t -> Fmt.string f t.name
| Virtual (_, impls) -> Fmt.pf f "%a" Fmt.(list ~sep:(unit "|") pp_impl) impls
| Real t -> Format.pp_print_string f t.name
| Virtual (_, impls) ->
Format.pp_print_string f
(String.concat "|" (List.map (Format.asprintf "%a" pp_impl) impls))

let pp_impl_long = pp_impl

Expand Down Expand Up @@ -244,10 +248,10 @@ module Make (Context : S.CONTEXT) = struct

let string_of_restriction = function
| { kind = `Prevent; expr = [] } -> "conflict with all versions"
| { kind = `Prevent; expr } -> Fmt.strf "not(%s)" (string_of_version_formula expr)
| { kind = `Prevent; expr } -> Format.asprintf "not(%s)" (string_of_version_formula expr)
| { kind = `Ensure; expr } -> string_of_version_formula expr

let describe_problem _impl = Fmt.to_to_string Context.pp_rejection
let describe_problem _impl = Format.asprintf "%a" Context.pp_rejection

let version = function
| RealImpl impl -> Some (impl.pkg.Cudf.package, impl.pkg.Cudf.version)
Expand Down
2 changes: 1 addition & 1 deletion lib-cudf/opam_0install_cudf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module Context = struct
| Some (`Lt, v) -> "<"^string_of_int v

let pp_rejection f = function
| UserConstraint (name, c) -> Fmt.pf f "Rejected by user-specified constraint %s%s" name (print_constr c)
| UserConstraint (name, c) -> Format.fprintf f "Rejected by user-specified constraint %s%s" name (print_constr c)
end

module Input = Model.Make(Context)
Expand Down
2 changes: 1 addition & 1 deletion lib-cudf/s.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module type CONTEXT = sig
(** A reason why a package can't be used as input to the solver. e.g. it is
for a different platform, or conflicts with a user-provided constraint. *)

val pp_rejection : rejection Fmt.t
val pp_rejection : Format.formatter -> rejection -> unit

val candidates : t -> Cudf_types.pkgname -> (Cudf_types.version * (Cudf.package, rejection) result) list
(** [candidates t name] is the list of available versions of [name], in order
Expand Down
2 changes: 0 additions & 2 deletions opam-0install-cudf.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ doc: "https://ocaml-opam.github.io/opam-0install-solver/"
bug-reports: "https://github.com/ocaml-opam/opam-0install-solver/issues"
depends: [
"dune" {>= "2.0"}
"fmt"
"cmdliner"
"cudf"
"ocaml" {>= "4.08.0"}
"0install-solver"
Expand Down

0 comments on commit f1183b5

Please sign in to comment.