diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2011-11-30 16:39:15 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-01 16:54:07 +0000 |
commit | 8e2c57876764a498760cc310187f96e9126e3428 (patch) | |
tree | e94c171bc5549ac6109ff17ee45ecb5dea639ccb /meta/classes | |
parent | 64f3e247df44f4f165d9ae0574d9c0c56e0a4232 (diff) | |
download | ast2050-yocto-poky-8e2c57876764a498760cc310187f96e9126e3428.zip ast2050-yocto-poky-8e2c57876764a498760cc310187f96e9126e3428.tar.gz |
classes/base: split out metadata revision code to separate function
Split out a new function get_layers_branch_rev() which returns a list
of the metadata layers and their revisions. This enables reuse in other
places, such as buildhistory.bbclass.
(From OE-Core rev: c1bca5d95051362320008f16d8f5acd87faa34ac)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/base.bbclass | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index a95dfd9..ea53498 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -200,6 +200,29 @@ def preferred_ml_updates(d): extramp.append(virt + pref + "-" + p) d.setVar("MULTI_PROVIDER_WHITELIST", " ".join(mp + extramp)) + +def get_layers_branch_rev(d): + layers = (d.getVar("BBLAYERS", 1) or "").split() + layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ + base_get_metadata_git_branch(i, None).strip(), \ + base_get_metadata_git_revision(i, None)) \ + for i in layers] + i = len(layers_branch_rev)-1 + p1 = layers_branch_rev[i].find("=") + s1 = layers_branch_rev[i][p1:] + while i > 0: + p2 = layers_branch_rev[i-1].find("=") + s2= layers_branch_rev[i-1][p2:] + if s1 == s2: + layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2] + i -= 1 + else: + i -= 1 + p1 = layers_branch_rev[i].find("=") + s1= layers_branch_rev[i][p1:] + return layers_branch_rev + + addhandler base_eventhandler python base_eventhandler() { from bb.event import getName @@ -211,26 +234,7 @@ python base_eventhandler() { statusvars = ['BB_VERSION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TUNE_FEATURES', 'TARGET_FPU'] statuslines = ["%-17s = \"%s\"" % (i, e.data.getVar(i, 1) or '') for i in statusvars] - layers = (e.data.getVar("BBLAYERS", 1) or "").split() - layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ - base_get_metadata_git_branch(i, None).strip(), \ - base_get_metadata_git_revision(i, None)) \ - for i in layers] - i = len(layers_branch_rev)-1 - p1 = layers_branch_rev[i].find("=") - s1= layers_branch_rev[i][p1:] - while i > 0: - p2 = layers_branch_rev[i-1].find("=") - s2= layers_branch_rev[i-1][p2:] - if s1 == s2: - layers_branch_rev[i-1] = layers_branch_rev[i-1][0:p2] - i -= 1 - else: - i -= 1 - p1 = layers_branch_rev[i].find("=") - s1= layers_branch_rev[i][p1:] - - statuslines += layers_branch_rev + statuslines += get_layers_branch_rev(e.data) statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines) bb.plain(statusmsg) |