diff options
author | Douglas Royds <douglas.royds@taitradio.com> | 2018-11-23 09:41:57 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-08 20:12:01 +0000 |
commit | cd56795a1588d780ca6a0cb974bf4024ab636be7 (patch) | |
tree | 25237bcee35d5c72293ce2ef7204aa5c95f05b59 /meta | |
parent | 98b7d22ed563efdf58beba1ba65270b731673103 (diff) | |
download | openembedded-core-cd56795a1588d780ca6a0cb974bf4024ab636be7.tar.gz openembedded-core-cd56795a1588d780ca6a0cb974bf4024ab636be7.tar.bz2 openembedded-core-cd56795a1588d780ca6a0cb974bf4024ab636be7.zip |
reproducible: Don't look for youngest file when no source tarball
Some packages (eg. init-ifupdown) take their source files entirely from
openembedded-core, that is, they download no source tarball.
These recipes either don't use S at all (ie. it is empty at unpack time),
or they set S = WORKDIR (as in init-ifupdown).
Looking at the file timestamps in the WORKDIR causes a non-reproducible
SOURCE_DATE_EPOCH, as files taken from file:// URIs do not have
reproducible timestamps.
If S == WORKDIR, we are better to assume that there is no source tarball,
and to fall back to a fixed timestamp for the SOURCE_DATE_EPOCH.
This makes the init-ifupdown build reproducible.
(From OE-Core rev: d395bad0179037eb5d0fa4d921985c87ae13f3a4)
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/reproducible_build.bbclass | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/meta/classes/reproducible_build.bbclass b/meta/classes/reproducible_build.bbclass index a0fd4d656b..8788ad7145 100644 --- a/meta/classes/reproducible_build.bbclass +++ b/meta/classes/reproducible_build.bbclass @@ -22,7 +22,10 @@ # 3. Use the mtime of "known" files such as NEWS, CHANGLELOG, ... # This works for well-kept repositories distributed via tarball. # -# 4. If the above steps fail, use the modification time of the youngest file in the source tree. +# 4. Use the modification time of the youngest file in the source tree, if there is one. +# This will be the newest file from the distribution tarball, if any. +# +# 5. Fall back to a fixed timestamp. # # Once the value of SOURCE_DATE_EPOCH is determined, it is stored in the recipe's SDE_FILE. # If none of these mechanisms are suitable, replace the do_deploy_source_date_epoch task @@ -104,15 +107,15 @@ def get_source_date_epoch_from_git(d, sourcedir): return source_date_epoch def get_source_date_epoch_from_youngest_file(d, sourcedir): + if sourcedir == d.getVar('WORKDIR'): + # These sources are almost certainly not from a tarball + return None + # Do it the hard way: check all files and find the youngest one... source_date_epoch = None newest_file = None - # Just in case S = WORKDIR - exclude = set(["build", "image", "license-destdir", "patches", "pseudo", - "recipe-sysroot", "recipe-sysroot-native", "sysroot-destdir", "temp"]) for root, dirs, files in os.walk(sourcedir, topdown=True): files = [f for f in files if not f[0] == '.'] - dirs[:] = [d for d in dirs if d not in exclude] for fname in files: filename = os.path.join(root, fname) |