[Reproducible-builds] Minimising work needed for this build-path issue
Ximin Luo
infinity0 at debian.org
Tue Oct 25 12:29:00 UTC 2016
Ximin Luo:
> [..] I was trying to come to agreement on the exact form the proposal should take.
>
> The behaviour is already settled:
>
> if path.startswith(R):
> newprefix = P or "."
> path = newprefix + path[len(R):]
>
> [..] What I'm asking is suggestions on how we should get R and P into the actual program. [..]
>
So, to give people an example of the possible different choices we have:
In all cases, we want to do:
if path.startswith(oldprefix):
path = newprefix + path[len(oldprefix):]
and the question is what concrete mechanism we want to set (oldprefix, newprefix) by.
Option A
oldprefix = getenv("SOURCE_ROOT_DIR")
newprefix = getenv("SOURCE_ROOT_PREFIX") or "."
Pros: Simple, easy to understand. Works almost exactly as debug-prefix-map which has already existed for ages in GCC.
Cons: Uses two environment variables.
Option B
oldprefix, newprefix = getenv("SOURCE_PREFIX_MAP").split("=", 1)
Pros: Works *exactly* as debug-prefix-map
Cons: Have to parse the thing. GCC splits on the first "=" but I found this out by looking at the source code (gcc/final.c:add_debug_prefix_map), it's not explicitly documented. Someone else could split at the last "=" for example.
Option C
oldprefix = getenv("ALLSOURCES_DIR")
newprefix = "."
Oh em gee what is going on here? Well this is a slight hack. Instead of setting SOURCE_ROOT_DIR=/build/blahblah we set ALLSOURCES_DIR=/build so that "blahblah" remains in the build output. This is analogous to the difference between "datadir = /usr/share/@PACKAGE@" vs "datarootdir = /usr/share" (in GNU installation directories naming conventions).
Pros: Simple for implementers, one environment variable that doesn't have to be parsed.
Cons: Requires reproducers to do the build in a directory called "blahblah". At least, everyone can do this - if you can't create directories with arbitrary names, you probably can't set environment variables either. However it does mix up two different mechanisms (env var + directory naming) to achieve reproducibility.
X
--
GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE
https://github.com/infinity0/pubkeys.git
More information about the Reproducible-builds
mailing list