]> code.ossystems Code Review - openembedded-core.git/commitdiff
sstate: Fix bugs after new fetcher
authorZhai Edwin <edwin.zhai@intel.com>
Fri, 11 Feb 2011 13:55:07 +0000 (21:55 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 11 Feb 2011 14:07:49 +0000 (14:07 +0000)
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

index e4564e4b0716c828579b946b943a4142aad7454e..4f1bc39e7a9fe208de1a453ad66cdee5f4cd4cf5 100644 (file)
@@ -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