diff options
author | Jeremy Laine <jeremy.laine@m4x.org> | 2008-05-16 16:24:50 +0000 |
---|---|---|
committer | Jeremy Laine <jeremy.laine@m4x.org> | 2008-05-16 16:24:50 +0000 |
commit | af19efb1b5128bfce441029e131dbe6c8a0e8043 (patch) | |
tree | 609ec59467ba1ff5e445ac5a9f8cc9bf1cceb0f2 /classes | |
parent | 9c36fb3b4266b5b0864b9898d171c731bcf403b4 (diff) | |
parent | e59191af5bc39b3ad744059da92f7c398b227c3e (diff) |
merge of '87aa8e8cdbee54b3d7ff294da220db58798e8c12'
and 'a5324bd0638da4faba37d7b92ff362d19510c2fc'
Diffstat (limited to 'classes')
-rw-r--r-- | classes/base.bbclass | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index 64a179f182..7ffb472058 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -701,6 +701,31 @@ python base_do_unpack() { raise bb.build.FuncFailed() } +def base_get_scmbasepath(d): + import bb + path_to_bbfiles = bb.data.getVar( 'BBFILES', d, 1 ).split() + return path_to_bbfiles[0][:path_to_bbfiles[0].rindex( "packages" )] + +def base_get_metadata_monotone_revision(d): + monotone_revision = "<unknown>" + try: + monotone_revision = file( "%s/_MTN/revision" % base_get_scmbasepath(d) ).read().strip() + if monotone_revision.startswith( "format_version" ): + monotone_revision_words = monotone_revision.split() + monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1] + except IOError: + pass + return monotone_revision + +def base_get_metadata_svn_revision(d): + revision = "<unknown>" + try: + revision = file( "%s/.svn/entries" % base_get_scmbasepath(d) ).readlines()[3].strip() + except IOError: + pass + return revision + +METADATA_REVISION ?= "${@base_get_metadata_monotone_revision(d)}" addhandler base_eventhandler python base_eventhandler() { @@ -732,19 +757,8 @@ python base_eventhandler() { if name.startswith("BuildStarted"): bb.data.setVar( 'BB_VERSION', bb.__version__, e.data ) - path_to_bbfiles = bb.data.getVar( 'BBFILES', e.data, 1 ) - path_to_packages = path_to_bbfiles[:path_to_bbfiles.rindex( "packages" )] - monotone_revision = "<unknown>" - try: - monotone_revision = file( "%s/_MTN/revision" % path_to_packages ).read().strip() - if monotone_revision.startswith( "format_version" ): - monotone_revision_words = monotone_revision.split() - monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1] - except IOError: - pass - bb.data.setVar( 'OE_REVISION', monotone_revision, e.data ) - statusvars = ['BB_VERSION', 'OE_REVISION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TARGET_FPU'] - statuslines = ["%-14s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars] + statusvars = ['BB_VERSION', 'METADATA_REVISION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TARGET_FPU'] + statuslines = ["%-17s = \"%s\"" % (i, bb.data.getVar(i, e.data, 1) or '') for i in statusvars] statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines) print statusmsg |