Skip to contentSkip to conversation

siggen: Fix a subtle bug in hash calculation for shared work tasks

PATCH In review Richard Purdie 2 participants 2 messages Aug 23, 2014 – Aug 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 siggen: Fix a subtle bug in hash calculation for shared work tasks

With a shared work task like gcc, the task can be run from a variety of different recipes which may have different virtual extensions in place.

Depending on whether gcc-runtime or nativesdk-gcc-runtime's do_preconfigure task is called for example will change the sorting of the task hashes due to the way clean_basename currently works.

The correct thing to do here is sort on the base filename first, then any extension when ordering the hashes. This means we do account for things like recipes with both a native and non-native dependency but we also fix the shared work case where we don't care whether it was a virtual version or not.

bitbake/lib/bb/siggen.py +1 -1
index 933311c..548f50d 100644
@@ -295,7 +295,7 @@ def dump_this_task(outfile, d):
 
 def clean_basepath(a):
     if a.startswith("virtual:"):
-        b = a.rsplit(":", 1)[0] + ":" + a.rsplit("/", 1)[1]
+        b = a.rsplit("/", 1)[1] + ":" + a.rsplit(":", 1)[0]
     else:
         b = a.rsplit("/", 1)[1]
     return b
#1 lore raw
Quoted 34 lines

-----Original Message-----
From: [email protected] [mailto:bitbake- [email protected]] On Behalf Of Richard Purdie
Sent: den 23 augusti 2014 10:23
To: bitbake-devel
Subject: [bitbake-devel] [PATCH] siggen: Fix a subtle bug in hash calculation for shared work tasks

With a shared work task like gcc, the task can be run from a variety of different recipes which may have different virtual extensions in place.

Depending on whether gcc-runtime or nativesdk-gcc-runtime's do_preconfigure
task is called for example will change the sorting of the task hashes due
to the way clean_basename currently works.

The correct thing to do here is sort on the base filename first, then any
extension when ordering the hashes. This means we do account for things like recipes with both a native and non-native dependency but we also fix
the shared work case where we don't care whether it was a virtual version
or not.

bitbake/lib/bb/siggen.py +0 -0
index 933311c..548f50d 100644

bitbake/lib/bb/siggen.py def dump_this_task(outfile, d): · line 301

Quoted 8 lines
bitbake/lib/bb/siggen.py +1 -1
@@ -295,7 +295,7 @@ def dump_this_task(outfile, d):
 
 def clean_basepath(a):
     if a.startswith("virtual:"):
-        b = a.rsplit(":", 1)[0] + ":" + a.rsplit("/", 1)[1]
+        b = a.rsplit("/", 1)[1] + ":" + a.rsplit(":", 1)[0]
     else:
         b = a.rsplit("/", 1)[1]
     return b

After the rewrite above, this can be simplified as:

def clean_basepath(a):

    b = a.rsplit("/", 1)[1]
    if a.startswith("virtual:"):
        b += ":" + a.rsplit(":", 1)[0]
    return b

//Peter