diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-04-07 10:01:44 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-04-10 23:00:44 +0100 |
commit | 23095a6b011c7473bbf9c5f6b79c22c364a10bac (patch) | |
tree | 64710092fdca2d5c50a8e24e24d287f48de9a394 /meta/lib/oe/sstatesig.py | |
parent | 27b7de94f0602143a9408dc36c636d301258158b (diff) | |
download | poky-23095a6b011c7473bbf9c5f6b79c22c364a10bac.tar.gz |
lib/oe/sstatesig: avoid reporting duplicate siginfo files from sstate
In find_siginfo(), which is used by bitbake-diffsigs among other things,
avoid adding a siginfo file from the sstate-cache where we've already
collected a sigdata file from the stamps directory with the same hash.
This avoids the possibility that the top two files (as picked by default
using the bitbake-diffsigs -t option) are for the same signature and
thus the tool would report no differences. In order to do that, just use
the hashfiles dict that we already have - we just need to change the
code to populate that even if we're collecting matching files without
looking for a fixed set of hashes (i.e. taskhashlist isn't set).
This replaces previous code in bitbake-diffsigs that attempted to filter
these out with limited success.
(From OE-Core rev: 5b69eef40868180c59400624096d7ebbbbea446b)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/sstatesig.py')
-rw-r--r-- | meta/lib/oe/sstatesig.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index a76a031ba2..8d930134c9 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py | |||
@@ -254,9 +254,6 @@ def find_siginfo(pn, taskname, taskhashlist, d): | |||
254 | import fnmatch | 254 | import fnmatch |
255 | import glob | 255 | import glob |
256 | 256 | ||
257 | if taskhashlist: | ||
258 | hashfiles = {} | ||
259 | |||
260 | if not taskname: | 257 | if not taskname: |
261 | # We have to derive pn and taskname | 258 | # We have to derive pn and taskname |
262 | key = pn | 259 | key = pn |
@@ -266,8 +263,15 @@ def find_siginfo(pn, taskname, taskhashlist, d): | |||
266 | if key.startswith('virtual:native:'): | 263 | if key.startswith('virtual:native:'): |
267 | pn = pn + '-native' | 264 | pn = pn + '-native' |
268 | 265 | ||
266 | hashfiles = {} | ||
269 | filedates = {} | 267 | filedates = {} |
270 | 268 | ||
269 | def get_hashval(siginfo): | ||
270 | if siginfo.endswith('.siginfo'): | ||
271 | return siginfo.rpartition(':')[2].partition('_')[0] | ||
272 | else: | ||
273 | return siginfo.rpartition('.')[2] | ||
274 | |||
271 | # First search in stamps dir | 275 | # First search in stamps dir |
272 | localdata = d.createCopy() | 276 | localdata = d.createCopy() |
273 | localdata.setVar('MULTIMACH_TARGET_SYS', '*') | 277 | localdata.setVar('MULTIMACH_TARGET_SYS', '*') |
@@ -297,6 +301,8 @@ def find_siginfo(pn, taskname, taskhashlist, d): | |||
297 | filedates[fullpath] = os.stat(fullpath).st_mtime | 301 | filedates[fullpath] = os.stat(fullpath).st_mtime |
298 | except OSError: | 302 | except OSError: |
299 | continue | 303 | continue |
304 | hashval = get_hashval(fullpath) | ||
305 | hashfiles[hashval] = fullpath | ||
300 | 306 | ||
301 | if not taskhashlist or (len(filedates) < 2 and not foundall): | 307 | if not taskhashlist or (len(filedates) < 2 and not foundall): |
302 | # That didn't work, look in sstate-cache | 308 | # That didn't work, look in sstate-cache |
@@ -320,9 +326,11 @@ def find_siginfo(pn, taskname, taskhashlist, d): | |||
320 | 326 | ||
321 | matchedfiles = glob.glob(filespec) | 327 | matchedfiles = glob.glob(filespec) |
322 | for fullpath in matchedfiles: | 328 | for fullpath in matchedfiles: |
323 | if taskhashlist: | 329 | actual_hashval = get_hashval(fullpath) |
324 | hashfiles[hashval] = fullpath | 330 | if actual_hashval in hashfiles: |
325 | else: | 331 | continue |
332 | hashfiles[hashval] = fullpath | ||
333 | if not taskhashlist: | ||
326 | try: | 334 | try: |
327 | filedates[fullpath] = os.stat(fullpath).st_mtime | 335 | filedates[fullpath] = os.stat(fullpath).st_mtime |
328 | except: | 336 | except: |