diff options
| author | Leon Woestenberg <leon.woestenberg@gmail.com> | 2008-05-23 15:59:49 +0000 |
|---|---|---|
| committer | Leon Woestenberg <leon.woestenberg@gmail.com> | 2008-05-23 15:59:49 +0000 |
| commit | 33b90e2dbb1f21ba4511f3e85dfeab1ae24502c4 (patch) | |
| tree | 04b505d6d032b8fb91eb9772a57fb0c5e5f393e8 /classes | |
| parent | ef71e5fbb312339650882401b54739a5e60726fc (diff) | |
| parent | df42d84d1ac1fc35e56fa66cf6559ce6ca2893d3 (diff) | |
merge of '5135d5b0b85d509b8af80d221f18563d4ce62475'
and '8b21a69e52feb768f1d096aa78e44dd20ce3aed4'
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/base.bbclass | 14 | ||||
| -rw-r--r-- | classes/devshell.bbclass | 3 | ||||
| -rw-r--r-- | classes/gtk-icon-cache.bbclass | 12 | ||||
| -rw-r--r-- | classes/image.bbclass | 69 | ||||
| -rw-r--r-- | classes/kernel.bbclass | 6 | ||||
| -rw-r--r-- | classes/oestats-client.bbclass | 71 | ||||
| -rw-r--r-- | classes/seppuku.bbclass | 5 |
7 files changed, 123 insertions, 57 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index 7ffb472058..3c6f5a15a1 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -706,6 +706,17 @@ def base_get_scmbasepath(d): 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_branch(d): + monotone_branch = "<unknown>" + try: + monotone_branch = file( "%s/_MTN/options" % base_get_scmbasepath(d) ).read().strip() + if monotone_branch.startswith( "database" ): + monotone_branch_words = monotone_branch.split() + monotone_branch = monotone_branch_words[ monotone_branch_words.index( "branch" )+1][1:-1] + except: + pass + return monotone_branch + def base_get_metadata_monotone_revision(d): monotone_revision = "<unknown>" try: @@ -725,6 +736,7 @@ def base_get_metadata_svn_revision(d): pass return revision +METADATA_BRANCH ?= "${@base_get_metadata_monotone_branch(d)}" METADATA_REVISION ?= "${@base_get_metadata_monotone_revision(d)}" addhandler base_eventhandler @@ -757,7 +769,7 @@ python base_eventhandler() { if name.startswith("BuildStarted"): bb.data.setVar( 'BB_VERSION', bb.__version__, e.data ) - statusvars = ['BB_VERSION', 'METADATA_REVISION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TARGET_FPU'] + statusvars = ['BB_VERSION', 'METADATA_BRANCH', '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 diff --git a/classes/devshell.bbclass b/classes/devshell.bbclass index 35456b517b..2944dbbfc2 100644 --- a/classes/devshell.bbclass +++ b/classes/devshell.bbclass @@ -3,6 +3,9 @@ EXTRA_OEMAKE[export] = "1" do_devshell[dirs] = "${S}" do_devshell[nostamp] = "1" +export DISPLAY +export XAUTHORITY + devshell_do_devshell() { export TERMWINDOWTITLE="Bitbake Developer Shell" ${TERMCMD} diff --git a/classes/gtk-icon-cache.bbclass b/classes/gtk-icon-cache.bbclass index b86562890a..b256365175 100644 --- a/classes/gtk-icon-cache.bbclass +++ b/classes/gtk-icon-cache.bbclass @@ -3,14 +3,18 @@ RDEPENDS += "hicolor-icon-theme" # This could run on the host as icon cache files are architecture independent, # but there is no gtk-update-icon-cache built natively. -gtk-icon-cache_postinst() { +gtk_icon_cache_postinst() { if [ "x$D" != "x" ]; then exit 1 fi + +# Update the pixbuf loaders in case they haven't been registered yet +gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders + gtk-update-icon-cache -q /usr/share/icons/hicolor } -gtk-icon-cache_postrm() { +gtk_icon_cache_postrm() { gtk-update-icon-cache -q /usr/share/icons/hicolor } @@ -29,13 +33,13 @@ python populate_packages_append () { postinst = bb.data.getVar('pkg_postinst_%s' % pkg, d, 1) or bb.data.getVar('pkg_postinst', d, 1) if not postinst: postinst = '#!/bin/sh\n' - postinst += bb.data.getVar('gtk-icon-cache_postinst', d, 1) + postinst += bb.data.getVar('gtk_icon_cache_postinst', d, 1) bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) postrm = bb.data.getVar('pkg_postrm_%s' % pkg, d, 1) or bb.data.getVar('pkg_postrm', d, 1) if not postrm: postrm = '#!/bin/sh\n' - postrm += bb.data.getVar('gtk-icon-cache_postrm', d, 1) + postrm += bb.data.getVar('gtk_icon_cache_postrm', d, 1) bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) } diff --git a/classes/image.bbclass b/classes/image.bbclass index f8d896d813..6350a733e8 100644 --- a/classes/image.bbclass +++ b/classes/image.bbclass @@ -32,6 +32,8 @@ python () { for dep in (bb.data.getVar('EXTRA_IMAGEDEPENDS', d, True) or "").split(): deps += " %s:do_populate_staging" % dep bb.data.setVarFlag('do_rootfs', 'depends', deps, d) + + runtime_mapping_rename("PACKAGE_INSTALL", d) } # @@ -43,17 +45,33 @@ python () { # is searched for in the BBPATH (same as the old version.) # def get_devtable_list(d): - import bb - devtable = bb.data.getVar('IMAGE_DEVICE_TABLE', d, 1) - if devtable != None: - return devtable - str = "" - devtables = bb.data.getVar('IMAGE_DEVICE_TABLES', d, 1) - if devtables == None: - devtables = 'files/device_table-minimal.txt' - for devtable in devtables.split(): - str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable) - return str + import bb + devtable = bb.data.getVar('IMAGE_DEVICE_TABLE', d, 1) + if devtable != None: + return devtable + str = "" + devtables = bb.data.getVar('IMAGE_DEVICE_TABLES', d, 1) + if devtables == None: + devtables = 'files/device_table-minimal.txt' + for devtable in devtables.split(): + str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable) + return str + +def get_imagecmds(d): + import bb + cmds = "\n" + old_overrides = bb.data.getVar('OVERRIDES', d, 0) + for type in bb.data.getVar('IMAGE_FSTYPES', d, True).split(): + localdata = bb.data.createCopy(d) + bb.data.setVar('OVERRIDES', '%s:%s' % (type, old_overrides), localdata) + bb.data.update_data(localdata) + cmd = "\t#Code for image type " + type + "\n" + cmd += "\t${IMAGE_CMD_" + type + "}\n" + cmd += "\tcd ${DEPLOY_DIR_IMAGE}/\n" + cmd += "\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n" + cmd += "\tln -s ${IMAGE_NAME}.rootfs." + type + " ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}." + type + "\n\n" + cmds += bb.data.expand(cmd, localdata) + return cmds IMAGE_POSTPROCESS_COMMAND ?= "" MACHINE_POSTPROCESS_COMMAND ?= "" @@ -66,6 +84,7 @@ LINGUAS_INSTALL = "${@" ".join(map(lambda s: "locale-base-%s" % s, bb.data.getVa do_rootfs[nostamp] = "1" do_rootfs[dirs] = "${TOPDIR}" +do_rootfs[lockfiles] = "${IMAGE_ROOTFS}.lock" do_build[nostamp] = "1" # Must call real_do_rootfs() from inside here, rather than as a separate @@ -83,25 +102,11 @@ fakeroot do_rootfs () { rootfs_${IMAGE_PKGTYPE}_do_rootfs - insert_feed_uris + insert_feed_uris ${IMAGE_PREPROCESS_COMMAND} - - export TOPDIR=${TOPDIR} - export DISTRO=${USERDISTRO} - export MACHINE=${MACHINE} - for type in ${IMAGE_FSTYPES}; do - if test -z "$FAKEROOTKEY"; then - fakeroot -i ${TMPDIR}/fakedb.image ${PYTHON} `which bbimage` -t $type -e ${FILE} - else - ${PYTHON} `which bbimage` -n "${IMAGE_NAME}" -t "$type" -e "${FILE}" - fi - - cd ${DEPLOY_DIR_IMAGE}/ - rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type - ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type - done + ${@get_imagecmds(d)} ${IMAGE_POSTPROCESS_COMMAND} @@ -119,19 +124,19 @@ do_deploy_to () { insert_feed_uris () { echo "Building feeds for [${DISTRO}].." - + for line in ${FEED_URIS} do # strip leading and trailing spaces/tabs, then split into name and uri line_clean="`echo "$line"|sed 's/^[ \t]*//;s/[ \t]*$//'`" feed_name="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\1/p'`" - feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`" + feed_uri="`echo "$line_clean" | sed -n 's/\(.*\)##\(.*\)/\2/p'`" echo "Added $feed_name feed with URL $feed_uri" # insert new feed-sources echo "src/gz $feed_name $feed_uri" >> ${IMAGE_ROOTFS}/etc/opkg/${feed_name}-feed.conf - done + done # Allow to use package deploy directory contents as quick devel-testing # feed. This creates individual feed configs for each arch subdir of those @@ -159,7 +164,7 @@ log_check() { else echo "Cannot find logfile [$lf_path]" fi - echo "Logfile is clean" + echo "Logfile is clean" done set -x @@ -170,7 +175,7 @@ log_check() { zap_root_password () { sed 's%^root:[^:]*:%root:*:%' < ${IMAGE_ROOTFS}/etc/passwd >${IMAGE_ROOTFS}/etc/passwd.new - mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd + mv ${IMAGE_ROOTFS}/etc/passwd.new ${IMAGE_ROOTFS}/etc/passwd } create_etc_timestamp() { diff --git a/classes/kernel.bbclass b/classes/kernel.bbclass index 47bb4b91ef..a7d34ca476 100644 --- a/classes/kernel.bbclass +++ b/classes/kernel.bbclass @@ -91,9 +91,9 @@ do_builtin_initramfs() { # Make sure to kill injected initramfs, in case someone will do "-c compile -f" rm usr/initramfs_data.cpio.gz } -addtask builtin_initramfs after do_compile -do_builtin_initramfs[nostamp] = "1" -do_builtin_initramfs[depends] = "${INITRAMFS_IMAGE_TARGET}:do_rootfs" +#addtask builtin_initramfs after do_compile +#do_builtin_initramfs[nostamp] = "1" +#do_builtin_initramfs[depends] = "${INITRAMFS_IMAGE_TARGET}:do_rootfs" kernel_do_stage() { ASMDIR=`readlink include/asm` diff --git a/classes/oestats-client.bbclass b/classes/oestats-client.bbclass index 880f02e62d..968aa42c3b 100644 --- a/classes/oestats-client.bbclass +++ b/classes/oestats-client.bbclass @@ -5,8 +5,8 @@ # To make use of this class, add to your local.conf: # # INHERIT += "oestats-client" -# OESTATS_SERVER = "some.server.org:8000" -# OESTATS_BUILDER = "some title" +# OESTATS_SERVER = "some.server.org" +# OESTATS_BUILDER = "some_nickname" def oestats_setid(d, val): import bb @@ -18,7 +18,7 @@ def oestats_getid(d): f = file(bb.data.getVar('TMPDIR', d, True) + '/oestats.id', 'r') return f.read() -def oestats_send(server, action, vars = {}): +def oestats_send(server, action, vars = {}, files = {}): import httplib # build body @@ -30,13 +30,21 @@ def oestats_send(server, action, vars = {}): output.append('Content-Disposition: form-data; name="%s"' % key) output.append('') output.append(vars[key]) + for key in files: + assert files[key] + output.append('--' + bound) + output.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, files[key]['filename'])) + output.append('Content-Type: %s' % files[key]['content-type']) + + output.append('') + output.append(files[key]['content']) output.append('--' + bound + '--') output.append('') body = "\r\n".join(output) # build headers headers = { - "User-agent": "oestats-client/0.1", + "User-agent": "oestats-client/0.5", "Content-type": "multipart/form-data; boundary=%s" % bound, "Content-length": str(len(body))} @@ -56,9 +64,11 @@ def oestats_start(server, builder, d): # send report id = "" try: - data = oestats_send(server, "/builds/start/", { + data = oestats_send(server, "/builds/", { 'builder': builder, - 'revision': bb.data.getVar('METADATA_REVISION', d, True), + 'build_arch': bb.data.getVar('BUILD_ARCH', d, True), + 'metadata_branch': bb.data.getVar('METADATA_BRANCH', d, True), + 'metadata_revision': bb.data.getVar('METADATA_REVISION', d, True), 'machine': bb.data.getVar('MACHINE', d, True), 'distro': bb.data.getVar('DISTRO', d, True), }) @@ -73,7 +83,7 @@ def oestats_start(server, builder, d): bb.note("oestats: error starting build, disabling stats") oestats_setid(d, id) -def oestats_stop(server, d, status): +def oestats_stop(server, d, failures): import bb # retrieve build id @@ -81,8 +91,13 @@ def oestats_stop(server, d, status): if not id: return # send report + if failures > 0: + status = "Failed" + else: + status = "Succeeded" + try: - response = oestats_send(server, "/builds/stop/%s/" % id, { + response = oestats_send(server, "/builds/%s/" % id, { 'status': status, }) except: @@ -90,6 +105,7 @@ def oestats_stop(server, d, status): def oestats_task(server, d, task, status): import bb + import glob import time # retrieve build id @@ -101,17 +117,38 @@ def oestats_task(server, d, task, status): elapsed = time.time() - float(bb.data.getVar('OESTATS_STAMP', d, True)) except: elapsed = 0 + + # prepare files + files = {} + if status == 'Failed': + logs = glob.glob("%s/log.%s.*" % (bb.data.getVar('T', d, True), task)) + if len(logs) > 0: + log = logs[0] + bb.note("oestats: sending log file : %s" % log) + files['log'] = { + 'filename': 'log.txt', + 'content': file(log).read(), + 'content-type': 'text/plain'} + + # prepare report + vars = { + 'build': id, + 'package': bb.data.getVar('PN', d, True), + 'version': bb.data.getVar('PV', d, True), + 'revision': bb.data.getVar('PR', d, True), + 'depends': bb.data.getVar('DEPENDS', d, True), + 'task': task, + 'status': status, + 'time': str(elapsed)} + bug_number = bb.data.getVar('OESTATS_BUG_NUMBER', d, True) + bug_tracker = bb.data.getVar('OESTATS_BUG_TRACKER', d, True) + if bug_number and bug_tracker: + vars['bug_number'] = bug_number + vars['bug_tracker'] = bug_tracker # send report try: - response = oestats_send(server, "/builds/task/%s/" % id, { - 'package': bb.data.getVar('PN', d, True), - 'version': bb.data.getVar('PV', d, True), - 'revision': bb.data.getVar('PR', d, True), - 'task': task, - 'status': status, - 'time': str(elapsed), - }) + response = oestats_send(server, "/tasks/", vars, files) except: bb.note("oestats: error sending task, disabling stats") oestats_setid(d, "") @@ -133,7 +170,7 @@ python oestats_eventhandler () { if getName(e) == 'BuildStarted': oestats_start(server, builder, e.data) elif getName(e) == 'BuildCompleted': - oestats_stop(server, e.data, 'Completed') + oestats_stop(server, e.data, e.getFailures()) elif getName(e) == 'TaskStarted': bb.data.setVar('OESTATS_STAMP', repr(time.time()), e.data) elif getName(e) == 'TaskSucceeded': diff --git a/classes/seppuku.bbclass b/classes/seppuku.bbclass index 1bdee28fa1..ab8096eb45 100644 --- a/classes/seppuku.bbclass +++ b/classes/seppuku.bbclass @@ -380,5 +380,10 @@ python seppuku_eventhandler() { else: print >> debug_file, "Not trying to create an attachment for bug #%s" % bug_number + # store bug number for oestats-client + if bug_number: + bb.data.setVar('OESTATS_BUG_NUMBER', bug_number, event.data) + bb.data.setVar('OESTATS_BUG_TRACKER', "http://bugs.openembedded.net/", event.data) + return NotHandled } |
