diff --git a/.travis-ci.sh b/.travis-ci.sh index 544bc189c9b..16696460a66 100755 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -29,7 +29,7 @@ init-bootstrap () { eval $(opam env) # extlib is installed, since UChar.cmi causes problems with the search # order. See also the removal of uChar and uTF8 in src_ext/jbuild-extlib-src - opam install cohttp-lwt-unix ssl cmdliner dose3 cudf.0.9 opam-file-format re extlib dune 'mccs>=1.1+5' --yes + opam install ssl cmdliner dose3 cudf.0.9 opam-file-format re extlib dune 'mccs>=1.1+5' --yes fi rm -f "$OPAMBSROOT"/log/* } @@ -102,7 +102,10 @@ EOF tar -xzf ocaml-$OCAML_VERSION.tar.gz cd ocaml-$OCAML_VERSION if [[ $OPAM_TEST -ne 1 ]] ; then - CONFIGURE_SWITCHES="-no-ocamldoc -no-ocamlbuild" + CONFIGURE_SWITCHES="-no-ocamldoc" + if [[ "$OCAML_VERSION" != "4.02.3" ]] ; then + CONFIGURE_SWITCHES="$CONFIGURE_SWITCHES -no-ocamlbuild" + fi fi ./configure --prefix ~/local -no-graph -no-debugger ${CONFIGURE_SWITCHES:-} if [[ $OPAM_TEST -eq 1 ]] ; then @@ -156,6 +159,7 @@ export OCAMLRUNPARAM=b make lib-ext fi make all + make man rm -f ~/local/bin/opam make install @@ -167,10 +171,10 @@ export OCAMLRUNPARAM=b done # Compile and run opam-rt cd ~/build - wget https://github.com/ocaml/opam-rt/archive/$TRAVIS_PULL_REQUEST_BRANCH.tar.gz -O opam-rt.tar.gz || \ - wget https://github.com/ocaml/opam-rt/archive/master.tar.gz -O opam-rt.tar.gz + wget https://github.com/ocaml/opam-rt/archive/opam2.0.tar.gz -O opam-rt.tar.gz tar -xzf opam-rt.tar.gz cd opam-rt-* + opam install ./opam-rt.opam --deps-only -y make opam switch default diff --git a/CHANGES b/CHANGES index e438db87ab9..0cad99f6bde 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,24 @@ 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.4: +* Add (rudimentary) error handling to `make man` +* Sandboxing on MacOS: considering the possibility that TMPDIR in unset +* display: Fix opam var display +* pin: + * update source of (version) pinned directory + * fix `--ignore-pin-depends` with autopin + * fix pinnings not installing/upgrading already pinned packages (introduced in 2.0.2) +* opam clean: Ignore errors trying to remove directories +* remove wrong mismatching extra-files warning +* urls: fix hg opam 1.2 url parsing +* lint: warning error 47 on descr first line +* dirtrack: fix precise tracking mode +* system: + * lock & signals: don't interrupt at non terminal signals + * shell: fix fish manpath setting + * git: use git -c diff.noprefix=false diff in case it is defined in user config + 2.0.3: * Fix manpage remaining $ (OPAMBESTEFFORT) * Fix OPAMROOTISOK handling @@ -552,12 +570,12 @@ are not marked). * Improve the syntax of filters * Add a `messages` field * Add a `--jobs` command line option and add `%{jobs}%` to be used in OPAM files -* Various improvments in the solver heuristics +* Various improvements in the solver heuristics * By default, turn-on checking of certificates for downloaded dependency archives: use `./configure --disable-certificate-check` to go back to the previous behavior * Check the md5sum of downloaded archives when compiling OPAM * Improved `opam info` command (more information, non-zero error code when no patterns match) * Display OS and OPAM version on internal errors to ease error reporting -* Fix `opam reinstall` when reinstalling a package wich is a dependency of installed packages (regression introduced in 0.9.5) +* Fix `opam reinstall` when reinstalling a package which is a dependency of installed packages (regression introduced in 0.9.5) * Export and read `OPAMSWITCH` to be able to call OPAM in different switches * `opam-client` can now be used in a toplevel * `-n` now means `--no-setup` and not `--no-checksums` anymore @@ -700,7 +718,7 @@ are not marked). * improve opam-mk-repo * fix `opam search` to be caseless * ability to filter some commands (depending on some predicates) in opam file -* improvments when packages disapear upstream +* improvements when packages disappear upstream * check for ocaml 3.12.1 on configure * tell the user to unset some potentially dangerous variables when running opam * fix few git backend issues diff --git a/configure b/configure index c0aa4fd75ae..eca5c59613c 100755 --- a/configure +++ b/configure @@ -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.3. +# Generated by GNU Autoconf 2.69 for opam 2.0.4. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -578,8 +578,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='opam' PACKAGE_TARNAME='opam' -PACKAGE_VERSION='2.0.3' -PACKAGE_STRING='opam 2.0.3' +PACKAGE_VERSION='2.0.4' +PACKAGE_STRING='opam 2.0.4' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1264,7 +1264,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.3 to adapt to many kinds of systems. +\`configure' configures opam 2.0.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1326,7 +1326,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of opam 2.0.3:";; + short | recursive ) echo "Configuration of opam 2.0.4:";; esac cat <<\_ACEOF @@ -1429,7 +1429,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -opam configure 2.0.3 +opam configure 2.0.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1524,7 +1524,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.3, which was +It was created by opam $as_me 2.0.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -6001,7 +6001,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.3, which was +This file was extended by opam $as_me 2.0.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6054,7 +6054,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.3 +opam config.status 2.0.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 87ae97f28a8..16e0f0b61a3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl The line below must be formatted AC_INIT(opam,VERSION) with no extra spaces -AC_INIT(opam,2.0.3) +AC_INIT(opam,2.0.4) AC_COPYRIGHT(Copyright 2012-2017 OcamlPro SAS) AC_CONFIG_MACRO_DIR([m4]) diff --git a/doc/Makefile b/doc/Makefile index f4f4b5d0c3e..9f00bfd597c 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -33,15 +33,17 @@ all: man html pages man: rm -rf man mkdir -p man - $(OPAM) $(HELPFMT) > man/opam.1 + $(OPAM) $(HELPFMT) > man/opam.1 2> man/err for i in $(TOPICS); do\ - $(OPAM) $$i $(HELPFMT) > man/opam-$$i.1;\ + $(OPAM) $$i $(HELPFMT) > man/opam-$$i.1 2>> man/err ; \ done - $(OPAM) admin $(HELPFMT) > man/opam-admin.1 + $(OPAM) admin $(HELPFMT) > man/opam-admin.1 2>> man/err for i in $(TOPICS_ADMIN); do\ - $(OPAM) admin $$i $(HELPFMT) > man/opam-admin-$$i.1;\ + $(OPAM) admin $$i $(HELPFMT) > man/opam-admin-$$i.1 2>> man/err ; \ done - $(OPAM_INSTALLER) $(HELPFMT) > man/opam-installer.1 + $(OPAM_INSTALLER) $(HELPFMT) > man/opam-installer.1 2>> man/err +# Dune doesn't (yet) support --no-print-directory + @if grep -v "^Entering directory '" man/err > man/err2 ; then cat man/err2 ; false ; fi man-html: man rm -rf man-html diff --git a/doc/design/depexts-plugins b/doc/design/depexts-plugins index 3ccbb071fae..2fece2a27a2 100644 --- a/doc/design/depexts-plugins +++ b/doc/design/depexts-plugins @@ -67,7 +67,7 @@ cases outlined above: or an explanation for the failure, while perform executes the actions (typically after user confirmation) -The proposed module interface is purposedly incomplete, as it makes no assumption +The proposed module interface is intentionally incomplete, as it makes no assumption on the way in which plugins are identified, and registered, which is an orthogonal issue. diff --git a/doc/design/depopts-and-features b/doc/design/depopts-and-features index f36b14a6b7c..08c1539b113 100644 --- a/doc/design/depopts-and-features +++ b/doc/design/depopts-and-features @@ -75,7 +75,7 @@ but presented in order of increased implementation complexity package is scheduled. The depopts: field is not used at all by the package dependencies - resolution phase, and must not be transalted into CUDF. + resolution phase, and must not be translated into CUDF. After the solver returns a solution, packages in this list that are present in the system are added with all their dependencies to the diff --git a/doc/design/provides.md b/doc/design/provides.md index fa6291a0eee..a62524fe171 100644 --- a/doc/design/provides.md +++ b/doc/design/provides.md @@ -35,7 +35,7 @@ versions. The feature provided can already be encoded without an extra field: given a list of packages that `provide` a given name, a package by this name can be added -with a dependency towards either of those. However, on a repository maintainance +with a dependency towards either of those. However, on a repository maintenance point of view, having to list all the alternatives adds much more burden. Besides, it's not possible, using pinning or an additional repository, to diff --git a/doc/pages/External_solvers.md b/doc/pages/External_solvers.md index 63ce79b7247..dbb8762122b 100644 --- a/doc/pages/External_solvers.md +++ b/doc/pages/External_solvers.md @@ -61,7 +61,7 @@ For example, the preference `-removed` tells the solver that among all possible These combinators can be combined in a comma separated sequence, that is treated in lexicographic order by the solver. ### Default preferences for an upgrade -For example, the preference `-removed,-notuptodate,-changed` tells the solver that after ensuring that removals are minimised, it should look for a solution that minimises also the number of packages wich are not at their latest version, and then reduce the changes to a minimum. +For example, the preference `-removed,-notuptodate,-changed` tells the solver that after ensuring that removals are minimised, it should look for a solution that minimises also the number of packages which are not at their latest version, and then reduce the changes to a minimum. This is close to the default preference setting used by `opam` when you perform an update or an upgrade, and in practice it tries to bring _all_ your packages to the latest version available, as far as this does not implies removing too many packages. It can be set using the environment variable `OPAMUPGRADECRITERIA`, or the [`solver-upgrade-criteria:`](Manual.html#configfield-solver-upgrade-criteria) configuration field. @@ -71,7 +71,7 @@ When you request to install a (set of) package(s), in general you do not expect ### Specifying preferences for opam `opam` allows to specify your criteria on the command line, using the `--criteria` option, that will apply only to the current command. -For example if you are a very conservative user, you might try issueing the following command: +For example, if you are a very conservative user, you might try issuing the following command: ``` opam install --criteria="-removed,-changed" ... ``` diff --git a/doc/pages/Specifying_Solver_Preferences.md b/doc/pages/Specifying_Solver_Preferences.md index 45f54b10af7..740683545b4 100644 --- a/doc/pages/Specifying_Solver_Preferences.md +++ b/doc/pages/Specifying_Solver_Preferences.md @@ -25,7 +25,7 @@ For example, the preference `-removed` tells the solver that among all possibl These combinators can be combined in a comma separated sequence, that is treated in lexicographic order by the solver. ### Default preferences for an upgrade -For example, the preference `-removed,-notuptodate,-changed` tells the solver that after ensuring that removals are minimised, it should look for a solution that minimises also the number of packages wich are not at their latest version, and then reduce the changes to a minimum. +For example, the preference `-removed,-notuptodate,-changed` tells the solver that after ensuring that removals are minimised, it should look for a solution that minimises also the number of packages which are not at their latest version, and then reduce the changes to a minimum. This is the default preference setting used by `opam` when you perform an update or an upgrade, and in practice it tries to bring _all_ your packages to the latest version available, as far as this does not implies removing too many packages. It can be set using the environment variable `OPAMUPGRADECRITERIA` @@ -35,7 +35,7 @@ When you request to install a (set of) package(s), in general you do not expect ### Specifying preferences for opam Recent versions of `opam` allow to specify your criteria on the command line, using the `--criteria` option, that will apply only to the current command. -For example if you are a very conservative user, you might try issueing the following command: +For example, if you are a very conservative user, you might try issuing the following command: ``` opam install --criteria="-removed,-changed" ... ``` diff --git a/doc/pages/Tricks.md b/doc/pages/Tricks.md index 500b640ea7b..39639d127ff 100644 --- a/doc/pages/Tricks.md +++ b/doc/pages/Tricks.md @@ -103,7 +103,7 @@ to: is to use the `conflict-class:` field: add _e.g._ `conflict-class: "foo-implementation"` to all versions of both `a` and `b`. -The need to define the virtual package explicitely also ensures that a third +The need to define the virtual package explicitly also ensures that a third package can't inject a new implementation without that being visible in `foo`: it would otherwise be a security hole when we deploy end-to-end signing of packages. diff --git a/opam-client.opam b/opam-client.opam index 15f03e3898e..8065a2141eb 100644 --- a/opam-client.opam +++ b/opam-client.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -21,8 +21,8 @@ build: [ [make "%{name}%.install"] ] depends: [ - "opam-state" {= "2.0.3"} - "opam-solver" {= "2.0.3"} + "opam-state" {= "2.0.4"} + "opam-solver" {= "2.0.4"} "re" {>= "1.7.2"} "cmdliner" {>= "0.9.8"} "dune" {build & >= "1.2.1"} diff --git a/opam-core.opam b/opam-core.opam index 8fddb378876..22a831d0f83 100644 --- a/opam-core.opam +++ b/opam-core.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " diff --git a/opam-devel.opam b/opam-devel.opam index 909fb07b3f1..5be27acfc1f 100644 --- a/opam-devel.opam +++ b/opam-devel.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -22,12 +22,12 @@ build: [ ] build-test: [make "tests"] depends: [ - "opam-client" {= "2.0.3"} + "opam-client" {= "2.0.4"} "cmdliner" {>= "0.9.8"} "dune" {build & >= "1.2.1"} ] post-messages: [ -"The development version of opam has been successfuly compiled into %{lib}%/%{name}%. You should not run it from there, please install the binaries to your PATH, e.g. with +"The development version of opam has been successfully compiled into %{lib}%/%{name}%. You should not run it from there, please install the binaries to your PATH, e.g. with sudo cp %{lib}%/%{name}%/* /usr/local/bin If you just want to give it a try without altering your current installation, you could use instead: diff --git a/opam-format.opam b/opam-format.opam index 9142b89cac4..9772470dd98 100644 --- a/opam-format.opam +++ b/opam-format.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -21,7 +21,7 @@ build: [ [make "%{name}%.install"] ] depends: [ - "opam-core" {= "2.0.3"} + "opam-core" {= "2.0.4"} "opam-file-format" {>= "2.0.0~rc2"} "dune" {build & >= "1.2.1"} ] diff --git a/opam-installer.opam b/opam-installer.opam index 58922d42e77..e07352ccd67 100644 --- a/opam-installer.opam +++ b/opam-installer.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -21,7 +21,7 @@ build: [ [make "%{name}%.install"] ] depends: [ - "opam-format" {= "2.0.3"} + "opam-format" {= "2.0.4"} "cmdliner" {>= "0.9.8"} "dune" {build & >= "1.2.1"} ] diff --git a/opam-repository.opam b/opam-repository.opam index 6c09dc381cf..0122dde5b55 100644 --- a/opam-repository.opam +++ b/opam-repository.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -21,7 +21,7 @@ build: [ [make "%{name}%.install"] ] depends: [ - "opam-format" {= "2.0.3"} + "opam-format" {= "2.0.4"} "dune" {build & >= "1.2.1"} ] available: ocaml-version >= "4.02.3" diff --git a/opam-solver.opam b/opam-solver.opam index 01cbe61357d..a7bef8baf1e 100644 --- a/opam-solver.opam +++ b/opam-solver.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -21,7 +21,7 @@ build: [ [make "%{name}%.install"] ] depends: [ - "opam-format" {= "2.0.3"} + "opam-format" {= "2.0.4"} "mccs" {>= "1.1+9"} "dose3" {>= "5"} "cudf" {>= "0.7"} diff --git a/opam-state.opam b/opam-state.opam index 527b6464b13..ac41ad9e767 100644 --- a/opam-state.opam +++ b/opam-state.opam @@ -1,5 +1,5 @@ opam-version: "1.2" -version: "2.0.3" +version: "2.0.4" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -21,7 +21,7 @@ build: [ [make "%{name}%.install"] ] depends: [ - "opam-repository" {= "2.0.3"} + "opam-repository" {= "2.0.4"} "dune" {build & >= "1.2.1"} ] available: ocaml-version >= "4.02.3" diff --git a/shell/bundle.sh b/shell/bundle.sh index 2dd635605c2..b390a1e077b 100755 --- a/shell/bundle.sh +++ b/shell/bundle.sh @@ -2,7 +2,7 @@ set -ue OCAMLV=4.04.1 -OPAMV=2.0.3 +OPAMV=2.0.4 OPAM_REPO=https://opam.ocaml.org/2.0 DEBUG= MAKESELF= diff --git a/shell/install.sh b/shell/install.sh index 5325cd440a9..26e3785905a 100755 --- a/shell/install.sh +++ b/shell/install.sh @@ -120,7 +120,7 @@ fi TMP=${TMPDIR:-/tmp} -ARCH=$(uname -m || echo unknwon) +ARCH=$(uname -m || echo unknown) case "$ARCH" in x86|i?86) ARCH="i686";; x86_64|amd64) ARCH="x86_64";; @@ -181,7 +181,7 @@ if [ -e "$TMP/$OPAM_BIN" ] && ! check_sha512 || [ ! -e "$TMP/$OPAM_BIN" ]; then if check_sha512; then echo "## Downloaded." else - echo "Checksum mismatch, a problem occured during download." + echo "Checksum mismatch, a problem occurred during download." exit 10 fi fi diff --git a/src/client/opamAction.ml b/src/client/opamAction.ml index b5a8cb16ef7..4a2c42bfcaa 100644 --- a/src/client/opamAction.ml +++ b/src/client/opamAction.ml @@ -148,8 +148,14 @@ let download_package st nv = else let dir = OpamSwitchState.source_dir st nv in if OpamPackage.Set.mem nv st.pinned && - OpamFilename.exists_dir dir - then Done None + OpamFilename.exists_dir dir && + OpamStd.Option.Op.( + OpamPinned.find_opam_file_in_source nv.name dir >>= + OpamFile.OPAM.read_opt >>= + OpamFile.OPAM.version_opt) + = Some nv.version + then + Done None else (OpamUpdate.cleanup_source st (OpamPackage.Map.find_opt nv st.installed_opams) diff --git a/src/client/opamAdminCommand.ml b/src/client/opamAdminCommand.ml index db100ac32f1..65c8fd420a6 100644 --- a/src/client/opamAdminCommand.ml +++ b/src/client/opamAdminCommand.ml @@ -685,7 +685,7 @@ let env_arg = comma-separated 'var=value' bindings, when resolving variables. \ This is used e.g. when computing available packages: if undefined, \ availability of packages is not taken into account. Note that, \ - unless overriden, variables like 'root' or 'opam-version' may be \ + unless overridden, variables like 'root' or 'opam-version' may be \ taken from the current opam installation. What is defined in \ $(i,~/.opam/config) is always ignored.") diff --git a/src/client/opamAuxCommands.ml b/src/client/opamAuxCommands.ml index 39c98e29685..6002864c0bf 100644 --- a/src/client/opamAuxCommands.ml +++ b/src/client/opamAuxCommands.ml @@ -400,6 +400,7 @@ let autopin st ?(simulate=false) ?quiet atom_or_local_list = OpamStd.Sys.exit_because `Aborted in let st = + if OpamClientConfig.(!r.ignore_pin_depends) then st else OpamPackage.Set.fold (fun nv st -> OpamPinCommand.handle_pin_depends st nv (OpamSwitchState.opam st nv)) (OpamPackage.Set.union pins already_pinned_set) st @@ -491,13 +492,13 @@ let get_compatible_compiler ?repos rt dir = (OpamStd.Format.itemize OpamPackage.to_string (OpamPackage.Set.elements local_packages)); if OpamConsole.confirm "Do you want to create an empty switch regardless?" - then [] + then [], false else OpamStd.Sys.exit_because `Aborted) else let compilers = OpamPackage.Set.inter compilers installable in try [OpamSolution.eq_atom_of_package - (OpamPackage.Set.choose_one compilers)] + (OpamPackage.Set.choose_one compilers)], true with | Not_found when not (OpamPackage.Set.is_empty local_packages) -> OpamConsole.warning @@ -507,7 +508,7 @@ let get_compatible_compiler ?repos rt dir = OpamConsole.confirm "Create the switch with no specific compiler selected, and attempt to \ continue?" - then [] + then [], false else OpamStd.Sys.exit_because `Aborted | Failure _ | Not_found -> (* Find a matching compiler from the default selection *) @@ -515,7 +516,7 @@ let get_compatible_compiler ?repos rt dir = OpamFile.Config.default_compiler gt.config in if default_compiler = Empty then - (OpamConsole.warning "No compiler selected"; []) + (OpamConsole.warning "No compiler selected"; [], false) else let candidates = OpamFormula.to_dnf default_compiler in try @@ -545,7 +546,7 @@ let get_compatible_compiler ?repos rt dir = Some (OpamSolution.eq_atoms_of_packages compiler) else None ) - candidates + candidates, false with Not_found -> OpamConsole.warning "The default compiler selection: %s\n\ @@ -557,5 +558,5 @@ let get_compatible_compiler ?repos rt dir = if OpamConsole.confirm "You may also proceed, with no specific compiler selected. \ Do you want to?" - then [] + then [], false else OpamStd.Sys.exit_because `Aborted diff --git a/src/client/opamAuxCommands.mli b/src/client/opamAuxCommands.mli index cb3efccbc97..570809bb5f1 100644 --- a/src/client/opamAuxCommands.mli +++ b/src/client/opamAuxCommands.mli @@ -21,7 +21,7 @@ open OpamStateTypes val copy_files_to_destdir: 'a switch_state -> dirname -> package_set -> unit (** Removes all files that may have been installed by [copy_files_to_destdir]; - it's more agressive than [OpamDirTrack.revert] and doesn't check if the + it's more aggressive than [OpamDirTrack.revert] and doesn't check if the files are current. *) val remove_files_from_destdir: 'a switch_state -> dirname -> package_set -> unit @@ -91,4 +91,4 @@ val simulate_autopin: warning, and returns the empty list after user confirmation. *) val get_compatible_compiler: ?repos:repository_name list -> - 'a repos_state -> dirname -> atom list + 'a repos_state -> dirname -> atom list * bool diff --git a/src/client/opamClient.ml b/src/client/opamClient.ml index 6e3b6355e8d..40965b20de2 100644 --- a/src/client/opamClient.ml +++ b/src/client/opamClient.ml @@ -248,7 +248,10 @@ let compute_upgrade_t ~upgrade:upgrade_atoms ()) -let upgrade_t ?strict_upgrade ?auto_install ?ask ?(check=false) ~all atoms t = +let upgrade_t + ?strict_upgrade ?auto_install ?ask ?(check=false) ?(terse=false) ~all + atoms t + = log "UPGRADE %a" (slog @@ function [] -> "" | a -> OpamFormula.string_of_atoms a) atoms; @@ -306,6 +309,8 @@ let upgrade_t ?strict_upgrade ?auto_install ?ask ?(check=false) ~all atoms t = let notuptodate = latest -- to_check in if OpamPackage.Set.is_empty notuptodate then OpamConsole.msg "Already up-to-date.\n" + else if terse then + OpamConsole.msg "No package build needed.\n" else (let hdmsg = "Everything as up-to-date as possible" in let unav = notuptodate -- Lazy.force t.available_packages in @@ -1262,9 +1267,20 @@ let reinstall t ?(assume_built=false) names = module PIN = struct open OpamPinCommand - let post_pin_action st names = + let post_pin_action st was_pinned names = + let names = + OpamPackage.Set.Op.(st.pinned -- was_pinned) + |> OpamPackage.names_of_packages + |> (fun s -> + List.fold_left + (fun s p -> OpamPackage.Name.Set.add p s) + s names) + |> OpamPackage.Name.Set.elements + in try - upgrade_t ~strict_upgrade:false ~auto_install:true ~ask:true ~all:false + upgrade_t + ~strict_upgrade:false ~auto_install:true ~ask:true ~terse:true + ~all:false (List.map (fun name -> name, None) names) st with e -> OpamConsole.note @@ -1304,13 +1320,7 @@ module PIN = struct source_pin st name ?version ~edit (Some (get_upstream st name)) | `None -> source_pin st name ?version ~edit None in - if action then - let names = - OpamPackage.Set.Op.(st.pinned -- pinned) - |> OpamPackage.Set.elements - |> List.map OpamPackage.name - in - (OpamConsole.msg "\n"; post_pin_action st names) + if action then (OpamConsole.msg "\n"; post_pin_action st pinned [name]) else st with | OpamPinCommand.Aborted -> OpamStd.Sys.exit_because `Aborted @@ -1350,13 +1360,7 @@ module PIN = struct OpamConsole.error_and_exit `Not_found "Package is not pinned, and no existing version was supplied." in - if action then - let names = - OpamPackage.Set.Op.(st.pinned -- pinned) - |> OpamPackage.Set.elements - |> List.map OpamPackage.name - in - post_pin_action st names + if action then post_pin_action st pinned [name] else st let unpin st ?(action=true) names = @@ -1372,7 +1376,9 @@ module PIN = struct else (nv.name, None) :: acc) installed_unpinned [] in - upgrade_t ~strict_upgrade:false ~auto_install:true ~ask:true ~all:false + upgrade_t + ~strict_upgrade:false ~auto_install:true ~ask:true ~all:false + ~terse:true atoms st else st diff --git a/src/client/opamClient.mli b/src/client/opamClient.mli index 46ca3dc4a1a..26e25881770 100644 --- a/src/client/opamClient.mli +++ b/src/client/opamClient.mli @@ -85,10 +85,12 @@ val update: val upgrade: rw switch_state -> ?check:bool -> all:bool -> atom list -> rw switch_state -(** Low-level version of [upgrade], bypassing the package name sanitization - and dev package update, and offering more control *) +(** Low-level version of [upgrade], bypassing the package name sanitization and + dev package update, and offering more control. [terse] avoids the verbose + message when we are at a local maximum, but there are possible upgrades *) val upgrade_t: ?strict_upgrade:bool -> ?auto_install:bool -> ?ask:bool -> ?check:bool -> + ?terse:bool -> all:bool -> atom list -> rw switch_state -> rw switch_state (** Recovers from an inconsistent universe *) @@ -121,4 +123,9 @@ module PIN: sig (** List the current pinned packages. *) val list: 'a switch_state -> short:bool -> unit + (** Runs an install/upgrade on the listed packages if necessary. + [post_pin_action st was_pinned names] takes the set of packages pinned + beforehand, and a list of newly pinned packages *) + val post_pin_action: rw switch_state -> package_set -> name list -> rw switch_state + end diff --git a/src/client/opamCommands.ml b/src/client/opamCommands.ml index 1500a4ba5a9..e671209996d 100644 --- a/src/client/opamCommands.ml +++ b/src/client/opamCommands.ml @@ -184,7 +184,7 @@ let init = `S "ARGUMENTS"; `S "OPTIONS"; `S "CONFIGURATION FILE"; - `P "Any field from the built-in initial configuration can be overriden \ + `P "Any field from the built-in initial configuration can be overridden \ through $(i,~/.opamrc), $(i,/etc/opamrc), or a file supplied with \ $(i,--config). The default configuration for this version of opam \ can be obtained using $(b,--show-default-opamrc)."; @@ -285,7 +285,7 @@ let init = let no_sandboxing = mk_flag ["disable-sandboxing"] "Use a default configuration with sandboxing disabled (note that this \ - may be overriden by `opamrc' if $(b,--no-opamrc) is not specified or \ + may be overridden by `opamrc' if $(b,--no-opamrc) is not specified or \ $(b,--config) is used). Use this at your own risk, without sandboxing \ it is possible for a broken package script to delete all your files." in @@ -1564,7 +1564,7 @@ let repository = package definitions anymore. With $(b,--all), makes opam forget about \ these repositories completely."; "set-repos", `set_repos, ["NAME..."], - "Explicitely selects the list of repositories to look up package \ + "Explicitly selects the list of repositories to look up package \ definitions from, in the specified priority order (overriding previous \ selection and ranks), according to the specified scope."; "set-url", `set_url, ["NAME"; "ADDRESS"; "[QUORUM]"; "[FINGERPRINTS]"], @@ -2040,7 +2040,7 @@ let switch = match packages, compiler_opt, OpamSwitch.is_external switch with | None, None, false -> OpamSwitchCommand.guess_compiler_package ?repos rt - (OpamSwitch.to_string switch) + (OpamSwitch.to_string switch), false | None, None, true -> OpamAuxCommands.get_compatible_compiler ?repos rt (OpamFilename.dirname_dir @@ -2049,7 +2049,7 @@ let switch = OpamStd.Option.Op.( ((compiler_opt >>| OpamSwitchCommand.guess_compiler_package ?repos rt) +! []) @ - packages +! []) + packages +! []), false in let param_compiler = function | [] -> None @@ -2109,7 +2109,7 @@ let switch = OpamGlobalState.with_ `Lock_write @@ fun gt -> let repos, rt = get_repos_rt gt repos in let switch = OpamSwitch.of_string switch_arg in - let packages = + let packages, local_compiler = compiler_packages rt ?repos switch (param_compiler params) in let _gt, st = @@ -2117,10 +2117,12 @@ let switch = ?synopsis:descr ?repos ~update_config:(not no_switch) ~packages + ~local_compiler switch in let st = - if not no_install && not empty && OpamSwitch.is_external switch then + if not no_install && not empty && + OpamSwitch.is_external switch && not local_compiler then let st, atoms = OpamAuxCommands.autopin st ~simulate:deps_only ~quiet:true [`Dirname (OpamFilename.Dir.of_string switch_arg)] @@ -2564,26 +2566,18 @@ let pin ?(unpin_only=false) () = OpamPath.Switch.Overlay.tmp_opam st.switch_global.root st.switch name in - if not (OpamFilename.exists (OpamFile.filename opam_localf)) then - OpamFile.OPAM.write opam_localf opam) opam_opt; - try OpamPinCommand.source_pin st name ~edit (Some url) - with OpamPinCommand.Aborted -> OpamStd.Sys.exit_because `Aborted - | OpamPinCommand.Nothing_to_do -> st) + if not (OpamFilename.exists (OpamFile.filename opam_localf)) + then OpamFile.OPAM.write opam_localf opam) + opam_opt; + try OpamPinCommand.source_pin st name ~edit (Some url) with + | OpamPinCommand.Aborted -> OpamStd.Sys.exit_because `Aborted + | OpamPinCommand.Nothing_to_do -> st) st names in - (* names are in newly pinned packages *) - let atoms = - OpamPackage.Set.Op.(st.pinned -- pinned) - |> OpamPackage.Set.elements - |> List.map (fun p -> (OpamPackage.name p, None)) - in if action then - let _st = - OpamClient.upgrade_t - ~strict_upgrade:false ~auto_install:true ~ask:true ~all:false - atoms st - in - `Ok () + (ignore @@ + OpamClient.PIN.post_pin_action st pinned (List.map fst names); + `Ok ()) else `Ok ()) | Some `add, [n; target] | Some `default n, [target] -> (match (fst package) n with @@ -2928,14 +2922,16 @@ let clean = OpamConsole.msg "rm -rf \"%s\"/*\n" (OpamFilename.Dir.to_string d) else - OpamFilename.cleandir d + try OpamFilename.cleandir d + with OpamSystem.Internal_error msg -> OpamConsole.warning "Error ignored: %s" msg in let rmdir d = if dry_run then OpamConsole.msg "rm -rf \"%s\"\n" (OpamFilename.Dir.to_string d) else - OpamFilename.rmdir d + try OpamFilename.rmdir d + with OpamSystem.Internal_error msg -> OpamConsole.warning "Error ignored: %s" msg in let switches = if all_switches then OpamGlobalState.switches gt diff --git a/src/client/opamConfigCommand.ml b/src/client/opamConfigCommand.ml index 4937cde29a6..4cb579c7b94 100644 --- a/src/client/opamConfigCommand.ml +++ b/src/client/opamConfigCommand.ml @@ -29,10 +29,25 @@ let help t = all_global_vars (OpamVariable.Map.map snd t.switch_global.global_variables) in - List.map (fun (var, doc) -> [ + let env = OpamPackageVar.resolve t in + List.map (fun (var, doc) -> + let content = + OpamFilter.ident_string env ~default:"" ([],var,None) + in + let doc = + if doc = OpamGlobalState.inferred_from_system then + match OpamStd.Option.Op.( + OpamVariable.Map.find_opt var t.switch_global.global_variables + >>| fst + >>= Lazy.force) with + | Some c when (OpamVariable.string_of_variable_contents c) <> content -> + "Set through local opam config or env" + | _ -> doc + else doc + in + [ OpamVariable.to_string var % `bold; - OpamFilter.ident_string (OpamPackageVar.resolve t) ~default:"" - ([],var,None) % `blue; + content % `blue; "#"; doc ]) (OpamVariable.Map.bindings all_global_vars) |> @@ -159,6 +174,17 @@ let rec print_fish_env env = (OpamStd.Env.escape_single_quotes ~using_backslashes:true v)) v) in + (* set manpath if and only if fish version >= 2.7 *) + let manpath_cmd v = + OpamConsole.msg "%s" ( + (* test for existence of `argparse` builtin, introduced in fish 2.7 . + * use `grep' instead of `builtin string match' so that old fish versions do not + * produce unwanted error messages on stderr. + * use `grep' inside a `/bin/sh' fragment so that nothing is written to stdout or + * stderr if `grep' does not exist. *) + "builtin -n | /bin/sh -c 'grep -q \\'^argparse$\\'' 1>/dev/null 2>/dev/null; and " + ) ; + set_arr_cmd "MANPATH" v in match env with | [] -> () | (k, v, _) :: r -> @@ -170,8 +196,7 @@ let rec print_fish_env env = * opamState.ml for details *) set_arr_cmd k v | "MANPATH" -> - if OpamStd.Env.getopt k <> None then - set_arr_cmd k v + manpath_cmd v | _ -> OpamConsole.msg "set -gx %s '%s';\n" k (OpamStd.Env.escape_single_quotes ~using_backslashes:true v)); @@ -315,32 +340,35 @@ let set_global var value = OpamGlobalState.write { gt with config } let variable gt v = - match OpamPackageVar.resolve_global gt v with - | Some c -> - OpamConsole.msg "%s\n" (OpamVariable.string_of_variable_contents c) - | None -> + let raw_switch_content = match OpamStateConfig.get_switch_opt () with - | None -> - OpamConsole.error_and_exit `Not_found - "Variable %s not found" - (OpamVariable.Full.to_string v) | Some switch -> let switch_config = OpamFile.Switch_config.safe_read (OpamPath.Switch.switch_config gt.root switch) in - match OpamPackageVar.resolve_switch_raw gt switch switch_config v with - | Some c -> - OpamConsole.msg "%s\n" (OpamVariable.string_of_variable_contents c) - | None -> - OpamSwitchState.with_ `Lock_none gt @@ fun st -> - match OpamPackageVar.resolve st v with - | Some c -> - OpamConsole.msg "%s\n" (OpamVariable.string_of_variable_contents c) - | None -> - OpamConsole.error_and_exit `Not_found - "Variable %s not found" - (OpamVariable.Full.to_string v) + OpamPackageVar.resolve_switch_raw gt switch switch_config v + | None -> None + in + let switch_content = + match raw_switch_content with + | None when not (OpamVariable.Full.is_global v) -> + OpamSwitchState.with_ `Lock_none gt @@ fun st -> + OpamPackageVar.resolve st v + | rsc -> rsc + in + let content = + match switch_content with + | Some _ as some -> some + | None -> OpamPackageVar.resolve_global gt v + in + match content with + | Some c -> OpamConsole.msg "%s\n" (OpamVariable.string_of_variable_contents c) + | None -> + OpamConsole.error_and_exit `Not_found + "Variable %s not found" + (OpamVariable.Full.to_string v) + let exec gt ?set_opamroot ?set_opamswitch ~inplace_path command = log "config-exec command=%a" (slog (String.concat " ")) command; diff --git a/src/client/opamInitDefaults.mli b/src/client/opamInitDefaults.mli index 06419db1031..36843f49047 100644 --- a/src/client/opamInitDefaults.mli +++ b/src/client/opamInitDefaults.mli @@ -9,7 +9,7 @@ (**************************************************************************) (** This module defines a few defaults, used at 'opam init', that bind opam to - its default OCaml repository at https://opam.ocaml.org. All can be overriden + its default OCaml repository at https://opam.ocaml.org. All can be overridden through the init command flags or an init config file. *) open OpamTypes diff --git a/src/client/opamSwitchCommand.ml b/src/client/opamSwitchCommand.ml index 8b5bdc8dbc0..8b1a37fe8a4 100644 --- a/src/client/opamSwitchCommand.ml +++ b/src/client/opamSwitchCommand.ml @@ -269,7 +269,7 @@ let install_compiler_packages t atoms = OpamSolution.check_solution ~quiet:OpamClientConfig.(not !r.show) t result; t -let install gt ?rt ?synopsis ?repos ~update_config ~packages switch = +let install gt ?rt ?synopsis ?repos ~update_config ~packages ?(local_compiler=false) switch = let update_config = update_config && not (OpamSwitch.is_external switch) in let old_switch_opt = OpamFile.Config.switch gt.config in let comp_dir = OpamPath.Switch.root gt.root switch in @@ -311,6 +311,13 @@ let install gt ?rt ?synopsis ?repos ~update_config ~packages switch = in { st with switch; available_packages } in + let st = + if OpamSwitch.is_external switch && local_compiler then + OpamAuxCommands.autopin st ~quiet:true + [`Dirname (OpamFilename.Dir.of_string (OpamSwitch.to_string switch))] + |> fst + else st + in let packages = try OpamSolution.sanitize_atom_list st packages with e -> diff --git a/src/client/opamSwitchCommand.mli b/src/client/opamSwitchCommand.mli index c7804e97f1a..0b25b142571 100644 --- a/src/client/opamSwitchCommand.mli +++ b/src/client/opamSwitchCommand.mli @@ -24,7 +24,9 @@ val install: ?synopsis:string -> ?repos:repository_name list -> update_config:bool -> - packages:atom conjunction -> switch -> + packages:atom conjunction -> + ?local_compiler:bool -> + switch -> unlocked global_state * rw switch_state (** Install a compiler's base packages *) diff --git a/src/core/opamDirTrack.ml b/src/core/opamDirTrack.ml index 9eed72c2d6f..45ed3a0ac88 100644 --- a/src/core/opamDirTrack.ml +++ b/src/core/opamDirTrack.ml @@ -60,7 +60,7 @@ let cached_digest = fun f size mtime -> try let csize, cmtime, digest = Hashtbl.find item_cache f in - if csize = size || mtime = cmtime then digest + if csize = size || mtime = cmtime then Digest.to_hex digest else raise Not_found with Not_found -> let digest = Digest.file f in diff --git a/src/core/opamProcess.ml b/src/core/opamProcess.ml index 42ff6ad61b5..9475bfdbdbe 100644 --- a/src/core/opamProcess.ml +++ b/src/core/opamProcess.ml @@ -131,7 +131,7 @@ let string_of_info ?(color=`yellow) info = [cmd] with arguments [args]. If [stdout_file] or [stderr_file] are set, the channels are redirected to the corresponding files. The outputs are discarded is [verbose] is set to false. The current - environment can also be overriden if [env] is set. The environment + environment can also be overridden if [env] is set. The environment which is used to run the process is recorded into [env_file] (if set). *) let create ?info_file ?env_file ?(allow_stdin=true) ?stdout_file ?stderr_file ?env ?(metadata=[]) ?dir diff --git a/src/core/opamStd.mli b/src/core/opamStd.mli index 4a623d03088..74129dfbab8 100644 --- a/src/core/opamStd.mli +++ b/src/core/opamStd.mli @@ -236,13 +236,13 @@ module String : sig (** {4 Transformations} *) - (** Cut a string at the first occurence of the given char *) + (** Cut a string at the first occurrence of the given char *) val cut_at: string -> char -> (string * string) option (** Same as [cut_at], but starts from the right *) val rcut_at: string -> char -> (string * string) option - (** Split a string at occurences of a given characters. Empty strings are + (** Split a string at occurrences of a given characters. Empty strings are skipped. *) val split: string -> char -> string list @@ -419,7 +419,7 @@ module Sys : sig (** Indicates intention to exit the program with given exit code *) exception Exit of int - (** Indicates intention to exec() the given command (paramters as per + (** Indicates intention to exec() the given command (parameters as per [Unix.execvpe]), after proper finalisations. It's the responsibility of the main function to catch this, call [exec_at_exit], and [Unix.execvpe]. *) diff --git a/src/core/opamSystem.ml b/src/core/opamSystem.ml index 90b68959826..81133b3e1a0 100644 --- a/src/core/opamSystem.ml +++ b/src/core/opamSystem.ml @@ -817,12 +817,18 @@ let rec flock_update Unix.(lockf fd F_ULOCK 0); Unix.lockf fd (unix_lock_op ~dontblock:true flag) 0 with Unix.Unix_error (Unix.EAGAIN,_,_) -> - if dontblock then raise Locked; + if dontblock then + OpamConsole.error_and_exit `Locked + "Another process has locked %s and non blocking mode enabled" + file; OpamConsole.formatted_msg "Another process has locked %s, waiting (%s to abort)... " file (if Sys.win32 then "CTRL+C" else "C-c"); - (try Unix.lockf fd (unix_lock_op ~dontblock:false flag) 0; - with Sys.Break as e -> OpamConsole.msg "\n"; raise e); + let rec lock_w_ignore_sig () = + try Unix.lockf fd (unix_lock_op ~dontblock:false flag) 0; + with Sys.Break as e -> (OpamConsole.msg "\n"; raise e) + | Unix.Unix_error (Unix.EINTR,_,_) -> lock_w_ignore_sig () + in lock_w_ignore_sig (); OpamConsole.msg "lock acquired.\n"); lock.kind <- (flag :> lock_flag) | _ -> assert false diff --git a/src/core/opamUrl.ml b/src/core/opamUrl.ml index d2e2115dfa0..d895df48ea3 100644 --- a/src/core/opamUrl.ml +++ b/src/core/opamUrl.ml @@ -36,7 +36,7 @@ let split_url = opt @@ seq [ (* Backend *) opt @@ seq [ group @@ rep @@ diff any (set "+:"); - char '+' ]; + alt [ char '+'; str "://"] ]; (* Protocol *) group @@ rep @@ diff any (char ':'); (* Separator *) diff --git a/src/core/opamVersionCompare.ml b/src/core/opamVersionCompare.ml index 016e179bc59..e11f4f530d3 100644 --- a/src/core/opamVersionCompare.ml +++ b/src/core/opamVersionCompare.ml @@ -75,7 +75,7 @@ let skip_zeros x xi xl = skip_while_from xi (fun c -> c = '0') x xl;; (* compare versions chunks, that is parts of version strings that are * epoch, upstream version, or revisision. Alternates string comparison - * and numerical comaprison. *) + * and numerical comparison. *) let compare_chunks x y = (* x and y may be empty *) let xl = String.length x diff --git a/src/format/opamVariable.ml b/src/format/opamVariable.ml index 832ad00aab2..9cc2fcd5321 100644 --- a/src/format/opamVariable.ml +++ b/src/format/opamVariable.ml @@ -57,7 +57,7 @@ module Full = struct in { scope; variable } - (* Read the variables overriden through the environment *) + (* Read the variables overridden through the environment *) let read_from_env v = let var_str = to_string (variable v) in let undash = OpamStd.String.map (function '-' -> '_' | c -> c) in diff --git a/src/repository/opamGit.ml b/src/repository/opamGit.ml index 8ea157b5c11..7c6635504d8 100644 --- a/src/repository/opamGit.ml +++ b/src/repository/opamGit.ml @@ -33,6 +33,8 @@ module VCS : OpamVCS.VCS = struct git repo_root [ "init" ]; (* Enforce this option, it can break our use of git if set *) git repo_root [ "config" ; "--local" ; "fetch.prune"; "false"]; + (* We reset diff.noprefix to ensure we get a `-p1` patch and avoid . *) + git repo_root [ "config" ; "--local" ; "diff.noprefix"; "false"]; (* Document the remote for user-friendliness (we don't use it) *) git repo_root [ "remote"; "add"; "origin"; OpamUrl.base_url repo_url ]; ] @@+ function @@ -156,7 +158,8 @@ module VCS : OpamVCS.VCS = struct (* Git diff is to the working dir, but doesn't work properly for unregistered directories. *) OpamSystem.raise_on_process_error r; - git repo_root ~stdout:patch_file [ "diff" ; "--no-ext-diff" ; "-R" ; "-p" ; rref; "--" ] + (* We also reset diff.noprefix here to handle already existing repo. *) + git repo_root ~stdout:patch_file [ "-c" ; "diff.noprefix=false" ; "diff" ; "--no-ext-diff" ; "-R" ; "-p" ; rref; "--" ] @@> fun r -> if not (OpamProcess.check_success_and_cleanup r) then (finalise (); diff --git a/src/repository/opamRepositoryBackend.mli b/src/repository/opamRepositoryBackend.mli index c299f903f41..9dc7b3e8792 100644 --- a/src/repository/opamRepositoryBackend.mli +++ b/src/repository/opamRepositoryBackend.mli @@ -69,7 +69,7 @@ module type S = sig val revision: dirname -> version option OpamProcess.job (** Like [pull_url], except for locally-bound version control backends, where - it should get the latest, uncommited source. *) + it should get the latest, uncommitted source. *) val sync_dirty: dirname -> url -> filename option download OpamProcess.job @@ -90,7 +90,7 @@ val local: dirname -> repository one [expected]. *) val check_digest: filename -> OpamHash.t option -> bool -(** Adds a label to the given job, for the correspondig repository name and +(** Adds a label to the given job, for the corresponding repository name and action *) val job_text: repository_name -> string -> 'a OpamProcess.job -> 'a OpamProcess.job diff --git a/src/solver/opamCudf.ml b/src/solver/opamCudf.ml index af72104fb41..e07ff546f55 100644 --- a/src/solver/opamCudf.ml +++ b/src/solver/opamCudf.ml @@ -122,7 +122,7 @@ module Graph = struct let strong_deps, weak_deps = (* strong deps are mandatory (constraint appearing in the top conjunction) - weak deps correspond to optional occurences of a package, as part of + weak deps correspond to optional occurrences of a package, as part of a disjunction: e.g. in (A>=4 & (B | A<5)), A>=4 is strong, and the other two are weak. In the end we want to retain B and A>=4. *) List.fold_left (fun (strong_deps, weak_deps) l -> diff --git a/src/solver/opamCudf.mli b/src/solver/opamCudf.mli index 7d94af8e6b8..cb8158dfff8 100644 --- a/src/solver/opamCudf.mli +++ b/src/solver/opamCudf.mli @@ -143,7 +143,7 @@ val remove: Cudf.universe -> Cudf_types.pkgname -> Cudf_types.constr -> Cudf.uni val uninstall_all: Cudf.universe -> Cudf.universe (** Install a package in the universe. We don't care about any - invariant here (eg. the resulting universe can have mutliple + invariant here (eg. the resulting universe can have multiple versions of the same package installed). *) val install: Cudf.universe -> Cudf.package -> Cudf.universe diff --git a/src/state/opamFileTools.ml b/src/state/opamFileTools.ml index 4b99a2848ab..b68b7021ace 100644 --- a/src/state/opamFileTools.ml +++ b/src/state/opamFileTools.ml @@ -497,7 +497,8 @@ let lint ?check_extra_files t = (t.install <> [] || t.remove <> [] || t.url <> None || t.extra_sources <> [])); cond 47 `Warning - "Synopsis should start with a capital and not end with a dot" + "Synopsis (or description first line) should start with a capital and \ + not end with a dot" (let valid_re = Re.(compile (seq [bos; diff any (alt [blank; lower]); rep any; diff any (alt [blank; char '.']); eos])) @@ -845,7 +846,8 @@ let add_aux_files ?dir ~files_subdir_hashes opam = (OpamFilename.Dir.to_string dir); opam | Some oef, Some ef -> - if oef <> ef then + let sort = List.sort (fun (b, _) (b', _) -> compare b b') in + if sort oef <> sort ef then log "Mismatching extra-files at %s" (OpamFilename.Dir.to_string dir); opam diff --git a/src/state/opamGlobalState.ml b/src/state/opamGlobalState.ml index 92aa9bca2a7..25815cd53b9 100644 --- a/src/state/opamGlobalState.ml +++ b/src/state/opamGlobalState.ml @@ -34,6 +34,8 @@ let load_config global_lock root = OpamFormatUpgrade.as_necessary global_lock root config; config +let inferred_from_system = "Inferred from system" + let load lock_kind = let root = OpamStateConfig.(!r.root_dir) in log "LOAD-GLOBAL-STATE @ %a" (slog OpamFilename.Dir.to_string) root; @@ -64,7 +66,9 @@ let load lock_kind = List.fold_left (fun acc (v,value) -> OpamVariable.Map.add v (lazy (Some (OpamStd.Option.default (S "unknown") (Lazy.force value))), - "Inferred from system") + (* Careful on changing it, it is used to determine user defined + variables on `config report`. See [OpamConfigCommand.help]. *) + inferred_from_system) acc) OpamVariable.Map.empty (OpamSysPoll.variables) diff --git a/src/state/opamGlobalState.mli b/src/state/opamGlobalState.mli index 4a298d8f0e0..013dedd44b4 100644 --- a/src/state/opamGlobalState.mli +++ b/src/state/opamGlobalState.mli @@ -39,7 +39,7 @@ val switch_exists: 'a global_state -> switch -> bool val installed_versions: 'a global_state -> name -> switch list package_map (** Default list of repositories to get packages from, ordered by decreasing - priority. This can be overriden by switch-specific selections, and does not + priority. This can be overridden by switch-specific selections, and does not have to include all configured repositories. *) val repos_list: 'a global_state -> repository_name list @@ -60,3 +60,6 @@ val write: rw global_state -> unit registered if it is set and exists, and removing any non-existing switches. Writes back to disk if possible (ie lock is available) *) val fix_switch_list: 'a global_state -> 'a global_state + +(** Description used for system inferred variables *) +val inferred_from_system: string diff --git a/src/state/opamStateTypes.mli b/src/state/opamStateTypes.mli index c00cebc6921..0e64378157a 100644 --- a/src/state/opamStateTypes.mli +++ b/src/state/opamStateTypes.mli @@ -54,7 +54,7 @@ type +'lock global_state = { config: OpamFile.Config.t; (** The main configuration file. A note of caution: this corresponds to the configuration as loaded from the file: to get the current options, which - may be overriden through the command-line or environment, see + may be overridden through the command-line or environment, see OpamStateConfig *) global_variables: diff --git a/src/state/opamUpdate.mli b/src/state/opamUpdate.mli index 477b9c5a406..f384f711fe0 100644 --- a/src/state/opamUpdate.mli +++ b/src/state/opamUpdate.mli @@ -47,7 +47,7 @@ val dev_packages: (** Updates a single dev or pinned package from its upstream. If [working_dir] is set, and the package is bound to a local, version-controlled dir, use the - working dir state instead of what has been commited to version control. + working dir state instead of what has been committed to version control. Returns true if changed, false otherwise, and a switch_state update function, applying possible changes in packages metadata *) diff --git a/src/state/shellscripts/sandbox_exec.sh b/src/state/shellscripts/sandbox_exec.sh index 752be7530c9..4926239a4fd 100644 --- a/src/state/shellscripts/sandbox_exec.sh +++ b/src/state/shellscripts/sandbox_exec.sh @@ -13,7 +13,20 @@ add_mounts() { esac } -add_mounts rw "${TMPDIR:-/tmp}" +if [ -z ${TMPDIR+x} ]; then + # If $TMPDIR is not set, some applications use /tmp, so + # /tmp must be made readable/writable + add_mounts rw /tmp + # However, others applications obtain the per-user temporary + # directory differently; the latter should be made readable/writable + # too and getconf seems to be a robust way to get it + if [ -z /usr/bin/getconf ]; then + TMP=`getconf DARWIN_USER_TEMP_DIR` + add_mounts rw $TMP + fi +else + add_mounts rw $TMPDIR +fi # C compilers using `ccache` will write to a shared cache directory # that remain writeable. ccache seems widespread in some Fedora systems. diff --git a/tests/README.unittest b/tests/README.unittest index 57efc1593ee..79bf9fc0496 100644 --- a/tests/README.unittest +++ b/tests/README.unittest @@ -9,7 +9,7 @@ ./init-repo.sh -i -* load a inital scenario (this command can be invoked multiple times): +* load an initial scenario (this command can be invoked multiple times): ./init-repo.sh -s 1 ./init-repo.sh -s 2