icecc-create-env: a tool to create icecc toolchain tarballs
PATCH 1/3 icecc-create-env: a tool to create icecc toolchain tarballs
IceCC needs tarballs with toolchains to work correctly. This is a version largely based on one from org.openembedded.dev, plus a patch to support recent compilers, LTO, etc.
--- .../icecc-create-env/icecc-lto-update.patch | 103 ++++++++++++++++++++ .../icecc-create-env/icecc-create-env_0.1.bb | 29 ++++++ 2 files changed, 132 insertions(+), 0 deletions(-) create mode 100644 meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-lto-update.patch create mode 100644 meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-lto-update.patch new file +103 -0
@@ -0,0 +1,103 @@ +--- a/icecc-create-env 2006-12-14 09:50:46.000000000 +0300 ++++ b/icecc-create-env 2011-08-31 17:52:45.000000000 +0400 +@@ -27,9 +27,6 @@ + # readlink is not portable enough. + path=`ls -H $path` + toadd="$name=$path" +- if test "$name" = "$path"; then +- toadd=$path +- fi + is_contained "$toadd" && return + if test -z "$silent"; then + echo "adding file $toadd" +@@ -117,6 +114,14 @@ + add_file "$specfile" + fi + ++ltofile=`$added_gcc -print-prog-name=lto1` ++pluginfile="${ltofile%lto1}liblto_plugin.so" ++if test -r "$pluginfile" ++then ++ add_file $pluginfile ${pluginfile#*usr} ++ add_file $pluginfile /usr${pluginfile#*usr} ++fi ++ + tempdir=`mktemp -d /tmp/iceccenvXXXXXX` + new_target_files= + for i in $target_files; do +@@ -140,49 +147,44 @@ + done + + #sort the files +- target_files=`for i in $new_target_files; do echo $i; done | sort` ++target_files=`for i in $new_target_files; do echo $i; done | sort` + + #test if an archive name was supplied + #if not use the md5 of all files as the archive name + if test -z "$archive_name"; then +-md5sum=NONE +-for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do +- if test -x $file; then +- md5sum=$file +- break +- fi +-done ++ md5sum=NONE ++ for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do ++ if test -x $file; then ++ md5sum=$file ++ break ++ fi ++ done + +-#calculate md5 and use it as the archive name +-archive_name=`for i in $target_files; do $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'` || { +- if test -z "$silent"; then +- echo "Couldn't compute MD5 sum." ++ #calculate md5 and use it as the archive name ++ archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || { ++ if test -z "$silent"; then ++ echo "Couldn't compute MD5 sum." ++ fi ++ exit 2 ++ } ++ mydir=`pwd` ++else ++ mydir="`dirname "$archive_name"`" ++ ++ #check if we have a full path or only a filename ++ if test "$mydir" = "." ; then ++ mydir=`pwd` ++ else ++ mydir="" + fi +- exit 2 +-} +- + fi + + if test -z "$silent"; then +-echo "creating $archive_name.tar.gz" ++echo "creating $archive_name" + fi + +-if test -z "$archive_name"; then +- mydir=`pwd` +-else +-# mydir=dirname ${archive_name} +- mydir=${archive_name%/*} +- +-#check if we have a full path or only a filename +- if test -z "$mydir"; then +- mydir=`pwd` +- else +- mydir="" +- fi +- +-fi + cd $tempdir +-tar -czhf "$mydir/$archive_name".tar.gz $target_files || { ++tar -czhf "$mydir/$archive_name" $target_files || { + if test -z "$silent"; then + echo "Couldn't create archive" + fi
meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb new file +29 -0
@@ -0,0 +1,29 @@ +DESCRIPTION = "This is a modified version of the icecc-create-env script in order to\ +make it work with OE." +SECTION = "base" +PRIORITY = "optional" +# source file has just a "GPL" word, but upstream is GPLv2+. +# most probably just GPL would be a mistake +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://icecc-create-env;beginline=2;endline=5;md5=ae1df3d6a058bfda40b66094c5f6065f" + +PR = "r1" + +DEPENDS = "" +INHIBIT_DEFAULT_DEPS = "1" + +inherit native + +PATCHTOOL = "patch" +SRC_URI = "http://www.digital-opsis.com/openembedded/icecc-create-env-${PV}.tar.gz \ + file://icecc-lto-update.patch " + +S = "${WORKDIR}" + +do_install() { + install -d ${D}/${bindir} + install -m 0755 ${WORKDIR}/icecc-create-env ${D}/${bindir} +} + +SRC_URI[md5sum] = "641ec45fe377529c7fd914f77b11b44f" +SRC_URI[sha256sum] = "9ff8360375432a7a5c476cc6d55b3fdea9d6f3edc080d295a60421d8f47b1834"
Signature · 1 line
1.7.2.5
PATCH 2/3 icecc.bbclass: replace with updated version
Replace a non-working icecc class with a rewritten one. It's cleaned up, most things are handled now in shell scripts, as it's possible that toolchains won't exist at the time of parsing/python substitution. Packages which empty PARALLEL_MAKE are ignored now, as not to break them.
--- meta/classes/icecc.bbclass | 390 ++++++++++++++++---------------------------- 1 files changed, 144 insertions(+), 246 deletions(-)
meta/classes/icecc.bbclass +144 -246
@@ -26,295 +26,193 @@ #Error checking is kept to minimum so double check any parameters you pass to the class ########################################################################################### +ICECC_ENV_EXEC ?= "${STAGING_BINDIR_NATIVE}/icecc-create-env" -def icc_determine_gcc_version(gcc): - """ - Hack to determine the version of GCC - - 'i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363)' - """ - return os.popen("%s --version" % gcc ).readline().split()[2] - -def create_cross_env(bb,d): - """ - Create a tar.bz2 of the current toolchain - """ - # Constin native-native compilation no environment needed if - # host prefix is empty (let us duplicate the query for ease) - prefix = bb.data.expand('${HOST_PREFIX}', d) - if len(prefix) == 0: - return "" - - import tarfile, socket, time - prefix = bb.data.expand('${HOST_PREFIX}' , d) - ice_dir = bb.data.expand("${STAGING_DIR_NATIVE}${prefix_native}") - distro = bb.data.expand('${DISTRO}', d) - target_sys = bb.data.expand('${TARGET_SYS}', d) - target_prefix = bb.data.expand('${TARGET_PREFIX}', d) - float = bb.data.getVar('TARGET_FPU', d) or "hard" - name = socket.gethostname() - - # Stupid check to determine if we have built a libc and a cross - # compiler. - try: - os.stat(os.path.join(ice_dir, target_sys, 'lib', 'libc.so')) - os.stat(os.path.join(ice_dir, target_sys, 'bin', 'g++')) - except: # no cross compiler built yet - return "" - - VERSION = icc_determine_gcc_version( os.path.join(ice_dir,target_sys,"bin","g++") ) - cross_name = prefix + distro + "-" + target_sys + "-" + float + "-" + VERSION + "-" + name - tar_file = os.path.join(ice_dir, 'ice', cross_name + '.tar.gz') - - try: - os.stat(tar_file) - # tar file already exists - return tar_file - except: - try: - os.makedirs(os.path.join(ice_dir,'ice')) - except: - # directory already exists, continue - pass - - - #check if user has specified a specific icecc-create-env script - #if not use the OE provided one - cr_env_script = bb.data.getVar('ICECC_ENV_EXEC', d) or bb.data.expand('${STAGING_DIR}', d)+"/ice/icecc-create-env" - #call the modified create-env script - result=os.popen("%s %s %s %s %s %s" %(cr_env_script, - "--silent", - os.path.join(ice_dir,target_sys,'bin','gcc'), - os.path.join(ice_dir,target_sys,'bin','g++'), - os.path.join(ice_dir,target_sys,'bin','as'), - os.path.join(ice_dir,"ice",cross_name) ) ) - return tar_file - +def icecc_dep_prepend(d): + # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not + # we need that built is the responsibility of the patch function / class, not + # the application. + if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d): + return "icecc-create-env" + return "" -def create_native_env(bb,d): - import tarfile, socket, time - ice_dir = bb.data.expand("${STAGING_DIR_NATIVE}${prefix_native}") - prefix = bb.data.expand('${HOST_PREFIX}' , d) - distro = bb.data.expand('${DISTRO}', d) - target_sys = bb.data.expand('${TARGET_SYS}', d) - target_prefix = bb.data.expand('${TARGET_PREFIX}', d) - float = bb.data.getVar('TARGET_FPU', d) or "hard" - name = socket.gethostname() +DEPENDS_prepend += "${@icecc_dep_prepend(d)} " - archive_name = "local-host-env" + "-" + name - tar_file = os.path.join(ice_dir, 'ice', archive_name + '.tar.gz') - - try: - os.stat(tar_file) - # tar file already exists - return tar_file - except: - try: - #os.makedirs(os.path.join(ice_dir)) - os.makedirs(os.path.join(ice_dir,'ice')) - except: - # directory already exists, continue - pass - - #check if user has specified a specific icecc-create-env script - #if not use the OE provided one - cr_env_script = bb.data.getVar('ICECC_ENV_EXEC', d) or bb.data.expand('${STAGING_DIR}', d)+"/ice/icecc-create-env" - result=os.popen("%s %s %s %s %s %s" %(cr_env_script, - "--silent", - os.popen("%s gcc" % "which").read()[:-1], - os.popen("%s g++" % "which").read()[:-1], - os.popen("%s as" % "which").read()[:-1], - os.path.join(ice_dir,"ice",archive_name) ) ) - return tar_file - - - -def create_cross_kernel_env(bb,d): - import tarfile, socket, time - ice_dir = bb.data.expand("${STAGING_DIR_NATIVE}${prefix_native}") - prefix = bb.data.expand('${HOST_PREFIX}' , d) - distro = bb.data.expand('${DISTRO}', d) - target_sys = bb.data.expand('${TARGET_SYS}', d) - target_prefix = bb.data.expand('${TARGET_PREFIX}', d) - float = bb.data.getVar('TARGET_FPU', d) or "hard" - name = socket.gethostname() +def get_cross_kernel_cc(bb,d): kernel_cc = bb.data.expand('${KERNEL_CC}', d) - kernel_cc = kernel_cc[:-1] - - # Stupid check to determine if we have built a libc and a cross - # compiler. - try: - os.stat(os.path.join(ice_dir, 'bin', kernel_cc)) - except: # no cross compiler built yet - return "" - - VERSION = icc_determine_gcc_version( os.path.join(ice_dir,"bin",kernel_cc) ) - cross_name = prefix + distro + "-" + target_sys + "-" + float + "-" + VERSION + "-" + name - tar_file = os.path.join(ice_dir, 'ice', cross_name + '.tar.gz') - - try: - os.stat(tar_file) - # tar file already exists - return tar_file - except: - try: - os.makedirs(os.path.join(ice_dir,'ice')) - except: - # directory already exists, continue - pass - + kernel_cc = kernel_cc.replace('ccache', '').strip() + kernel_cc = kernel_cc.split(' ')[0] + kernel_cc = kernel_cc.strip() + return kernel_cc - #check if user has specified a specific icecc-create-env script - #if not use the OE provided one - cr_env_script = bb.data.getVar('ICECC_ENV_EXEC', d) or bb.data.expand('${STAGING_DIR}', d)+"/ice/icecc-create-env" - result=os.popen("%s %s %s %s %s %s" %(cr_env_script, - "--silent", - os.path.join(ice_dir,'bin',kernel_cc), - os.path.join(ice_dir,target_sys,'bin','g++'), - os.path.join(ice_dir,target_sys,'bin','as'), - os.path.join(ice_dir,"ice",cross_name) ) ) - return tar_file - - -def create_env(bb,d): - - #return create_cross_kernel_env(bb,d) - - if bb.data.inherits_class("native", d): - return create_native_env(bb,d) - elif bb.data.inherits_class("kernel", d): - return create_cross_kernel_env(bb,d) - elif bb.data.inherits_class("cross", d): - return create_native_env(bb,d) - elif bb.data.inherits_class("sdk", d): - return create_native_env(bb,d) - else: - return create_cross_env(bb,d) - - -def create_path(compilers, type, bb, d): +def create_path(compilers, bb, d): """ Create Symlinks for the icecc in the staging directory """ - staging = os.path.join(bb.data.expand('${STAGING_DIR}', d), "ice", type) + staging = os.path.join(bb.data.expand('${STAGING_BINDIR}', d), "ice") + if icc_is_kernel(bb, d): + staging += "-kernel" #check if the icecc path is set by the user - icecc = bb.data.getVar('ICECC_PATH', d) or os.popen("%s icecc" % "which").read()[:-1] + icecc = bb.data.getVar('ICECC_PATH', d) or os.popen("which icecc").read()[:-1] # Create the dir if necessary try: os.stat(staging) except: - os.makedirs(staging) + try: + os.makedirs(staging) + except: + pass for compiler in compilers: gcc_path = os.path.join(staging, compiler) try: os.stat(gcc_path) except: - os.symlink(icecc, gcc_path) + try: + os.symlink(icecc, gcc_path) + except: + pass - return staging + ":" + return staging +def use_icc(bb,d): + package_tmp = bb.data.expand('${PN}', d) -def use_icc_version(bb,d): - icecc_ver = "yes" - system_class_blacklist = [ "none" ] - - for black in system_class_blacklist: - if bb.data.inherits_class(black, d): - icecc_ver = "no" - - user_class_blacklist = bb.data.getVar('ICECC_USER_CLASS_BL', d) or "none" - user_class_blacklist = user_class_blacklist.split() - - for black in user_class_blacklist: - if bb.data.inherits_class(black, d): - icecc_ver = "no" - - return icecc_ver - + system_class_blacklist = [ "none" ] + user_class_blacklist = (bb.data.getVar('ICECC_USER_CLASS_BL', d) or "none").split() + package_class_blacklist = system_class_blacklist + user_class_blacklist -def icc_path(bb,d,compile): - package_tmp = bb.data.expand('${PN}', d) + for black in package_class_blacklist: + if bb.data.inherits_class(black, d): + #bb.note(package_tmp, ' class ', black, ' found in blacklist, disable icecc') + return "no" #"system" package blacklist contains a list of packages that can not distribute compile tasks #for one reason or the other - system_package_blacklist = [ "uclibc", "glibc-intermediate", "gcc", "qemu", "bind", "u-boot", "dhcp-forwarder", "enchant" ] - - for black in system_package_blacklist: - if black in package_tmp: - bb.data.setVar("PARALLEL_MAKE" , "", d) - return "" - - #user defined exclusion list - user_package_blacklist = bb.data.getVar('ICECC_USER_PACKAGE_BL', d) or "none" - user_package_blacklist = user_package_blacklist.split() - - for black in user_package_blacklist: - if black in package_tmp: - bb.data.setVar("PARALLEL_MAKE" , "", d) - return "" - - - prefix = bb.data.expand('${HOST_PREFIX}', d) - - - if compile and bb.data.inherits_class("cross", d): - return create_path( ["gcc", "g++"], "native", bb, d) - - elif compile and bb.data.inherits_class("native", d): - return create_path( ["gcc", "g++"], "native", bb, d) - - elif compile and bb.data.inherits_class("kernel", d): - return create_path( [get_cross_kernel_ver(bb,d), "foo"], "cross-kernel", bb, d) + system_package_blacklist = [ "uclibc", "glibc", "gcc", "bind", "u-boot", "dhcp-forwarder", "enchant", "connman", "orbit2" ] + user_package_blacklist = (bb.data.getVar('ICECC_USER_PACKAGE_BL', d) or "").split() + package_blacklist = system_package_blacklist + user_package_blacklist + + for black in package_blacklist: + if black in package_tmp: + #bb.note(package_tmp, ' found in blacklist, disable icecc') + return "no" + + if bb.data.getVar('PARALLEL_MAKE', d) == "": + bb.note(package_tmp, " ", bb.data.expand('${PV}', d), " has empty PARALLEL_MAKE, disable icecc") + return "no" + + return "yes" + +def icc_is_kernel(bb, d): + return \ + bb.data.inherits_class("kernel", d); + +def icc_is_native(bb, d): + return \ + bb.data.inherits_class("cross", d) or \ + bb.data.inherits_class("cross-canadian", d) or \ + bb.data.inherits_class("native", d) or \ + bb.data.inherits_class("nativesdk", d); + +def icc_version(bb, d): + if use_icc(bb, d) == "no": + return "" - elif not compile or len(prefix) == 0: - return create_path( ["gcc", "g++"], "native", bb, d) + parallel = bb.data.getVar('ICECC_PARALLEL_MAKE', d) or "" + bb.data.setVar("PARALLEL_MAKE", parallel, d) + if icc_is_native(bb, d): + archive_name = "local-host-env" + elif bb.data.expand('${HOST_PREFIX}', d) == "": + bb.fatal(bb.data.expand("${PN}", d), " NULL prefix") else: - return create_path( [prefix+"gcc", prefix+"g++"], "cross", bb, d) + prefix = bb.data.expand('${HOST_PREFIX}' , d) + distro = bb.data.expand('${DISTRO}', d) + target_sys = bb.data.expand('${TARGET_SYS}', d) + float = bb.data.getVar('TARGET_FPU', d) or "hard" + archive_name = prefix + distro + "-" + target_sys + "-" + float + if icc_is_kernel(bb, d): + archive_name += "-kernel" + + import socket + ice_dir = bb.data.expand('${STAGING_DIR_NATIVE}${prefix_native}', d) + tar_file = os.path.join(ice_dir, 'ice', archive_name + "-@VERSION@-" + socket.gethostname() + '.tar.gz') + return tar_file +def icc_path(bb,d): + if icc_is_kernel(bb, d): + return create_path( [get_cross_kernel_cc(bb,d), ], bb, d) + else: + prefix = bb.data.expand('${HOST_PREFIX}', d) + return create_path( [prefix+"gcc", prefix+"g++"], bb, d) + +def icc_get_tool(bb, d, tool): + if icc_is_native(bb, d): + return os.popen("which %s" % tool).read()[:-1] + elif icc_is_kernel(bb, d): + return os.popen("which %s" % get_cross_kernel_cc(bb, d)).read()[:-1] + else: + ice_dir = bb.data.expand('${STAGING_BINDIR_TOOLCHAIN}', d) + target_sys = bb.data.expand('${TARGET_SYS}', d) + return os.path.join(ice_dir, "%s-%s" % (target_sys, tool)) + +set_icecc_env() { + ICECC_VERSION="${@icc_version(bb, d)}" + if [ "x${ICECC_VERSION}" = "x" ] + then + return + fi -def icc_version(bb,d): - return create_env(bb,d) + ICE_PATH="${@icc_path(bb, d)}" + if [ "x${ICE_PATH}" = "x" ] + then + return + fi + ICECC_CC="${@icc_get_tool(bb,d, "gcc")}" + ICECC_CXX="${@icc_get_tool(bb,d, "g++")}" + if [ ! -x "${ICECC_CC}" -o ! -x "${ICECC_CXX}" ] + then + return + fi -def check_for_kernel(bb,d): - if bb.data.inherits_class("kernel", d): - return "yes" - return "no" + ICE_VERSION=`$ICECC_CC -dumpversion` + ICECC_VERSION=`echo ${ICECC_VERSION} | sed -e "s/@VERSION@/$ICE_VERSION/g"` + if [ ! -x "${ICECC_ENV_EXEC}" ] + then + return + fi + ICECC_AS="`${ICECC_CC} -print-prog-name=as`" + if [ "`dirname "${ICECC_AS}"`" = "." ] + then + ICECC_AS="`which as`" + fi -def get_cross_kernel_ver(bb,d): + if [ ! -r "${ICECC_VERSION}" ] + then + mkdir -p "`dirname "${ICECC_VERSION}"`" + ${ICECC_ENV_EXEC} "${ICECC_CC}" "${ICECC_CXX}" "${ICECC_AS}" "${ICECC_VERSION}" + fi - return bb.data.expand('${KERNEL_CC}', d).strip() or "gcc" + export ICECC_VERSION ICECC_CC ICECC_CXX + export PATH="$ICE_PATH:$PATH" + export CCACHE_PATH="$PATH" +} -# set the icecream environment variables do_configure_prepend() { - export PATH=${@icc_path(bb,d,False)}$PATH - export ICECC_CC="gcc" - export ICECC_CXX="g++" + set_icecc_env } do_compile_prepend() { - - export PATH=${@icc_path(bb,d,True)}$PATH - - #check if we are building a kernel and select gcc-cross-kernel - if [ "${@check_for_kernel(bb,d)}" = "yes" ]; then - export ICECC_CC="${@get_cross_kernel_ver(bb,d)}" - export ICECC_CXX="${HOST_PREFIX}g++" - else - export ICECC_CC="${HOST_PREFIX}gcc" - export ICECC_CXX="${HOST_PREFIX}g++" - fi - - if [ "${@use_icc_version(bb,d)}" = "yes" ]; then - export ICECC_VERSION="${@icc_version(bb,d)}" - else - export ICECC_VERSION="NONE" - fi + set_icecc_env } + +#do_install_prepend() { +# set_icecc_env +#}
Signature · 1 line
1.7.2.5
PATCH 3/3 bugzilla.bbclass: add a class to report build problems to bugzilla
In reply to Dmitry Eremin-SolenikovAdd a class to report build errors to bugzilla. Idea largely based on sepukku.bbclass, however it's rewritten nearly fully to use XML-RPC interface of bugzilla. Tested with bugzilla 4.0, other version might require some sort of adaptation.
--- meta/classes/bugzilla.bbclass | 186 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 186 insertions(+), 0 deletions(-) create mode 100644 meta/classes/bugzilla.bbclass
meta/classes/bugzilla.bbclass new file +186 -0
@@ -0,0 +1,186 @@ +# +# Small event handler to automatically open URLs and file +# bug reports at a bugzilla of your choiche +# it uses XML-RPC interface, so you must have it enabled +# +# Before using you must define BUGZILLA_USER, BUGZILLA_PASS credentials, +# BUGZILLA_XMLRPC - uri of xmlrpc.cgi, +# BUGZILLA_PRODUCT, BUGZILLA_COMPONENT - a place in BTS for build bugs +# BUGZILLA_VERSION - version against which to report new bugs +# + +def bugzilla_find_bug_report(debug_file, server, args, bugname): + args['summary'] = bugname + bugs = server.Bug.search(args) + if len(bugs['bugs']) == 0: + print >> debug_file, "Bugs not found" + return (False,None) + else: # silently pick the first result + print >> debug_file, "Result of bug search is " + print >> debug_file, bugs + status = bugs['bugs'][0]['status'] + id = bugs['bugs'][0]['id'] + return (not status in ["CLOSED", "RESOLVED", "VERIFIED"],id) + +def bugzilla_file_bug(debug_file, server, args, name, text, version): + args['summary'] = name + args['comment'] = text + args['version'] = version + args['op_sys'] = 'Linux' + args['platform'] = 'Other' + args['severity'] = 'normal' + args['priority'] = 'Normal' + try: + return server.Bug.create(args)['id'] + except Exception, e: + print >> debug_file, repr(e) + return None + +def bugzilla_reopen_bug(debug_file, server, args, bug_number): + args['ids'] = [bug_number] + args['status'] = "CONFIRMED" + try: + server.Bug.update(args) + return True + except Exception, e: + print >> debug_file, repr(e) + return False + +def bugzilla_create_attachment(debug_file, server, args, bug_number, text, file_name, log, logdescription): + args['ids'] = [bug_number] + args['file_name'] = file_name + args['summary'] = logdescription + args['content_type'] = "text/plain" + args['data'] = log + args['comment'] = text + try: + server.Bug.add_attachment(args) + return True + except Exception, e: + print >> debug_file, repr(e) + return False + +def bugzilla_add_comment(debug_file, server, args, bug_number, text): + args['id'] = bug_number + args['comment'] = text + try: + server.Bug.add_comment(args) + return True + except Exception, e: + print >> debug_file, repr(e) + return False + +addhandler bugzilla_eventhandler +python bugzilla_eventhandler() { + import bb, os, glob + import xmlrpclib, httplib + + class ProxiedTransport(xmlrpclib.Transport): + def __init__(self, proxy, use_datetime = 0): + xmlrpclib.Transport.__init__(self, use_datetime) + self.proxy = proxy + self.user = None + self.password = None + + def set_user(self, user): + self.user = user + + def set_password(self, password): + self.password = password + + def make_connection(self, host): + self.realhost = host + return httplib.HTTP(self.proxy) + + def send_request(self, connection, handler, request_body): + connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler)) + if self.user != None: + if self.password != None: + auth = "%s:%s" % (self.user, self.password) + else: + auth = self.user + connection.putheader("Proxy-authorization", "Basic " + base64.encodestring(auth)) + + event = e + data = e.data + name = bb.event.getName(event) + if name == "MsgNote": + # avoid recursion + return + + if name == "TaskFailed": + xmlrpc = bb.data.getVar("BUGZILLA_XMLRPC", data, True) + user = bb.data.getVar("BUGZILLA_USER", data, True) + passw = bb.data.getVar("BUGZILLA_PASS", data, True) + product = bb.data.getVar("BUGZILLA_PRODUCT", data, True) + compon = bb.data.getVar("BUGZILLA_COMPONENT", data, True) + version = bb.data.getVar("BUGZILLA_VERSION", data, True) + + proxy = bb.data.getVar('http_proxy', data, True ) + if (proxy): + import urllib2 + s, u, p, hostport = urllib2._parse_proxy(proxy) + transport = ProxiedTransport(hostport) + else: + transport = None + + server = xmlrpclib.ServerProxy(xmlrpc, transport=transport, verbose=0) + args = { + 'Bugzilla_login': user, + 'Bugzilla_password': passw, + 'product': product, + 'component': compon} + + # evil hack to figure out what is going on + debug_file = open(os.path.join(bb.data.getVar("TMPDIR", data, True),"..","bugzilla-log"),"a") + + file = None + bugname = "%(package)s-%(pv)s-autobuild" % { "package" : bb.data.getVar("PN", data, True), + "pv" : bb.data.getVar("PV", data, True), + } + log_file = glob.glob("%s/log.%s.*" % (bb.data.getVar('T', event.data, True), event.task)) + text = "The %s step in %s failed at %s for machine %s" % (e.task, bb.data.getVar("PN", data, True), bb.data.getVar('DATETIME', data, True), bb.data.getVar( 'MACHINE', data, True ) ) + if len(log_file) != 0: + print >> debug_file, "Adding log file %s" % log_file[0] + file = open(log_file[0], 'r') + log = file.read() + file.close(); + else: + print >> debug_file, "No log file found for the glob" + log = None + + (bug_open, bug_number) = bugzilla_find_bug_report(debug_file, server, args.copy(), bugname) + print >> debug_file, "Bug is open: %s and bug number: %s" % (bug_open, bug_number) + + # The bug is present and still open, attach an error log + if not bug_number: + bug_number = bugzilla_file_bug(debug_file, server, args.copy(), bugname, text, version) + if not bug_number: + print >> debug_file, "Couldn't acquire a new bug_numer, filing a bugreport failed" + else: + print >> debug_file, "The new bug_number: '%s'" % bug_number + elif not bug_open: + if not bugzilla_reopen_bug(debug_file, server, args.copy(), bug_number): + print >> debug_file, "Failed to reopen the bug #%s" % bug_number + else: + print >> debug_file, "Reopened the bug #%s" % bug_number + + if bug_number and log: + print >> debug_file, "The bug is known as '%s'" % bug_number + desc = "Build log for machine %s" % (bb.data.getVar('MACHINE', data, True)) + if not bugzilla_create_attachment(debug_file, server, args.copy(), bug_number, text, log_file[0], log, desc): + print >> debug_file, "Failed to attach the build log for bug #%s" % bug_number + else: + print >> debug_file, "Created an attachment for '%s' '%s' '%s'" % (product, compon, bug_number) + else: + print >> debug_file, "Not trying to create an attachment for bug #%s" % bug_number + if not bugzilla_add_comment(debug_file, server, args.copy(), bug_number, text, ): + print >> debug_file, "Failed to create a comment the build log for bug #%s" % bug_number + else: + print >> debug_file, "Created an attachment for '%s' '%s' '%s'" % (product, compon, bug_number) + + # store bug number for oestats-client + if bug_number: + bb.data.setVar('OESTATS_BUG_NUMBER', bug_number, data) +} +
Signature · 1 line
1.7.2.5
Richard Purdie
AppliedQuoted 11 lines · Dmitry Eremin-Solenikov
IceCC needs tarballs with toolchains to work correctly. This is a version largely based on one from org.openembedded.dev, plus a patch to support recent compilers, LTO, etc.
Signed-off-by Dmitry Eremin-Solenikov <[email protected]>--- .../icecc-create-env/icecc-lto-update.patch | 103 ++++++++++++++++++++ .../icecc-create-env/icecc-create-env_0.1.bb | 29 ++++++ 2 files changed, 132 insertions(+), 0 deletions(-) create mode 100644 meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-lto-update.patch create mode 100644 meta/recipes-devtools/icecc-create-env/icecc-create-env_0.1.bb
Merged to master, thanks (along with patches 2 and 3)
Cheers,
Richard