All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Signature generation for bitbake-diffsigs
@ 2012-08-27 20:45 Paul Eggleton
  2012-08-27 20:45 ` [PATCH 1/1] lib/oe/sstatesig.py: add signature data query function Paul Eggleton
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggleton @ 2012-08-27 20:45 UTC (permalink / raw)
  To: openembedded-core

This is the OE-Core part of the changes for bitbake-diffsigs just posted
to the bitbake-devel mailing list.


The following change since commit 1677b736bca5dc46db522da1874459d2de77209d:

  terminal.py: use unique ids for screen sessions (2012-08-25 14:44:31 +0100)

is available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib paule/bbdiffsigs-oe
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/bbdiffsigs-oe

Paul Eggleton (1):
  lib/oe/sstatesig.py: add signature data query function

 meta/lib/oe/sstatesig.py |   81 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

-- 
1.7.9.5




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] lib/oe/sstatesig.py: add signature data query function
  2012-08-27 20:45 [PATCH 0/1] Signature generation for bitbake-diffsigs Paul Eggleton
@ 2012-08-27 20:45 ` Paul Eggleton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2012-08-27 20:45 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/lib/oe/sstatesig.py |   81 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py
index 20d94b2..749029b 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
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-27 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-27 20:45 [PATCH 0/1] Signature generation for bitbake-diffsigs Paul Eggleton
2012-08-27 20:45 ` [PATCH 1/1] lib/oe/sstatesig.py: add signature data query function Paul Eggleton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.