summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorDouglas Royds <douglas.royds@taitradio.com>2018-09-14 14:58:17 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-21 18:45:46 -0700
commitfdc018106297c2fdb849e97cba494153b217d6a7 (patch)
treeb0732f77f8d7d45887ffc75289edf79f3294fbbc /meta/classes
parentd6f2ffb5c766d3295863f3a5d9ae47c1b7b14067 (diff)
downloadpoky-fdc018106297c2fdb849e97cba494153b217d6a7.tar.gz
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 <douglas.royds@taitradio.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/reproducible_build.bbclass19
1 files changed, 11 insertions, 8 deletions
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
51 51
52def get_source_date_epoch_from_known_files(d, sourcedir): 52def get_source_date_epoch_from_known_files(d, sourcedir):
53 source_date_epoch = None 53 source_date_epoch = None
54 newest_file = None
54 known_files = set(["NEWS", "ChangeLog", "Changelog", "CHANGES"]) 55 known_files = set(["NEWS", "ChangeLog", "Changelog", "CHANGES"])
55 for file in known_files: 56 for file in known_files:
56 filepath = os.path.join(sourcedir, file) 57 filepath = os.path.join(sourcedir, file)
@@ -59,6 +60,9 @@ def get_source_date_epoch_from_known_files(d, sourcedir):
59 # There may be more than one "known_file" present, if so, use the youngest one 60 # There may be more than one "known_file" present, if so, use the youngest one
60 if not source_date_epoch or mtime > source_date_epoch: 61 if not source_date_epoch or mtime > source_date_epoch:
61 source_date_epoch = mtime 62 source_date_epoch = mtime
63 newest_file = filepath
64 if newest_file:
65 bb.debug(1, "SOURCE_DATE_EPOCH taken from: %s" % newest_file)
62 return source_date_epoch 66 return source_date_epoch
63 67
64def find_git_folder(d, sourcedir): 68def find_git_folder(d, sourcedir):
@@ -93,7 +97,7 @@ def get_source_date_epoch_from_git(d, sourcedir):
93 if gitpath: 97 if gitpath:
94 import subprocess 98 import subprocess
95 source_date_epoch = int(subprocess.check_output(['git','log','-1','--pretty=%ct'], cwd=gitpath)) 99 source_date_epoch = int(subprocess.check_output(['git','log','-1','--pretty=%ct'], cwd=gitpath))
96 bb.debug(1, "git repo path: %s sde: %d" % (gitpath, source_date_epoch)) 100 bb.debug(1, "git repository: %s" % gitpath)
97 return source_date_epoch 101 return source_date_epoch
98 102
99def get_source_date_epoch_from_youngest_file(d, sourcedir): 103def get_source_date_epoch_from_youngest_file(d, sourcedir):
@@ -117,14 +121,14 @@ def get_source_date_epoch_from_youngest_file(d, sourcedir):
117 source_date_epoch = mtime 121 source_date_epoch = mtime
118 newest_file = filename 122 newest_file = filename
119 123
120 if newest_file != None: 124 if newest_file:
121 bb.debug(1," SOURCE_DATE_EPOCH %d derived from: %s" % (source_date_epoch, newest_file)) 125 bb.debug(1, "Newest file found: %s" % newest_file)
122 return source_date_epoch 126 return source_date_epoch
123 127
124python do_create_source_date_epoch_stamp() { 128python do_create_source_date_epoch_stamp() {
125 epochfile = d.getVar('SDE_FILE') 129 epochfile = d.getVar('SDE_FILE')
126 if os.path.isfile(epochfile): 130 if os.path.isfile(epochfile):
127 bb.debug(1, " path: %s reusing __source_date_epoch.txt" % epochfile) 131 bb.debug(1, "Reusing SOURCE_DATE_EPOCH from: %s" % epochfile)
128 return 132 return
129 133
130 sourcedir = d.getVar('S') 134 sourcedir = d.getVar('S')
@@ -136,10 +140,9 @@ python do_create_source_date_epoch_stamp() {
136 ) 140 )
137 if source_date_epoch == 0: 141 if source_date_epoch == 0:
138 # empty folder, not a single file ... 142 # empty folder, not a single file ...
139 # kernel source do_unpack is special cased 143 bb.debug(1, "No files found to determine SOURCE_DATE_EPOCH")
140 if not bb.data.inherits_class('kernel', d):
141 bb.debug(1, "Unable to determine source_date_epoch! path:%s" % sourcedir)
142 144
145 bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch)
143 bb.utils.mkdirhier(d.getVar('SDE_DIR')) 146 bb.utils.mkdirhier(d.getVar('SDE_DIR'))
144 with open(epochfile, 'w') as f: 147 with open(epochfile, 'w') as f:
145 f.write(str(source_date_epoch)) 148 f.write(str(source_date_epoch))
@@ -155,6 +158,6 @@ python () {
155 if os.path.isfile(epochfile): 158 if os.path.isfile(epochfile):
156 with open(epochfile, 'r') as f: 159 with open(epochfile, 'r') as f:
157 source_date_epoch = f.read() 160 source_date_epoch = f.read()
158 bb.debug(1, "source_date_epoch stamp found ---> stamp %s" % source_date_epoch) 161 bb.debug(1, "SOURCE_DATE_EPOCH: %s" % source_date_epoch)
159 d.setVar('SOURCE_DATE_EPOCH', source_date_epoch) 162 d.setVar('SOURCE_DATE_EPOCH', source_date_epoch)
160} 163}