mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 15:49:32 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
d6f2ffb5c7
commit
fdc0181062
@@ -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):
|
def get_source_date_epoch_from_known_files(d, sourcedir):
|
||||||
source_date_epoch = None
|
source_date_epoch = None
|
||||||
|
newest_file = None
|
||||||
known_files = set(["NEWS", "ChangeLog", "Changelog", "CHANGES"])
|
known_files = set(["NEWS", "ChangeLog", "Changelog", "CHANGES"])
|
||||||
for file in known_files:
|
for file in known_files:
|
||||||
filepath = os.path.join(sourcedir, file)
|
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
|
# 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:
|
if not source_date_epoch or mtime > source_date_epoch:
|
||||||
source_date_epoch = mtime
|
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
|
return source_date_epoch
|
||||||
|
|
||||||
def find_git_folder(d, sourcedir):
|
def find_git_folder(d, sourcedir):
|
||||||
@@ -93,7 +97,7 @@ def get_source_date_epoch_from_git(d, sourcedir):
|
|||||||
if gitpath:
|
if gitpath:
|
||||||
import subprocess
|
import subprocess
|
||||||
source_date_epoch = int(subprocess.check_output(['git','log','-1','--pretty=%ct'], cwd=gitpath))
|
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
|
return source_date_epoch
|
||||||
|
|
||||||
def get_source_date_epoch_from_youngest_file(d, sourcedir):
|
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
|
source_date_epoch = mtime
|
||||||
newest_file = filename
|
newest_file = filename
|
||||||
|
|
||||||
if newest_file != None:
|
if newest_file:
|
||||||
bb.debug(1," SOURCE_DATE_EPOCH %d derived from: %s" % (source_date_epoch, newest_file))
|
bb.debug(1, "Newest file found: %s" % newest_file)
|
||||||
return source_date_epoch
|
return source_date_epoch
|
||||||
|
|
||||||
python do_create_source_date_epoch_stamp() {
|
python do_create_source_date_epoch_stamp() {
|
||||||
epochfile = d.getVar('SDE_FILE')
|
epochfile = d.getVar('SDE_FILE')
|
||||||
if os.path.isfile(epochfile):
|
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
|
return
|
||||||
|
|
||||||
sourcedir = d.getVar('S')
|
sourcedir = d.getVar('S')
|
||||||
@@ -136,10 +140,9 @@ python do_create_source_date_epoch_stamp() {
|
|||||||
)
|
)
|
||||||
if source_date_epoch == 0:
|
if source_date_epoch == 0:
|
||||||
# empty folder, not a single file ...
|
# empty folder, not a single file ...
|
||||||
# kernel source do_unpack is special cased
|
bb.debug(1, "No files found to determine SOURCE_DATE_EPOCH")
|
||||||
if not bb.data.inherits_class('kernel', d):
|
|
||||||
bb.debug(1, "Unable to determine source_date_epoch! path:%s" % sourcedir)
|
|
||||||
|
|
||||||
|
bb.debug(1, "SOURCE_DATE_EPOCH: %d" % source_date_epoch)
|
||||||
bb.utils.mkdirhier(d.getVar('SDE_DIR'))
|
bb.utils.mkdirhier(d.getVar('SDE_DIR'))
|
||||||
with open(epochfile, 'w') as f:
|
with open(epochfile, 'w') as f:
|
||||||
f.write(str(source_date_epoch))
|
f.write(str(source_date_epoch))
|
||||||
@@ -155,6 +158,6 @@ python () {
|
|||||||
if os.path.isfile(epochfile):
|
if os.path.isfile(epochfile):
|
||||||
with open(epochfile, 'r') as f:
|
with open(epochfile, 'r') as f:
|
||||||
source_date_epoch = f.read()
|
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)
|
d.setVar('SOURCE_DATE_EPOCH', source_date_epoch)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user