Patchwork [bitbake-devel,8/8] Hob: Set empty DISTRO if "defaultsetup" is selected

login
register
mail settings
Submitter Dongxiao Xu
Date March 24, 2012, 5:47 a.m.
Message ID <a8df5fb9f370eb9024df8ff73b23f9c963c18377.1332567775.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/24445/
State New
Headers show

Comments

Dongxiao Xu - March 24, 2012, 5:47 a.m.
In Hob advanced setting, if "defaultsetup" is selected, we need to set
empty to DISTRO variable in bitbake server.

Otherwise, defaultsetup.conf will be parsed twice, causing TMPDIR and
its related variables mess up.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/hobeventhandler.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Richard Purdie - March 24, 2012, 10:20 a.m.
On Sat, 2012-03-24 at 13:47 +0800, Dongxiao Xu wrote:
> In Hob advanced setting, if "defaultsetup" is selected, we need to set
> empty to DISTRO variable in bitbake server.
> 
> Otherwise, defaultsetup.conf will be parsed twice, causing TMPDIR and
> its related variables mess up.
> 
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  lib/bb/ui/crumbs/hobeventhandler.py |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
> index 4b8aabc..a98a0bb 100644
> --- a/lib/bb/ui/crumbs/hobeventhandler.py
> +++ b/lib/bb/ui/crumbs/hobeventhandler.py
> @@ -274,6 +274,8 @@ class HobHandler(gobject.GObject):
>          self.server.runCommand(["setVariable", "IMAGE_FSTYPES", " ".join(image_fstypes).lstrip(" ")])
>  
>      def set_distro(self, distro):
> +        if distro == "defaultsetup":
> +            distro = ""
>          self.server.runCommand(["setVariable", "DISTRO", distro])
>  
>      def set_package_format(self, format):

This worries me a little since you're doing something different to what
the usual case would be (DISTRO not set at all). Is there not a way we
can not set DISTRO at all so we ensure we're consistent?

What I'd like to avoid is a set of "hob-only" bugs caused by doing
things slightly differently.

Cheers,

Richard
Dongxiao Xu - March 24, 2012, 11:09 a.m.
On Sat, 2012-03-24 at 10:20 +0000, Richard Purdie wrote:
> On Sat, 2012-03-24 at 13:47 +0800, Dongxiao Xu wrote:
> > In Hob advanced setting, if "defaultsetup" is selected, we need to set
> > empty to DISTRO variable in bitbake server.
> > 
> > Otherwise, defaultsetup.conf will be parsed twice, causing TMPDIR and
> > its related variables mess up.
> > 
> > Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> > ---
> >  lib/bb/ui/crumbs/hobeventhandler.py |    2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
> > index 4b8aabc..a98a0bb 100644
> > --- a/lib/bb/ui/crumbs/hobeventhandler.py
> > +++ b/lib/bb/ui/crumbs/hobeventhandler.py
> > @@ -274,6 +274,8 @@ class HobHandler(gobject.GObject):
> >          self.server.runCommand(["setVariable", "IMAGE_FSTYPES", " ".join(image_fstypes).lstrip(" ")])
> >  
> >      def set_distro(self, distro):
> > +        if distro == "defaultsetup":
> > +            distro = ""
> >          self.server.runCommand(["setVariable", "DISTRO", distro])
> >  
> >      def set_package_format(self, format):
> 
> This worries me a little since you're doing something different to what
> the usual case would be (DISTRO not set at all). Is there not a way we
> can not set DISTRO at all so we ensure we're consistent?
> 
> What I'd like to avoid is a set of "hob-only" bugs caused by doing
> things slightly differently.

The logic should be:

   def set_distro(self, distro):
       if distro != "defaultsetup":
           self.server.runCommand(["setVariable", "DISTRO", distro])

Do you think this is reasonable?

Thanks,
Dongxiao

> 
> Cheers,
> 
> Richard
> 
> 
>
Richard Purdie - March 24, 2012, 11:40 a.m.
On Sat, 2012-03-24 at 19:09 +0800, Xu, Dongxiao wrote:
> On Sat, 2012-03-24 at 10:20 +0000, Richard Purdie wrote:
> > On Sat, 2012-03-24 at 13:47 +0800, Dongxiao Xu wrote:
> > > In Hob advanced setting, if "defaultsetup" is selected, we need to set
> > > empty to DISTRO variable in bitbake server.
> > > 
> > > Otherwise, defaultsetup.conf will be parsed twice, causing TMPDIR and
> > > its related variables mess up.
> > > 
> > > Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> > > ---
> > >  lib/bb/ui/crumbs/hobeventhandler.py |    2 ++
> > >  1 files changed, 2 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
> > > index 4b8aabc..a98a0bb 100644
> > > --- a/lib/bb/ui/crumbs/hobeventhandler.py
> > > +++ b/lib/bb/ui/crumbs/hobeventhandler.py
> > > @@ -274,6 +274,8 @@ class HobHandler(gobject.GObject):
> > >          self.server.runCommand(["setVariable", "IMAGE_FSTYPES", " ".join(image_fstypes).lstrip(" ")])
> > >  
> > >      def set_distro(self, distro):
> > > +        if distro == "defaultsetup":
> > > +            distro = ""
> > >          self.server.runCommand(["setVariable", "DISTRO", distro])
> > >  
> > >      def set_package_format(self, format):
> > 
> > This worries me a little since you're doing something different to what
> > the usual case would be (DISTRO not set at all). Is there not a way we
> > can not set DISTRO at all so we ensure we're consistent?
> > 
> > What I'd like to avoid is a set of "hob-only" bugs caused by doing
> > things slightly differently.
> 
> The logic should be:
> 
>    def set_distro(self, distro):
>        if distro != "defaultsetup":
>            self.server.runCommand(["setVariable", "DISTRO", distro])
> 
> Do you think this is reasonable?

Yes, I'm happier with that.

Cheers,

Richard

Patch

diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 4b8aabc..a98a0bb 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -274,6 +274,8 @@  class HobHandler(gobject.GObject):
         self.server.runCommand(["setVariable", "IMAGE_FSTYPES", " ".join(image_fstypes).lstrip(" ")])
 
     def set_distro(self, distro):
+        if distro == "defaultsetup":
+            distro = ""
         self.server.runCommand(["setVariable", "DISTRO", distro])
 
     def set_package_format(self, format):