summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/cooker.py79
1 files changed, 70 insertions, 9 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index cd32dd4ca4..67f0805cbb 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -709,26 +709,87 @@ class BBCooker:
709 """Handle collections""" 709 """Handle collections"""
710 self.status.bbfile_config_priorities = [] 710 self.status.bbfile_config_priorities = []
711 if collections: 711 if collections:
712 collection_priorities = {}
713 collection_depends = {}
712 collection_list = collections.split() 714 collection_list = collections.split()
715 min_prio = 0
713 for c in collection_list: 716 for c in collection_list:
717 # Get collection priority if defined explicitly
718 priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1)
719 if priority:
720 try:
721 prio = int(priority)
722 except ValueError:
723 parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority)
724 if min_prio == 0 or prio < min_prio:
725 min_prio = prio
726 collection_priorities[c] = prio
727 else:
728 collection_priorities[c] = None
729
730 # Check dependencies and store information for priority calculation
731 deps = bb.data.getVar("LAYERDEPENDS_%s" % c, self.configuration.data, 1)
732 if deps:
733 depnamelist = []
734 deplist = deps.split()
735 for dep in deplist:
736 depsplit = dep.split(':')
737 if len(depsplit) > 1:
738 try:
739 depver = int(depsplit[1])
740 except ValueError:
741 parselog.error("invalid version value in LAYERDEPENDS_%s: \"%s\"", c, dep)
742 continue
743 else:
744 depver = None
745 dep = depsplit[0]
746 depnamelist.append(dep)
747
748 if dep in collection_list:
749 if depver:
750 layerver = bb.data.getVar("LAYERVERSION_%s" % dep, self.configuration.data, 1)
751 if layerver:
752 try:
753 lver = int(layerver)
754 except ValueError:
755 parselog.error("invalid value for LAYERVERSION_%s: \"%s\"", c, layerver)
756 continue
757 if lver <> depver:
758 parselog.error("Layer dependency %s of layer %s is at version %d, expected %d", dep, c, lver, depver)
759 else:
760 parselog.error("Layer dependency %s of layer %s has no version, expected %d", dep, c, depver)
761 else:
762 parselog.error("Layer dependency %s of layer %s not found", dep, c)
763 collection_depends[c] = depnamelist
764 else:
765 collection_depends[c] = []
766
767 # Recursively work out collection priorities based on dependencies
768 def calc_layer_priority(collection):
769 if not collection_priorities[collection]:
770 max_depprio = min_prio
771 for dep in collection_depends[collection]:
772 calc_layer_priority(dep)
773 depprio = collection_priorities[dep]
774 if depprio > max_depprio:
775 max_depprio = depprio
776 max_depprio += 1
777 parselog.debug(1, "Calculated priority of layer %s as %d", collection, max_depprio)
778 collection_priorities[collection] = max_depprio
779
780 # Calculate all layer priorities using calc_layer_priority and store in bbfile_config_priorities
781 for c in collection_list:
782 calc_layer_priority(c)
714 regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1) 783 regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1)
715 if regex == None: 784 if regex == None:
716 parselog.error("BBFILE_PATTERN_%s not defined" % c) 785 parselog.error("BBFILE_PATTERN_%s not defined" % c)
717 continue 786 continue
718 priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1)
719 if priority == None:
720 parselog.error("BBFILE_PRIORITY_%s not defined" % c)
721 continue
722 try: 787 try:
723 cre = re.compile(regex) 788 cre = re.compile(regex)
724 except re.error: 789 except re.error:
725 parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex) 790 parselog.error("BBFILE_PATTERN_%s \"%s\" is not a valid regular expression", c, regex)
726 continue 791 continue
727 try: 792 self.status.bbfile_config_priorities.append((c, regex, cre, collection_priorities[c]))
728 pri = int(priority)
729 self.status.bbfile_config_priorities.append((c, regex, cre, pri))
730 except ValueError:
731 parselog.error("invalid value for BBFILE_PRIORITY_%s: \"%s\"", c, priority)
732 793
733 def buildSetVars(self): 794 def buildSetVars(self):
734 """ 795 """