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:52:54 +0000 |
commit | c1bca5d95051362320008f16d8f5acd87faa34ac (patch) | |
tree | 96a605006fa9f8a31d87edc34f7adb0c0e8442f5 /meta/classes | |
parent | 869372e7e11b9ba38fcfb721c460404c6f31db95 (diff) | |
download | openembedded-core-c1bca5d95051362320008f16d8f5acd87faa34ac.tar.gz openembedded-core-c1bca5d95051362320008f16d8f5acd87faa34ac.tar.bz2 openembedded-core-c1bca5d95051362320008f16d8f5acd87faa34ac.zip |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
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 a95dfd9a08..ea5349852b 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) |