From 0c6a9f2f931c65df90763850e9b30bb0d913e498 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Fri, 9 Mar 2007 20:29:00 +0000 Subject: classes/insane.bbclass: Use split and make it work with python2.3 again rsplit was introduced in python 2.4 and is like split but starts to split from the right side. The only difference is obviously if you have maxsplit set (which we don't). So it is fine to remove the 'r' --- classes/insane.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/insane.bbclass b/classes/insane.bbclass index a3ca21d1dc..40f6151f08 100644 --- a/classes/insane.bbclass +++ b/classes/insane.bbclass @@ -206,7 +206,7 @@ def package_qa_check_rpath(file,name,d): bb.fatal("This class assumed that WORKDIR is ${TMPDIR}/work... Not doing any check") output = os.popen("%s -Byr %s" % (scanelf,file)) - txt = output.readline().rsplit() + txt = output.readline().split() if bad_dir in txt: package_qa_write_error( 1, name, file, d) bb.error("QA Issue package %s contains bad RPATH %s in file %s" % (name, txt, file)) -- cgit v1.2.3 From 21e7506f34e5cc2fc0667ecab73202422f7225cd Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Sat, 10 Mar 2007 00:28:54 +0000 Subject: classes/seppuku.bbclass: Switch to HTTP post, attach the build logs instead of using comments The limit of comments is too low. Use attachments to work around this issue. Also start using HTTP post to avoid really long URLs. They lead to a pipe error. To post we use a MultiPartPoster which is licensed LGPL and can be freely downloaded. You need to put it into the PYTHONPATH Add a new variable for creating attachments and document it. --- classes/seppuku.bbclass | 111 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 95 insertions(+), 16 deletions(-) (limited to 'classes') diff --git a/classes/seppuku.bbclass b/classes/seppuku.bbclass index 5757df7efb..8d5e234c49 100644 --- a/classes/seppuku.bbclass +++ b/classes/seppuku.bbclass @@ -5,6 +5,23 @@ # This class requires python2.4 because of the urllib2 usage # +def seppuku_spliturl(url): + """ + Split GET URL to return the host base and the query + as a param dictionary + """ + import urllib + (uri,query) = urllib.splitquery(url) + param = {} + for par in query.split("&"): + (key,value) = urllib.splitvalue(par) + key = urllib.unquote(key) + value = urllib.unquote(value) + param[key] = value + + return (uri,param) + + def seppuku_login(opener, login, user, password): """ @@ -109,7 +126,7 @@ def seppuku_find_bug_report(opener, query, product, component, bugname): (number,status) = scanner.result()[0] return (not status in ["CLOS", "RESO", "VERI"],number) -def seppuku_reopen_bug(opener, file, product, component, bug_number, bugname, text): +def seppuku_reopen_bug(poster, file, product, component, bug_number, bugname, text): """ Reopen a bug report and append to the comment @@ -118,22 +135,34 @@ def seppuku_reopen_bug(opener, file, product, component, bug_number, bugname, te http://bugzilla.openmoko.org/cgi-bin/bugzilla/process_bug.cgi?id=239&bug_file_loc=http%3A%2F%2F&version=2007&longdesclength=2&product=OpenMoko&component=autobuilds&comment=bla&priority=P2&bug_severity=normal&op_sys=Linux&rep_platform=Neo1973&knob=reopen&target_milestone=Phase+0&short_desc=foo """ - import urllib, urllib2 - param = urllib.urlencode( { "product" : product, "component" : component, "longdesclength" : 2, - "short_desc" : bugname, "knob" : "reopen", "id" : bug_number, "comment" : text } ) + import urllib2 + (uri, param) = seppuku_spliturl( file ) + + # Prepare the post + param["product"] = product + param["component"] = component + param["longdesclength"] = 2 + param["short_desc"] = bugname + param["knob"] = "reopen" + param["id"] = bug_number + param["comment"] = text + try: - result = opener.open( file + param ) + result = poster.open( uri, param ) except urllib2.HTTPError, e: print e.geturl() print e.info() return False + except Exception, e: + print e + return False if result.code != 200: return False else: return True -def seppuku_file_bug(opener, file, product, component, bugname, text): +def seppuku_file_bug(poster, file, product, component, bugname, text): """ Create a completely new bug report @@ -150,14 +179,21 @@ def seppuku_file_bug(opener, file, product, component, bugname, text): @param text Text """ - import urllib,urllib2 - param = urllib.urlencode( { "product" : product, "component" : component, "short_desc" : bugname, "comment" : text } ) + import urllib2 + (uri, param) = seppuku_spliturl( file ) + param["product"] = product + param["component"] = component + param["short_desc"] = bugname + param["comment"] = text + try: - result = opener.open( file + param ) + result = poster.open( uri, param ) except urllib2.HTTPError, e: print e.geturl() print e.info() - raise e + return False + except Exception, e: + print e return False if result.code != 200: @@ -165,6 +201,35 @@ def seppuku_file_bug(opener, file, product, component, bugname, text): else: return True +def seppuku_create_attachment(poster, attach_query, product, component, bug_number, text, file): + """ + + Create a new attachment for the failed report + """ + + if not bug_number: + import bb + bb.note("Can't create an attachment, the bug is not present") + return False + + import urllib2 + param = { "bugid" : bug_number, "action" : "insert", "data" : file, "description" : "Build log", "ispatch" : "0", "contenttypemethod" : "list", "contenttypeselection" : "text/plain", "comment" : text } + + try: + result = poster.open( attach_query, param ) + except urllib2.HTTPError, e: + print e.geturl() + print e.info() + return False + except Exception, e: + print e + return False + + print result.read() + if result.code != 200: + return False + else: + return True addhandler seppuku_eventhandler @@ -177,7 +242,12 @@ python seppuku_eventhandler() { from bb import data, mkdirhier, build import bb, os, glob - bb.note( "Ran" ) + # Try to load our exotic libraries + try: + import MultipartPostHandler + except: + bb.note("You need to put the MultipartPostHandler into your PYTHONPATH. Download it from http://pipe.scs.fsu.edu/PostHandler/MultipartPostHandler.py") + return NotHandled try: import urllib2, cookielib @@ -194,10 +264,12 @@ python seppuku_eventhandler() { elif name == "TaskFailed" or name == "NoProvider": cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) + poster = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj),MultipartPostHandler.MultipartPostHandler) login = bb.data.getVar("SEPPUKU_LOGIN", data, True) query = bb.data.getVar("SEPPUKU_QUERY", data, True) newbug = bb.data.getVar("SEPPUKU_NEWREPORT", data, True) reopen = bb.data.getVar("SEPPUKU_ADDCOMMENT", data, True) + attach = bb.data.getVar("SEPPUKU_ATTACHMENT", data, True) user = bb.data.getVar("SEPPUKU_USER", data, True) passw = bb.data.getVar("SEPPUKU_PASS", data, True) product = bb.data.getVar("SEPPUKU_PRODUCT", data, True) @@ -215,12 +287,12 @@ python seppuku_eventhandler() { "pr" : bb.data.getVar("PR", data, True), "task" : e.task } log_file = glob.glob("%s/log.%s.*" % (bb.data.getVar('T', event.data, True), event.task)) - if len(log_file) != 0: - to_file = bb.data.getVar('TINDER_LOG', event.data, True) - text = "".join(open(log_file[0], 'r').readlines()) + text = "The package failed to build at %s" % bb.data.getVar('DATETIME', data, True) + file = open(log_file[0], 'r') elif name == "NoProvider": bugname = "noprovider for %s runtime: %s" % (event.getItem, event.getisRuntime) text = "Please fix it" + file = None else: assert False @@ -234,10 +306,17 @@ python seppuku_eventhandler() { return NotHandled if bug_number and not bug_open: - if not seppuku_reopen_bug(opener, reopen, product, component, bug_number, bugname, text): + if not seppuku_reopen_bug(poster, reopen, product, component, bug_number, bugname, text): bb.note("Failed to reopen the bug report") - elif not seppuku_file_bug(opener, newbug, product, component, bugname, text): + elif not seppuku_file_bug(poster, newbug, product, component, bugname, text): bb.note("Filing a bugreport failed") + else: + # get the new bug number and create an attachment + (bug_open, bug_number) = seppuku_find_bug_report(opener, query, product, component, bugname) + + if file: + if not seppuku_create_attachment(poster, attach, product, component, bug_number, text, file): + bb.note("Failed to attach the build log") return NotHandled } -- cgit v1.2.3 From 1b661974e3f8f844f6ec4cdb7bb42cef9595b626 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Sat, 10 Mar 2007 14:10:06 +0000 Subject: own-mirrors.bbclass: added class which can be used to set PREMIRRORS from config - SOURCE_MIRROR_URL is new variable which point to source mirror which will be used before fetching from original SRC_URI location. --- classes/own-mirrors.bbclass | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 classes/own-mirrors.bbclass (limited to 'classes') diff --git a/classes/own-mirrors.bbclass b/classes/own-mirrors.bbclass new file mode 100644 index 0000000000..32763ed24f --- /dev/null +++ b/classes/own-mirrors.bbclass @@ -0,0 +1,4 @@ +PREMIRRORS() { +http://.*/.* ${SOURCE_MIRROR_URL} +ftp://.*/.* ${SOURCE_MIRROR_URL} +} -- cgit v1.2.3 From bd13294b484455566e38dc333eb2f098b90cef09 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 10 Mar 2007 20:12:18 +0000 Subject: opie.bbclass: Allow OPIE_CVS_PV to be overriden. --- classes/opie.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/opie.bbclass b/classes/opie.bbclass index c3b9d13226..92cde5487b 100644 --- a/classes/opie.bbclass +++ b/classes/opie.bbclass @@ -15,7 +15,7 @@ inherit palmtop -OPIE_CVS_PV = "1.2.2+cvs${SRCDATE}" +OPIE_CVS_PV ?= "1.2.2+cvs${SRCDATE}" DEPENDS_prepend = "${@["libopie2 ", ""][(bb.data.getVar('PN', d, 1) == 'libopie2')]}" -- cgit v1.2.3