diff options
Diffstat (limited to 'poky/scripts/lib')
-rw-r--r-- | poky/scripts/lib/buildstats.py | 2 | ||||
-rw-r--r-- | poky/scripts/lib/checklayer/__init__.py | 42 | ||||
-rw-r--r-- | poky/scripts/lib/devtool/standard.py | 11 | ||||
-rw-r--r-- | poky/scripts/lib/wic/engine.py | 13 |
4 files changed, 41 insertions, 27 deletions
diff --git a/poky/scripts/lib/buildstats.py b/poky/scripts/lib/buildstats.py index d9aadf3cb..f7db3eaf9 100644 --- a/poky/scripts/lib/buildstats.py +++ b/poky/scripts/lib/buildstats.py @@ -263,7 +263,7 @@ class BuildStats(dict): """Aggregate other buildstats into this""" if set(self.keys()) != set(buildstats.keys()): raise ValueError("Refusing to aggregate buildstats, set of " - "recipes is different") + "recipes is different: %s" % (set(self.keys()) ^ set(buildstats.keys()))) for pkg, data in buildstats.items(): self[pkg].aggregate(data) diff --git a/poky/scripts/lib/checklayer/__init__.py b/poky/scripts/lib/checklayer/__init__.py index 778804184..670f0eea3 100644 --- a/poky/scripts/lib/checklayer/__init__.py +++ b/poky/scripts/lib/checklayer/__init__.py @@ -196,38 +196,36 @@ def add_layer_dependencies(bblayersconf, layer, layers, logger): if layer_depends is None: return False else: - # Don't add a layer that is already present. - added = set() - output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') - for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): - added.add(path) - - for layer_depend in layer_depends: - name = layer_depend['name'] - path = layer_depend['path'] + add_layers(bblayersconf, layer_depends, logger) + + return True + +def add_layers(bblayersconf, layers, logger): + # Don't add a layer that is already present. + added = set() + output = check_command('Getting existing layers failed.', 'bitbake-layers show-layers').decode('utf-8') + for layer, path, pri in re.findall(r'^(\S+) +([^\n]*?) +(\d+)$', output, re.MULTILINE): + added.add(path) + + with open(bblayersconf, 'a+') as f: + for layer in layers: + logger.info('Adding layer %s' % layer['name']) + name = layer['name'] + path = layer['path'] if path in added: - continue + logger.info('%s is already in %s' % (name, bblayersconf)) else: added.add(path) - logger.info('Adding layer dependency %s' % name) - with open(bblayersconf, 'a+') as f: f.write("\nBBLAYERS += \"%s\"\n" % path) return True -def add_layer(bblayersconf, layer, layers, logger): - logger.info('Adding layer %s' % layer['name']) - with open(bblayersconf, 'a+') as f: - f.write("\nBBLAYERS += \"%s\"\n" % layer['path']) - - return True - -def check_command(error_msg, cmd): +def check_command(error_msg, cmd, cwd=None): ''' Run a command under a shell, capture stdout and stderr in a single stream, throw an error when command returns non-zero exit code. Returns the output. ''' - p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd=cwd) output, _ = p.communicate() if p.returncode: msg = "%s\nCommand: %s\nOutput:\n%s" % (error_msg, cmd, output.decode('utf-8')) @@ -257,7 +255,7 @@ def get_signatures(builddir, failsafe=False, machine=None): os.unlink(sigs_file) try: check_command('Generating signatures failed. This might be due to some parse error and/or general layer incompatibilities.', - cmd) + cmd, builddir) except RuntimeError as ex: if failsafe and os.path.exists(sigs_file): # Ignore the error here. Most likely some recipes active diff --git a/poky/scripts/lib/devtool/standard.py b/poky/scripts/lib/devtool/standard.py index d14b7a654..b7d4d47df 100644 --- a/poky/scripts/lib/devtool/standard.py +++ b/poky/scripts/lib/devtool/standard.py @@ -509,6 +509,11 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works if not 'flag' in event: if event['op'].startswith(('_append[', '_prepend[')): extra_overrides.append(event['op'].split('[')[1].split(']')[0]) + # We want to remove duplicate overrides. If a recipe had multiple + # SRC_URI_override += values it would cause mulitple instances of + # overrides. This doesn't play nicely with things like creating a + # branch for every instance of DEVTOOL_EXTRA_OVERRIDES. + extra_overrides = list(set(extra_overrides)) if extra_overrides: logger.info('SRC_URI contains some conditional appends/prepends - will create branches to represent these') @@ -769,9 +774,13 @@ def modify(args, config, basepath, workspace): check_commits = True else: if os.path.exists(os.path.join(srctree, '.git')): - # Check if it's a tree previously extracted by us + # Check if it's a tree previously extracted by us. This is done + # by ensuring that devtool-base and args.branch (devtool) exist. + # The check_commits logic will cause an exception if either one + # of these doesn't exist try: (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree) + bb.process.run('git rev-parse %s' % args.branch, cwd=srctree) except bb.process.ExecutionError: stdout = '' if stdout: diff --git a/poky/scripts/lib/wic/engine.py b/poky/scripts/lib/wic/engine.py index 4662c665c..ea600d285 100644 --- a/poky/scripts/lib/wic/engine.py +++ b/poky/scripts/lib/wic/engine.py @@ -245,9 +245,16 @@ class Disk: self._ptable_format = None # find parted - self.paths = "/bin:/usr/bin:/usr/sbin:/sbin/" + # read paths from $PATH environment variable + # if it fails, use hardcoded paths + pathlist = "/bin:/usr/bin:/usr/sbin:/sbin/" + try: + self.paths = os.environ['PATH'] + ":" + pathlist + except KeyError: + self.paths = pathlist + if native_sysroot: - for path in self.paths.split(':'): + for path in pathlist.split(':'): self.paths = "%s%s:%s" % (native_sysroot, path, self.paths) self.parted = find_executable("parted", self.paths) @@ -331,7 +338,7 @@ class Disk: def copy(self, src, pnum, path): """Copy partition image into wic image.""" if self.partitions[pnum].fstype.startswith('ext'): - cmd = "echo -e 'cd {}\nwrite {} {}' | {} -w {}".\ + cmd = "printf 'cd {}\nwrite {} {}' | {} -w {}".\ format(path, src, os.path.basename(src), self.debugfs, self._get_part_image(pnum)) else: # fat |