summaryrefslogtreecommitdiffstats
path: root/meta/classes/reproducible_build.bbclass
AgeCommit message (Collapse)Author
2018-11-23reproducible: Don't look for youngest file when no source tarballDouglas Royds
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 <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-23reproducible: Refactor: Break out fixed_source_date_epoch() functionDouglas Royds
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-11-06reproducible_build: update do_deploy_source_date_epoch commmentDouglas Royds
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. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-09-21reproducible: Consistent debug loggingDouglas Royds
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. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-09-21reproducible: Don't enforce existence of ${S} dirDouglas Royds
Unnecessary. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-09-21reproducible: Find the git repo in WORKDIR/git or S firstDouglas Royds
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. Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-09-21reproducible: Rename ambiguous "path" var to sourcedir or workdir as appropriateDouglas Royds
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-09-21reproducible: Refactor: get_source_date_epoch_from_youngest_file()Douglas Royds
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-09-21reproducible: Tidy class descriptionDouglas Royds
Tidy whitespace, delete commented-out lines Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
2018-08-08classes/reproducible_build: Avoid dereferencing symlinksJoshua Watt
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. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-25reproducible_build.bbclass: support for binary reproducibilityJuro Bystricky
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] Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com>