diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-04 13:20:28 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 09:06:37 +0000 |
commit | 984e90f4d71d866580131c4927b0a77baf1bb9bd (patch) | |
tree | adfe717341c87f2719990a962951492b65c03c1c /meta/classes/sstate.bbclass | |
parent | ca7adf75295c2a6041b891bfa61e0b4bc2f7c860 (diff) | |
download | poky-984e90f4d71d866580131c4927b0a77baf1bb9bd.tar.gz |
meta/classes: Update classes to use new fetcher API
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r-- | meta/classes/sstate.bbclass | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index a754821c08..e4564e4b07 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -326,40 +326,40 @@ def sstate_package(ss, d): | |||
326 | return | 326 | return |
327 | 327 | ||
328 | def pstaging_fetch(sstatepkg, d): | 328 | def pstaging_fetch(sstatepkg, d): |
329 | import bb.fetch | ||
330 | |||
331 | # only try and fetch if the user has configured a mirror | ||
332 | 329 | ||
330 | # Only try and fetch if the user has configured a mirror | ||
333 | mirrors = bb.data.getVar('SSTATE_MIRRORS', d, True) | 331 | mirrors = bb.data.getVar('SSTATE_MIRRORS', d, True) |
334 | if mirrors: | 332 | if not mirrors: |
335 | # Copy the data object and override DL_DIR and SRC_URI | 333 | return |
336 | localdata = bb.data.createCopy(d) | ||
337 | bb.data.update_data(localdata) | ||
338 | 334 | ||
339 | dldir = bb.data.expand("${SSTATE_DIR}", localdata) | 335 | import bb.fetch2 |
340 | srcuri = "file://" + os.path.basename(sstatepkg) | 336 | # Copy the data object and override DL_DIR and SRC_URI |
337 | localdata = bb.data.createCopy(d) | ||
338 | bb.data.update_data(localdata) | ||
341 | 339 | ||
342 | bb.mkdirhier(dldir) | 340 | dldir = bb.data.expand("${SSTATE_DIR}", localdata) |
341 | srcuri = "file://" + os.path.basename(sstatepkg) | ||
343 | 342 | ||
344 | bb.data.setVar('DL_DIR', dldir, localdata) | 343 | bb.mkdirhier(dldir) |
345 | bb.data.setVar('PREMIRRORS', mirrors, localdata) | ||
346 | bb.data.setVar('SRC_URI', srcuri, localdata) | ||
347 | 344 | ||
348 | # Try a fetch from the sstate mirror, if it fails just return and | 345 | bb.data.setVar('DL_DIR', dldir, localdata) |
349 | # we will build the package | 346 | bb.data.setVar('PREMIRRORS', mirrors, localdata) |
350 | try: | 347 | bb.data.setVar('SRC_URI', srcuri, localdata) |
351 | bb.fetch.init([srcuri], localdata) | 348 | |
352 | if bb.fetch.__version__ == "1": | 349 | # Try a fetch from the sstate mirror, if it fails just return and |
353 | bb.fetch.go(localdata, [srcuri]) | 350 | # we will build the package |
354 | else: | 351 | try: |
355 | bb.fetch.download(localdata, [srcuri]) | 352 | fetcher = bb.fetch2.Fetch([srcuri], localdata) |
356 | # Need to optimise this, if using file:// urls, the fetcher just changes the local path | 353 | fetcher.download() |
357 | # For now work around by symlinking | 354 | |
358 | localpath = bb.data.expand(bb.fetch.localpath(srcuri, localdata), localdata) | 355 | # Need to optimise this, if using file:// urls, the fetcher just changes the local path |
359 | if localpath != sstatepkg and os.path.exists(localpath): | 356 | # For now work around by symlinking |
360 | os.symlink(localpath, sstatepkg) | 357 | localpath = bb.data.expand(fetcher.localpath(srcuri), localdata) |
361 | except: | 358 | if localpath != sstatepkg and os.path.exists(localpath) and not os.path.exists(sstatepkg): |
362 | pass | 359 | os.symlink(localpath, sstatepkg) |
360 | |||
361 | except bb.fetch2.BBFetchException: | ||
362 | pass | ||
363 | 363 | ||
364 | def sstate_setscene(d): | 364 | def sstate_setscene(d): |
365 | shared_state = sstate_state_fromvars(d) | 365 | shared_state = sstate_state_fromvars(d) |