summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-08-27 20:45:14 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-10 13:03:55 +0100
commit27f842eba51cc4e2ad9faffbcef347a9d3717952 (patch)
tree3b42e61b2808a71824441e8961998d979440e961 /meta/lib/oe
parent950c85e398c53c8b4f00f1728e947f339dd37e7b (diff)
downloadast2050-yocto-poky-27f842eba51cc4e2ad9faffbcef347a9d3717952.zip
ast2050-yocto-poky-27f842eba51cc4e2ad9faffbcef347a9d3717952.tar.gz
lib/oe/sstatesig.py: add signature data query function
Add a function that can be used from BitBake code which will find signature data (sigdata/siginfo) files based on specified criteria, and hook it into BitBake as bb.siggen.find_siginfo. (From OE-Core rev: 9f0453c29891e32f8038c4bbc22ada28bfbf818a) 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')
-rw-r--r--meta/lib/oe/sstatesig.py81
1 files changed, 81 insertions, 0 deletions
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 50b4027..39f9ccf 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -74,3 +74,84 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
# Insert these classes into siggen's namespace so it can see and select them
bb.siggen.SignatureGeneratorOEBasic = SignatureGeneratorOEBasic
bb.siggen.SignatureGeneratorOEBasicHash = SignatureGeneratorOEBasicHash
+
+
+def find_siginfo(pn, taskname, taskhashlist, d):
+ """ Find signature data files for comparison purposes """
+
+ import fnmatch
+
+ if taskhashlist:
+ hashfiles = {}
+
+ if not taskname:
+ # We have to derive pn and taskname
+ key = pn
+ splitit = key.split('.bb.')
+ taskname = splitit[1]
+ pn = os.path.basename(splitit[0]).split('_')[0]
+ if key.startswith('virtual:native:'):
+ pn = pn + '-native'
+
+ # First search in stamps dir
+ stampdir = d.getVar('TMPDIR', True) + '/stamps'
+ filespec = '%s-*.%s.sigdata.*' % (pn, taskname)
+ filedates = {}
+ foundall = False
+ for root, dirs, files in os.walk(stampdir):
+ for fn in files:
+ if fnmatch.fnmatch(fn, filespec):
+ fullpath = os.path.join(root, fn)
+ match = False
+ if taskhashlist:
+ for taskhash in taskhashlist:
+ if fn.endswith('.%s' % taskhash):
+ hashfiles[taskhash] = fullpath
+ if len(hashfiles) == len(taskhashlist):
+ foundall = True
+ break
+ else:
+ filedates[fullpath] = os.stat(fullpath).st_mtime
+ if foundall:
+ break
+
+ if len(filedates) < 2 and not foundall:
+ # That didn't work, look in sstate-cache
+ hashes = taskhashlist or ['*']
+ localdata = bb.data.createCopy(d)
+ for hashval in hashes:
+ localdata.setVar('PACKAGE_ARCH', '*')
+ localdata.setVar('TARGET_VENDOR', '*')
+ localdata.setVar('TARGET_OS', '*')
+ localdata.setVar('PN', pn)
+ localdata.setVar('PV', '*')
+ localdata.setVar('PR', '*')
+ localdata.setVar('BB_TASKHASH', hashval)
+ if pn.endswith('-native') or pn.endswith('-crosssdk') or pn.endswith('-cross'):
+ localdata.setVar('SSTATE_EXTRAPATH', "${NATIVELSBSTRING}/")
+ sstatename = d.getVarFlag(taskname, "sstate-name")
+ if not sstatename:
+ sstatename = taskname
+ filespec = '%s_%s.*.siginfo' % (localdata.getVar('SSTATE_PKG', True), sstatename)
+
+ if hashval != '*':
+ sstatedir = "%s/%s" % (d.getVar('SSTATE_DIR', True), hashval[:2])
+ else:
+ sstatedir = d.getVar('SSTATE_DIR', True)
+
+ filedates = {}
+ for root, dirs, files in os.walk(sstatedir):
+ for fn in files:
+ fullpath = os.path.join(root, fn)
+ if fnmatch.fnmatch(fullpath, filespec):
+ if taskhashlist:
+ hashfiles[hashval] = fullpath
+ else:
+ filedates[fullpath] = os.stat(fullpath).st_mtime
+
+ if taskhashlist:
+ return hashfiles
+ else:
+ return filedates
+
+bb.siggen.find_siginfo = find_siginfo
OpenPOWER on IntegriCloud