summaryrefslogtreecommitdiffstats
path: root/meta/classes/reproducible_build.bbclass
Commit message (Collapse)AuthorAgeFilesLines
* reproducible: Don't look for youngest file when no source tarballDouglas Royds2018-11-231-5/+8
| | | | | | | | | | | | | | | | | | | 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>
* reproducible: Refactor: Break out fixed_source_date_epoch() functionDouglas Royds2018-11-231-4/+5
| | | | | | | (From OE-Core rev: 4eb6def4fe82959c2a348142b9eada27d3354aef) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible_build: update do_deploy_source_date_epoch commmentDouglas Royds2018-11-071-1/+4
| | | | | | | | | | | | Once the value of SOURCE_DATE_EPOCH is determined, it is stored in the recipe's SDE_FILE. If none of the existing mechanisms are suitable, replace the do_deploy_source_date_epoch task with recipe-specific functionality to write the appropriate SOURCE_DATE_EPOCH into the SDE_FILE. (From OE-Core rev: e7b891b76954c784f5a93bd0a1c91315673ce40d) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible: Consistent debug loggingDouglas Royds2018-09-211-8/+11
| | | | | | | | | | | | | | | Log both the source of the source_date_epoch and the resulting source_date_epoch in all cases. Also, now that we are determining the source_date_epoch successfully for both yocto and non-yocto kernels, remove the inherits_class('kernel') exception. We will log a failure to find a source_date_epoch for kernels as well. (From OE-Core rev: 48fe0e83435f9fb53b1e5b37d5d9f1c2caccd22d) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible: Don't enforce existence of ${S} dirDouglas Royds2018-09-211-5/+1
| | | | | | | | | | Unnecessary. (From OE-Core rev: 75d5a9d72566aca7a9f08bea21523b3c66bddeae) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible: Find the git repo in WORKDIR/git or S firstDouglas Royds2018-09-211-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the search regime for find_git_folder(): 1. WORKDIR/git: This is the default git fetcher unpack path 2. ${S} 3. Go looking for .git/ under the WORKDIR as a last resort. linux-yocto: We had an existing (silent) defect. The linux-yocto recipes all specify two git SRC_URIs, one for the kernel source itself, the other for the kmeta data (config fragments and friends). find_git_folder() was finding the git checkout for the kmeta data, but due to a typo in the git log -1 --pretty=%ct line, we were (silently) reading the source_date_epoch from the ${S} directory = STAGING_KERNEL_DIR, which is empty. If your build/ happened to be inside a git checkout, git would walk up the directory tree, and silently read the commit timestamp from this other git checkout. The correct path to read the git commit timestamp from is the "gitpath", being that found by find_git_folder(), though this function was incorrectly finding the kmeta data checkout, not the kernel source tree. Non-kernel git recipes: The default git fetcher clones and checks out the sources at WORKDIR/git/ regardless of the setting of S (unless subpath or destsuffix is set). find_git_folder() now looks for the WORKDIR/git/.git/ directory first. Non-yocto linux kernels: Kernel recipes that don't inherit kernel-yocto should always set S = ${WORKDIR}/git, so that when base_do_unpack_append() in kernel.bbclass moves the checkout down to the STAGING_KERNEL_DIR and symlinks it as WORKDIR/git, the build can still work by following the symlink. We were previously failing to follow the symlink in the os.walk(), but we now look first for WORKDIR/git/.git/, and find it due to the symlink. If none of the above mechanisms work for finding the git checkout, perhaps there was a subpath or destsuffix specified in the SRC_URI. We go looking for the git checkout under the WORKDIR as a last resort. (From OE-Core rev: b0ddb141d36853447f85ecaac07dbc9c5779627f) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible: Rename ambiguous "path" var to sourcedir or workdir as appropriateDouglas Royds2018-09-211-18/+19
| | | | | | | | (From OE-Core rev: 01358d6a89623a38e66969daa431d2eecb1ce8a2) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible: Refactor: get_source_date_epoch_from_youngest_file()Douglas Royds2018-09-211-33/+40
| | | | | | | | (From OE-Core rev: 2c8baf6c50e5a266a1e9ac939415bd481668e17e) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible: Tidy class descriptionDouglas Royds2018-09-211-27/+22
| | | | | | | | | | Tidy whitespace, delete commented-out lines (From OE-Core rev: 254eb5a2a12fd6b5cf7427818ea9fa886ea407a6) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* classes/reproducible_build: Avoid dereferencing symlinksJoshua Watt2018-08-081-2/+2
| | | | | | | | | | | | Using os.path.getmtime() will dereference symbolic links in an attempt to get the last modified time. This can cause errors if the target doesn't exist, or worse map to some absolute build host path which would make a build not reproducible. (From OE-Core rev: fae23c72288068f90e2f357a8abf1384850c02ed) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* reproducible_build.bbclass: support for binary reproducibilityJuro Bystricky2018-03-251-0/+150
Setup environment for builds requiring binary reproducibility. Determine and export SOURCE_DATE_EPOCH per each recipe. This is a crucial step to achieve binary reproducibility. The value for this variable (timestamp) is obtained after source code for a recipe has been unpacked, but before it is patched. If the code sources come from a GIT repo, we get the timestamp from the top commit. (GIT repo does not preserve file mktime timestamps). Otherwise, if GIT repo is not present, we try to get mtime from known files such as NEWS, ChangeLog, etc. If this also fails, we go through all files and get the timestamp from the youngest one. We create an individual timestamp for each recipe. The timestamp is stored in the file '__source_date_epoch.txt' (in the folder source-date-epoch_). Later on, each task reads this file and sets the exported value of SOURCE_DATE_EPOCH to the value found in the file. Uasge: INHERIT += "reproducible_build" [YOCTO#11178] [YOCTO#11179] (From OE-Core rev: cc438ac7711dedbe05d654e99af9316c9215b02e) Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>