-
Notifications
You must be signed in to change notification settings - Fork 413
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
Create cookie file for toolchain packages #10782
Conversation
36aa52d
to
88c87a5
Compare
src/dune_rules/pkg_rules.ml
Outdated
match build_command with | ||
| None | Some Dune -> Memo.return build_command | ||
| Some (Action action) -> | ||
let+ installed = Fs_memo.dir_exists prefix in |
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.
Note that doing this check at rule generation time at is wrong as I've mentioned. Doesn't prevent this PR from being merged, but you should work on pushing these checks to action execution.
src/dune_rules/pkg_rules.ml
Outdated
(* If the toolchain is already installed, just create an empty | ||
config.cache file so other packages see that the compiler package | ||
is installed. *) | ||
Dune_lang.Action.Run |
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.
Any reason why you moved this from Pkg_toolchain
? I'd really prefer to keep this feature as isolated as possible. I realize, we can't fully accomplish that, but we should at least try.
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.
Not a strong reason, no. I'll move it back.
This fixes two issues with cookies for toolchain packages: Prior to this change, dune expected toolchain cookies to be created inside the toolchains directory, ie. outside of the project. The machinery for creating cookies only works within the build directory, so cookies for toolchain packages were never created. The location of the cookie had to be the same as the location of the installed package, in what dune referred to as the package's "target_dir". The fix is to decouply these two locations by adding a new path "prefix" to packages, corresponding to the "--prefix" argument of most configure scripts. This allows toolchain packages to have a "target_dir" within the build directory, and for a cookie file to be created within its "target_dir", while still allowing the package to be installed outside the project inside its "prefix", inside the toolchains directory. The second issue is that the contents of the cookie was based on the package's "target_dir", and thus cookies for toolchain packages would be empty (toolchain packages are now installed in the package's "prefix" dir instead). Dune makes the distinction between the "paths" and "write_paths" of a package, the latter being the unsandboxed final install paths of the package, and it's the "target_dir" within a package's "write_paths" that is traversed (in the absence of a <package>.install file) to determine the contents of the package's cookie. The fix was to detect the case where the "paths" of a package contains a prefix referring outside the build directory, and in such a case, traverse the directory at that path rather than the one at "target_dir". Toolchains still don't completely work, as in some cases build tools are unable to find binaries installed by the compiler package, however manual inspection shows that the cookie is being created for toolchain packages and contains the expected contents. Fixes for the remaining issues will come in later changes. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
88c87a5
to
cccb665
Compare
This fixes two issues with cookies for toolchain packages: Prior to this change, dune expected toolchain cookies to be created inside the toolchains directory, ie. outside of the project. The machinery for creating cookies only works within the build directory, so cookies for toolchain packages were never created. The location of the cookie had to be the same as the location of the installed package, in what dune referred to as the package's "target_dir". The fix is to decouply these two locations by adding a new path "prefix" to packages, corresponding to the "--prefix" argument of most configure scripts. This allows toolchain packages to have a "target_dir" within the build directory, and for a cookie file to be created within its "target_dir", while still allowing the package to be installed outside the project inside its "prefix", inside the toolchains directory. The second issue is that the contents of the cookie was based on the package's "target_dir", and thus cookies for toolchain packages would be empty (toolchain packages are now installed in the package's "prefix" dir instead). Dune makes the distinction between the "paths" and "write_paths" of a package, the latter being the unsandboxed final install paths of the package, and it's the "target_dir" within a package's "write_paths" that is traversed (in the absence of a <package>.install file) to determine the contents of the package's cookie. The fix was to detect the case where the "paths" of a package contains a prefix referring outside the build directory, and in such a case, traverse the directory at that path rather than the one at "target_dir". Toolchains still don't completely work, as in some cases build tools are unable to find binaries installed by the compiler package, however manual inspection shows that the cookie is being created for toolchain packages and contains the expected contents. Fixes for the remaining issues will come in later changes. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
This fixes two issues with cookies for toolchain packages:
Prior to this change, dune expected toolchain cookies to be created inside the toolchains directory, ie. outside of the project. The machinery for creating cookies only works within the build directory, so cookies for toolchain packages were never created. The location of the cookie had to be the same as the location of the installed package, in what dune referred to as the package's "target_dir". The fix is to decouply these two locations by adding a new path "prefix" to packages, corresponding to the "--prefix" argument of most configure scripts. This allows toolchain packages to have a "target_dir" within the build directory, and for a cookie file to be created within its "target_dir", while still allowing the package to be installed outside the project inside its "prefix", inside the toolchains directory.
The second issue is that the contents of the cookie was based on the package's "target_dir", and thus cookies for toolchain packages would be empty (toolchain packages are now installed in the package's "prefix" dir instead). Dune makes the distinction between the "paths" and "write_paths" of a package, the latter being the unsandboxed final install paths of the package, and it's the "target_dir" within a package's "write_paths" that is traversed (in the absence of a .install file) to determine the contents of the package's cookie. The fix was to detect the case where the "paths" of a package contains a prefix referring outside the build directory, and in such a case, traverse the directory at that path rather than the one at "target_dir".
Toolchains still don't completely work, as in some cases build tools are unable to find binaries installed by the compiler package, however manual inspection shows that the cookie is being created for toolchain packages and contains the expected contents. Fixes for the remaining issues will come in later changes.