Skip to content

Commit

Permalink
Merge pull request #3074 from OCamlPro/new-depexts
Browse files Browse the repository at this point in the history
New depexts
  • Loading branch information
AltGr authored Oct 17, 2017
2 parents 5962dd3 + cbe974e commit 5d64d95
Show file tree
Hide file tree
Showing 30 changed files with 257 additions and 219 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Changes prefixed with "(*)" are potentially breaking to scripts or existing
repositories (changes that are automatically handled by the format upgrade tools
are not marked).

2.0.0~beta5

2.0.0~beta4
* Building with OCaml < 4.02.3 is no longer supported
* Support compilation with a built-in mccs solver (removing run-time dependency
Expand Down
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for opam 2.0.0~beta4.
# Generated by GNU Autoconf 2.69 for opam 2.0.0~beta5.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -578,8 +578,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='opam'
PACKAGE_TARNAME='opam'
PACKAGE_VERSION='2.0.0~beta4'
PACKAGE_STRING='opam 2.0.0~beta4'
PACKAGE_VERSION='2.0.0~beta5'
PACKAGE_STRING='opam 2.0.0~beta5'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1243,7 +1243,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 opam 2.0.0~beta4 to adapt to many kinds of systems.
\`configure' configures opam 2.0.0~beta5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1305,7 +1305,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of opam 2.0.0~beta4:";;
short | recursive ) echo "Configuration of opam 2.0.0~beta5:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1406,7 +1406,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
opam configure 2.0.0~beta4
opam configure 2.0.0~beta5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1463,7 +1463,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 opam $as_me 2.0.0~beta4, which was
It was created by opam $as_me 2.0.0~beta5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -5078,7 +5078,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 opam $as_me 2.0.0~beta4, which was
This file was extended by opam $as_me 2.0.0~beta5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -5131,7 +5131,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
opam config.status 2.0.0~beta4
opam config.status 2.0.0~beta5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT(opam,2.0.0~beta4)
AC_INIT(opam,2.0.0~beta5)
AC_COPYRIGHT(Copyright 2012-2017 OcamlPro SAS)

AC_CONFIG_MACRO_DIR([m4])
Expand Down
40 changes: 21 additions & 19 deletions doc/pages/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,9 +853,12 @@ files.
[`conflicts:`](#opamfield-conflicts) field.

- <a id="opamfield-conflicts">
`conflicts: [ <pkgname> { <version-constraint> } ... ]`</a>:
`conflicts: [ <filtered-package-formula> ... ]`</a>:
a list of package names with optional version constraints indicating that the
current package can't coexist with those.
current package can't coexist with those. Conflicts are only allowed on a
disjunction of packages: the `&` connector is disallowed between packages or
package versions. For example, you can conflict with `"foo" {>= "3"} | "bar"`,
but not with `"foo" {>= "3"} & "bar"` or even `"foo" {>= "3" & < "4"}`.

- <a id="opamfield-conflict-class">`conflict-class: [ <pkgname> ... ]`</a>:
an alternate, symmetric way of defining package conflicts. Conflict classes
Expand All @@ -865,25 +868,24 @@ files.
packages.

- <a id="opamfield-depexts">
`depexts: [ [ [ <string> ... ] [ <string> ... ] ] ... ]`</a>:
the package external dependencies. This field is a list that can be used for
describing the dependencies of the package toward software or packages
external to the <span class="opam">opam</span> ecosystem, for various systems. It contains pairs of
lists of the form `[ predicates ext-packages ]`. `predicates` is used to
select the element of the list based on the current system: it is a list of
tags (strings) that can correspond to the OS, architecture or distribution.
The `predicates` is used as a conjunction: the pair will only be selected when
_all_ tags are active. The resulting `ext-packages` should be identifiers of
packages recognised by the system's package manager.

There is currently no definite specification for the precise tags you should
use, but the closest thing is the
[opam-depext project](https://github.com/OCamlPro/opam-depext). The
`depexts` information can be retrieved through the `opam list --external`
command.
`depexts: [ [ <string> ... ] { <filter> } ... ]`</a>:

the package external dependencies. This field may be used to describe the
dependencies of the package toward software or packages external to the <span
class="opam">opam</span> ecosystem, for various systems. Each
`[ <string> ... ] { <filter> }` element declares the strings to the left as
identifiers to required system-managed packages, while the filter to the right
allows to select the systems they will be active on.

The filters typically use variables `arch`, `os`, `os-distribution`,
`os-version`, `os-family`, as defined in
[opam-depext](https://github.com/ocaml/opam-depext) (note that opam itself
doesn't define all of these at the moment). The `depexts` information can be
retrieved through the `opam list --external` command with the appropriate
`--vars` bindings.

The `depexts:` field should preferably be used on [`conf`](#opamflag-conf)
packages, which make the dependencies clearer and avoids duplicating the
packages, which makes the dependencies clearer and avoids duplicating the
efforts of documenting the appropriate system packages on the various
OSes available.

Expand Down
6 changes: 3 additions & 3 deletions opam-client.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand All @@ -19,8 +19,8 @@ build: [
[make "%{name}%.install"]
]
depends: [
"opam-state" {= "2.0.0~beta4"}
"opam-solver" {= "2.0.0~beta4"}
"opam-state" {= "2.0.0~beta5"}
"opam-solver" {= "2.0.0~beta5"}
"cmdliner" {>= "0.9.8"}
"jbuilder" {build & >= "1.0+beta12"}
]
Expand Down
2 changes: 1 addition & 1 deletion opam-core.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand Down
4 changes: 2 additions & 2 deletions opam-devel.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand All @@ -20,7 +20,7 @@ build: [
]
build-test: [make "tests"]
depends: [
"opam-client" {= "2.0.0~beta4"}
"opam-client" {= "2.0.0~beta5"}
"cmdliner" {>= "0.9.8"}
"jbuilder" {build & >= "1.0+beta12"}
]
Expand Down
4 changes: 2 additions & 2 deletions opam-format.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand All @@ -19,7 +19,7 @@ build: [
[make "%{name}%.install"]
]
depends: [
"opam-core" {= "2.0.0~beta4"}
"opam-core" {= "2.0.0~beta5"}
"opam-file-format" {>= "2.0.0~beta3"}
"jbuilder" {build & >= "1.0+beta12"}
]
Expand Down
4 changes: 2 additions & 2 deletions opam-repository.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand All @@ -19,7 +19,7 @@ build: [
[make "%{name}%.install"]
]
depends: [
"opam-format" {= "2.0.0~beta4"}
"opam-format" {= "2.0.0~beta5"}
"jbuilder" {build & >= "1.0+beta12"}
]
available: ocaml-version >= "4.02.3"
4 changes: 2 additions & 2 deletions opam-solver.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand All @@ -19,7 +19,7 @@ build: [
[make "%{name}%.install"]
]
depends: [
"opam-format" {= "2.0.0~beta4"}
"opam-format" {= "2.0.0~beta5"}
"mccs" {>= "1.1+3"}
"dose3" {>= "5"}
"cudf" {>= "0.7"}
Expand Down
4 changes: 2 additions & 2 deletions opam-state.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "1.2"
version: "2.0.0~beta4"
version: "2.0.0~beta5"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
"Thomas Gazagnaire <thomas@gazagnaire.org>"
Expand All @@ -19,7 +19,7 @@ build: [
[make "%{name}%.install"]
]
depends: [
"opam-repository" {= "2.0.0~beta4"}
"opam-repository" {= "2.0.0~beta5"}
"jbuilder" {build & >= "1.0+beta12"}
]
available: ocaml-version >= "4.02.3"
2 changes: 1 addition & 1 deletion release/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ TAG="$1"; shift

if [[ $# -eq 0 || " $* " =~ " archive " ]]; then
make TAG="$TAG" GIT_URL="https://github.com/ocaml/opam.git" "out/opam-full-$TAG.tar.gz"
cd out && git-upload-release ocaml opam "$TAG" opam-full-2.0.0-beta4.tar.gz
cd out && git-upload-release ocaml opam "$TAG" "opam-full-$TAG.tar.gz"
fi

if [[ $# -eq 0 || " $* " =~ " builds " ]]; then
Expand Down
2 changes: 1 addition & 1 deletion shell/bundle.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -ue

OCAMLV=4.04.1
OPAMV=2.0.0~beta4
OPAMV=2.0.0~beta5
OPAM_REPO=https://opam.ocaml.org/2.0
DEBUG=
MAKESELF=
Expand Down
50 changes: 25 additions & 25 deletions src/client/opamArg.ml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ let apply_global_options o =
?switch_from:(o.opt_switch >>| fun _ -> `Command_line)
(* ?jobs: int *)
(* ?dl_jobs: int *)
(* ?external_tags:string list *)
(* ?keep_build_dir:bool *)
(* ?build_test:bool *)
(* ?build_doc:bool *)
Expand Down Expand Up @@ -147,19 +146,18 @@ type build_options = {
dryrun : bool;
fake : bool;
skip_update : bool;
external_tags : string list;
jobs : int option;
ignore_constraints_on: name list option;
unlock_base : bool;
}

let create_build_options
keep_build_dir reuse_build_dir inplace_build make no_checksums
req_checksums build_test build_doc show dryrun skip_update external_tags
req_checksums build_test build_doc show dryrun skip_update
fake jobs ignore_constraints_on unlock_base = {
keep_build_dir; reuse_build_dir; inplace_build; make;
no_checksums; req_checksums; build_test; build_doc; show; dryrun;
skip_update; external_tags; fake; jobs; ignore_constraints_on; unlock_base;
skip_update; fake; jobs; ignore_constraints_on; unlock_base;
}

let apply_build_options b =
Expand All @@ -186,7 +184,6 @@ let apply_build_options b =
?unlock_base:(flag b.unlock_base)
();
OpamClientConfig.update
?external_tags:(match b.external_tags with [] -> None | l -> Some l)
?keep_build_dir:(flag b.keep_build_dir)
?reuse_build_dir:(flag b.reuse_build_dir)
?inplace_build:(flag b.inplace_build)
Expand Down Expand Up @@ -505,6 +502,24 @@ let atom_or_local =
in
parse, print

let variable_bindings =
let parse str =
try
OpamStd.String.split str ',' |>
List.map (fun s -> match OpamStd.String.cut_at s '=' with
| Some (a, b) -> OpamVariable.of_string a, b
| None -> Printf.ksprintf failwith "%S is not a binding" s) |>
fun bnds -> `Ok bnds
with Failure e -> `Error e
in
let print ppf x =
List.map
(fun (a,b) -> Printf.sprintf "%s=%s" (OpamVariable.to_string a) b) x |>
String.concat "," |>
pr_str ppf
in
parse, print

let warn_selector =
let parse str =
let sep = Re.(compile (set "+-")) in
Expand Down Expand Up @@ -554,26 +569,16 @@ let enum_with_default sl: 'a Arg.converter =
parse, print

let opamlist_column =
let depexts_flag_re =
Re.(compile @@ seq [
str "depexts(";
group @@ rep @@ seq [rep @@ diff any (set ",)"); opt (char ',')];
char ')'])
in
let parse str =
if OpamStd.String.ends_with ~suffix:":" str then
let fld = OpamStd.String.remove_suffix ~suffix:":" str in
`Ok (OpamListCommand.Field fld)
else
try
try `Ok (OpamListCommand.Depexts
(OpamStd.String.split
(Re.Group.get (Re.exec depexts_flag_re str) 1) ','))
with Not_found ->
List.find (function (OpamListCommand.Field _), _ -> false
| _, name -> name = str)
OpamListCommand.field_names
|> fun (f, _) -> `Ok f
List.find (function (OpamListCommand.Field _), _ -> false
| _, name -> name = str)
OpamListCommand.field_names
|> fun (f, _) -> `Ok f
with Not_found ->
`Error (Printf.sprintf
"No known printer for column %s. If you meant an opam file \
Expand Down Expand Up @@ -1005,11 +1010,6 @@ let build_options =
packages, they are normally updated from their origin first. This flag \
disables that behaviour and will keep them to their version in cache."
in
let external_tags =
mk_opt ~section ["external"] "TAGS"
"Display the external packages associated to the given tags. \
This is deprecated, use `opam list --external' instead"
Arg.(list string) [] in
let fake =
mk_flag ~section ["fake"]
"This option registers the actions into the opam database, without \
Expand All @@ -1030,7 +1030,7 @@ let build_options =
Term.(const create_build_options
$keep_build_dir $reuse_build_dir $inplace_build $make
$no_checksums $req_checksums $build_test $build_doc $show $dryrun
$skip_update $external_tags $fake $jobs_flag $ignore_constraints_on
$skip_update $fake $jobs_flag $ignore_constraints_on
$unlock_base)

let package_selection_section = "PACKAGE SELECTION OPTIONS"
Expand Down
3 changes: 3 additions & 0 deletions src/client/opamArg.mli
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ val atom: atom Arg.converter
val atom_or_local:
[ `Atom of atom | `Filename of filename | `Dirname of dirname ] Arg.converter

(** [var=value,...] argument *)
val variable_bindings: (OpamVariable.t * string) list Arg.converter

(** Warnings string ["+3..10-4"] *)
val warn_selector: (int * bool) list Arg.converter

Expand Down
Loading

0 comments on commit 5d64d95

Please sign in to comment.