diff options
-rw-r--r-- | meta/classes/utility-tasks.bbclass | 37 | ||||
-rw-r--r-- | meta/lib/oe/distro_check.py | 33 |
2 files changed, 62 insertions, 8 deletions
diff --git a/meta/classes/utility-tasks.bbclass b/meta/classes/utility-tasks.bbclass index b3609965e7..8e905308be 100644 --- a/meta/classes/utility-tasks.bbclass +++ b/meta/classes/utility-tasks.bbclass | |||
@@ -488,6 +488,31 @@ do_buildall() { | |||
488 | : | 488 | : |
489 | } | 489 | } |
490 | 490 | ||
491 | addhandler check_eventhandler | ||
492 | python check_eventhandler() { | ||
493 | from bb.event import Handled, NotHandled | ||
494 | # if bb.event.getName(e) == "TaskStarted": | ||
495 | |||
496 | if bb.event.getName(e) == "BuildStarted": | ||
497 | import oe.distro_check as dc | ||
498 | tmpdir = bb.data.getVar('TMPDIR', e.data, 1) | ||
499 | distro_check_dir = os.path.join(tmpdir, "distro_check") | ||
500 | datetime = bb.data.getVar('DATETIME', e.data, 1) | ||
501 | """initialize log files.""" | ||
502 | logpath = bb.data.getVar('LOG_DIR', e.data, 1) | ||
503 | bb.utils.mkdirhier(logpath) | ||
504 | logfile = os.path.join(logpath, "distrocheck.%s.csv" % bb.data.getVar('DATETIME', e.data, 1)) | ||
505 | if not os.path.exists(logfile): | ||
506 | slogfile = os.path.join(logpath, "distrocheck.csv") | ||
507 | if os.path.exists(slogfile): | ||
508 | os.remove(slogfile) | ||
509 | os.system("touch %s" % logfile) | ||
510 | os.symlink(logfile, slogfile) | ||
511 | bb.data.setVar('LOG_FILE', logfile, e.data) | ||
512 | |||
513 | return NotHandled | ||
514 | } | ||
515 | |||
491 | addtask distro_check | 516 | addtask distro_check |
492 | do_distro_check[nostamp] = "1" | 517 | do_distro_check[nostamp] = "1" |
493 | python do_distro_check() { | 518 | python do_distro_check() { |
@@ -495,12 +520,9 @@ python do_distro_check() { | |||
495 | import oe.distro_check as dc | 520 | import oe.distro_check as dc |
496 | localdata = bb.data.createCopy(d) | 521 | localdata = bb.data.createCopy(d) |
497 | bb.data.update_data(localdata) | 522 | bb.data.update_data(localdata) |
498 | 523 | tmpdir = bb.data.getVar('TMPDIR', d, 1) | |
499 | tmpdir = bb.data.getVar('TMPDIR', localdata, 1) | ||
500 | distro_check_dir = os.path.join(tmpdir, "distro_check") | 524 | distro_check_dir = os.path.join(tmpdir, "distro_check") |
501 | datetime = bb.data.getVar('DATETIME', localdata, 1) | 525 | datetime = bb.data.getVar('DATETIME', localdata, 1) |
502 | |||
503 | # if distro packages list data is old then rebuild it | ||
504 | dc.update_distro_data(distro_check_dir, datetime) | 526 | dc.update_distro_data(distro_check_dir, datetime) |
505 | 527 | ||
506 | # do the comparison | 528 | # do the comparison |
@@ -510,3 +532,10 @@ python do_distro_check() { | |||
510 | dc.save_distro_check_result(result, datetime, d) | 532 | dc.save_distro_check_result(result, datetime, d) |
511 | } | 533 | } |
512 | 534 | ||
535 | addtask distro_checkall after do_distro_check | ||
536 | do_distro_checkall[recrdeptask] = "do_distro_check" | ||
537 | do_distro_checkall[nostamp] = "1" | ||
538 | do_distro_checkall() { | ||
539 | : | ||
540 | } | ||
541 | |||
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py index 58972585a6..3f61630d1a 100644 --- a/meta/lib/oe/distro_check.py +++ b/meta/lib/oe/distro_check.py | |||
@@ -230,7 +230,7 @@ def update_distro_data(distro_check_dir, datetime): | |||
230 | f = open(datetime_file, "r+b") | 230 | f = open(datetime_file, "r+b") |
231 | fcntl.lockf(f, fcntl.LOCK_EX) | 231 | fcntl.lockf(f, fcntl.LOCK_EX) |
232 | saved_datetime = f.read() | 232 | saved_datetime = f.read() |
233 | if saved_datetime != datetime: | 233 | if saved_datetime[0:8] != datetime[0:8]: |
234 | bb.note("The build datetime did not match: saved:%s current:%s" % (saved_datetime, datetime)) | 234 | bb.note("The build datetime did not match: saved:%s current:%s" % (saved_datetime, datetime)) |
235 | bb.note("Regenerating distro package lists") | 235 | bb.note("Regenerating distro package lists") |
236 | create_distro_packages_list(distro_check_dir) | 236 | create_distro_packages_list(distro_check_dir) |
@@ -247,10 +247,33 @@ def compare_in_distro_packages_list(distro_check_dir, d): | |||
247 | if not os.path.isdir(distro_check_dir): | 247 | if not os.path.isdir(distro_check_dir): |
248 | raise Exception("compare_in_distro_packages_list: invalid distro_check_dir passed") | 248 | raise Exception("compare_in_distro_packages_list: invalid distro_check_dir passed") |
249 | 249 | ||
250 | localdata = bb.data.createCopy(d) | ||
250 | pkglst_dir = os.path.join(distro_check_dir, "package_lists") | 251 | pkglst_dir = os.path.join(distro_check_dir, "package_lists") |
251 | matching_distros = [] | 252 | matching_distros = [] |
253 | pn = bb.data.getVar('PN', d, True) | ||
252 | recipe_name = bb.data.getVar('PN', d, True) | 254 | recipe_name = bb.data.getVar('PN', d, True) |
253 | tmp = bb.data.getVar('DISTRO_PN_ALIAS', d, True) | 255 | bb.note("Checking: %s" % pn) |
256 | |||
257 | if pn.find("-native") != -1: | ||
258 | pnstripped = pn.split("-native") | ||
259 | bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) | ||
260 | bb.data.update_data(localdata) | ||
261 | recipe_name = pnstripped[0] | ||
262 | |||
263 | if pn.find("-cross") != -1: | ||
264 | pnstripped = pn.split("-cross") | ||
265 | bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) | ||
266 | bb.data.update_data(localdata) | ||
267 | recipe_name = pnstripped[0] | ||
268 | |||
269 | if pn.find("-initial") != -1: | ||
270 | pnstripped = pn.split("-initial") | ||
271 | bb.data.setVar('OVERRIDES', "pn-" + pnstripped[0] + ":" + bb.data.getVar('OVERRIDES', d, True), localdata) | ||
272 | bb.data.update_data(localdata) | ||
273 | recipe_name = pnstripped[0] | ||
274 | |||
275 | bb.note("Recipe: %s" % recipe_name) | ||
276 | tmp = bb.data.getVar('DISTRO_PN_ALIAS', localdata, True) | ||
254 | distro_pn_aliases = {} | 277 | distro_pn_aliases = {} |
255 | if tmp: | 278 | if tmp: |
256 | list = tmp.split(' ') | 279 | list = tmp.split(' ') |
@@ -271,6 +294,8 @@ def compare_in_distro_packages_list(distro_check_dir, d): | |||
271 | f.close() | 294 | f.close() |
272 | break | 295 | break |
273 | f.close() | 296 | f.close() |
297 | |||
298 | bb.note("Matching: %s" % matching_distros) | ||
274 | return matching_distros | 299 | return matching_distros |
275 | 300 | ||
276 | def save_distro_check_result(result, datetime, d): | 301 | def save_distro_check_result(result, datetime, d): |
@@ -281,8 +306,8 @@ def save_distro_check_result(result, datetime, d): | |||
281 | return | 306 | return |
282 | if not os.path.isdir(logdir): | 307 | if not os.path.isdir(logdir): |
283 | os.makedirs(logdir) | 308 | os.makedirs(logdir) |
284 | result_file = os.path.join(logdir, "distro_check-" + datetime + ".results") | 309 | result_file = os.path.join(logdir, "distrocheck.csv") |
285 | line = pn + " : " | 310 | line = pn + ", " |
286 | for i in result: | 311 | for i in result: |
287 | line = line + i + ", " | 312 | line = line + i + ", " |
288 | if result: | 313 | if result: |