summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
authorConstantin Musca <constantinx.musca@intel.com>2013-02-27 17:37:24 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-07 11:14:37 +0000
commitd4e470322658af75db276ecbe8d906949541c872 (patch)
tree31ad7b30577ff17f9187c3b96497410092580f5e /meta/classes/buildhistory.bbclass
parent6159ad1063f4be518d8f0a1c024f12fc16d13592 (diff)
downloadpoky-d4e470322658af75db276ecbe8d906949541c872.tar.gz
buildhistory.bbclass: add support for SRCREV logging
- create "latest_srcrev" for each recipe with the following format: ${BB_FILENAME},${SRC_URI},${SRCREV},${FROM_AUTOREV} [YOCTO #3041] (From OE-Core rev: f9acd756746e61b82b58d300f3ab13f3b086787d) Signed-off-by: Constantin Musca <constantinx.musca@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass23
1 files changed, 22 insertions, 1 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 43780ad2da..07b3c1edaf 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -45,6 +45,11 @@ python buildhistory_emit_pkghistory() {
45 self.pr = "r0" 45 self.pr = "r0"
46 self.depends = "" 46 self.depends = ""
47 self.packages = "" 47 self.packages = ""
48 self.bbfile = ""
49 self.src_uri = ""
50 self.srcrev = ""
51 self.srcrev_autorev = ""
52
48 53
49 class PackageInfo: 54 class PackageInfo:
50 def __init__(self, name): 55 def __init__(self, name):
@@ -152,6 +157,12 @@ python buildhistory_emit_pkghistory() {
152 pe = d.getVar('PE', True) or "0" 157 pe = d.getVar('PE', True) or "0"
153 pv = d.getVar('PV', True) 158 pv = d.getVar('PV', True)
154 pr = d.getVar('PR', True) 159 pr = d.getVar('PR', True)
160
161 bbfile = d.getVar('BB_FILENAME', True)
162 src_uri = d.getVar('SRC_URI', True)
163 srcrev = d.getVar('SRCREV', True)
164 srcrev_autorev = 'yes' if d.getVar('SRCREV', False) == 'AUTOINC' else 'no'
165
155 packages = squashspaces(d.getVar('PACKAGES', True)) 166 packages = squashspaces(d.getVar('PACKAGES', True))
156 167
157 packagelist = packages.split() 168 packagelist = packages.split()
@@ -160,7 +171,7 @@ python buildhistory_emit_pkghistory() {
160 else: 171 else:
161 # Remove files for packages that no longer exist 172 # Remove files for packages that no longer exist
162 for item in os.listdir(pkghistdir): 173 for item in os.listdir(pkghistdir):
163 if item != "latest": 174 if item != "latest" and item != "latest_srcrev":
164 if item not in packagelist: 175 if item not in packagelist:
165 subdir = os.path.join(pkghistdir, item) 176 subdir = os.path.join(pkghistdir, item)
166 for subfile in os.listdir(subdir): 177 for subfile in os.listdir(subdir):
@@ -172,6 +183,10 @@ python buildhistory_emit_pkghistory() {
172 rcpinfo.pv = pv 183 rcpinfo.pv = pv
173 rcpinfo.pr = pr 184 rcpinfo.pr = pr
174 rcpinfo.depends = sortlist(squashspaces(d.getVar('DEPENDS', True) or "")) 185 rcpinfo.depends = sortlist(squashspaces(d.getVar('DEPENDS', True) or ""))
186 rcpinfo.bbfile = bbfile
187 rcpinfo.src_uri = src_uri
188 rcpinfo.srcrev = srcrev
189 rcpinfo.srcrev_autorev = srcrev_autorev
175 rcpinfo.packages = packages 190 rcpinfo.packages = packages
176 write_recipehistory(rcpinfo, d) 191 write_recipehistory(rcpinfo, d)
177 192
@@ -243,6 +258,12 @@ def write_recipehistory(rcpinfo, d):
243 f.write("DEPENDS = %s\n" % rcpinfo.depends) 258 f.write("DEPENDS = %s\n" % rcpinfo.depends)
244 f.write("PACKAGES = %s\n" % rcpinfo.packages) 259 f.write("PACKAGES = %s\n" % rcpinfo.packages)
245 260
261 if rcpinfo.srcrev:
262 srcrevfile = os.path.join(pkghistdir, "latest_srcrev")
263 with open(srcrevfile, "w") as f:
264 f.write(','.join([rcpinfo.bbfile, rcpinfo.src_uri, rcpinfo.srcrev,
265 rcpinfo.srcrev_autorev]))
266
246 267
247def write_pkghistory(pkginfo, d): 268def write_pkghistory(pkginfo, d):
248 bb.debug(2, "Writing package history for package %s" % pkginfo.name) 269 bb.debug(2, "Writing package history for package %s" % pkginfo.name)