bitbake: siggen: Test extra cross/native hashserv method

Hack the hashserv to allow extra data to be injected into the hashserv
method. This allows OE-Core to handle cases where there are multiple
sstate objects for the same taskhash, e.g. native/cross objects based
upon BUILD_ARCH or the host distro (when uninative isn't used).

This has been tested and proven to be very effective. We will likely
rework the code to improve how this is handled but for now this
improves automated builds until we can get to that refactoring and
more invasive changes.

(Bitbake rev: e21bf572cfe18e805d3f849777189685f7391a67)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0a09b0fa03d1afc08037964dc63a18ef7cff9c78)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2019-12-28 00:03:16 +00:00
parent 9f02b50c8c
commit 5a7ede639f

View File

@@ -391,12 +391,16 @@ class SignatureGeneratorBasicHash(SignatureGeneratorBasic):
bb.build.write_taint(task, d, fn)
class SignatureGeneratorUniHashMixIn(object):
def __init__(self, data):
self.extramethod = {}
super().__init__(data)
def get_taskdata(self):
return (self.server, self.method) + super().get_taskdata()
return (self.server, self.method, self.extramethod) + super().get_taskdata()
def set_taskdata(self, data):
self.server, self.method = data[:2]
super().set_taskdata(data[2:])
self.server, self.method, self.extramethod = data[:3]
super().set_taskdata(data[3:])
def client(self):
if getattr(self, '_client', None) is None:
@@ -453,7 +457,10 @@ class SignatureGeneratorUniHashMixIn(object):
unihash = taskhash
try:
data = self.client().get_unihash(self.method, self.taskhash[tid])
method = self.method
if tid in self.extramethod:
method = method + self.extramethod[tid]
data = self.client().get_unihash(method, self.taskhash[tid])
if data:
unihash = data
# A unique hash equal to the taskhash is not very interesting,
@@ -522,7 +529,11 @@ class SignatureGeneratorUniHashMixIn(object):
extra_data['task'] = task
extra_data['outhash_siginfo'] = sigfile.read().decode('utf-8')
data = self.client().report_unihash(taskhash, self.method, outhash, unihash, extra_data)
method = self.method
if tid in self.extramethod:
method = method + self.extramethod[tid]
data = self.client().report_unihash(taskhash, method, outhash, unihash, extra_data)
new_unihash = data['unihash']
if new_unihash != unihash:
@@ -549,7 +560,11 @@ class SignatureGeneratorUniHashMixIn(object):
def report_unihash_equiv(self, tid, taskhash, wanted_unihash, current_unihash, datacaches):
try:
extra_data = {}
data = self.client().report_unihash_equiv(taskhash, self.method, wanted_unihash, extra_data)
method = self.method
if tid in self.extramethod:
method = method + self.extramethod[tid]
data = self.client().report_unihash_equiv(taskhash, method, wanted_unihash, extra_data)
bb.note('Reported task %s as unihash %s to %s (%s)' % (tid, wanted_unihash, self.server, str(data)))
if data is None: