[OE-core] [PATCH 4/4] runqemu: get NATIVE dirs from env when in source OE build dir

Joshua Lock joshuagloe at gmail.com
Mon Sep 5 15:49:17 UTC 2016


On 5 September 2016 at 15:47, Robert Yang <liezhi.yang at windriver.com> wrote:

> Hi Josh,
>
> Thanks for fixing this, I got errors when test this patch:
>
> $ runqemu tmp/deploy/images/qemux86/
> runqemu - INFO - Running bitbake -e...
> Traceback (most recent call last):
>   File "/buildarea/lyang1/poky/scripts/runqemu", line 864, in <module>
>     ret = main()
>   File "/buildarea/lyang1/poky/scripts/runqemu", line 851, in main
>     config.read_qemuboot()
>   File "/buildarea/lyang1/poky/scripts/runqemu", line 536, in
> read_qemuboot
>     self.qemuboot = qbs.split[0]
> AttributeError: 'list' object has no attribute 'split'
>

Thanks for reviewing and catching this.


> And after your patches, it always need run "bitbake -e", this makes
> us can't use runqemu when another build is running:
> ERROR: Only one copy of bitbake should be run against a build directory
>
> Maybe we check STAGING_DIR_NATIVE, STAGING_BINDIR_NATIVE
> and STAGING_DIR_HOST, if they are existed, then we don't need run bitbake
> -e.
>

That's a nice idea, I'll implement that for v2 of the series.


> And please see my comments below.
>
>
> On 09/05/2016 09:59 PM, Joshua Lock wrote:
>
>> When we're running from a sourced OE build directory parse the
>> STAGING_* directories from the bitbake environment, rather than
>> using those hard-coded in the conf file.
>>
>> Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
>> ---
>>  scripts/runqemu | 22 ++++++++++++++++++++++
>>  1 file changed, 22 insertions(+)
>>
>> diff --git a/scripts/runqemu b/scripts/runqemu
>> index cfe7bff..5a97802 100755
>> --- a/scripts/runqemu
>> +++ b/scripts/runqemu
>> @@ -555,6 +555,16 @@ class BaseConfig(object):
>>                  logger.info('Setting DEPLOY_DIR_IMAGE to folder
>> containing %s (%s)' % (self.qemuboot, imgdir))
>>                  self.set('DEPLOY_DIR_IMAGE', imgdir)
>>
>> +        # When we're running from a sourced OE environment use the
>> STAGING_*
>> +        # directories from the environment.
>> +        if self.bitbake_e:
>> +            native_vars = ['STAGING_DIR_NATIVE', 'STAGING_BINDIR_NATIVE']
>> +            for nv in native_vars:
>> +                s = re.search('^%s="(.*)"' % nv, self.bitbake_e, re.M)
>> +                if s and s.group(1) != self.get(nv):
>> +                    logger.info('Overriding conf file setting of %s to
>> %s from Bitbake environment' % (nv, s.group(1)))
>> +                    self.set(nv, s.group(1))
>> +
>>      def print_config(self):
>>          logger.info('Continuing with the following parameters:\n')
>>          if not self.fstype in self.vmtypes:
>> @@ -815,6 +825,17 @@ class BaseConfig(object):
>>              shutil.rmtree(self.nfs_dir)
>>              shutil.rmtree('%s.pseudo_state' % self.nfs_dir)
>>
>> +    def check_sourced_env(self):
>> +        bitbake = shutil.which('bitbake')
>> +        if bitbake and not self.bitbake_e:
>> +            mach = self.get('MACHINE')
>> +            if mach:
>> +                cmd = 'MACHINE=%s bitbake -e' % mach
>> +            else:
>> +                cmd = 'bitbake -e'
>> +            logger.info('Running %s...' % cmd)
>> +            self.bitbake_e = subprocess.Popen(cmd, shell=True,
>> stdout=subprocess.PIPE).stdout.read().decode('utf-8')
>>
>
> I think that we need check whether the command is successed
> or not, and print errors if it is failed to run.
>

Sure, I'll implement that.

Joshua <joshua.g.lock at intel.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20160905/14785dd6/attachment-0002.html>


More information about the Openembedded-core mailing list