diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/runqemu | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 5b719d5ac7..2830c15d52 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -558,6 +558,22 @@ class BaseConfig(object): | |||
558 | logger.info('Setting DEPLOY_DIR_IMAGE to folder containing %s (%s)' % (self.qemuboot, imgdir)) | 558 | logger.info('Setting DEPLOY_DIR_IMAGE to folder containing %s (%s)' % (self.qemuboot, imgdir)) |
559 | self.set('DEPLOY_DIR_IMAGE', imgdir) | 559 | self.set('DEPLOY_DIR_IMAGE', imgdir) |
560 | 560 | ||
561 | # If the STAGING_*_NATIVE directories from the config file don't exist | ||
562 | # and we're in a sourced OE build directory try to extract the paths | ||
563 | # from `bitbake -e` | ||
564 | havenative = os.path.exists(self.get('STAGING_DIR_NATIVE')) and \ | ||
565 | os.path.exists(self.get('STAGING_BINDIR_NATIVE')) | ||
566 | |||
567 | if not havenative: | ||
568 | if not self.bitbake_e: | ||
569 | self.load_bitbake_env() | ||
570 | native_vars = ['STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE'] | ||
571 | for nv in native_vars: | ||
572 | s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M) | ||
573 | if s and s.group(1) != self.get(nv): | ||
574 | logger.info('Overriding conf file setting of %s to %s from Bitbake environment' % (nv, s.group(1))) | ||
575 | self.set(nv, s.group(1)) | ||
576 | |||
561 | def print_config(self): | 577 | def print_config(self): |
562 | logger.info('Continuing with the following parameters:\n') | 578 | logger.info('Continuing with the following parameters:\n') |
563 | if not self.fstype in self.vmtypes: | 579 | if not self.fstype in self.vmtypes: |
@@ -815,6 +831,29 @@ class BaseConfig(object): | |||
815 | shutil.rmtree(self.nfs_dir) | 831 | shutil.rmtree(self.nfs_dir) |
816 | shutil.rmtree('%s.pseudo_state' % self.nfs_dir) | 832 | shutil.rmtree('%s.pseudo_state' % self.nfs_dir) |
817 | 833 | ||
834 | def load_bitbake_env(self, mach=None): | ||
835 | if self.bitbake_e: | ||
836 | return | ||
837 | |||
838 | bitbake = shutil.which('bitbake') | ||
839 | if not bitbake: | ||
840 | return | ||
841 | |||
842 | if not mach: | ||
843 | mach = self.get('MACHINE') | ||
844 | |||
845 | if mach: | ||
846 | cmd = 'MACHINE=%s bitbake -e' % mach | ||
847 | else: | ||
848 | cmd = 'bitbake -e' | ||
849 | |||
850 | logger.info('Running %s...' % cmd) | ||
851 | try: | ||
852 | self.bitbake_e = subprocess.check_output(cmd, shell=True).decode('utf-8') | ||
853 | except subprocess.CalledProcessError as err: | ||
854 | self.bitbake_e = '' | ||
855 | logger.warn("Couldn't run 'bitbake -e' to gather environment information:\n%s" % err.output.decode('utf-8')) | ||
856 | |||
818 | def main(): | 857 | def main(): |
819 | if len(sys.argv) == 1 or "help" in sys.argv: | 858 | if len(sys.argv) == 1 or "help" in sys.argv: |
820 | print_usage() | 859 | print_usage() |