diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2021-05-27 13:18:35 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-06-03 23:09:41 +0100 |
| commit | ba491952ee8b6183251f37e62485fc49b6e87ea5 (patch) | |
| tree | b651b6cb0d2e0e1804b8d09aea0a8d4f39b627ea | |
| parent | c26ea554a7613d4561712fdd3060c7de7c0584d4 (diff) | |
| download | poky-ba491952ee8b6183251f37e62485fc49b6e87ea5.tar.gz | |
classes/buildhistory: Add option to strip path prefix
Adds an option to strip a prefix from the paths reported in
buildhistory. This makes it easier to compare task signatures in the
build history when the builds were done from different directories.
(From OE-Core rev: 194e7a29212c4a29222730f47d3133dfe92447c1)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/buildhistory.bbclass | 3 | ||||
| -rw-r--r-- | meta/lib/oe/sstatesig.py | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 059de36a5d..55b12d7893 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
| @@ -43,6 +43,7 @@ BUILDHISTORY_COMMIT ?= "1" | |||
| 43 | BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>" | 43 | BUILDHISTORY_COMMIT_AUTHOR ?= "buildhistory <buildhistory@${DISTRO}>" |
| 44 | BUILDHISTORY_PUSH_REPO ?= "" | 44 | BUILDHISTORY_PUSH_REPO ?= "" |
| 45 | BUILDHISTORY_TAG ?= "build" | 45 | BUILDHISTORY_TAG ?= "build" |
| 46 | BUILDHISTORY_PATH_PREFIX_STRIP ?= "" | ||
| 46 | 47 | ||
| 47 | SSTATEPOSTINSTFUNCS_append = " buildhistory_emit_pkghistory" | 48 | SSTATEPOSTINSTFUNCS_append = " buildhistory_emit_pkghistory" |
| 48 | # We want to avoid influencing the signatures of sstate tasks - first the function itself: | 49 | # We want to avoid influencing the signatures of sstate tasks - first the function itself: |
| @@ -697,7 +698,7 @@ python buildhistory_write_sigs() { | |||
| 697 | if hasattr(bb.parse.siggen, 'dump_siglist'): | 698 | if hasattr(bb.parse.siggen, 'dump_siglist'): |
| 698 | taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task') | 699 | taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task') |
| 699 | bb.utils.mkdirhier(taskoutdir) | 700 | bb.utils.mkdirhier(taskoutdir) |
| 700 | bb.parse.siggen.dump_siglist(os.path.join(taskoutdir, 'tasksigs.txt')) | 701 | bb.parse.siggen.dump_siglist(os.path.join(taskoutdir, 'tasksigs.txt'), d.getVar("BUILDHISTORY_PATH_PREFIX_STRIP")) |
| 701 | } | 702 | } |
| 702 | 703 | ||
| 703 | def buildhistory_get_build_id(d): | 704 | def buildhistory_get_build_id(d): |
diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index e86a09b332..47f3ca4efb 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py | |||
| @@ -248,13 +248,24 @@ class SignatureGeneratorOEBasicHashMixIn(object): | |||
| 248 | f.write(' "\n') | 248 | f.write(' "\n') |
| 249 | f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(l))) | 249 | f.write('SIGGEN_LOCKEDSIGS_TYPES_%s = "%s"' % (self.machine, " ".join(l))) |
| 250 | 250 | ||
| 251 | def dump_siglist(self, sigfile): | 251 | def dump_siglist(self, sigfile, path_prefix_strip=None): |
| 252 | def strip_fn(fn): | ||
| 253 | nonlocal path_prefix_strip | ||
| 254 | if not path_prefix_strip: | ||
| 255 | return fn | ||
| 256 | |||
| 257 | fn_exp = fn.split(":") | ||
| 258 | if fn_exp[-1].startswith(path_prefix_strip): | ||
| 259 | fn_exp[-1] = fn_exp[-1][len(path_prefix_strip):] | ||
| 260 | |||
| 261 | return ":".join(fn_exp) | ||
| 262 | |||
| 252 | with open(sigfile, "w") as f: | 263 | with open(sigfile, "w") as f: |
| 253 | tasks = [] | 264 | tasks = [] |
| 254 | for taskitem in self.taskhash: | 265 | for taskitem in self.taskhash: |
| 255 | (fn, task) = taskitem.rsplit(":", 1) | 266 | (fn, task) = taskitem.rsplit(":", 1) |
| 256 | pn = self.lockedpnmap[fn] | 267 | pn = self.lockedpnmap[fn] |
| 257 | tasks.append((pn, task, fn, self.taskhash[taskitem])) | 268 | tasks.append((pn, task, strip_fn(fn), self.taskhash[taskitem])) |
| 258 | for (pn, task, fn, taskhash) in sorted(tasks): | 269 | for (pn, task, fn, taskhash) in sorted(tasks): |
| 259 | f.write('%s:%s %s %s\n' % (pn, task, fn, taskhash)) | 270 | f.write('%s:%s %s %s\n' % (pn, task, fn, taskhash)) |
| 260 | 271 | ||
