From: Holger Freyther Date: Mon, 20 Feb 2006 23:22:57 +0000 (+0000) Subject: merge of 623eed7c92806a0e18e3daa7e8dee2edd301a94e X-Git-Tag: Release-2010-05/1~9453^2~2304^2~101^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cbde8cbe425ff9c1d24c009a6a785327d8bbee5b;p=openembedded.git merge of 623eed7c92806a0e18e3daa7e8dee2edd301a94e and d7c8c3fb9c9b65e500f2c9ffb52d588c15efa14b --- cbde8cbe425ff9c1d24c009a6a785327d8bbee5b diff --cc classes/tinderclient.bbclass index 3385fc0f93,d01bce1fcf..290166bb03 --- a/classes/tinderclient.bbclass +++ b/classes/tinderclient.bbclass @@@ -1,248 -1,245 +1,74 @@@ --def tinder_form_data(bound, dict, log): -- """ -- Create the boundary for the HTTP Post -- """ -- output = [] -- -- # for each key in the dictionary -- for name in dict: -- output.append( "--" + bound ) -- output.append( 'Content-Disposition: form-data; name="%s"' % name ) -- output.append( "" ) -- output.append( dict[name] ) -- if log: -- output.append( "--" + bound ) -- output.append( 'Content-Disposition: form-data; name="log"; filename="log.txt"' ) -- output.append( '' ) -- output.append( log ) -- output.append( '--' + bound + '--' ) -- output.append( '' ) -- -- return "\r\n".join(output) -- --def tinder_time_string(): -- """ -- Return the time as GMT -- """ -- return "" -- --def tinder_format_http_post(d,status,log): -- """ -- Format the Tinderbox HTTP post with the data needed -- for the tinderbox to be happy. -- """ -- -- from bb import data -- import os,random -- -- # the variables we will need to send on this form post -- variables = { -- "tree" : data.getVar('TINDER_TREE', d, True), -- "machine_name" : data.getVar('TINDER_MACHINE', d, True), -- "os" : os.uname()[0], -- "os_version" : os.uname()[2], -- "compiler" : "gcc", -- "clobber" : data.getVar('TINDER_CLOBBER', d, True) -- } -- -- # optionally add the status -- if status: -- variables["status"] = str(status) -- -- # try to load the machine id -- # we only need on build_status.pl but sending it -- # always does not hurt ++def tinder_tz_offset(off): ++ # get the offset.n minutes Either it is a number like ++ # +200 or -300 try: -- f = file(data.getVar('TMPDIR',d,True)+'/tinder-machine.id', 'r') -- id = f.read() -- variables['machine_id'] = id -- except: -- pass -- -- # the boundary we will need -- boundary = "----------------------------------%d" % int(random.random()*1000000000000) -- -- # now format the body -- body = tinder_form_data( boundary, variables, log ) -- -- return ("multipart/form-data; boundary=%s" % boundary),body -- -- --def tinder_build_start(d): -- """ -- Inform the tinderbox that a build is starting. We do this -- by posting our name and tree to the build_start.pl script -- on the server. -- """ ++ return int(off) ++ except ValueError: ++ if off == "Europe/Berlin": ++ return 120 ++ else: ++ return 0 ++ ++def tinder_tinder_time(offset): ++ import datetime ++ td = datetime.timedelta(minutes=tinder_tz_offset(offset)) ++ time = datetime.datetime.utcnow() + td ++ return time.strftime('%m/%d/%Y %H:%M:%S') ++ ++def tinder_tinder_start(date,offset): ++ import datetime, time ++ td = datetime.timedelta(minutes=tinder_tz_offset(offset)) ++ ti = time.strptime(date, "%m/%d/%Y %H:%M:%S") ++ time = datetime.datetime(*ti[0:7])+td ++ return time.strftime('%m/%d/%Y %H:%M:%S') ++ ++def tinder_send_email(da, header, log): ++ import smtplib from bb import data -- import httplib -- -- # get the body and type -- content_type, body = tinder_format_http_post(d,None,None) -- server = data.getVar('TINDER_HOST', d, True ) -- url = data.getVar('TINDER_URL', d, True ) -- -- selector = url + "/xml/build_start.pl" -- - #print "selector %s and url %s" % (selector, url) - print "selector %s and url %s" % (selector, url) -- -- # now post it -- h = httplib.HTTP(server) -- h.putrequest('POST', selector) -- h.putheader('content-type', content_type) -- h.putheader('content-length', str(len(body))) -- h.endheaders() -- h.send(body) -- errcode, errmsg, headers = h.getreply() - #print errcode, errmsg, headers - print errcode, errmsg, headers -- report = h.file.read() -- -- # now let us find the machine id that was assigned to us -- search = " TINDERBOX RUNNING env %(time_start)s" ) -- output.append( env ) -- output.append( "<--- TINDERBOX FINISHED (SUCCESS) %(time_end)s" ) -- return "\n".join(output) % vars() -- --def tinder_tinder_start(d): -- """ -- PRINT the configuration of this build -- """ ++ str = "tinderbox: administrator: %s\n" % data.getVar('TINDER_ADMIN', da, True) ++ str += "tinderbox: starttime: %s\n" % tinder_tinder_start(data.getVar('TINDER_START', da, True) or data.getVar('BUILDSTART', da, True), data.getVar('TINDER_TZ', da, True)) ++ str += "tinderbox: buildname: %s\n" % data.getVar('TINDER_BUILD', da, True) ++ str += "tinderbox: errorparser: %s\n" % data.getVar('TINDER_ERROR', da, True) ++ str += "tinderbox: status: %s\n" % status ++ str += "tinderbox: timenow: %s\n" % tinder_tinder_time(data.getVar('TINDER_TZ', da, True)) ++ str += "tinderbox: tree: %s\n" % data.getVar('TINDER_TREE', da, True) ++ str += "tinderbox: buildfamily: %s\n" % "unix" ++ str += "tinderbox: END" -- time_start = tinder_time_string() -- config = tinder_print_info(d) - #env = tinder_print_env() - env = tinder_print_env() -- time_end = tinder_time_string() -- -- output = [] -- output.append( "---> TINDERBOX PRINTING CONFIGURATION %(time_start)s" ) -- output.append( config ) - #output.append( env ) - output.append( env ) -- output.append( "<--- TINDERBOX FINISHED PRINTING CONFIGURATION %(time_end)s" ) - output.append( "" ) -- return "\n".join(output) % vars() ++ return str def tinder_do_tinder_report(event): """ -- Report to the tinderbox: -- On the BuildStart we will inform the box directly -- On the other events we will write to the TINDER_LOG and -- when the Task is finished we will send the report. -- -- The above is not yet fully implemented. Currently we send -- information immediately. The caching/queuing needs to be -- implemented. Also sending more or less information is not -- implemented yet. ++ Report to the tinderbox. Either we will report every step ++ (depending on TINDER_VERBOSE_REPORT) at the end we will send the ++ tinderclient.log """ from bb.event import getName from bb import data, mkdirhier @@@ -251,56 -248,57 +77,74 @@@ # variables name = getName(event) log = "" -- status = 1 ++ header = "" ++ verbose = data.getVar('TINDER_VERBOSE_REPORT', event.data, True) == "1" # Check what we need to do Build* shows we start or are done if name == "BuildStarted": -- tinder_build_start(event.data) -- log = tinder_tinder_start(event.data) -- -- try: -- # truncate the tinder log file -- f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+') -- f.truncate(0) -- f.close() -- except IOError: -- pass -- -- # Append the Task-Log (compile,configure...) to the log file -- # we will send to the server ++ header = tinder_prepare_mail_header(event.data, 'building') ++ # generate ++ for var in os.environ: ++ log += "%s=%s\n" % (var, os.environ[var]) ++ ++ mkdirhier(data.getVar('TMPDIR', event.data, True)) ++ file = open(data.getVar('TINDER_LOG', event.data, True), 'w') ++ file.write(log) ++ ++ if not verbose: ++ header = "" ++ ++ if name == "PkgFailed" or name == "BuildCompleted": ++ status = 'build_failed' ++ if name == "BuildCompleted": ++ status = "success" ++ header = tinder_prepare_mail_header(event.data, status) ++ # append the log ++ log_file = data.getVar('TINDER_LOG', event.data, True) ++ file = open(log_file, 'r') ++ for line in file.readlines(): ++ log += line ++ ++ if verbose and name == "TaskStarted": ++ header = tinder_prepare_mail_header(event.data, 'building') ++ log = "Task %s started" % event.task ++ ++ if verbose and name == "PkgStarted": ++ header = tinder_prepare_mail_header(event.data, 'building') ++ log = "Package %s started" % data.getVar('P', event.data, True) ++ ++ if verbose and name == "PkgSucceeded": ++ header = tinder_prepare_mail_header(event.data, 'building') ++ log = "Package %s done" % data.getVar('P', event.data, True) ++ ++ # Append the Task Log if name == "TaskSucceeded" or name == "TaskFailed": log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task)) if len(log_file) != 0: - log = "\n".join( open(log_file[0], 'r').readlines() ) + to_file = data.getVar('TINDER_LOG', event.data, True) - log = open(log_file[0], 'r').readlines() ++ log_txt = open(log_file[0], 'r').readlines() ++ to_file = open(to_file, 'a') ++ ++ to_file.writelines(log_txt) -- # set the right 'HEADER'/Summary for the TinderBox -- if name == "TaskStarted": - log += "---> TINDERBOX Task %s started\n" % event.task - log += "--> TINDERBOX Task %s started" % event.task -- elif name == "TaskSucceeded": - log += "<--- TINDERBOX Task %s done (SUCCESS)\n" % event.task - log += "<-- TINDERBOX Task %s done (SUCCESS)" % event.task -- elif name == "TaskFailed": - log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task - log += "<-- TINDERBOX Task %s failed (FAILURE)" % event.task -- elif name == "PkgStarted": - log += "---> TINDERBOX Package %s started\n" % data.getVar('P', event.data, True) - log += "--> TINDERBOX Package %s started" % data.getVar('P', event.data, True) -- elif name == "PkgSucceeded": - log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True) - log += "<-- TINDERBOX Package %s done (SUCCESS)" % data.getVar('P', event.data, True) -- elif name == "PkgFailed": - log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) - log += "<-- TINDERBOX Package %s failed (FAILURE)" % data.getVar('P', event.data, True) -- status = 200 -- elif name == "BuildCompleted": -- status = 100 ++ # append to the log ++ if verbose: ++ header = tinder_prepare_mail_header(event.data, 'building') ++ for line in log_txt: ++ log += line -- # now post the log -- if len(log) == 0: ++ # now mail the log ++ if len(log) == 0 or len(header) == 0: return -- # for now we will use the http post method as it is the only one -- log_post_method = tinder_send_http -- log_post_method(event.data, status, log) ++ log_post_method = tinder_send_email ++ if data.getVar('TINDER_SENDLOG', event.data, True) == "http": ++ log_post_method = tinder_send_http ++ ++ log_post_method(event.data, header, log) --# we want to be an event handler addhandler tinderclient_eventhandler python tinderclient_eventhandler() { from bb import note, error, data diff --cc packages/gtk-webcore/osb-browser_20060212.bb index e7ff63949f,de7c12d95c..d45319cb8a --- a/packages/gtk-webcore/osb-browser_20060212.bb +++ b/packages/gtk-webcore/osb-browser_20060212.bb @@@ -16,6 -16,6 +16,6 @@@ SRC_URI = "cvs://anonymous@cvs.sourcefo file://no-pedantic.patch;patch=1" S = "${WORKDIR}/osb-browser" - DEFAULT_PREFERENCE = "${@['-1', '1'][(bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or "1.0").split('.')[0] == '4' or False]}" -DEFAULT_PREFERENCE = "${@['-1', '1'][not bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" ++DEFAULT_PREFERENCE = "${@['-1', '1'][bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" inherit autotools diff --cc packages/gtk-webcore/osb-jscore_20060212.bb index 91b2b474d5,c2f078b60c..d8e3a9b8f8 --- a/packages/gtk-webcore/osb-jscore_20060212.bb +++ b/packages/gtk-webcore/osb-jscore_20060212.bb @@@ -13,7 -13,7 +13,7 @@@ SRC_URI = "cvs://anonymous@cvs.sourcefo file://gcc4-fno-threadsafe-statics-JavaScriptCore.patch;patch=1" S = "${WORKDIR}/JavaScriptCore" - DEFAULT_PREFERENCE = "${@['-1', '1'][(bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or "1.0").split('.')[0] == '4' or False]}" -DEFAULT_PREFERENCE = "${@['-1', '1'][not bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" ++DEFAULT_PREFERENCE = "${@['-1', '1'][bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" inherit autotools pkgconfig diff --cc packages/gtk-webcore/osb-nrcit_20060212.bb index 6f3502e418,2d4f69a86d..7530bb5719 --- a/packages/gtk-webcore/osb-nrcit_20060212.bb +++ b/packages/gtk-webcore/osb-nrcit_20060212.bb @@@ -16,7 -16,7 +16,7 @@@ SRC_URI = "cvs://anonymous@cvs.sourcefo file://gcc4-fno-threadsafe-statics-NRCit.patch;patch=1" S = "${WORKDIR}/NRCit" - DEFAULT_PREFERENCE = "${@['-1', '1'][(bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or "1.0").split('.')[0] == '4' or False]}" -DEFAULT_PREFERENCE = "${@['-1', '1'][not bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" ++DEFAULT_PREFERENCE = "${@['-1', '1'][bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" inherit autotools pkgconfig diff --cc packages/gtk-webcore/osb-nrcore_20060212.bb index 44eebcc753,d3dbf0ca95..4ab4275071 --- a/packages/gtk-webcore/osb-nrcore_20060212.bb +++ b/packages/gtk-webcore/osb-nrcore_20060212.bb @@@ -16,7 -16,7 +16,7 @@@ SRC_URI = "cvs://anonymous@cvs.sourcefo file://gcc4-fno-threadsafe-statics-NRCore.patch;patch=1" S = "${WORKDIR}/NRCore" - DEFAULT_PREFERENCE = "${@['-1', '1'][(bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or "1.0").split('.')[0] == '4' or False]}" -DEFAULT_PREFERENCE = "${@['-1', '1'][not bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1) or bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" ++DEFAULT_PREFERENCE = "${@['-1', '1'][bb.data.getVar('PREFERRED_VERSION_gcc-cross', d, 1).split('.')[0] == '4']}" LEAD_SONAME = "libnrcore.so"