|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The BUILD_PATH_PREFIX_MAP specification tells how to use that
environment variable to achieve reproducible build, i.e. builds of
products that do not leak absolute paths from the build
environment. See
https://reproducible-builds.org/specs/build-path-prefix-map.
However, that specification only describes half of the story. Let us
call the building of reproducible products the "Build Phase". That is
the phase covered by the existing specification.
Let us defined the "Deployment phase" as the phase where you accept a
built reproducible product and make use of it, i.e. deploy it. An
example would be the debugger taking a reproducible binary and letting
the user debug it, showing the user the source code, etc.
We use the same mechanism in the deployment phase. Then
the BUILD_PATH_PREFIX_MAP must be setup with the logical
inverse of the mapping used during the build phase.
This PR generalized the functions in Build_path_prefix_map
and Location to facility the inverse map.
Also, this is part of a larger PR,
https://github.com/ocaml/ocaml/pull/12126, which itself
was part of
https://github.com/ocaml/ocaml/pull/12085, that is being split up
because it was too large. In addition to these changes, that PR
includes ocamltest enhancements plus the tests for
these changes. See it for prior discussion and the other changes.
For the new functions, see the '.mli' file for details.
1. utils/build_path_prefix_map.{ml,mli}
The new api functions are:
val rewrite_first : map -> path -> path option
val rewrite_all : map -> path -> path list
2. parsing/location.{ml,mli}
The new api functions are:
val rewrite_find_first_existing: string -> string option
val rewrite_find_all_existing_dirs: string -> string list
In addition to those new APIs, Location.absolute_path was modified
to do rewriting on absolute paths (in addition to relative paths
which it was already doing).
At the present time their is no code depending on these new APIs,
so the only functional change is the change to Location.absolute_path
The new API functions are used in the other parts of the PRs mentioned.
|