mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
Bitbake classes updates from OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@294 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
STAGING_PKGMAPS_DIR = "${STAGING_DIR}/pkgmaps/debian"
|
||||||
|
|
||||||
|
# Debain package renaming only occurs when a package is built
|
||||||
|
# We therefore have to make sure we build all runtime packages
|
||||||
|
# before building the current package to make the packages runtime
|
||||||
|
# depends are correct
|
||||||
|
BUILD_ALL_DEPS = "1"
|
||||||
|
|
||||||
python debian_package_name_hook () {
|
python debian_package_name_hook () {
|
||||||
import glob, copy, stat, errno, re
|
import glob, copy, stat, errno, re
|
||||||
|
|
||||||
@@ -74,7 +82,7 @@ python debian_package_name_hook () {
|
|||||||
if soname_result:
|
if soname_result:
|
||||||
(pkgname, devname) = soname_result
|
(pkgname, devname) = soname_result
|
||||||
for pkg in packages.split():
|
for pkg in packages.split():
|
||||||
if (bb.data.getVar('PKG_' + pkg, d)):
|
if (bb.data.getVar('PKG_' + pkg, d) or bb.data.getVar('DEBIAN_NOAUTONAME_' + pkg, d)):
|
||||||
continue
|
continue
|
||||||
if pkg == orig_pkg:
|
if pkg == orig_pkg:
|
||||||
newpkg = pkgname
|
newpkg = pkgname
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ do_stage_append () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
PACKAGES = "${SRCNAME} ${SRCNAME}-themes ${SRCNAME}-dev ${SRCNAME}-examples"
|
PACKAGES = "${PN} ${PN}-themes ${PN}-dev ${PN}-examples "
|
||||||
FILES_${SRCNAME} = "${libdir}/lib*.so*"
|
FILES_${PN} = "${libdir}/lib*.so*"
|
||||||
FILES_${SRCNAME}-themes = "${datadir}/${SRCNAME}/themes ${datadir}/${SRCNAME}/data ${datadir}/${SRCNAME}/fonts ${datadir}/${SRCNAME}/pointers ${datadir}/${SRCNAME}/images ${datadir}/${SRCNAME}/users ${datadir}/${SRCNAME}/images ${datadir}/${SRCNAME}/styles"
|
FILES_${PN}-themes = "${datadir}/${PN}/themes ${datadir}/${PN}/data ${datadir}/${PN}/fonts ${datadir}/${PN}/pointers ${datadir}/${PN}/images ${datadir}/${PN}/users ${datadir}/${PN}/images ${datadir}/${PN}/styles"
|
||||||
FILES_${SRCNAME}-dev += "${bindir}/${SRCNAME}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${datadir}/${SRCNAME}/include"
|
FILES_${PN}-dev = "${bindir}/${PN}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${libdir}/lib*.a"
|
||||||
FILES_${SRCNAME}-examples = "${bindir} ${datadir}"
|
FILES_${PN}-examples = "${bindir} ${datadir}"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,73 @@
|
|||||||
def legitimize_package_name(s):
|
def legitimize_package_name(s):
|
||||||
return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
|
return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
|
||||||
|
|
||||||
|
STAGING_PKGMAPS_DIR ?= "${STAGING_DIR}/pkgmaps"
|
||||||
|
|
||||||
|
def add_package_mapping (pkg, new_name, d):
|
||||||
|
import bb, os
|
||||||
|
|
||||||
|
def encode(str):
|
||||||
|
import codecs
|
||||||
|
c = codecs.getencoder("string_escape")
|
||||||
|
return c(str)[0]
|
||||||
|
|
||||||
|
pmap_dir = bb.data.getVar('STAGING_PKGMAPS_DIR', d, 1)
|
||||||
|
|
||||||
|
bb.mkdirhier(pmap_dir)
|
||||||
|
|
||||||
|
data_file = os.path.join(pmap_dir, pkg)
|
||||||
|
|
||||||
|
f = open(data_file, 'w')
|
||||||
|
f.write("%s\n" % encode(new_name))
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def get_package_mapping (pkg, d):
|
||||||
|
import bb, os
|
||||||
|
|
||||||
|
def decode(str):
|
||||||
|
import codecs
|
||||||
|
c = codecs.getdecoder("string_escape")
|
||||||
|
return c(str)[0]
|
||||||
|
|
||||||
|
data_file = bb.data.expand("${STAGING_PKGMAPS_DIR}/%s" % pkg, d)
|
||||||
|
|
||||||
|
if os.access(data_file, os.R_OK):
|
||||||
|
f = file(data_file, 'r')
|
||||||
|
lines = f.readlines()
|
||||||
|
f.close()
|
||||||
|
for l in lines:
|
||||||
|
return decode(l).strip()
|
||||||
|
return pkg
|
||||||
|
|
||||||
|
def runtime_mapping_rename (varname, d):
|
||||||
|
import bb, os
|
||||||
|
|
||||||
|
#bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1)))
|
||||||
|
|
||||||
|
new_depends = []
|
||||||
|
for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""):
|
||||||
|
# Have to be careful with any version component of the depend
|
||||||
|
split_depend = depend.split(' (')
|
||||||
|
new_depend = get_package_mapping(split_depend[0].strip(), d)
|
||||||
|
if len(split_depend) > 1:
|
||||||
|
new_depends.append("%s (%s" % (new_depend, split_depend[1]))
|
||||||
|
else:
|
||||||
|
new_depends.append(new_depend)
|
||||||
|
|
||||||
|
bb.data.setVar(varname, " ".join(new_depends) or None, d)
|
||||||
|
|
||||||
|
#bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1)))
|
||||||
|
|
||||||
|
python package_mapping_rename_hook () {
|
||||||
|
runtime_mapping_rename("RDEPENDS", d)
|
||||||
|
runtime_mapping_rename("RRECOMMENDS", d)
|
||||||
|
runtime_mapping_rename("RSUGGESTS", d)
|
||||||
|
runtime_mapping_rename("RPROVIDES", d)
|
||||||
|
runtime_mapping_rename("RREPLACES", d)
|
||||||
|
runtime_mapping_rename("RCONFLICTS", d)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False):
|
def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False):
|
||||||
import os, os.path, bb
|
import os, os.path, bb
|
||||||
|
|
||||||
@@ -240,8 +307,11 @@ python populate_packages () {
|
|||||||
bb.build.exec_func("package_name_hook", d)
|
bb.build.exec_func("package_name_hook", d)
|
||||||
|
|
||||||
for pkg in packages.split():
|
for pkg in packages.split():
|
||||||
if bb.data.getVar('PKG_%s' % pkg, d, 1) is None:
|
pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1)
|
||||||
|
if pkgname is None:
|
||||||
bb.data.setVar('PKG_%s' % pkg, pkg, d)
|
bb.data.setVar('PKG_%s' % pkg, pkg, d)
|
||||||
|
else:
|
||||||
|
add_package_mapping(pkg, pkgname, d)
|
||||||
|
|
||||||
dangling_links = {}
|
dangling_links = {}
|
||||||
pkg_files = {}
|
pkg_files = {}
|
||||||
@@ -641,5 +711,5 @@ python package_do_package () {
|
|||||||
|
|
||||||
do_package[dirs] = "${D}"
|
do_package[dirs] = "${D}"
|
||||||
populate_packages[dirs] = "${D}"
|
populate_packages[dirs] = "${D}"
|
||||||
EXPORT_FUNCTIONS do_package do_shlibs do_split_locales
|
EXPORT_FUNCTIONS do_package do_shlibs do_split_locales mapping_rename_hook
|
||||||
addtask package before do_build after do_populate_staging
|
addtask package before do_build after do_populate_staging
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ python do_package_ipk () {
|
|||||||
ctrlfile.close()
|
ctrlfile.close()
|
||||||
raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value)
|
raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value)
|
||||||
# more fields
|
# more fields
|
||||||
|
|
||||||
|
bb.build.exec_func("mapping_rename_hook", localdata)
|
||||||
|
|
||||||
rdepends = explode_deps(bb.data.getVar("RDEPENDS", localdata, 1) or "")
|
rdepends = explode_deps(bb.data.getVar("RDEPENDS", localdata, 1) or "")
|
||||||
rrecommends = explode_deps(bb.data.getVar("RRECOMMENDS", localdata, 1) or "")
|
rrecommends = explode_deps(bb.data.getVar("RRECOMMENDS", localdata, 1) or "")
|
||||||
rsuggests = (bb.data.getVar("RSUGGESTS", localdata, 1) or "").split()
|
rsuggests = (bb.data.getVar("RSUGGESTS", localdata, 1) or "").split()
|
||||||
|
|||||||
@@ -11,12 +11,16 @@ HOST_OS = "${BUILD_OS}"
|
|||||||
HOST_PREFIX = "${BUILD_PREFIX}"
|
HOST_PREFIX = "${BUILD_PREFIX}"
|
||||||
HOST_CC_ARCH = "${BUILD_CC_ARCH}"
|
HOST_CC_ARCH = "${BUILD_CC_ARCH}"
|
||||||
|
|
||||||
export CPPFLAGS = "${BUILD_CPPFLAGS}"
|
CPPFLAGS = "${BUILD_CPPFLAGS}"
|
||||||
export CFLAGS = "${BUILD_CFLAGS}"
|
CFLAGS = "${BUILD_CFLAGS}"
|
||||||
export CXXFLAGS = "${BUILD_CFLAGS}"
|
CXXFLAGS = "${BUILD_CFLAGS}"
|
||||||
export LDFLAGS = "${BUILD_LDFLAGS}"
|
LDFLAGS = "${BUILD_LDFLAGS}"
|
||||||
|
|
||||||
prefix = "/usr/local/${SDK_NAME}"
|
prefix = "/usr/local/${SDK_NAME}"
|
||||||
exec_prefix = "${prefix}"
|
exec_prefix = "${prefix}"
|
||||||
|
base_prefix = "${exec_prefix}"
|
||||||
|
|
||||||
FILES_${PN} = "${prefix}"
|
FILES_${PN} = "${prefix}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,74 +1,248 @@
|
|||||||
def tinder_tz_offset(off):
|
def tinder_form_data(bound, dict, log):
|
||||||
# get the offset.n minutes Either it is a number like
|
"""
|
||||||
# +200 or -300
|
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
|
||||||
try:
|
try:
|
||||||
return int(off)
|
f = file(data.getVar('TMPDIR',d,True)+'/tinder-machine.id', 'r')
|
||||||
except ValueError:
|
id = f.read()
|
||||||
if off == "Europe/Berlin":
|
variables['machine_id'] = id
|
||||||
return 120
|
except:
|
||||||
else:
|
pass
|
||||||
return 0
|
|
||||||
|
|
||||||
def tinder_tinder_time(offset):
|
# the boundary we will need
|
||||||
import datetime
|
boundary = "----------------------------------%d" % int(random.random()*1000000000000)
|
||||||
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):
|
# now format the body
|
||||||
import datetime, time
|
body = tinder_form_data( boundary, variables, log )
|
||||||
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):
|
return ("multipart/form-data; boundary=%s" % boundary),body
|
||||||
import smtplib
|
|
||||||
|
|
||||||
|
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.
|
||||||
|
"""
|
||||||
from bb import data
|
from bb import data
|
||||||
from email.MIMEText import MIMEText
|
import httplib
|
||||||
msg = MIMEText(header +'\n' + log)
|
|
||||||
msg['Subject'] = data.getVar('TINDER_SUBJECT',da, True) or "Tinder-Client build log"
|
# get the body and type
|
||||||
msg['To'] = data.getVar('TINDER_MAILTO' ,da, True)
|
content_type, body = tinder_format_http_post(d,None,None)
|
||||||
msg['From'] = data.getVar('TINDER_FROM', da, True)
|
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)
|
||||||
|
|
||||||
|
# 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
|
||||||
|
report = h.file.read()
|
||||||
|
|
||||||
|
# now let us find the machine id that was assigned to us
|
||||||
|
search = "<machine id='"
|
||||||
|
report = report[report.find(search)+len(search):]
|
||||||
|
report = report[0:report.find("'")]
|
||||||
|
|
||||||
|
import bb
|
||||||
|
bb.note("Machine ID assigned by tinderbox: %s" % report )
|
||||||
|
|
||||||
|
# now we will need to save the machine number
|
||||||
|
# we will override any previous numbers
|
||||||
|
f = file(data.getVar('TMPDIR', d, True)+"/tinder-machine.id", 'w')
|
||||||
|
f.write(report)
|
||||||
|
|
||||||
|
|
||||||
s = smtplib.SMTP()
|
def tinder_send_http(d, status, log):
|
||||||
s.connect()
|
"""
|
||||||
s.sendmail(data.getVar('TINDER_FROM', da, True), [data.getVar('TINDER_MAILTO', da, True)], msg.as_string())
|
Send this log as build status
|
||||||
s.close()
|
"""
|
||||||
|
|
||||||
def tinder_send_http(da, header, log):
|
|
||||||
from bb import data
|
from bb import data
|
||||||
import httplib, urllib
|
import httplib
|
||||||
cont = "\n%s\n%s" % ( header, log)
|
|
||||||
headers = {"Content-type": "multipart/form-data" }
|
|
||||||
|
|
||||||
conn = httplib.HTTPConnection(data.getVar('TINDER_HOST',da, True))
|
|
||||||
conn.request("POST", data.getVar('TINDER_URL',da,True), cont, headers)
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
|
|
||||||
# Prepare tinderbox mail header
|
# get the body and type
|
||||||
def tinder_prepare_mail_header(da, status):
|
content_type, body = tinder_format_http_post(d,status,log)
|
||||||
|
server = data.getVar('TINDER_HOST', d, True )
|
||||||
|
url = data.getVar('TINDER_URL', d, True )
|
||||||
|
|
||||||
|
selector = url + "/xml/build_status.pl"
|
||||||
|
|
||||||
|
# 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 h.file.read()
|
||||||
|
|
||||||
|
|
||||||
|
def tinder_print_info(d):
|
||||||
|
"""
|
||||||
|
Print the TinderBox Info
|
||||||
|
Including informations of the BaseSystem and the Tree
|
||||||
|
we use.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from bb import data
|
||||||
|
import os
|
||||||
|
# get the local vars
|
||||||
|
|
||||||
|
time = tinder_time_string()
|
||||||
|
ops = os.uname()[0]
|
||||||
|
version = os.uname()[2]
|
||||||
|
url = data.getVar( 'TINDER_URL' , d, True )
|
||||||
|
tree = data.getVar( 'TINDER_TREE', d, True )
|
||||||
|
branch = data.getVar( 'TINDER_BRANCH', d, True )
|
||||||
|
srcdate = data.getVar( 'SRCDATE', d, True )
|
||||||
|
machine = data.getVar( 'MACHINE', d, True )
|
||||||
|
distro = data.getVar( 'DISTRO', d, True )
|
||||||
|
bbfiles = data.getVar( 'BBFILES', d, True )
|
||||||
|
tarch = data.getVar( 'TARGET_ARCH', d, True )
|
||||||
|
fpu = data.getVar( 'TARGET_FPU', d, True )
|
||||||
|
oerev = data.getVar( 'OE_REVISION', d, True ) or "unknown"
|
||||||
|
|
||||||
|
# there is a bug with tipple quoted strings
|
||||||
|
# i will work around but will fix the original
|
||||||
|
# bug as well
|
||||||
|
output = []
|
||||||
|
output.append("== Tinderbox Info" )
|
||||||
|
output.append("Time: %(time)s" )
|
||||||
|
output.append("OS: %(ops)s" )
|
||||||
|
output.append("%(version)s" )
|
||||||
|
output.append("Compiler: gcc" )
|
||||||
|
output.append("Tinderbox Client: 0.1" )
|
||||||
|
output.append("Tinderbox Client Last Modified: yesterday" )
|
||||||
|
output.append("Tinderbox Protocol: 0.1" )
|
||||||
|
output.append("URL: %(url)s" )
|
||||||
|
output.append("Tree: %(tree)s" )
|
||||||
|
output.append("Config:" )
|
||||||
|
output.append("branch = '%(branch)s'" )
|
||||||
|
output.append("TARGET_ARCH = '%(tarch)s'" )
|
||||||
|
output.append("TARGET_FPU = '%(fpu)s'" )
|
||||||
|
output.append("SRCDATE = '%(srcdate)s'" )
|
||||||
|
output.append("MACHINE = '%(machine)s'" )
|
||||||
|
output.append("DISTRO = '%(distro)s'" )
|
||||||
|
output.append("BBFILES = '%(bbfiles)s'" )
|
||||||
|
output.append("OEREV = '%(oerev)s'" )
|
||||||
|
output.append("== End Tinderbox Client Info" )
|
||||||
|
|
||||||
|
# now create the real output
|
||||||
|
return "\n".join(output) % vars()
|
||||||
|
|
||||||
|
|
||||||
|
def tinder_print_env():
|
||||||
|
"""
|
||||||
|
Print the environment variables of this build
|
||||||
|
"""
|
||||||
from bb import data
|
from bb import data
|
||||||
|
import os
|
||||||
|
|
||||||
str = "tinderbox: administrator: %s\n" % data.getVar('TINDER_ADMIN', da, True)
|
time_start = tinder_time_string()
|
||||||
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))
|
time_end = tinder_time_string()
|
||||||
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"
|
|
||||||
|
|
||||||
return str
|
# build the environment
|
||||||
|
env = ""
|
||||||
|
for var in os.environ:
|
||||||
|
env += "%s=%s\n" % (var, os.environ[var])
|
||||||
|
|
||||||
|
output = []
|
||||||
|
output.append( "---> 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
|
||||||
|
"""
|
||||||
|
|
||||||
|
time_start = tinder_time_string()
|
||||||
|
config = tinder_print_info(d)
|
||||||
|
#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( "<--- TINDERBOX FINISHED PRINTING CONFIGURATION %(time_end)s" )
|
||||||
|
output.append( "" )
|
||||||
|
return "\n".join(output) % vars()
|
||||||
|
|
||||||
def tinder_do_tinder_report(event):
|
def tinder_do_tinder_report(event):
|
||||||
"""
|
"""
|
||||||
Report to the tinderbox. Either we will report every step
|
Report to the tinderbox:
|
||||||
(depending on TINDER_VERBOSE_REPORT) at the end we will send the
|
On the BuildStart we will inform the box directly
|
||||||
tinderclient.log
|
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.
|
||||||
"""
|
"""
|
||||||
from bb.event import getName
|
from bb.event import getName
|
||||||
from bb import data, mkdirhier
|
from bb import data, mkdirhier
|
||||||
@@ -77,74 +251,58 @@ def tinder_do_tinder_report(event):
|
|||||||
# variables
|
# variables
|
||||||
name = getName(event)
|
name = getName(event)
|
||||||
log = ""
|
log = ""
|
||||||
header = ""
|
status = 1
|
||||||
verbose = data.getVar('TINDER_VERBOSE_REPORT', event.data, True) == "1"
|
|
||||||
|
|
||||||
# Check what we need to do Build* shows we start or are done
|
# Check what we need to do Build* shows we start or are done
|
||||||
if name == "BuildStarted":
|
if name == "BuildStarted":
|
||||||
header = tinder_prepare_mail_header(event.data, 'building')
|
tinder_build_start(event.data)
|
||||||
# generate
|
log = tinder_tinder_start(event.data)
|
||||||
for var in os.environ:
|
|
||||||
log += "%s=%s\n" % (var, os.environ[var])
|
|
||||||
|
|
||||||
mkdirhier(data.getVar('TMPDIR', event.data, True))
|
try:
|
||||||
file = open(data.getVar('TINDER_LOG', event.data, True), 'w')
|
# truncate the tinder log file
|
||||||
file.write(log)
|
f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+')
|
||||||
|
f.truncate(0)
|
||||||
|
f.close()
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
|
||||||
if not verbose:
|
# Append the Task-Log (compile,configure...) to the log file
|
||||||
header = ""
|
# we will send to the server
|
||||||
|
|
||||||
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":
|
if name == "TaskSucceeded" or name == "TaskFailed":
|
||||||
log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task))
|
log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task))
|
||||||
|
|
||||||
if len(log_file) != 0:
|
if len(log_file) != 0:
|
||||||
to_file = data.getVar('TINDER_LOG', event.data, True)
|
to_file = data.getVar('TINDER_LOG', event.data, True)
|
||||||
log_txt = open(log_file[0], 'r').readlines()
|
log += "".join(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
|
||||||
|
elif name == "TaskSucceeded":
|
||||||
|
log += "<--- TINDERBOX Task %s done (SUCCESS)\n" % event.task
|
||||||
|
elif name == "TaskFailed":
|
||||||
|
log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task
|
||||||
|
elif name == "PkgStarted":
|
||||||
|
log += "---> TINDERBOX Package %s started\n" % data.getVar('P', event.data, True)
|
||||||
|
elif name == "PkgSucceeded":
|
||||||
|
log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True)
|
||||||
|
elif name == "PkgFailed":
|
||||||
|
log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True)
|
||||||
|
status = 200
|
||||||
|
elif name == "BuildCompleted":
|
||||||
|
log += "Build Completed\n"
|
||||||
|
status = 100
|
||||||
|
|
||||||
# append to the log
|
# now post the log
|
||||||
if verbose:
|
if len(log) == 0:
|
||||||
header = tinder_prepare_mail_header(event.data, 'building')
|
|
||||||
for line in log_txt:
|
|
||||||
log += line
|
|
||||||
|
|
||||||
# now mail the log
|
|
||||||
if len(log) == 0 or len(header) == 0:
|
|
||||||
return
|
return
|
||||||
|
|
||||||
log_post_method = tinder_send_email
|
# for now we will use the http post method as it is the only one
|
||||||
if data.getVar('TINDER_SENDLOG', event.data, True) == "http":
|
log_post_method = tinder_send_http
|
||||||
log_post_method = tinder_send_http
|
log_post_method(event.data, status, log)
|
||||||
|
|
||||||
log_post_method(event.data, header, log)
|
|
||||||
|
|
||||||
|
|
||||||
|
# we want to be an event handler
|
||||||
addhandler tinderclient_eventhandler
|
addhandler tinderclient_eventhandler
|
||||||
python tinderclient_eventhandler() {
|
python tinderclient_eventhandler() {
|
||||||
from bb import note, error, data
|
from bb import note, error, data
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
LICENSE= "BSD-X"
|
LICENSE= "BSD-X"
|
||||||
SECTION = "x11/libs"
|
SECTION = "x11/libs"
|
||||||
|
|
||||||
XLIBS_CVS = "cvs://anoncvs:anoncvs@pdx.freedesktop.org/cvs/xlibs"
|
XLIBS_CVS = "${FREEDESKTOP_CVS}/xlibs"
|
||||||
|
|
||||||
inherit autotools pkgconfig
|
inherit autotools pkgconfig
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user