|author||Douglas Royds <firstname.lastname@example.org>||2018-11-23 09:41:57 +1300|
|committer||Richard Purdie <email@example.com>||2018-11-23 23:32:10 +0000|
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. Signed-off-by: Douglas Royds <firstname.lastname@example.org> Signed-off-by: Richard Purdie <email@example.com>
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
@@ -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):
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 == '.']
- dirs[:] = [d for d in dirs if d not in exclude]
for fname in files:
filename = os.path.join(root, fname)