Skip to content
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

Add a lock file for the alt-ergo-lib #774

Merged
merged 6 commits into from
Aug 16, 2023
Merged

Conversation

Halbaroth
Copy link
Collaborator

This PR add a lock file for the alt-ergo-lib in order to improve the reproducibility of the building process.
I also add a target lock in the makefile to update the lock file.

@Halbaroth Halbaroth added the build label Aug 2, 2023
@Halbaroth Halbaroth added this to the 2.5.0 milestone Aug 2, 2023
@Halbaroth Halbaroth marked this pull request as ready for review August 9, 2023 15:30
Copy link
Collaborator

@bclement-ocp bclement-ocp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make the lock target phony.

Makefile Outdated
lock:
opam lock ./alt-ergo-lib.opam -w
# Remove OCaml compiler constraints
sed -i '/\"ocaml/d' ./alt-ergo-lib.opam.locked
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't be blanket removing packages that start with "ocaml because there are non-compiler-related libraries whose name starts with ocaml (e.g. ocamlgraph).

In our case, it removes the lock for ocaml-compiler-libs, ocamlbuild and ocamlfind which I believe are independent of the compiler version.

I think the following is better:

Suggested change
sed -i '/\"ocaml/d' ./alt-ergo-lib.opam.locked
sed -i '/"ocaml"\|"ocaml-base-compiler"\|"ocaml-system"\|"ocaml-config"/d' ./alt-ergo-lib.opam.locked

@@ -234,6 +234,11 @@ archi: $(EXTRA_DIR)/ocamldot/ocamldot
echo "}" >> archi.dot
dot -Tpdf archi.dot > archi.pdf

lock:
opam lock ./alt-ergo-lib.opam -w
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should dune build ./alt-ergo-lib.opam first?

Makefile Outdated
@@ -234,6 +234,11 @@ archi: $(EXTRA_DIR)/ocamldot/ocamldot
echo "}" >> archi.dot
dot -Tpdf archi.dot > archi.pdf

lock: clean lib
Copy link
Collaborator

@bclement-ocp bclement-ocp Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need clean and lib dependencies?

(Especially clean, I don't understand why we need that)

Copy link
Collaborator Author

@Halbaroth Halbaroth Aug 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I clean the _build directory to be sure the binary compiles with the actual opam switch and I add the lib to check if the binary compiles as we ask me. The command dune build ./alt-ergo-lib.opam doesn't exist.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only suggested to make sure that alt-ergo-lib.opam is up-to-date before locking it because it seemed sensible. Making sure that the library compiles makes sense as well, although I am not sure either of these things are necessary, I'm fine having them or not as you prefer.

However we shouldn't clean the build directory without a reason, and I don't see any reason to do it here -- if we want to check that the library builds, we can just do that, without clearing the build cache.

Not sure what you mean by "The command dune bulid ./alt-ergo-lib.opam doesn't exist." however, it should rebuild alt-ergo-lib.opam from the dune-project.

$ file alt-ergo-lib.opam
alt-ergo-lib.opam: cannot open `alt-ergo-lib.opam' (No such file or directory)

$ dune build ./alt-ergo-lib.opam
                                  
$ file alt-ergo-lib.opam
alt-ergo-lib.opam: ASCII text

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't know that dune build ./alt-ergo-lib.opam rebuild only the opam file. I thought the command has no effect at all when I tried it.

I think we should force to recompile the binary before creating the lock file. I agree cleaning everything is not great. I did that because I have absolutely no faith in Dune to rebuild correctly the binary after updating the opam switch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact the CI will fail in any case. So we can only rebuild the opam file ;)

@Halbaroth Halbaroth merged commit a0b47a6 into OCamlPro:next Aug 16, 2023
10 checks passed
@Halbaroth Halbaroth mentioned this pull request Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants