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:14:42 +0000 |
commit | c90a56ed6d427396cc65f163d2f1559794fe6336 (patch) | |
tree | 5ccd5b5eb2b49cd91f4f7abbe1afd7cc3c7ea9cb /meta/classes | |
parent | e2a2f8cd895245a7f126afb125e094a0b8bbce33 (diff) | |
download | poky-c90a56ed6d427396cc65f163d2f1559794fe6336.tar.gz |
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)
(From OE-Core rev: cd56795a1588d780ca6a0cb974bf4024ab636be7)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 @@ | |||
22 | # 3. Use the mtime of "known" files such as NEWS, CHANGLELOG, ... | 22 | # 3. Use the mtime of "known" files such as NEWS, CHANGLELOG, ... |
23 | # This works for well-kept repositories distributed via tarball. | 23 | # This works for well-kept repositories distributed via tarball. |
24 | # | 24 | # |
25 | # 4. If the above steps fail, use the modification time of the youngest file in the source tree. | 25 | # 4. Use the modification time of the youngest file in the source tree, if there is one. |
26 | # This will be the newest file from the distribution tarball, if any. | ||
27 | # | ||
28 | # 5. Fall back to a fixed timestamp. | ||
26 | # | 29 | # |
27 | # Once the value of SOURCE_DATE_EPOCH is determined, it is stored in the recipe's SDE_FILE. | 30 | # Once the value of SOURCE_DATE_EPOCH is determined, it is stored in the recipe's SDE_FILE. |
28 | # If none of these mechanisms are suitable, replace the do_deploy_source_date_epoch task | 31 | # 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): | |||
104 | return source_date_epoch | 107 | return source_date_epoch |
105 | 108 | ||
106 | def get_source_date_epoch_from_youngest_file(d, sourcedir): | 109 | def get_source_date_epoch_from_youngest_file(d, sourcedir): |
110 | if sourcedir == d.getVar('WORKDIR'): | ||
111 | # These sources are almost certainly not from a tarball | ||
112 | return None | ||
113 | |||
107 | # Do it the hard way: check all files and find the youngest one... | 114 | # Do it the hard way: check all files and find the youngest one... |
108 | source_date_epoch = None | 115 | source_date_epoch = None |
109 | newest_file = None | 116 | newest_file = None |
110 | # Just in case S = WORKDIR | ||
111 | exclude = set(["build", "image", "license-destdir", "patches", "pseudo", | ||
112 | "recipe-sysroot", "recipe-sysroot-native", "sysroot-destdir", "temp"]) | ||
113 | for root, dirs, files in os.walk(sourcedir, topdown=True): | 117 | for root, dirs, files in os.walk(sourcedir, topdown=True): |
114 | files = [f for f in files if not f[0] == '.'] | 118 | files = [f for f in files if not f[0] == '.'] |
115 | dirs[:] = [d for d in dirs if d not in exclude] | ||
116 | 119 | ||
117 | for fname in files: | 120 | for fname in files: |
118 | filename = os.path.join(root, fname) | 121 | filename = os.path.join(root, fname) |