From fdc018106297c2fdb849e97cba494153b217d6a7 Mon Sep 17 00:00:00 2001 From: Douglas Royds Date: Fri, 14 Sep 2018 14:58:17 +1200 Subject: reproducible: Consistent debug logging 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 Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- meta/classes/reproducible_build.bbclass | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'meta/classes/reproducible_build.bbclass') diff --git a/meta/classes/reproducible_build.bbclass b/meta/classes/reproducible_build.bbclass index a81f249790..4f3680a376 100644 --- a/meta/classes/reproducible_build.bbclass +++ b/meta/classes/reproducible_build.bbclass @@ -51,6 +51,7 @@ addtask do_deploy_source_date_epoch before do_configure after do_patch def get_source_date_epoch_from_known_files(d, sourcedir): source_date_epoch = None + newest_file = None known_files = set(["NEWS", "ChangeLog", "Changelog", "CHANGES"]) for file in known_files: filepath = os.path.join(sourcedir, file) @@ -59,6 +60,9 @@ def get_source_date_epoch_from_known_files(d, sourcedir): # There may be more than one "known_file" present, if so, use the youngest one if not source_date_epoch or mtime > source_date_epoch: source_date_epoch = mtime + newest_file = filepath + if newest_file: + bb.debug(1, "SOURCE_DATE_EPOCH taken from: %s" % newest_file) return source_date_epoch def find_git_folder(d, sourcedir): @@ -93,7 +97,7 @@ def get_source_date_epoch_from_git(d, sourcedir): if gitpath: import subprocess source_date_epoch = int(subprocess.check_output(['git','log','-1','--pretty=%ct'], cwd=gitpath)) - bb.debug(1, "git repo path: %s sde: %d" % (gitpath, source_date_epoch)) + bb.debug(1, "git repository: %s" % gitpath) return source_date_epoch def get_source_date_epoch_from_youngest_file(d, sourcedir): @@ -117,14 +121,14 @@ def get_source_date_epoch_from_youngest_file(d, sourcedir): source_date_epoch = mtime newest_file = filename - if newest_file != None: - bb.debug(1," SOURCE_DATE_EPOCH %d derived from: %s" % (source_date_epoch, newest_file)) + if newest_file: + bb.debug(1, "Newest file found: %s" % newest_file) return source_date_epoch python do_create_source_date_epoch_stamp() { epochfile = d.getVar('SDE_FILE') if os.path.isfile(epochfile): - bb.debug(1, " path: %s reusing __source_date_epoch.txt" % epochfile) + bb.debug(1, "Reusing SOURCE_DATE_EPOCH from: %s" % epochfile) return sourcedir = d.getVar('S') @@ -136,10 +140,9 @@ python do_create_source_date_epoch_stamp() { ) if source_date_epoch == 0: # empty folder, not a single file ... - # kernel source do_unpack is special cased - if not bb.data.inherits_class('kernel', d): - bb.debug(1, "Unable to determine source_date_epoch! path:%s" % sourcedir) + bb.debug(1, "No files found to determine SOURCE_DATE_EPOCH") + bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch) bb.utils.mkdirhier(d.getVar('SDE_DIR')) with open(epochfile, 'w') as f: f.write(str(source_date_epoch)) @@ -155,6 +158,6 @@ python () { if os.path.isfile(epochfile): with open(epochfile, 'r') as f: source_date_epoch = f.read() - bb.debug(1, "source_date_epoch stamp found ---> stamp %s" % source_date_epoch) + bb.debug(1, "SOURCE_DATE_EPOCH: %s" % source_date_epoch) d.setVar('SOURCE_DATE_EPOCH', source_date_epoch) } -- cgit v1.2.3-54-g00ecf