-
Notifications
You must be signed in to change notification settings - Fork 37
Clean up the lock file #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Halbaroth
wants to merge
5
commits into
OCamlPro:next
Choose a base branch
from
Halbaroth:clean-lock-file
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Clean up the lock file #1367
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e2e6a2e
Clean up the lock file
Halbaroth 2aa9957
Generate lock files in a fresh switch
Halbaroth 30522c5
Add opam-ed package in the nix shell
Halbaroth dbf5b16
Do not erase the locked switch at end of the script
Halbaroth 0274cd6
Clean up the switch if it is a fresh one
Halbaroth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| opam-version: "2.0" | ||
| name: "alt-ergo" | ||
| version: "dev" | ||
| synopsis: "The Alt-Ergo SMT prover" | ||
| description: """\ | ||
| Alt-Ergo is an automatic theorem prover of mathematical formulas. It was developed at LRI, and is now maintained at OCamlPro. | ||
|
|
||
| See more details on https://alt-ergo.ocamlpro.com/""" | ||
| maintainer: "Alt-Ergo developers <alt-ergo@ocamlpro.com>" | ||
| authors: "Alt-Ergo developers <alt-ergo@ocamlpro.com>" | ||
| license: ["LicenseRef-OCamlpro-Non-Commercial" "Apache-2.0"] | ||
| tags: "org:OCamlPro" | ||
| homepage: "https://alt-ergo.ocamlpro.com/" | ||
| doc: "https://ocamlpro.github.io/alt-ergo" | ||
| bug-reports: "https://github.com/OCamlPro/alt-ergo/issues" | ||
| depends: [ | ||
| "alt-ergo-lib" {= "dev"} | ||
| "base-bigarray" {= "base"} | ||
| "base-threads" {= "base"} | ||
| "base-unix" {= "base"} | ||
| "camlzip" {= "1.14"} | ||
| "cmdliner" {= "2.1.1"} | ||
| "conf-gmp" {= "5"} | ||
| "conf-pkg-config" {= "5"} | ||
| "conf-zlib" {= "1"} | ||
| "crunch" {= "4.1.0"} | ||
| "csexp" {= "1.5.2"} | ||
| "dolmen" {= "dev"} | ||
| "dolmen_loop" {= "dev"} | ||
| "dolmen_type" {= "dev"} | ||
| "dune" {= "3.24.2"} | ||
| "dune-build-info" {= "3.24.2"} | ||
| "dune-private-libs" {= "3.24.2"} | ||
| "dune-site" {= "3.24.2"} | ||
| "dyn" {= "3.24.2"} | ||
| "fmt" {= "0.11.0"} | ||
| "fs-io" {= "3.24.2"} | ||
| "gen" {= "1.1"} | ||
| "hmap" {= "0.8.1"} | ||
| "logs" {= "0.10.0"} | ||
| "menhir" {= "20260209"} | ||
| "menhirCST" {= "20260209"} | ||
| "menhirGLR" {= "20260209"} | ||
| "menhirLib" {= "20260209"} | ||
| "menhirSdk" {= "20260209"} | ||
| "ocamlbuild" {= "0.16.1"} | ||
| "ocplib-simplex" {= "0.5.1"} | ||
| "ordering" {= "3.24.2"} | ||
| "pp" {= "2.0.0"} | ||
| "pp_loc" {= "2.1.0"} | ||
| "ptime" {= "1.2.0"} | ||
| "seq" {= "base"} | ||
| "spelll" {= "0.4"} | ||
| "stdlib-shims" {= "0.3.0"} | ||
| "stdune" {= "3.24.2"} | ||
| "top-closure" {= "3.24.2"} | ||
| "topkg" {= "1.1.1"} | ||
| "uutf" {= "1.0.4"} | ||
| "zarith" {= "1.14"} | ||
| ] | ||
| build: [ | ||
| ["dune" "subst"] {dev} | ||
| [ | ||
| "dune" | ||
| "build" | ||
| "-p" | ||
| name | ||
| "-j" | ||
| jobs | ||
| "--promote-install-files=false" | ||
| "@install" | ||
| "@runtest" {with-test} | ||
| "@doc" {with-doc} | ||
| ] | ||
| ["dune" "install" "-p" name "--create-install-files" name] | ||
| ] | ||
| dev-repo: "git+https://github.com/OCamlPro/alt-ergo.git" | ||
| pin-depends: [ | ||
| [ | ||
| "dolmen.dev" | ||
| "git+https://github.com/Gbury/dolmen.git#a0f1bc66e7256fff1068ac0df525a2d23c1f3ea7" | ||
| ] | ||
| [ | ||
| "dolmen_loop.dev" | ||
| "git+https://github.com/Gbury/dolmen.git#a0f1bc66e7256fff1068ac0df525a2d23c1f3ea7" | ||
| ] | ||
| [ | ||
| "dolmen_type.dev" | ||
| "git+https://github.com/Gbury/dolmen.git#a0f1bc66e7256fff1068ac0df525a2d23c1f3ea7" | ||
| ] | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { sources, lib, ocamlPackages, cmdliner_2, opam-file-format }: | ||
|
|
||
| let | ||
| opam-ed = sources.opam-ed; | ||
| in | ||
|
|
||
| ocamlPackages.buildDunePackage { | ||
| strictDeps = true; | ||
| pname = "opam-ed"; | ||
| inherit (opam-ed) version; | ||
|
|
||
| minimalOCamlVersion = "4.08"; | ||
| duneVersion = "3"; | ||
|
|
||
| propagatedBuildInputs = with ocamlPackages; [ | ||
| cmdliner_2 | ||
| opam-file-format | ||
| ]; | ||
|
|
||
| src = opam-ed; | ||
|
|
||
| meta = with lib; { | ||
| inherit (opam-ed) homepage description; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
|
|
||
| forbidden_fields=( | ||
| "\"ocaml\"" | ||
| "\"ocaml-base-compiler\"" | ||
| "\"ocaml-system\"" | ||
| "\"ocaml-config\"" | ||
| "\"ocaml-variants\"" | ||
| "\"ocaml-compiler\"" | ||
| "\"ocaml-compiler-libs\"" | ||
| "\"ocaml-options-vanilla\"" | ||
| "\"base-domains\"" | ||
| "\"base-effects\"" | ||
| "\"base-nnp\"" | ||
| "\"ocamlfind\"" | ||
| "\"host" | ||
| ) | ||
|
|
||
| read input || true | ||
|
|
||
| for key in "${forbidden_fields[@]}" | ||
| do | ||
| if [[ "$input" =~ "$key" ]] then | ||
| exit 1 | ||
| fi | ||
| done | ||
|
|
||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/usr/bin/env bash | ||
| set -e | ||
| trap cleanup EXIT | ||
| export OPAMYES=true | ||
| export OPAMSWITCH="$LOCK_SWITCH" | ||
|
|
||
| function cleanup() { | ||
| opam switch remove "$LOCK_SWITCH" | ||
| } | ||
|
|
||
| opam switch create "$LOCK_SWITCH" 5.4.1 --no-switch | ||
|
|
||
| opam install --deps-only --with-test --assume-depexts \ | ||
| ./alt-ergo-lib.opam \ | ||
| ./alt-ergo.opam | ||
|
|
||
| opam exec -- dune build @install @runtest -p \ | ||
| alt-ergo-lib,alt-ergo | ||
|
|
||
| opam lock -w \ | ||
| ./alt-ergo-lib.opam \ | ||
| ./alt-ergo.opam | ||
|
|
||
| opam-ed -i \ | ||
| "filter depends ./rsc/extra/filter_depends.sh" \ | ||
| -f ./alt-ergo-lib.opam.locked \ | ||
| -f ./alt-ergo.opam.locked | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,5 +42,6 @@ pkgs.mkShell { | |
| landmarks-ppx | ||
| qcheck | ||
| utop | ||
| opam-ed | ||
| ]); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should either have a hardcoded default value or fail before setting the
trap cleanup EXITotherwise this risks removing the user's switch, no? I'm not too sure about how opam processesOPAMSWITCH.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A default value for
LOCK_SWITCHis hardcoded in the Makefile. The trap is executed at exit with the environment of the script, soOPAMSWITCHcontains the value ofLOCK_SWITCH. For instance, this scriptoutputs
Hello, bar!although the variable is set after the trap command.I agree that it is too complicated. I modified the script to make it safer:
LOCK_SWITCHinto the bash script. Users can still override it withLOCK_SWITCH=... make lock.LOCK_SWITCHtoLOCKED_SWITCH.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was more concerned with someone calling the script manually without going through the Makefile (I guess it's not supported but it still shouldn't have that kind of side effects)!
I like the new approach! Two remarks:
: "${LOCK_SWITCH:=alt-ergo-locked}"instead ofexport LOCK_SWITCH="alt-ergo-locked"to actually be a default value (but a hardcoded one is fine as well) ;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oups I forgot to translate the strange Makefile syntax to the strange Bash syntax...
In the last commit, the script cleans the switch after the check.