public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: Joshua Lock <joshuagloe@gmail.com>,
	<openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH 4/4] runqemu: get NATIVE dirs from env when in source OE build dir
Date: Mon, 5 Sep 2016 22:47:44 +0800	[thread overview]
Message-ID: <a08a52ab-c834-d104-695f-491d297a4e1d@windriver.com> (raw)
In-Reply-To: <6180658762c54732ad9d8db624f2f0502996ff9b.1473083836.git.joshua.g.lock@intel.com>

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'

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.

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@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.

// Robert

> +
>  def main():
>      if len(sys.argv) == 1 or "help" in sys.argv:
>          print_usage()
> @@ -826,6 +847,7 @@ def main():
>          logger.error(esc)
>          logger.error("Try 'runqemu help' on how to use it")
>          return 1
> +    config.check_sourced_env()
>      config.read_qemuboot()
>      config.check_and_set()
>      config.print_config()
>


  reply	other threads:[~2016-09-05 14:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-05 13:59 [PATCH 0/4] Python3 runqemu Joshua Lock
2016-09-05 13:59 ` [PATCH 1/4] runqemu: fix typos Joshua Lock
2016-09-05 13:59 ` [PATCH 2/4] runqemu: use glob rather than calling out to ls Joshua Lock
2016-09-05 14:51   ` Robert Yang
2016-09-05 15:51     ` Joshua Lock
2016-09-05 13:59 ` [PATCH 3/4] runqemu: assume artefacts are relative to *.qemuboot.conf Joshua Lock
2016-09-05 13:59 ` [PATCH 4/4] runqemu: get NATIVE dirs from env when in source OE build dir Joshua Lock
2016-09-05 14:47   ` Robert Yang [this message]
2016-09-05 15:49     ` Joshua Lock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a08a52ab-c834-d104-695f-491d297a4e1d@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=joshuagloe@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox