diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/autotools.bbclass | 25 | ||||
-rw-r--r-- | classes/base.bbclass | 9 | ||||
-rw-r--r-- | classes/oestats-client.bbclass | 108 |
3 files changed, 126 insertions, 16 deletions
diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass index 5b921dce5d..7137876a93 100644 --- a/classes/autotools.bbclass +++ b/classes/autotools.bbclass @@ -58,7 +58,6 @@ oe_runconf () { --oldincludedir=${oldincludedir} \ --infodir=${infodir} \ --mandir=${mandir} \ - --enable-mainainer-mode \ ${EXTRA_OECONF} \ $@" oenote "Running $cfgcmd..." @@ -199,21 +198,14 @@ autotools_stage_all() { las=$(find . -name \*.la -type f) cd $olddir echo "Found la files: $las" - if [ -n "$las" ]; then - # If there are .la files then libtool was used in the - # build, so install them with magic mangling. - for i in $las - do - dir=$(dirname $i) - echo "oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir}" - oe_libinstall -C ${S} -so $(basename $i .la) ${STAGING_LIBDIR}/${dir} - done - else - # Otherwise libtool wasn't used, and lib/ can be copied - # directly. - autotools_stage_dir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR} - fi - + for i in $las + do + sed -e 's/^installed=yes$/installed=no/' \ + -e '/^dependency_libs=/s,${WORKDIR}[[:alnum:]/\._+-]*/\([[:alnum:]\._+-]*\),${STAGING_LIBDIR}/\1,g' \ + -e "/^dependency_libs=/s,\([[:space:]']\)${libdir},\1${STAGING_LIBDIR},g" \ + -i ${STAGE_TEMP}/${libdir}/$i + done + autotools_stage_dir ${STAGE_TEMP}/${libdir} ${STAGING_LIBDIR} fi # Ok, this is nasty. pkgconfig.bbclass is usually used to install .pc files, # however some packages rely on the presence of .pc files to enable/disable @@ -233,3 +225,4 @@ autotools_stage_all() { } EXPORT_FUNCTIONS do_configure do_install + diff --git a/classes/base.bbclass b/classes/base.bbclass index b653bec83f..64a179f182 100644 --- a/classes/base.bbclass +++ b/classes/base.bbclass @@ -287,7 +287,16 @@ oe_libinstall() { if [ -z "$dir" ]; then dir=`pwd` fi + dotlai=$libname.lai + + # Sanity check that the libname.lai is unique + number_of_files=`(cd $dir; find . -name "$dotlai") | wc -l` + if [ $number_of_files -gt 1 ]; then + oefatal "oe_libinstall: $dotlai is not unique in $dir" + fi + + dir=$dir`(cd $dir;find . -name "$dotlai") | sed "s/^\.//;s/\/$dotlai\$//;q"` olddir=`pwd` __runcmd cd $dir diff --git a/classes/oestats-client.bbclass b/classes/oestats-client.bbclass new file mode 100644 index 0000000000..da70a77825 --- /dev/null +++ b/classes/oestats-client.bbclass @@ -0,0 +1,108 @@ +# Integration with the oestats build statistics server, see: +# +# http://opensource.bolloretelecom.eu/projects/oestats +# +# To make use of this class, add to your local.conf: +# +# INHERIT += "oestats-client" +# OESTATS_SERVER = "some.server.org:8000" +# OESTATS_BUILDER = "some title" + +def oestats_revision(dir): + import re + try: + f = file("%s/_MTN/revision" % dir) + m = re.search(r"old_revision \[(.*)\]", f.read()) + return m.group(1) + except: + return + +def oestats_send(server, action, vars = {}): + import httplib, urllib + + params = urllib.urlencode(vars) + headers = {"Content-type": "application/x-www-form-urlencoded", + "Accept": "text/plain"} + conn = httplib.HTTPConnection(server) + conn.request("POST", action, params, headers) + response = conn.getresponse() + conn.close() + return response + +def oestats_start(server, builder, d): + import bb + import os.path + + # collect information about revisions + path_bb = bb.data.getVar('BBPATH', d, 1) + for p in (path_bb or "").split(':'): + revision = oestats_revision(p) + if revision: + break + + # send report + response = oestats_send(server, "/builds/start/", { + 'builder': builder, + 'revision': revision, + 'machine': bb.data.getVar( 'MACHINE', d, True ), + 'distro': bb.data.getVar( 'DISTRO', d, True ), + }) + id = response.read() + + # save the build id + bb.note("Stats id: %s" % id) + f = file(bb.data.getVar('TMPDIR', d, True)+"/oestats.id", 'w') + f.write(id) + +def oestats_stop(server, d, status): + import bb + + # retrieve build id + f = file(bb.data.getVar('TMPDIR',d,True)+"/oestats.id", 'r') + id = f.read() + + # send report + response = oestats_send(server, "/builds/stop/%s/" % id, { + 'status': status, + }) + +def oestats_task(server, d, task, status): + import bb + + # retrieve build id + f = file(bb.data.getVar('TMPDIR',d,True)+"/oestats.id", 'r') + id = f.read() + + # send report + 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, + }) + +addhandler oestats_eventhandler +python oestats_eventhandler () { + from bb.event import getName + import bb + + if e.data is None or getName(e) == "MsgNote": + return NotHandled + + server = bb.data.getVar('OESTATS_SERVER', e.data, True) + builder = bb.data.getVar('OESTATS_BUILDER', e.data, True) + if not server or not builder: + return NotHandled + + if getName(e) == 'BuildStarted': + oestats_start(server, builder, e.data) + elif getName(e) == 'BuildCompleted': + oestats_stop(server, e.data, 'Completed') + elif getName(e) == 'TaskSucceeded': + oestats_task(server, e.data, e.task, 'Succeeded') + elif getName(e) == 'TaskFailed': + oestats_task(server, e.data, e.task, 'Failed') + + return NotHandled +} |