diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-25 14:57:53 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-11-27 10:35:30 +0000 |
commit | 4cd96710785eb05abeff1f281878655118d4a7dd (patch) | |
tree | f2e15210fa7057df398c6e20ecc51f1d747a12ab /bitbake/lib/bb/cooker.py | |
parent | 0a434ac10158e2011d41a1189e65e9474b1672be (diff) | |
download | poky-4cd96710785eb05abeff1f281878655118d4a7dd.tar.gz |
bitbake: Update users of getVar/setVar to use the data store functions directly
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 4f01cc10c6..5bbabfceb9 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -136,16 +136,16 @@ class BBCooker: | |||
136 | self.loadConfigurationData() | 136 | self.loadConfigurationData() |
137 | 137 | ||
138 | if not self.configuration.cmd: | 138 | if not self.configuration.cmd: |
139 | self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build" | 139 | self.configuration.cmd = self.configuration.data.getVar("BB_DEFAULT_TASK", True) or "build" |
140 | 140 | ||
141 | # Take a lock so only one copy of bitbake can run against a given build | 141 | # Take a lock so only one copy of bitbake can run against a given build |
142 | # directory at a time | 142 | # directory at a time |
143 | lockfile = bb.data.expand("${TOPDIR}/bitbake.lock", self.configuration.data) | 143 | lockfile = self.configuration.data.expand("${TOPDIR}/bitbake.lock") |
144 | self.lock = bb.utils.lockfile(lockfile, False, False) | 144 | self.lock = bb.utils.lockfile(lockfile, False, False) |
145 | if not self.lock: | 145 | if not self.lock: |
146 | bb.fatal("Only one copy of bitbake should be run against a build directory") | 146 | bb.fatal("Only one copy of bitbake should be run against a build directory") |
147 | 147 | ||
148 | bbpkgs = bb.data.getVar('BBPKGS', self.configuration.data, True) | 148 | bbpkgs = self.configuration.data.getVar('BBPKGS', True) |
149 | if bbpkgs and len(self.configuration.pkgs_to_build) == 0: | 149 | if bbpkgs and len(self.configuration.pkgs_to_build) == 0: |
150 | self.configuration.pkgs_to_build.extend(bbpkgs.split()) | 150 | self.configuration.pkgs_to_build.extend(bbpkgs.split()) |
151 | 151 | ||
@@ -174,7 +174,7 @@ class BBCooker: | |||
174 | self.configuration.data = bb.data.init() | 174 | self.configuration.data = bb.data.init() |
175 | 175 | ||
176 | if not self.server_registration_cb: | 176 | if not self.server_registration_cb: |
177 | bb.data.setVar("BB_WORKERCONTEXT", "1", self.configuration.data) | 177 | self.configuration.data.setVar("BB_WORKERCONTEXT", "1") |
178 | 178 | ||
179 | filtered_keys = bb.utils.approved_variables() | 179 | filtered_keys = bb.utils.approved_variables() |
180 | bb.data.inheritFromOS(self.configuration.data, self.savedenv, filtered_keys) | 180 | bb.data.inheritFromOS(self.configuration.data, self.savedenv, filtered_keys) |
@@ -189,13 +189,13 @@ class BBCooker: | |||
189 | sys.exit(1) | 189 | sys.exit(1) |
190 | 190 | ||
191 | if not self.configuration.cmd: | 191 | if not self.configuration.cmd: |
192 | self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data, True) or "build" | 192 | self.configuration.cmd = self.configuration.data.getVar("BB_DEFAULT_TASK", True) or "build" |
193 | 193 | ||
194 | def parseConfiguration(self): | 194 | def parseConfiguration(self): |
195 | 195 | ||
196 | 196 | ||
197 | # Change nice level if we're asked to | 197 | # Change nice level if we're asked to |
198 | nice = bb.data.getVar("BB_NICE_LEVEL", self.configuration.data, True) | 198 | nice = self.configuration.data.getVar("BB_NICE_LEVEL", True) |
199 | if nice: | 199 | if nice: |
200 | curnice = os.nice(0) | 200 | curnice = os.nice(0) |
201 | nice = int(nice) - curnice | 201 | nice = int(nice) - curnice |
@@ -293,7 +293,7 @@ class BBCooker: | |||
293 | # this showEnvironment() code path doesn't use the cache | 293 | # this showEnvironment() code path doesn't use the cache |
294 | self.parseConfiguration() | 294 | self.parseConfiguration() |
295 | self.status = bb.cache.CacheData(self.caches_array) | 295 | self.status = bb.cache.CacheData(self.caches_array) |
296 | self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) | 296 | self.handleCollections( self.configuration.data.getVar("BBFILE_COLLECTIONS", 1) ) |
297 | 297 | ||
298 | fn = self.matchFile(buildfile) | 298 | fn = self.matchFile(buildfile) |
299 | elif len(pkgs_to_build) == 1: | 299 | elif len(pkgs_to_build) == 1: |
@@ -597,7 +597,7 @@ class BBCooker: | |||
597 | bb.data.expandKeys(localdata) | 597 | bb.data.expandKeys(localdata) |
598 | 598 | ||
599 | # Handle PREFERRED_PROVIDERS | 599 | # Handle PREFERRED_PROVIDERS |
600 | for p in (bb.data.getVar('PREFERRED_PROVIDERS', localdata, True) or "").split(): | 600 | for p in (localdata.getVar('PREFERRED_PROVIDERS', True) or "").split(): |
601 | try: | 601 | try: |
602 | (providee, provider) = p.split(':') | 602 | (providee, provider) = p.split(':') |
603 | except: | 603 | except: |
@@ -645,8 +645,8 @@ class BBCooker: | |||
645 | # Generate a list of parsed configuration files by searching the files | 645 | # Generate a list of parsed configuration files by searching the files |
646 | # listed in the __depends and __base_depends variables with a .conf suffix. | 646 | # listed in the __depends and __base_depends variables with a .conf suffix. |
647 | conffiles = [] | 647 | conffiles = [] |
648 | dep_files = bb.data.getVar('__depends', self.configuration.data) or set() | 648 | dep_files = self.configuration.data.getVar('__depends') or set() |
649 | dep_files.union(bb.data.getVar('__base_depends', self.configuration.data) or set()) | 649 | dep_files.union(self.configuration.data.getVar('__base_depends') or set()) |
650 | 650 | ||
651 | for f in dep_files: | 651 | for f in dep_files: |
652 | if f[0].endswith(".conf"): | 652 | if f[0].endswith(".conf"): |
@@ -674,7 +674,7 @@ class BBCooker: | |||
674 | 674 | ||
675 | matches = [] | 675 | matches = [] |
676 | p = re.compile(re.escape(filepattern)) | 676 | p = re.compile(re.escape(filepattern)) |
677 | bbpaths = bb.data.getVar('BBPATH', self.configuration.data, True).split(':') | 677 | bbpaths = self.configuration.data.getVar('BBPATH', True).split(':') |
678 | for path in bbpaths: | 678 | for path in bbpaths: |
679 | dirpath = os.path.join(path, directory) | 679 | dirpath = os.path.join(path, directory) |
680 | if os.path.exists(dirpath): | 680 | if os.path.exists(dirpath): |
@@ -696,7 +696,7 @@ class BBCooker: | |||
696 | 696 | ||
697 | data = self.configuration.data | 697 | data = self.configuration.data |
698 | # iterate configs | 698 | # iterate configs |
699 | bbpaths = bb.data.getVar('BBPATH', data, True).split(':') | 699 | bbpaths = data.getVar('BBPATH', True).split(':') |
700 | for path in bbpaths: | 700 | for path in bbpaths: |
701 | confpath = os.path.join(path, "conf", var) | 701 | confpath = os.path.join(path, "conf", var) |
702 | if os.path.exists(confpath): | 702 | if os.path.exists(confpath): |
@@ -801,16 +801,16 @@ class BBCooker: | |||
801 | parselog.debug(2, "Found bblayers.conf (%s)", layerconf) | 801 | parselog.debug(2, "Found bblayers.conf (%s)", layerconf) |
802 | data = _parse(layerconf, data) | 802 | data = _parse(layerconf, data) |
803 | 803 | ||
804 | layers = (bb.data.getVar('BBLAYERS', data, True) or "").split() | 804 | layers = (data.getVar('BBLAYERS', True) or "").split() |
805 | 805 | ||
806 | data = bb.data.createCopy(data) | 806 | data = bb.data.createCopy(data) |
807 | for layer in layers: | 807 | for layer in layers: |
808 | parselog.debug(2, "Adding layer %s", layer) | 808 | parselog.debug(2, "Adding layer %s", layer) |
809 | bb.data.setVar('LAYERDIR', layer, data) | 809 | data.setVar('LAYERDIR', layer) |
810 | data = _parse(os.path.join(layer, "conf", "layer.conf"), data) | 810 | data = _parse(os.path.join(layer, "conf", "layer.conf"), data) |
811 | data.expandVarref('LAYERDIR') | 811 | data.expandVarref('LAYERDIR') |
812 | 812 | ||
813 | bb.data.delVar('LAYERDIR', data) | 813 | data.delVar('LAYERDIR') |
814 | 814 | ||
815 | if not data.getVar("BBPATH", True): | 815 | if not data.getVar("BBPATH", True): |
816 | raise SystemExit("The BBPATH variable is not set") | 816 | raise SystemExit("The BBPATH variable is not set") |
@@ -828,8 +828,8 @@ class BBCooker: | |||
828 | 828 | ||
829 | # Nomally we only register event handlers at the end of parsing .bb files | 829 | # Nomally we only register event handlers at the end of parsing .bb files |
830 | # We register any handlers we've found so far here... | 830 | # We register any handlers we've found so far here... |
831 | for var in bb.data.getVar('__BBHANDLERS', data) or []: | 831 | for var in data.getVar('__BBHANDLERS') or []: |
832 | bb.event.register(var, bb.data.getVar(var, data)) | 832 | bb.event.register(var, data.getVar(var)) |
833 | 833 | ||
834 | if data.getVar("BB_WORKERCONTEXT", False) is None: | 834 | if data.getVar("BB_WORKERCONTEXT", False) is None: |
835 | bb.fetch.fetcher_init(data) | 835 | bb.fetch.fetcher_init(data) |
@@ -848,7 +848,7 @@ class BBCooker: | |||
848 | min_prio = 0 | 848 | min_prio = 0 |
849 | for c in collection_list: | 849 | for c in collection_list: |
850 | # Get collection priority if defined explicitly | 850 | # Get collection priority if defined explicitly |
851 | priority = bb.data.getVar("BBFILE_PRIORITY_%s" % c, self.configuration.data, 1) | 851 | priority = self.configuration.data.getVar("BBFILE_PRIORITY_%s" % c, 1) |
852 | if priority: | 852 | if priority: |
853 | try: | 853 | try: |
854 | prio = int(priority) | 854 | prio = int(priority) |
@@ -861,7 +861,7 @@ class BBCooker: | |||
861 | collection_priorities[c] = None | 861 | collection_priorities[c] = None |
862 | 862 | ||
863 | # Check dependencies and store information for priority calculation | 863 | # Check dependencies and store information for priority calculation |
864 | deps = bb.data.getVar("LAYERDEPENDS_%s" % c, self.configuration.data, 1) | 864 | deps = self.configuration.data.getVar("LAYERDEPENDS_%s" % c, 1) |
865 | if deps: | 865 | if deps: |
866 | depnamelist = [] | 866 | depnamelist = [] |
867 | deplist = deps.split() | 867 | deplist = deps.split() |
@@ -880,7 +880,7 @@ class BBCooker: | |||
880 | 880 | ||
881 | if dep in collection_list: | 881 | if dep in collection_list: |
882 | if depver: | 882 | if depver: |
883 | layerver = bb.data.getVar("LAYERVERSION_%s" % dep, self.configuration.data, 1) | 883 | layerver = self.configuration.data.getVar("LAYERVERSION_%s" % dep, 1) |
884 | if layerver: | 884 | if layerver: |
885 | try: | 885 | try: |
886 | lver = int(layerver) | 886 | lver = int(layerver) |
@@ -913,7 +913,7 @@ class BBCooker: | |||
913 | # Calculate all layer priorities using calc_layer_priority and store in bbfile_config_priorities | 913 | # Calculate all layer priorities using calc_layer_priority and store in bbfile_config_priorities |
914 | for c in collection_list: | 914 | for c in collection_list: |
915 | calc_layer_priority(c) | 915 | calc_layer_priority(c) |
916 | regex = bb.data.getVar("BBFILE_PATTERN_%s" % c, self.configuration.data, 1) | 916 | regex = self.configuration.data.getVar("BBFILE_PATTERN_%s" % c, 1) |
917 | if regex == None: | 917 | if regex == None: |
918 | parselog.error("BBFILE_PATTERN_%s not defined" % c) | 918 | parselog.error("BBFILE_PATTERN_%s not defined" % c) |
919 | continue | 919 | continue |
@@ -928,9 +928,9 @@ class BBCooker: | |||
928 | """ | 928 | """ |
929 | Setup any variables needed before starting a build | 929 | Setup any variables needed before starting a build |
930 | """ | 930 | """ |
931 | if not bb.data.getVar("BUILDNAME", self.configuration.data): | 931 | if not self.configuration.data.getVar("BUILDNAME"): |
932 | bb.data.setVar("BUILDNAME", time.strftime('%Y%m%d%H%M'), self.configuration.data) | 932 | self.configuration.data.setVar("BUILDNAME", time.strftime('%Y%m%d%H%M')) |
933 | bb.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S', time.gmtime()), self.configuration.data) | 933 | self.configuration.data.setVar("BUILDSTART", time.strftime('%m/%d/%Y %H:%M:%S', time.gmtime())) |
934 | 934 | ||
935 | def matchFiles(self, bf): | 935 | def matchFiles(self, bf): |
936 | """ | 936 | """ |
@@ -977,7 +977,7 @@ class BBCooker: | |||
977 | # buildFile() doesn't use the cache | 977 | # buildFile() doesn't use the cache |
978 | self.parseConfiguration() | 978 | self.parseConfiguration() |
979 | self.status = bb.cache.CacheData(self.caches_array) | 979 | self.status = bb.cache.CacheData(self.caches_array) |
980 | self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) | 980 | self.handleCollections( self.configuration.data.getVar("BBFILE_COLLECTIONS", 1) ) |
981 | 981 | ||
982 | # If we are told to do the None task then query the default task | 982 | # If we are told to do the None task then query the default task |
983 | if (task == None): | 983 | if (task == None): |
@@ -1021,7 +1021,7 @@ class BBCooker: | |||
1021 | taskdata = bb.taskdata.TaskData(self.configuration.abort) | 1021 | taskdata = bb.taskdata.TaskData(self.configuration.abort) |
1022 | taskdata.add_provider(self.configuration.data, self.status, item) | 1022 | taskdata.add_provider(self.configuration.data, self.status, item) |
1023 | 1023 | ||
1024 | buildname = bb.data.getVar("BUILDNAME", self.configuration.data) | 1024 | buildname = self.configuration.data.getVar("BUILDNAME") |
1025 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.configuration.event_data) | 1025 | bb.event.fire(bb.event.BuildStarted(buildname, [item]), self.configuration.event_data) |
1026 | 1026 | ||
1027 | # Execute the runqueue | 1027 | # Execute the runqueue |
@@ -1098,7 +1098,7 @@ class BBCooker: | |||
1098 | 1098 | ||
1099 | self.buildSetVars() | 1099 | self.buildSetVars() |
1100 | 1100 | ||
1101 | buildname = bb.data.getVar("BUILDNAME", self.configuration.data) | 1101 | buildname = self.configuration.data.getVar("BUILDNAME") |
1102 | bb.event.fire(bb.event.BuildStarted(buildname, targets), self.configuration.event_data) | 1102 | bb.event.fire(bb.event.BuildStarted(buildname, targets), self.configuration.event_data) |
1103 | 1103 | ||
1104 | localdata = data.createCopy(self.configuration.data) | 1104 | localdata = data.createCopy(self.configuration.data) |
@@ -1132,16 +1132,16 @@ class BBCooker: | |||
1132 | del self.status | 1132 | del self.status |
1133 | self.status = bb.cache.CacheData(self.caches_array) | 1133 | self.status = bb.cache.CacheData(self.caches_array) |
1134 | 1134 | ||
1135 | ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or "" | 1135 | ignore = self.configuration.data.getVar("ASSUME_PROVIDED", 1) or "" |
1136 | self.status.ignored_dependencies = set(ignore.split()) | 1136 | self.status.ignored_dependencies = set(ignore.split()) |
1137 | 1137 | ||
1138 | for dep in self.configuration.extra_assume_provided: | 1138 | for dep in self.configuration.extra_assume_provided: |
1139 | self.status.ignored_dependencies.add(dep) | 1139 | self.status.ignored_dependencies.add(dep) |
1140 | 1140 | ||
1141 | self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) | 1141 | self.handleCollections( self.configuration.data.getVar("BBFILE_COLLECTIONS", 1) ) |
1142 | 1142 | ||
1143 | (filelist, masked) = self.collect_bbfiles() | 1143 | (filelist, masked) = self.collect_bbfiles() |
1144 | bb.data.renameVar("__depends", "__base_depends", self.configuration.data) | 1144 | self.configuration.data.renameVar("__depends", "__base_depends") |
1145 | 1145 | ||
1146 | self.parser = CookerParser(self, filelist, masked) | 1146 | self.parser = CookerParser(self, filelist, masked) |
1147 | self.state = state.parsing | 1147 | self.state = state.parsing |
@@ -1232,7 +1232,7 @@ class BBCooker: | |||
1232 | if g not in newfiles: | 1232 | if g not in newfiles: |
1233 | newfiles.append(g) | 1233 | newfiles.append(g) |
1234 | 1234 | ||
1235 | bbmask = bb.data.getVar('BBMASK', self.configuration.data, 1) | 1235 | bbmask = self.configuration.data.getVar('BBMASK', 1) |
1236 | 1236 | ||
1237 | if bbmask: | 1237 | if bbmask: |
1238 | try: | 1238 | try: |