diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 12:34:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-16 17:41:59 +0100 |
commit | 4b424bdfdbbe16b6e41f6cd1de75a51e3799cf94 (patch) | |
tree | f59682b14ffa5de9fef7dd62b88dddd43e3de400 /meta/lib/oe | |
parent | f47a396964c4de76838f8c59b8226625817aa369 (diff) | |
download | poky-4b424bdfdbbe16b6e41f6cd1de75a51e3799cf94.tar.gz |
reproducible: Merge code into base.bbclass
Reproducibility is here to stay and needs to be part of our default workflow.
Move the remaining code to base.bbclass so it is always a first class citizen
and it is clear people need to be mindful of it.
(From OE-Core rev: abb0671d2cebfd7e8df94796404bbe9c7f961058)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/reproducible.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/lib/oe/reproducible.py b/meta/lib/oe/reproducible.py index a5000574cf..4fb99d963c 100644 --- a/meta/lib/oe/reproducible.py +++ b/meta/lib/oe/reproducible.py | |||
@@ -5,6 +5,57 @@ import os | |||
5 | import subprocess | 5 | import subprocess |
6 | import bb | 6 | import bb |
7 | 7 | ||
8 | # For reproducible builds, this code sets the default SOURCE_DATE_EPOCH in each | ||
9 | # component's build environment. The format is number of seconds since the | ||
10 | # system epoch. | ||
11 | # | ||
12 | # Upstream components (generally) respect this environment variable, | ||
13 | # using it in place of the "current" date and time. | ||
14 | # See https://reproducible-builds.org/specs/source-date-epoch/ | ||
15 | # | ||
16 | # The default value of SOURCE_DATE_EPOCH comes from the function | ||
17 | # get_source_date_epoch_value which reads from the SDE_FILE, or if the file | ||
18 | # is not available will use the fallback of SOURCE_DATE_EPOCH_FALLBACK. | ||
19 | # | ||
20 | # The SDE_FILE is normally constructed from the function | ||
21 | # create_source_date_epoch_stamp which is typically added as a postfuncs to | ||
22 | # the do_unpack task. If a recipe does NOT have do_unpack, it should be added | ||
23 | # to a task that runs after the source is available and before the | ||
24 | # do_deploy_source_date_epoch task is executed. | ||
25 | # | ||
26 | # If a recipe wishes to override the default behavior it should set it's own | ||
27 | # SOURCE_DATE_EPOCH or override the do_deploy_source_date_epoch_stamp task | ||
28 | # with recipe-specific functionality to write the appropriate | ||
29 | # SOURCE_DATE_EPOCH into the SDE_FILE. | ||
30 | # | ||
31 | # SOURCE_DATE_EPOCH is intended to be a reproducible value. This value should | ||
32 | # be reproducible for anyone who builds the same revision from the same | ||
33 | # sources. | ||
34 | # | ||
35 | # There are 4 ways the create_source_date_epoch_stamp function determines what | ||
36 | # becomes SOURCE_DATE_EPOCH: | ||
37 | # | ||
38 | # 1. Use the value from __source_date_epoch.txt file if this file exists. | ||
39 | # This file was most likely created in the previous build by one of the | ||
40 | # following methods 2,3,4. | ||
41 | # Alternatively, it can be provided by a recipe via SRC_URI. | ||
42 | # | ||
43 | # If the file does not exist: | ||
44 | # | ||
45 | # 2. If there is a git checkout, use the last git commit timestamp. | ||
46 | # Git does not preserve file timestamps on checkout. | ||
47 | # | ||
48 | # 3. Use the mtime of "known" files such as NEWS, CHANGLELOG, ... | ||
49 | # This works for well-kept repositories distributed via tarball. | ||
50 | # | ||
51 | # 4. Use the modification time of the youngest file in the source tree, if | ||
52 | # there is one. | ||
53 | # This will be the newest file from the distribution tarball, if any. | ||
54 | # | ||
55 | # 5. Fall back to a fixed timestamp (SOURCE_DATE_EPOCH_FALLBACK). | ||
56 | # | ||
57 | # Once the value is determined, it is stored in the recipe's SDE_FILE. | ||
58 | |||
8 | def get_source_date_epoch_from_known_files(d, sourcedir): | 59 | def get_source_date_epoch_from_known_files(d, sourcedir): |
9 | source_date_epoch = None | 60 | source_date_epoch = None |
10 | newest_file = None | 61 | newest_file = None |