diff options
author | Richard Purdie <richard@openedhand.com> | 2006-02-27 13:18:52 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2006-02-27 13:18:52 +0000 |
commit | 3ddfbc771904e34273bea4a829fbf3ce1f13be30 (patch) | |
tree | 84d058181ff851fc594a2dea022dbf5ea3f39b5b | |
parent | e6c95ae25926d7e8cb2f1516ec5c03eb947d11f7 (diff) | |
download | poky-3ddfbc771904e34273bea4a829fbf3ce1f13be30.tar.gz |
Bitbake classes updates from OE
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@294 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r-- | openembedded/classes/debian.bbclass | 10 | ||||
-rw-r--r-- | openembedded/classes/efl.bbclass | 10 | ||||
-rw-r--r-- | openembedded/classes/package.bbclass | 74 | ||||
-rw-r--r-- | openembedded/classes/package_ipk.bbclass | 3 | ||||
-rw-r--r-- | openembedded/classes/sdk.bbclass | 12 | ||||
-rw-r--r-- | openembedded/classes/tinderclient.bbclass | 378 | ||||
-rw-r--r-- | openembedded/classes/xlibs.bbclass | 2 |
7 files changed, 366 insertions, 123 deletions
diff --git a/openembedded/classes/debian.bbclass b/openembedded/classes/debian.bbclass index d66c1fc763..5688dad93b 100644 --- a/openembedded/classes/debian.bbclass +++ b/openembedded/classes/debian.bbclass | |||
@@ -1,3 +1,11 @@ | |||
1 | STAGING_PKGMAPS_DIR = "${STAGING_DIR}/pkgmaps/debian" | ||
2 | |||
3 | # Debain package renaming only occurs when a package is built | ||
4 | # We therefore have to make sure we build all runtime packages | ||
5 | # before building the current package to make the packages runtime | ||
6 | # depends are correct | ||
7 | BUILD_ALL_DEPS = "1" | ||
8 | |||
1 | python debian_package_name_hook () { | 9 | python debian_package_name_hook () { |
2 | import glob, copy, stat, errno, re | 10 | import glob, copy, stat, errno, re |
3 | 11 | ||
@@ -74,7 +82,7 @@ python debian_package_name_hook () { | |||
74 | if soname_result: | 82 | if soname_result: |
75 | (pkgname, devname) = soname_result | 83 | (pkgname, devname) = soname_result |
76 | for pkg in packages.split(): | 84 | for pkg in packages.split(): |
77 | if (bb.data.getVar('PKG_' + pkg, d)): | 85 | if (bb.data.getVar('PKG_' + pkg, d) or bb.data.getVar('DEBIAN_NOAUTONAME_' + pkg, d)): |
78 | continue | 86 | continue |
79 | if pkg == orig_pkg: | 87 | if pkg == orig_pkg: |
80 | newpkg = pkgname | 88 | newpkg = pkgname |
diff --git a/openembedded/classes/efl.bbclass b/openembedded/classes/efl.bbclass index b438ca61b4..e5968b9aec 100644 --- a/openembedded/classes/efl.bbclass +++ b/openembedded/classes/efl.bbclass | |||
@@ -73,9 +73,9 @@ do_stage_append () { | |||
73 | fi | 73 | fi |
74 | } | 74 | } |
75 | 75 | ||
76 | PACKAGES = "${SRCNAME} ${SRCNAME}-themes ${SRCNAME}-dev ${SRCNAME}-examples" | 76 | PACKAGES = "${PN} ${PN}-themes ${PN}-dev ${PN}-examples " |
77 | FILES_${SRCNAME} = "${libdir}/lib*.so*" | 77 | FILES_${PN} = "${libdir}/lib*.so*" |
78 | 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" | 78 | 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" |
79 | FILES_${SRCNAME}-dev += "${bindir}/${SRCNAME}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${datadir}/${SRCNAME}/include" | 79 | FILES_${PN}-dev = "${bindir}/${PN}-config ${libdir}/pkgconfig ${libdir}/lib*.?a ${libdir}/lib*.a" |
80 | FILES_${SRCNAME}-examples = "${bindir} ${datadir}" | 80 | FILES_${PN}-examples = "${bindir} ${datadir}" |
81 | 81 | ||
diff --git a/openembedded/classes/package.bbclass b/openembedded/classes/package.bbclass index 03a533d59a..71795e8bb6 100644 --- a/openembedded/classes/package.bbclass +++ b/openembedded/classes/package.bbclass | |||
@@ -1,6 +1,73 @@ | |||
1 | def legitimize_package_name(s): | 1 | def legitimize_package_name(s): |
2 | return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') | 2 | return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') |
3 | 3 | ||
4 | STAGING_PKGMAPS_DIR ?= "${STAGING_DIR}/pkgmaps" | ||
5 | |||
6 | def add_package_mapping (pkg, new_name, d): | ||
7 | import bb, os | ||
8 | |||
9 | def encode(str): | ||
10 | import codecs | ||
11 | c = codecs.getencoder("string_escape") | ||
12 | return c(str)[0] | ||
13 | |||
14 | pmap_dir = bb.data.getVar('STAGING_PKGMAPS_DIR', d, 1) | ||
15 | |||
16 | bb.mkdirhier(pmap_dir) | ||
17 | |||
18 | data_file = os.path.join(pmap_dir, pkg) | ||
19 | |||
20 | f = open(data_file, 'w') | ||
21 | f.write("%s\n" % encode(new_name)) | ||
22 | f.close() | ||
23 | |||
24 | def get_package_mapping (pkg, d): | ||
25 | import bb, os | ||
26 | |||
27 | def decode(str): | ||
28 | import codecs | ||
29 | c = codecs.getdecoder("string_escape") | ||
30 | return c(str)[0] | ||
31 | |||
32 | data_file = bb.data.expand("${STAGING_PKGMAPS_DIR}/%s" % pkg, d) | ||
33 | |||
34 | if os.access(data_file, os.R_OK): | ||
35 | f = file(data_file, 'r') | ||
36 | lines = f.readlines() | ||
37 | f.close() | ||
38 | for l in lines: | ||
39 | return decode(l).strip() | ||
40 | return pkg | ||
41 | |||
42 | def runtime_mapping_rename (varname, d): | ||
43 | import bb, os | ||
44 | |||
45 | #bb.note("%s before: %s" % (varname, bb.data.getVar(varname, d, 1))) | ||
46 | |||
47 | new_depends = [] | ||
48 | for depend in explode_deps(bb.data.getVar(varname, d, 1) or ""): | ||
49 | # Have to be careful with any version component of the depend | ||
50 | split_depend = depend.split(' (') | ||
51 | new_depend = get_package_mapping(split_depend[0].strip(), d) | ||
52 | if len(split_depend) > 1: | ||
53 | new_depends.append("%s (%s" % (new_depend, split_depend[1])) | ||
54 | else: | ||
55 | new_depends.append(new_depend) | ||
56 | |||
57 | bb.data.setVar(varname, " ".join(new_depends) or None, d) | ||
58 | |||
59 | #bb.note("%s after: %s" % (varname, bb.data.getVar(varname, d, 1))) | ||
60 | |||
61 | python package_mapping_rename_hook () { | ||
62 | runtime_mapping_rename("RDEPENDS", d) | ||
63 | runtime_mapping_rename("RRECOMMENDS", d) | ||
64 | runtime_mapping_rename("RSUGGESTS", d) | ||
65 | runtime_mapping_rename("RPROVIDES", d) | ||
66 | runtime_mapping_rename("RREPLACES", d) | ||
67 | runtime_mapping_rename("RCONFLICTS", d) | ||
68 | } | ||
69 | |||
70 | |||
4 | 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): | 71 | 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): |
5 | import os, os.path, bb | 72 | import os, os.path, bb |
6 | 73 | ||
@@ -240,8 +307,11 @@ python populate_packages () { | |||
240 | bb.build.exec_func("package_name_hook", d) | 307 | bb.build.exec_func("package_name_hook", d) |
241 | 308 | ||
242 | for pkg in packages.split(): | 309 | for pkg in packages.split(): |
243 | if bb.data.getVar('PKG_%s' % pkg, d, 1) is None: | 310 | pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1) |
311 | if pkgname is None: | ||
244 | bb.data.setVar('PKG_%s' % pkg, pkg, d) | 312 | bb.data.setVar('PKG_%s' % pkg, pkg, d) |
313 | else: | ||
314 | add_package_mapping(pkg, pkgname, d) | ||
245 | 315 | ||
246 | dangling_links = {} | 316 | dangling_links = {} |
247 | pkg_files = {} | 317 | pkg_files = {} |
@@ -641,5 +711,5 @@ python package_do_package () { | |||
641 | 711 | ||
642 | do_package[dirs] = "${D}" | 712 | do_package[dirs] = "${D}" |
643 | populate_packages[dirs] = "${D}" | 713 | populate_packages[dirs] = "${D}" |
644 | EXPORT_FUNCTIONS do_package do_shlibs do_split_locales | 714 | EXPORT_FUNCTIONS do_package do_shlibs do_split_locales mapping_rename_hook |
645 | addtask package before do_build after do_populate_staging | 715 | addtask package before do_build after do_populate_staging |
diff --git a/openembedded/classes/package_ipk.bbclass b/openembedded/classes/package_ipk.bbclass index a70b1e8cdd..9ae526bb3b 100644 --- a/openembedded/classes/package_ipk.bbclass +++ b/openembedded/classes/package_ipk.bbclass | |||
@@ -165,6 +165,9 @@ python do_package_ipk () { | |||
165 | ctrlfile.close() | 165 | ctrlfile.close() |
166 | raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value) | 166 | raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value) |
167 | # more fields | 167 | # more fields |
168 | |||
169 | bb.build.exec_func("mapping_rename_hook", localdata) | ||
170 | |||
168 | rdepends = explode_deps(bb.data.getVar("RDEPENDS", localdata, 1) or "") | 171 | rdepends = explode_deps(bb.data.getVar("RDEPENDS", localdata, 1) or "") |
169 | rrecommends = explode_deps(bb.data.getVar("RRECOMMENDS", localdata, 1) or "") | 172 | rrecommends = explode_deps(bb.data.getVar("RRECOMMENDS", localdata, 1) or "") |
170 | rsuggests = (bb.data.getVar("RSUGGESTS", localdata, 1) or "").split() | 173 | rsuggests = (bb.data.getVar("RSUGGESTS", localdata, 1) or "").split() |
diff --git a/openembedded/classes/sdk.bbclass b/openembedded/classes/sdk.bbclass index bd49c51225..bcabbc79bd 100644 --- a/openembedded/classes/sdk.bbclass +++ b/openembedded/classes/sdk.bbclass | |||
@@ -11,12 +11,16 @@ HOST_OS = "${BUILD_OS}" | |||
11 | HOST_PREFIX = "${BUILD_PREFIX}" | 11 | HOST_PREFIX = "${BUILD_PREFIX}" |
12 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" | 12 | HOST_CC_ARCH = "${BUILD_CC_ARCH}" |
13 | 13 | ||
14 | export CPPFLAGS = "${BUILD_CPPFLAGS}" | 14 | CPPFLAGS = "${BUILD_CPPFLAGS}" |
15 | export CFLAGS = "${BUILD_CFLAGS}" | 15 | CFLAGS = "${BUILD_CFLAGS}" |
16 | export CXXFLAGS = "${BUILD_CFLAGS}" | 16 | CXXFLAGS = "${BUILD_CFLAGS}" |
17 | export LDFLAGS = "${BUILD_LDFLAGS}" | 17 | LDFLAGS = "${BUILD_LDFLAGS}" |
18 | 18 | ||
19 | prefix = "/usr/local/${SDK_NAME}" | 19 | prefix = "/usr/local/${SDK_NAME}" |
20 | exec_prefix = "${prefix}" | 20 | exec_prefix = "${prefix}" |
21 | base_prefix = "${exec_prefix}" | ||
21 | 22 | ||
22 | FILES_${PN} = "${prefix}" | 23 | FILES_${PN} = "${prefix}" |
24 | |||
25 | |||
26 | |||
diff --git a/openembedded/classes/tinderclient.bbclass b/openembedded/classes/tinderclient.bbclass index 290166bb03..1c6a6c497f 100644 --- a/openembedded/classes/tinderclient.bbclass +++ b/openembedded/classes/tinderclient.bbclass | |||
@@ -1,74 +1,248 @@ | |||
1 | def tinder_tz_offset(off): | 1 | def tinder_form_data(bound, dict, log): |
2 | # get the offset.n minutes Either it is a number like | 2 | """ |
3 | # +200 or -300 | 3 | Create the boundary for the HTTP Post |
4 | """ | ||
5 | output = [] | ||
6 | |||
7 | # for each key in the dictionary | ||
8 | for name in dict: | ||
9 | output.append( "--" + bound ) | ||
10 | output.append( 'Content-Disposition: form-data; name="%s"' % name ) | ||
11 | output.append( "" ) | ||
12 | output.append( dict[name] ) | ||
13 | if log: | ||
14 | output.append( "--" + bound ) | ||
15 | output.append( 'Content-Disposition: form-data; name="log"; filename="log.txt"' ) | ||
16 | output.append( '' ) | ||
17 | output.append( log ) | ||
18 | output.append( '--' + bound + '--' ) | ||
19 | output.append( '' ) | ||
20 | |||
21 | return "\r\n".join(output) | ||
22 | |||
23 | def tinder_time_string(): | ||
24 | """ | ||
25 | Return the time as GMT | ||
26 | """ | ||
27 | return "" | ||
28 | |||
29 | def tinder_format_http_post(d,status,log): | ||
30 | """ | ||
31 | Format the Tinderbox HTTP post with the data needed | ||
32 | for the tinderbox to be happy. | ||
33 | """ | ||
34 | |||
35 | from bb import data | ||
36 | import os,random | ||
37 | |||
38 | # the variables we will need to send on this form post | ||
39 | variables = { | ||
40 | "tree" : data.getVar('TINDER_TREE', d, True), | ||
41 | "machine_name" : data.getVar('TINDER_MACHINE', d, True), | ||
42 | "os" : os.uname()[0], | ||
43 | "os_version" : os.uname()[2], | ||
44 | "compiler" : "gcc", | ||
45 | "clobber" : data.getVar('TINDER_CLOBBER', d, True) | ||
46 | } | ||
47 | |||
48 | # optionally add the status | ||
49 | if status: | ||
50 | variables["status"] = str(status) | ||
51 | |||
52 | # try to load the machine id | ||
53 | # we only need on build_status.pl but sending it | ||
54 | # always does not hurt | ||
4 | try: | 55 | try: |
5 | return int(off) | 56 | f = file(data.getVar('TMPDIR',d,True)+'/tinder-machine.id', 'r') |
6 | except ValueError: | 57 | id = f.read() |
7 | if off == "Europe/Berlin": | 58 | variables['machine_id'] = id |
8 | return 120 | 59 | except: |
9 | else: | 60 | pass |
10 | return 0 | 61 | |
11 | 62 | # the boundary we will need | |
12 | def tinder_tinder_time(offset): | 63 | boundary = "----------------------------------%d" % int(random.random()*1000000000000) |
13 | import datetime | 64 | |
14 | td = datetime.timedelta(minutes=tinder_tz_offset(offset)) | 65 | # now format the body |
15 | time = datetime.datetime.utcnow() + td | 66 | body = tinder_form_data( boundary, variables, log ) |
16 | return time.strftime('%m/%d/%Y %H:%M:%S') | 67 | |
17 | 68 | return ("multipart/form-data; boundary=%s" % boundary),body | |
18 | def tinder_tinder_start(date,offset): | 69 | |
19 | import datetime, time | 70 | |
20 | td = datetime.timedelta(minutes=tinder_tz_offset(offset)) | 71 | def tinder_build_start(d): |
21 | ti = time.strptime(date, "%m/%d/%Y %H:%M:%S") | 72 | """ |
22 | time = datetime.datetime(*ti[0:7])+td | 73 | Inform the tinderbox that a build is starting. We do this |
23 | return time.strftime('%m/%d/%Y %H:%M:%S') | 74 | by posting our name and tree to the build_start.pl script |
24 | 75 | on the server. | |
25 | def tinder_send_email(da, header, log): | 76 | """ |
26 | import smtplib | ||
27 | from bb import data | 77 | from bb import data |
28 | from email.MIMEText import MIMEText | 78 | import httplib |
29 | msg = MIMEText(header +'\n' + log) | 79 | |
30 | msg['Subject'] = data.getVar('TINDER_SUBJECT',da, True) or "Tinder-Client build log" | 80 | # get the body and type |
31 | msg['To'] = data.getVar('TINDER_MAILTO' ,da, True) | 81 | content_type, body = tinder_format_http_post(d,None,None) |
32 | msg['From'] = data.getVar('TINDER_FROM', da, True) | 82 | server = data.getVar('TINDER_HOST', d, True ) |
83 | url = data.getVar('TINDER_URL', d, True ) | ||
84 | |||
85 | selector = url + "/xml/build_start.pl" | ||
86 | |||
87 | #print "selector %s and url %s" % (selector, url) | ||
88 | |||
89 | # now post it | ||
90 | h = httplib.HTTP(server) | ||
91 | h.putrequest('POST', selector) | ||
92 | h.putheader('content-type', content_type) | ||
93 | h.putheader('content-length', str(len(body))) | ||
94 | h.endheaders() | ||
95 | h.send(body) | ||
96 | errcode, errmsg, headers = h.getreply() | ||
97 | #print errcode, errmsg, headers | ||
98 | report = h.file.read() | ||
99 | |||
100 | # now let us find the machine id that was assigned to us | ||
101 | search = "<machine id='" | ||
102 | report = report[report.find(search)+len(search):] | ||
103 | report = report[0:report.find("'")] | ||
104 | |||
105 | import bb | ||
106 | bb.note("Machine ID assigned by tinderbox: %s" % report ) | ||
33 | 107 | ||
108 | # now we will need to save the machine number | ||
109 | # we will override any previous numbers | ||
110 | f = file(data.getVar('TMPDIR', d, True)+"/tinder-machine.id", 'w') | ||
111 | f.write(report) | ||
34 | 112 | ||
35 | s = smtplib.SMTP() | ||
36 | s.connect() | ||
37 | s.sendmail(data.getVar('TINDER_FROM', da, True), [data.getVar('TINDER_MAILTO', da, True)], msg.as_string()) | ||
38 | s.close() | ||
39 | 113 | ||
40 | def tinder_send_http(da, header, log): | 114 | def tinder_send_http(d, status, log): |
115 | """ | ||
116 | Send this log as build status | ||
117 | """ | ||
41 | from bb import data | 118 | from bb import data |
42 | import httplib, urllib | 119 | import httplib |
43 | cont = "\n%s\n%s" % ( header, log) | 120 | |
44 | headers = {"Content-type": "multipart/form-data" } | 121 | |
122 | # get the body and type | ||
123 | content_type, body = tinder_format_http_post(d,status,log) | ||
124 | server = data.getVar('TINDER_HOST', d, True ) | ||
125 | url = data.getVar('TINDER_URL', d, True ) | ||
126 | |||
127 | selector = url + "/xml/build_status.pl" | ||
128 | |||
129 | # now post it | ||
130 | h = httplib.HTTP(server) | ||
131 | h.putrequest('POST', selector) | ||
132 | h.putheader('content-type', content_type) | ||
133 | h.putheader('content-length', str(len(body))) | ||
134 | h.endheaders() | ||
135 | h.send(body) | ||
136 | errcode, errmsg, headers = h.getreply() | ||
137 | #print errcode, errmsg, headers | ||
138 | #print h.file.read() | ||
139 | |||
45 | 140 | ||
46 | conn = httplib.HTTPConnection(data.getVar('TINDER_HOST',da, True)) | 141 | def tinder_print_info(d): |
47 | conn.request("POST", data.getVar('TINDER_URL',da,True), cont, headers) | 142 | """ |
48 | conn.close() | 143 | Print the TinderBox Info |
144 | Including informations of the BaseSystem and the Tree | ||
145 | we use. | ||
146 | """ | ||
147 | |||
148 | from bb import data | ||
149 | import os | ||
150 | # get the local vars | ||
151 | |||
152 | time = tinder_time_string() | ||
153 | ops = os.uname()[0] | ||
154 | version = os.uname()[2] | ||
155 | url = data.getVar( 'TINDER_URL' , d, True ) | ||
156 | tree = data.getVar( 'TINDER_TREE', d, True ) | ||
157 | branch = data.getVar( 'TINDER_BRANCH', d, True ) | ||
158 | srcdate = data.getVar( 'SRCDATE', d, True ) | ||
159 | machine = data.getVar( 'MACHINE', d, True ) | ||
160 | distro = data.getVar( 'DISTRO', d, True ) | ||
161 | bbfiles = data.getVar( 'BBFILES', d, True ) | ||
162 | tarch = data.getVar( 'TARGET_ARCH', d, True ) | ||
163 | fpu = data.getVar( 'TARGET_FPU', d, True ) | ||
164 | oerev = data.getVar( 'OE_REVISION', d, True ) or "unknown" | ||
49 | 165 | ||
166 | # there is a bug with tipple quoted strings | ||
167 | # i will work around but will fix the original | ||
168 | # bug as well | ||
169 | output = [] | ||
170 | output.append("== Tinderbox Info" ) | ||
171 | output.append("Time: %(time)s" ) | ||
172 | output.append("OS: %(ops)s" ) | ||
173 | output.append("%(version)s" ) | ||
174 | output.append("Compiler: gcc" ) | ||
175 | output.append("Tinderbox Client: 0.1" ) | ||
176 | output.append("Tinderbox Client Last Modified: yesterday" ) | ||
177 | output.append("Tinderbox Protocol: 0.1" ) | ||
178 | output.append("URL: %(url)s" ) | ||
179 | output.append("Tree: %(tree)s" ) | ||
180 | output.append("Config:" ) | ||
181 | output.append("branch = '%(branch)s'" ) | ||
182 | output.append("TARGET_ARCH = '%(tarch)s'" ) | ||
183 | output.append("TARGET_FPU = '%(fpu)s'" ) | ||
184 | output.append("SRCDATE = '%(srcdate)s'" ) | ||
185 | output.append("MACHINE = '%(machine)s'" ) | ||
186 | output.append("DISTRO = '%(distro)s'" ) | ||
187 | output.append("BBFILES = '%(bbfiles)s'" ) | ||
188 | output.append("OEREV = '%(oerev)s'" ) | ||
189 | output.append("== End Tinderbox Client Info" ) | ||
50 | 190 | ||
51 | # Prepare tinderbox mail header | 191 | # now create the real output |
52 | def tinder_prepare_mail_header(da, status): | 192 | return "\n".join(output) % vars() |
193 | |||
194 | |||
195 | def tinder_print_env(): | ||
196 | """ | ||
197 | Print the environment variables of this build | ||
198 | """ | ||
53 | from bb import data | 199 | from bb import data |
200 | import os | ||
201 | |||
202 | time_start = tinder_time_string() | ||
203 | time_end = tinder_time_string() | ||
204 | |||
205 | # build the environment | ||
206 | env = "" | ||
207 | for var in os.environ: | ||
208 | env += "%s=%s\n" % (var, os.environ[var]) | ||
209 | |||
210 | output = [] | ||
211 | output.append( "---> TINDERBOX RUNNING env %(time_start)s" ) | ||
212 | output.append( env ) | ||
213 | output.append( "<--- TINDERBOX FINISHED (SUCCESS) %(time_end)s" ) | ||
54 | 214 | ||
55 | str = "tinderbox: administrator: %s\n" % data.getVar('TINDER_ADMIN', da, True) | 215 | return "\n".join(output) % vars() |
56 | 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)) | 216 | |
57 | str += "tinderbox: buildname: %s\n" % data.getVar('TINDER_BUILD', da, True) | 217 | def tinder_tinder_start(d): |
58 | str += "tinderbox: errorparser: %s\n" % data.getVar('TINDER_ERROR', da, True) | 218 | """ |
59 | str += "tinderbox: status: %s\n" % status | 219 | PRINT the configuration of this build |
60 | str += "tinderbox: timenow: %s\n" % tinder_tinder_time(data.getVar('TINDER_TZ', da, True)) | 220 | """ |
61 | str += "tinderbox: tree: %s\n" % data.getVar('TINDER_TREE', da, True) | ||
62 | str += "tinderbox: buildfamily: %s\n" % "unix" | ||
63 | str += "tinderbox: END" | ||
64 | 221 | ||
65 | return str | 222 | time_start = tinder_time_string() |
223 | config = tinder_print_info(d) | ||
224 | #env = tinder_print_env() | ||
225 | time_end = tinder_time_string() | ||
226 | |||
227 | output = [] | ||
228 | output.append( "---> TINDERBOX PRINTING CONFIGURATION %(time_start)s" ) | ||
229 | output.append( config ) | ||
230 | #output.append( env ) | ||
231 | output.append( "<--- TINDERBOX FINISHED PRINTING CONFIGURATION %(time_end)s" ) | ||
232 | output.append( "" ) | ||
233 | return "\n".join(output) % vars() | ||
66 | 234 | ||
67 | def tinder_do_tinder_report(event): | 235 | def tinder_do_tinder_report(event): |
68 | """ | 236 | """ |
69 | Report to the tinderbox. Either we will report every step | 237 | Report to the tinderbox: |
70 | (depending on TINDER_VERBOSE_REPORT) at the end we will send the | 238 | On the BuildStart we will inform the box directly |
71 | tinderclient.log | 239 | On the other events we will write to the TINDER_LOG and |
240 | when the Task is finished we will send the report. | ||
241 | |||
242 | The above is not yet fully implemented. Currently we send | ||
243 | information immediately. The caching/queuing needs to be | ||
244 | implemented. Also sending more or less information is not | ||
245 | implemented yet. | ||
72 | """ | 246 | """ |
73 | from bb.event import getName | 247 | from bb.event import getName |
74 | from bb import data, mkdirhier | 248 | from bb import data, mkdirhier |
@@ -77,74 +251,58 @@ def tinder_do_tinder_report(event): | |||
77 | # variables | 251 | # variables |
78 | name = getName(event) | 252 | name = getName(event) |
79 | log = "" | 253 | log = "" |
80 | header = "" | 254 | status = 1 |
81 | verbose = data.getVar('TINDER_VERBOSE_REPORT', event.data, True) == "1" | ||
82 | 255 | ||
83 | # Check what we need to do Build* shows we start or are done | 256 | # Check what we need to do Build* shows we start or are done |
84 | if name == "BuildStarted": | 257 | if name == "BuildStarted": |
85 | header = tinder_prepare_mail_header(event.data, 'building') | 258 | tinder_build_start(event.data) |
86 | # generate | 259 | log = tinder_tinder_start(event.data) |
87 | for var in os.environ: | 260 | |
88 | log += "%s=%s\n" % (var, os.environ[var]) | 261 | try: |
89 | 262 | # truncate the tinder log file | |
90 | mkdirhier(data.getVar('TMPDIR', event.data, True)) | 263 | f = file(data.getVar('TINDER_LOG', event.data, True), 'rw+') |
91 | file = open(data.getVar('TINDER_LOG', event.data, True), 'w') | 264 | f.truncate(0) |
92 | file.write(log) | 265 | f.close() |
93 | 266 | except IOError: | |
94 | if not verbose: | 267 | pass |
95 | header = "" | 268 | |
96 | 269 | # Append the Task-Log (compile,configure...) to the log file | |
97 | if name == "PkgFailed" or name == "BuildCompleted": | 270 | # we will send to the server |
98 | status = 'build_failed' | ||
99 | if name == "BuildCompleted": | ||
100 | status = "success" | ||
101 | header = tinder_prepare_mail_header(event.data, status) | ||
102 | # append the log | ||
103 | log_file = data.getVar('TINDER_LOG', event.data, True) | ||
104 | file = open(log_file, 'r') | ||
105 | for line in file.readlines(): | ||
106 | log += line | ||
107 | |||
108 | if verbose and name == "TaskStarted": | ||
109 | header = tinder_prepare_mail_header(event.data, 'building') | ||
110 | log = "Task %s started" % event.task | ||
111 | |||
112 | if verbose and name == "PkgStarted": | ||
113 | header = tinder_prepare_mail_header(event.data, 'building') | ||
114 | log = "Package %s started" % data.getVar('P', event.data, True) | ||
115 | |||
116 | if verbose and name == "PkgSucceeded": | ||
117 | header = tinder_prepare_mail_header(event.data, 'building') | ||
118 | log = "Package %s done" % data.getVar('P', event.data, True) | ||
119 | |||
120 | # Append the Task Log | ||
121 | if name == "TaskSucceeded" or name == "TaskFailed": | 271 | if name == "TaskSucceeded" or name == "TaskFailed": |
122 | log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task)) | 272 | log_file = glob.glob("%s/log.%s.*" % (data.getVar('T', event.data, True), event.task)) |
123 | 273 | ||
124 | if len(log_file) != 0: | 274 | if len(log_file) != 0: |
125 | to_file = data.getVar('TINDER_LOG', event.data, True) | 275 | to_file = data.getVar('TINDER_LOG', event.data, True) |
126 | log_txt = open(log_file[0], 'r').readlines() | 276 | log += "".join(open(log_file[0], 'r').readlines()) |
127 | to_file = open(to_file, 'a') | ||
128 | |||
129 | to_file.writelines(log_txt) | ||
130 | 277 | ||
131 | # append to the log | 278 | # set the right 'HEADER'/Summary for the TinderBox |
132 | if verbose: | 279 | if name == "TaskStarted": |
133 | header = tinder_prepare_mail_header(event.data, 'building') | 280 | log += "---> TINDERBOX Task %s started\n" % event.task |
134 | for line in log_txt: | 281 | elif name == "TaskSucceeded": |
135 | log += line | 282 | log += "<--- TINDERBOX Task %s done (SUCCESS)\n" % event.task |
283 | elif name == "TaskFailed": | ||
284 | log += "<--- TINDERBOX Task %s failed (FAILURE)\n" % event.task | ||
285 | elif name == "PkgStarted": | ||
286 | log += "---> TINDERBOX Package %s started\n" % data.getVar('P', event.data, True) | ||
287 | elif name == "PkgSucceeded": | ||
288 | log += "<--- TINDERBOX Package %s done (SUCCESS)\n" % data.getVar('P', event.data, True) | ||
289 | elif name == "PkgFailed": | ||
290 | log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % data.getVar('P', event.data, True) | ||
291 | status = 200 | ||
292 | elif name == "BuildCompleted": | ||
293 | log += "Build Completed\n" | ||
294 | status = 100 | ||
136 | 295 | ||
137 | # now mail the log | 296 | # now post the log |
138 | if len(log) == 0 or len(header) == 0: | 297 | if len(log) == 0: |
139 | return | 298 | return |
140 | 299 | ||
141 | log_post_method = tinder_send_email | 300 | # for now we will use the http post method as it is the only one |
142 | if data.getVar('TINDER_SENDLOG', event.data, True) == "http": | 301 | log_post_method = tinder_send_http |
143 | log_post_method = tinder_send_http | 302 | log_post_method(event.data, status, log) |
144 | |||
145 | log_post_method(event.data, header, log) | ||
146 | 303 | ||
147 | 304 | ||
305 | # we want to be an event handler | ||
148 | addhandler tinderclient_eventhandler | 306 | addhandler tinderclient_eventhandler |
149 | python tinderclient_eventhandler() { | 307 | python tinderclient_eventhandler() { |
150 | from bb import note, error, data | 308 | from bb import note, error, data |
diff --git a/openembedded/classes/xlibs.bbclass b/openembedded/classes/xlibs.bbclass index f9a1195663..e797748770 100644 --- a/openembedded/classes/xlibs.bbclass +++ b/openembedded/classes/xlibs.bbclass | |||
@@ -1,7 +1,7 @@ | |||
1 | LICENSE= "BSD-X" | 1 | LICENSE= "BSD-X" |
2 | SECTION = "x11/libs" | 2 | SECTION = "x11/libs" |
3 | 3 | ||
4 | XLIBS_CVS = "cvs://anoncvs:anoncvs@pdx.freedesktop.org/cvs/xlibs" | 4 | XLIBS_CVS = "${FREEDESKTOP_CVS}/xlibs" |
5 | 5 | ||
6 | inherit autotools pkgconfig | 6 | inherit autotools pkgconfig |
7 | 7 | ||