summaryrefslogtreecommitdiffstats
path: root/meta/classes/buildhistory.bbclass
diff options
context:
space:
mode:
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)