All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Fix sstate error
@ 2011-02-11 14:01 Zhai Edwin
  2011-02-11 14:01 ` [PATCH 1/1] sstate: Fix bugs after new fetcher Zhai Edwin
  2011-02-11 14:09 ` [PATCH 0/1] Fix sstate error Richard Purdie
  0 siblings, 2 replies; 6+ messages in thread
From: Zhai Edwin @ 2011-02-11 14:01 UTC (permalink / raw)
  To: poky

From: Zhai Edwin <edwin.zhai@intel.com>

RP,
Current sstate's fetch code doesn't reflect latest fetcher changes, so old
fetch style cause exception and fail silently. This patch fix it.

Another issue is "import xxx" in python function from sstate.bbclass can only
sit in the head of the function, else have UnboundLocalError: "local variable
XXX referenced before assignment".

We don't know if it is a known limitation of *.bbclass or some potential bug.
Can you give some comments?


Thanks,
edwin


Pull URL: git://git.pokylinux.org/poky-contrib.git
  Branch: gzhai/fix2
  Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=gzhai/fix2

Thanks,
    Zhai Edwin <edwin.zhai@intel.com>
---


Zhai Edwin (1):
  sstate: Fix bugs after new fetcher

 meta/classes/sstate.bbclass |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] sstate: Fix bugs after new fetcher
  2011-02-11 14:01 [PATCH 0/1] Fix sstate error Zhai Edwin
@ 2011-02-11 14:01 ` Zhai Edwin
  2011-02-11 14:09 ` [PATCH 0/1] Fix sstate error Richard Purdie
  1 sibling, 0 replies; 6+ messages in thread
From: Zhai Edwin @ 2011-02-11 14:01 UTC (permalink / raw)
  To: poky

From: Zhai Edwin <edwin.zhai@intel.com>

Current sstate's fetch code doesn't reflect latest fetcher changes, so old
fetch style cause exception and fail silently.

[BUGID #708] got fixed.

Another issue is "import xxx" in python function from sstate.bbclass can only
sit in the head of the function, else have UnboundLocalError: "local variable
XXX referenced before assignment".

Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
---
 meta/classes/sstate.bbclass |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index e4564e4..4f1bc39 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -326,13 +326,13 @@ def sstate_package(ss, d):
     return
 
 def pstaging_fetch(sstatepkg, d):
+    import bb.fetch2
 
     # Only try and fetch if the user has configured a mirror
     mirrors = bb.data.getVar('SSTATE_MIRRORS', d, True)
     if not mirrors:
         return
 
-    import bb.fetch2
     # Copy the data object and override DL_DIR and SRC_URI
     localdata = bb.data.createCopy(d)
     bb.data.update_data(localdata)
@@ -453,8 +453,8 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d):
             #bb.note(str(srcuri))
 
             try:
-                bb.fetch.init(srcuri.split(), localdata)
-                bb.fetch.checkstatus(localdata, srcuri.split())
+                fetcher = bb.fetch2.Fetch(srcuri.split(), localdata)
+                fetcher.checkstatus()
                 ret.append(task)
             except:
                 pass     
-- 
1.6.3.3



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] Fix sstate error
  2011-02-11 14:01 [PATCH 0/1] Fix sstate error Zhai Edwin
  2011-02-11 14:01 ` [PATCH 1/1] sstate: Fix bugs after new fetcher Zhai Edwin
@ 2011-02-11 14:09 ` Richard Purdie
  2011-02-11 14:42   ` Zhai, Edwin
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2011-02-11 14:09 UTC (permalink / raw)
  To: Zhai Edwin; +Cc: poky

On Fri, 2011-02-11 at 22:01 +0800, Zhai Edwin wrote:
> From: Zhai Edwin <edwin.zhai@intel.com>
> 
> RP,
> Current sstate's fetch code doesn't reflect latest fetcher changes, so old
> fetch style cause exception and fail silently. This patch fix it.

I've merged the fix to master, thanks.

> Another issue is "import xxx" in python function from sstate.bbclass can only
> sit in the head of the function, else have UnboundLocalError: "local variable
> XXX referenced before assignment".
>
> We don't know if it is a known limitation of *.bbclass or some potential bug.
> Can you give some comments?

Good question. The import should really always be at the top of the code
block in question so I think its a python constraint, not a .bbclass
one...

Cheers,

Richard









^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] Fix sstate error
  2011-02-11 14:09 ` [PATCH 0/1] Fix sstate error Richard Purdie
@ 2011-02-11 14:42   ` Zhai, Edwin
  2011-02-11 14:54     ` Richard Purdie
  0 siblings, 1 reply; 6+ messages in thread
From: Zhai, Edwin @ 2011-02-11 14:42 UTC (permalink / raw)
  To: Richard Purdie; +Cc: poky



Richard Purdie wrote:
>
> On Fri, 2011-02-11 at 22:01 +0800, Zhai Edwin wrote:
> > From: Zhai Edwin <edwin.zhai@intel.com>
> >
> > RP,
> > Current sstate's fetch code doesn't reflect latest fetcher changes, 
> so old
> > fetch style cause exception and fail silently. This patch fix it.
>
> I've merged the fix to master, thanks.
>
> > Another issue is "import xxx" in python function from sstate.bbclass 
> can only
> > sit in the head of the function, else have UnboundLocalError: "local 
> variable
> > XXX referenced before assignment".
> >
> > We don't know if it is a known limitation of *.bbclass or some 
> potential bug.
> > Can you give some comments?
>
> Good question. The import should really always be at the top of the code
> block in question so I think its a python constraint, not a .bbclass
> one...
>

Seems in-middle "import" is widely used in other *.py,
See bitbake/lib/bb/fetch/ssh.py,
    def go(self, url, urldata, d):
..........................
        import commands
        cmd = 'scp -B -r %s %s %s/' % (
            port,
            commands.mkarg(fr),
            commands.mkarg(ldir)
        )

I found only bb has such limitation:all the "import bb.xxx" are in the 
head of function, and adding stuff before it will cause same problem. 
Anything special for bb module?

> Cheers,
>
> Richard
>
>
>
>
>
>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] Fix sstate error
  2011-02-11 14:42   ` Zhai, Edwin
@ 2011-02-11 14:54     ` Richard Purdie
  2011-02-12  0:20       ` Zhai, Edwin
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Purdie @ 2011-02-11 14:54 UTC (permalink / raw)
  To: Zhai, Edwin; +Cc: poky

On Fri, 2011-02-11 at 22:42 +0800, Zhai, Edwin wrote:
> Richard Purdie wrote:
> > Good question. The import should really always be at the top of the code
> > block in question so I think its a python constraint, not a .bbclass
> > one...
> >
> 
> Seems in-middle "import" is widely used in other *.py,
> See bitbake/lib/bb/fetch/ssh.py,
>     def go(self, url, urldata, d):
> ..........................
>         import commands
>         cmd = 'scp -B -r %s %s %s/' % (
>             port,
>             commands.mkarg(fr),
>             commands.mkarg(ldir)
>         )
> 
> I found only bb has such limitation:all the "import bb.xxx" are in the 
> head of function, and adding stuff before it will cause same problem. 
> Anything special for bb module?

Is it just specific to the way we hacked the fetch vs fetch2 switch in?

Also, are you saying this problem only happens in parsed python in
the .bb and .bbclass files or that it happens in the bitbake code in
general?

Cheers,

Richard



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/1] Fix sstate error
  2011-02-11 14:54     ` Richard Purdie
@ 2011-02-12  0:20       ` Zhai, Edwin
  0 siblings, 0 replies; 6+ messages in thread
From: Zhai, Edwin @ 2011-02-12  0:20 UTC (permalink / raw)
  To: Richard Purdie; +Cc: poky



Richard Purdie wrote:
>
> On Fri, 2011-02-11 at 22:42 +0800, Zhai, Edwin wrote:
> > Richard Purdie wrote:
> > > Good question. The import should really always be at the top of 
> the code
> > > block in question so I think its a python constraint, not a .bbclass
> > > one...
> > >
> >
> > Seems in-middle "import" is widely used in other *.py,
> > See bitbake/lib/bb/fetch/ssh.py,
> >     def go(self, url, urldata, d):
> > ..........................
> >         import commands
> >         cmd = 'scp -B -r %s %s %s/' % (
> >             port,
> >             commands.mkarg(fr),
> >             commands.mkarg(ldir)
> >         )
> >
> > I found only bb has such limitation:all the "import bb.xxx" are in the
> > head of function, and adding stuff before it will cause same problem.
> > Anything special for bb module?
>
> Is it just specific to the way we hacked the fetch vs fetch2 switch in?
>
> Also, are you saying this problem only happens in parsed python in
> the .bb and .bbclass files or that it happens in the bitbake code in
> general?
>

Also in bitbake code like bitbake/lib/bb/utils.py.

> Cheers,
>
> Richard
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-12  0:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-11 14:01 [PATCH 0/1] Fix sstate error Zhai Edwin
2011-02-11 14:01 ` [PATCH 1/1] sstate: Fix bugs after new fetcher Zhai Edwin
2011-02-11 14:09 ` [PATCH 0/1] Fix sstate error Richard Purdie
2011-02-11 14:42   ` Zhai, Edwin
2011-02-11 14:54     ` Richard Purdie
2011-02-12  0:20       ` Zhai, Edwin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.