diff options
Diffstat (limited to 'meta/classes/distrodata.bbclass')
-rw-r--r-- | meta/classes/distrodata.bbclass | 110 |
1 files changed, 59 insertions, 51 deletions
diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index 0378790f70..31e7420cf4 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass @@ -3,8 +3,6 @@ require conf/distro/include/distro_tracking_fields.inc addhandler distro_eventhandler python distro_eventhandler() { - from bb.event import Handled, NotHandled - # if bb.event.getName(e) == "TaskStarted": if bb.event.getName(e) == "BuildStarted": """initialize log files.""" @@ -25,7 +23,7 @@ python distro_eventhandler() { f.close() bb.utils.unlockfile(lf) - return NotHandled + return } addtask distrodata_np @@ -213,9 +211,6 @@ do_distrodataall() { addhandler checkpkg_eventhandler python checkpkg_eventhandler() { - from bb.event import Handled, NotHandled - # if bb.event.getName(e) == "TaskStarted": - if bb.event.getName(e) == "BuildStarted": """initialize log files.""" logpath = bb.data.getVar('LOG_DIR', e.data, 1) @@ -234,8 +229,15 @@ python checkpkg_eventhandler() { f.write("Package\tOwner\tURI Type\tVersion\tTracking\tUpstream\tTMatch\tRMatch\n") f.close() bb.utils.unlockfile(lf) - - return NotHandled + """initialize log files for package report system""" + logfile2 = os.path.join(logpath, "get_pkg_info.%s.log" % bb.data.getVar('DATETIME', e.data, 1)) + if not os.path.exists(logfile2): + slogfile2 = os.path.join(logpath, "get_pkg_info.log") + if os.path.exists(slogfile2): + os.remove(slogfile2) + os.system("touch %s" % logfile2) + os.symlink(logfile2, slogfile2) + return } addtask checkpkg @@ -262,8 +264,8 @@ python do_checkpkg() { prefix1 = "[a-zA-Z][a-zA-Z0-9]*([\-_][a-zA-Z]\w+)*[\-_]" # match most patterns which uses "-" as separator to version digits prefix2 = "[a-zA-Z]+" # a loose pattern such as for unzip552.tar.gz prefix = "(%s|%s)" % (prefix1, prefix2) - suffix = "(tar\.gz|tgz|tar\.bz2|zip)" - suffixtuple = ("tar.gz", "tgz", "zip", "tar.bz2") + suffix = "(tar\.gz|tgz|tar\.bz2|zip|xz)" + suffixtuple = ("tar.gz", "tgz", "zip", "tar.bz2", "tar.xz") sinterstr = "(?P<name>%s?)(?P<ver>.*)" % prefix sdirstr = "(?P<name>%s)(?P<ver>.*)\.(?P<type>%s$)" % (prefix, suffix) @@ -307,42 +309,31 @@ python do_checkpkg() { """ def internal_fetch_wget(url, d, tmpf): status = "ErrFetchUnknown" - try: - """ - Clear internal url cache as it's a temporary check. Not doing so will have - bitbake check url multiple times when looping through a single url - """ - fn = bb.data.getVar('FILE', d, 1) - bb.fetch.urldata_cache[fn] = {} - bb.fetch.init([url], d) - except bb.fetch.NoMethodError: - status = "ErrFetchNoMethod" - except: - status = "ErrInitUrlUnknown" - else: - """ - To avoid impacting bitbake build engine, this trick is required for reusing bitbake - interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR} - while we don't want to pollute that place. So bb.fetch.checkstatus() is borrowed here - which is designed for check purpose but we override check command for our own purpose - """ - ld = bb.data.createCopy(d) - bb.data.setVar('CHECKCOMMAND_wget', "/usr/bin/env wget -t 1 --passive-ftp -O %s '${URI}'" \ + """ + Clear internal url cache as it's a temporary check. Not doing so will have + bitbake check url multiple times when looping through a single url + """ + fn = bb.data.getVar('FILE', d, 1) + bb.fetch2.urldata_cache[fn] = {} + + """ + To avoid impacting bitbake build engine, this trick is required for reusing bitbake + interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR} + while we don't want to pollute that place. So bb.fetch2.checkstatus() is borrowed here + which is designed for check purpose but we override check command for our own purpose + """ + ld = bb.data.createCopy(d) + bb.data.setVar('CHECKCOMMAND_wget', "/usr/bin/env wget -t 1 --passive-ftp -O %s --user-agent=\"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12\" '${URI}'" \ % tmpf.name, d) - bb.data.update_data(ld) - - try: - bb.fetch.checkstatus(ld) - except bb.fetch.MissingParameterError: - status = "ErrMissParam" - except bb.fetch.FetchError: - status = "ErrFetch" - except bb.fetch.MD5SumError: - status = "ErrMD5Sum" - except: - status = "ErrFetchUnknown" - else: - status = "SUCC" + bb.data.update_data(ld) + + try: + fetcher = bb.fetch2.Fetch([url], ld) + fetcher.checkstatus() + status = "SUCC" + except bb.fetch2.BBFetchException, e: + status = "ErrFetch" + return status """ @@ -425,7 +416,7 @@ python do_checkpkg() { """match "{PN}-5.21.1.tar.gz">{PN}-5.21.1.tar.gz """ pn1 = re.search("^%s" % prefix, curname).group() s = "[^\"]*%s[^\d\"]*?(\d+[\.\-_])+[^\"]*" % pn1 - searchstr = "[hH][rR][eE][fF]=\"%s\">" % s + searchstr = "[hH][rR][eE][fF]=\"%s\".*>" % s reg = re.compile(searchstr) valid = 0 @@ -443,7 +434,7 @@ python do_checkpkg() { status = "ErrParseDir" else: """newver still contains a full package name string""" - status = re.search("(\d+[.\-_])*\d+", newver[1]).group() + status = re.search("(\d+[.\-_])*[0-9a-zA-Z]+", newver[1]).group() elif not len(fhtml): status = "ErrHostNoDir" @@ -464,11 +455,23 @@ python do_checkpkg() { logpath = bb.data.getVar('LOG_DIR', d, 1) bb.utils.mkdirhier(logpath) logfile = os.path.join(logpath, "checkpkg.csv") + """initialize log files for package report system""" + logfile2 = os.path.join(logpath, "get_pkg_info.log") """generate package information from .bb file""" pname = bb.data.getVar('PN', d, 1) pdesc = bb.data.getVar('DESCRIPTION', d, 1) pgrp = bb.data.getVar('SECTION', d, 1) + pversion = bb.data.getVar('PV', d, 1) + plicense = bb.data.getVar('LICENSE',d,1) + psection = bb.data.getVar('SECTION',d,1) + phome = bb.data.getVar('HOMEPAGE', d, 1) + prelease = bb.data.getVar('PR',d,1) + ppriority = bb.data.getVar('PRIORITY',d,1) + pdepends = bb.data.getVar('DEPENDS',d,1) + pbugtracker = bb.data.getVar('BUGTRACKER',d,1) + ppe = bb.data.getVar('PE',d,1) + psrcuri = bb.data.getVar('SRC_URI',d,1) found = 0 for uri in src_uri.split(): @@ -614,6 +617,14 @@ python do_checkpkg() { (pname, maintainer, pproto, pcurver, pmver, pupver, pmstatus, pstatus)) f.close() bb.utils.unlockfile(lf) + + """write into get_pkg_info log file to supply data for package report system""" + lf2 = bb.utils.lockfile(logfile2 + ".lock") + f2 = open(logfile2, "a") + f2.write("%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" % \ + (pname,pversion,pupver,plicense,psection, phome,prelease, ppriority,pdepends,pbugtracker,ppe,pdesc,pstatus,pmver,psrcuri)) + f2.close() + bb.utils.unlockfile(lf2) } addtask checkpkgall after do_checkpkg @@ -625,9 +636,6 @@ do_checkpkgall() { #addhandler check_eventhandler python check_eventhandler() { - from bb.event import Handled, NotHandled - # if bb.event.getName(e) == "TaskStarted": - if bb.event.getName(e) == "BuildStarted": import oe.distro_check as dc tmpdir = bb.data.getVar('TMPDIR', e.data, 1) @@ -645,7 +653,7 @@ python check_eventhandler() { os.symlink(logfile, slogfile) bb.data.setVar('LOG_FILE', logfile, e.data) - return NotHandled + return } addtask distro_check |