feat(pkg): relocatable compiler support#13321
Conversation
d5b4236 to
4804dc0
Compare
According to [1] and [2], `build-id` is a SHA256 hash identifying the precise package version with all its dependencies. Consumers of this variable, such as the process.sh script in [3], use this to identify specific packages in existing opam switches. In [3] this is used to find an already-built relocatable OCaml compiler. In dune we wish to re-use [3] for choosing the relocatable compiler, therefore we need to substitute the value with something that will not be picked up as a hash from an existing opam valuation of build-id. For now we choose a magic number that is easily recognizable in case anything needs to be debugged. [1] https://github.com/ocaml/opam/blob/master/src/state/opamPackageVar.ml [2] https://github.com/ocaml/opam/wiki/Spec-for-Extended-package-specific-variables [3] https://github.com/dra27/opam-repository/tree/relocatable Addressing relevant concern in: - #13229
96d4bac to
eaaebab
Compare
b604e28 to
4fcca47
Compare
ead22d4 to
e389f75
Compare
1f6b442 to
a0d27ac
Compare
a0d27ac to
0468eb4
Compare
0468eb4 to
fba12b9
Compare
|
@dra27 did this which is merged now (a Does its existence let the heuristics here be replaced with a conflict check for that package instead? |
|
@avsm I've deleted my earlier rushed meesage. The heuristic here is to detect the relocatable compiler during build time. That way we can decide whether or not to treat it as a "toolchain" or a regular package. This will have to stay around, and can now be expanded to use the We invoke this heuristic when interpreting a lock file which is currently configured by the user. The question of forcing |
fb45eac to
1daa1b0
Compare
Detect relocatable compilers and bypass the toolchain mechanism for them. Relocatable compilers can be installed as normal packages since they don't have hardcoded absolute paths. A compiler is considered relocatable if either: - The relocatable-compiler meta-package is present (dra27's repo) - The OCaml version is >= 5.5.0 (natively relocatable) When a relocatable compiler is detected, the toolchain mechanism (prefix redirect, DESTDIR install, shared cache) is skipped entirely. Also set OPAMSWITCH=dune in the package build environment so that the relocatable compiler's process.sh script can progress without an actual opam switch. Signed-off-by: Ali Caglayan <alizter@gmail.com>
1daa1b0 to
610035c
Compare
This PR adds a way for us to detect if a compiler in our "package universe" is relocatable. Knowing this means we can avoid the use of our toolchains functionality and instead build the compiler like a regular package.
The current chosen heuristic for knowing so is by inspecting if we have the
reloctable-compilermeta-package available (for interoperability with David's relocatable opam repository) or by checking for therelocatablemeta-package in opam-repository.We add a test checking the checking behaviour and making sure that compiler-like packages are able to be cached in these cases.
To try it out for yourself, put the following in
dune-workspace:Or use
(ocaml (= 5.5.0)) relocatablein yourpackage(depends).Part of the work on: