summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 50b4027bd6..39f9ccf77e 100644
--- a/meta/lib/oe/sstatesig.py
+++ b/meta/lib/oe/sstatesig.py
@@ -74,3 +74,84 @@ class SignatureGeneratorOEBasicHash(bb.siggen.SignatureGeneratorBasicHash):
74# Insert these classes into siggen's namespace so it can see and select them 74# Insert these classes into siggen's namespace so it can see and select them
75bb.siggen.SignatureGeneratorOEBasic = SignatureGeneratorOEBasic 75bb.siggen.SignatureGeneratorOEBasic = SignatureGeneratorOEBasic
76bb.siggen.SignatureGeneratorOEBasicHash = SignatureGeneratorOEBasicHash 76bb.siggen.SignatureGeneratorOEBasicHash = SignatureGeneratorOEBasicHash
77
78
79def find_siginfo(pn, taskname, taskhashlist, d):
80 """ Find signature data files for comparison purposes """
81
82 import fnmatch
83
84 if taskhashlist:
85 hashfiles = {}
86
87 if not taskname:
88 # We have to derive pn and taskname
89 key = pn
90 splitit = key.split('.bb.')
91 taskname = splitit[1]
92 pn = os.path.basename(splitit[0]).split('_')[0]
93 if key.startswith('virtual:native:'):
94 pn = pn + '-native'
95
96 # First search in stamps dir
97 stampdir = d.getVar('TMPDIR', True) + '/stamps'
98 filespec = '%s-*.%s.sigdata.*' % (pn, taskname)
99 filedates = {}
100 foundall = False
101 for root, dirs, files in os.walk(stampdir):
102 for fn in files:
103 if fnmatch.fnmatch(fn, filespec):
104 fullpath = os.path.join(root, fn)
105 match = False
106 if taskhashlist:
107 for taskhash in taskhashlist:
108 if fn.endswith('.%s' % taskhash):
109 hashfiles[taskhash] = fullpath
110 if len(hashfiles) == len(taskhashlist):
111 foundall = True
112 break
113 else:
114 filedates[fullpath] = os.stat(fullpath).st_mtime
115 if foundall:
116 break
117
118 if len(filedates) < 2 and not foundall:
119 # That didn't work, look in sstate-cache
120 hashes = taskhashlist or ['*']
121 localdata = bb.data.createCopy(d)
122 for hashval in hashes:
123 localdata.setVar('PACKAGE_ARCH', '*')
124 localdata.setVar('TARGET_VENDOR', '*')
125 localdata.setVar('TARGET_OS', '*')
126 localdata.setVar('PN', pn)
127 localdata.setVar('PV', '*')
128 localdata.setVar('PR', '*')
129 localdata.setVar('BB_TASKHASH', hashval)
130 if pn.endswith('-native') or pn.endswith('-crosssdk') or pn.endswith('-cross'):
131 localdata.setVar('SSTATE_EXTRAPATH', "${NATIVELSBSTRING}/")
132 sstatename = d.getVarFlag(taskname, "sstate-name")
133 if not sstatename:
134 sstatename = taskname
135 filespec = '%s_%s.*.siginfo' % (localdata.getVar('SSTATE_PKG', True), sstatename)
136
137 if hashval != '*':
138 sstatedir = "%s/%s" % (d.getVar('SSTATE_DIR', True), hashval[:2])
139 else:
140 sstatedir = d.getVar('SSTATE_DIR', True)
141
142 filedates = {}
143 for root, dirs, files in os.walk(sstatedir):
144 for fn in files:
145 fullpath = os.path.join(root, fn)
146 if fnmatch.fnmatch(fullpath, filespec):
147 if taskhashlist:
148 hashfiles[hashval] = fullpath
149 else:
150 filedates[fullpath] = os.stat(fullpath).st_mtime
151
152 if taskhashlist:
153 return hashfiles
154 else:
155 return filedates
156
157bb.siggen.find_siginfo = find_siginfo