summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2013-04-03 10:49:36 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-04 14:04:41 +0100
commitd040acb90453b77c31aab00b7450d81633fe6791 (patch)
treeb4605983abe74e4b96ba32b53f5e1115c9941018 /meta/classes/buildhistory.bbclass
parentfe336b149552b1f4f24d979c40302653298b98cc (diff)
downloadpoky-d040acb90453b77c31aab00b7450d81633fe6791.tar.gz
buildhistory: record tag names and show warning when the same tag corresponds to different revision
* persistent cache records tag-srcrev mappings, but is not shared between builders * when tag is moved in remote repo, all builders should rebuild the component to use the same source, show warning when revision is different than what was used in last build (From OE-Core rev: 0bc22ed6bd67031749e8f2cb5415dabf933eef56) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r--meta/classes/buildhistory.bbclass29
1 files changed, 25 insertions, 4 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 82d0bf8070..8c9f7942ee 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -538,24 +538,38 @@ def _get_srcrev_values(d):
538 scms.append(u) 538 scms.append(u)
539 539
540 autoinc_templ = 'AUTOINC+' 540 autoinc_templ = 'AUTOINC+'
541 dict = {} 541 dict_srcrevs = {}
542 dict_tag_srcrevs = {}
542 for scm in scms: 543 for scm in scms:
543 ud = urldata[scm] 544 ud = urldata[scm]
544 for name in ud.names: 545 for name in ud.names:
545 rev = ud.method.sortable_revision(scm, ud, d, name) 546 rev = ud.method.sortable_revision(scm, ud, d, name)
546 if rev.startswith(autoinc_templ): 547 if rev.startswith(autoinc_templ):
547 rev = rev[len(autoinc_templ):] 548 rev = rev[len(autoinc_templ):]
548 dict[name] = rev 549 dict_srcrevs[name] = rev
549 return dict 550 if 'tag' in ud.parm:
551 tag = ud.parm['tag'];
552 key = name+'_'+tag
553 dict_tag_srcrevs[key] = rev
554 return (dict_srcrevs, dict_tag_srcrevs)
550 555
551python do_write_srcrev() { 556python do_write_srcrev() {
552 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True) 557 pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
553 srcrevfile = os.path.join(pkghistdir, 'latest_srcrev') 558 srcrevfile = os.path.join(pkghistdir, 'latest_srcrev')
554 559
555 srcrevs = _get_srcrev_values(d) 560 srcrevs, tag_srcrevs = _get_srcrev_values(d)
556 if srcrevs: 561 if srcrevs:
557 if not os.path.exists(pkghistdir): 562 if not os.path.exists(pkghistdir):
558 os.makedirs(pkghistdir) 563 os.makedirs(pkghistdir)
564 old_tag_srcrevs = {}
565 if os.path.exists(srcrevfile):
566 with open(srcrevfile) as f:
567 for line in f:
568 if line.startswith('# tag_'):
569 key, value = line.split("=", 1)
570 key = key.replace('# tag_', '').strip()
571 value = value.replace('"', '').strip()
572 old_tag_srcrevs[key] = value
559 with open(srcrevfile, 'w') as f: 573 with open(srcrevfile, 'w') as f:
560 orig_srcrev = d.getVar('SRCREV', False) or 'INVALID' 574 orig_srcrev = d.getVar('SRCREV', False) or 'INVALID'
561 if orig_srcrev != 'INVALID': 575 if orig_srcrev != 'INVALID':
@@ -568,6 +582,13 @@ python do_write_srcrev() {
568 f.write('SRCREV_%s = "%s"\n' % (name, srcrev)) 582 f.write('SRCREV_%s = "%s"\n' % (name, srcrev))
569 else: 583 else:
570 f.write('SRCREV = "%s"\n' % srcrevs.itervalues().next()) 584 f.write('SRCREV = "%s"\n' % srcrevs.itervalues().next())
585 if len(tag_srcrevs) > 0:
586 for name, srcrev in tag_srcrevs.items():
587 f.write('# tag_%s = "%s"\n' % (name, srcrev))
588 if name in old_tag_srcrevs and old_tag_srcrevs[name] != srcrev:
589 pkg = d.getVar('PN', True)
590 bb.warn("Revision for tag %s in package %s was changed since last build (from %s to %s)" % (name, pkg, old_tag_srcrevs[name], srcrev))
591
571 else: 592 else:
572 if os.path.exists(srcrevfile): 593 if os.path.exists(srcrevfile):
573 os.remove(srcrevfile) 594 os.remove(srcrevfile)