diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 15:42:56 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-10-07 15:42:56 +0100 |
commit | 240b6636f9619a265ab06fa4d0f61c89b3c324c8 (patch) | |
tree | 8f9195fa180566d8d9606bc6fe82e36558d1207f /meta/classes | |
parent | 24ad63979f08c13867a5d7fd489ba8368dd9ee60 (diff) | |
download | poky-240b6636f9619a265ab06fa4d0f61c89b3c324c8.tar.gz |
sstate: Fix SSTAGE_MIRRORS handling and improve example in local.conf.sample
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/sstate.bbclass | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 7f897ae54d..4a63d37d20 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -254,14 +254,18 @@ def pstaging_fetch(sstatepkg, d): | |||
254 | import bb.fetch | 254 | import bb.fetch |
255 | 255 | ||
256 | # only try and fetch if the user has configured a mirror | 256 | # only try and fetch if the user has configured a mirror |
257 | if bb.data.getVar('SSTATE_MIRROR', d) != "": | 257 | |
258 | mirrors = bb.data.getVar('SSTATE_MIRRORS', d, True) | ||
259 | if mirrors: | ||
258 | # Copy the data object and override DL_DIR and SRC_URI | 260 | # Copy the data object and override DL_DIR and SRC_URI |
259 | pd = d.createCopy() | 261 | localdata = bb.data.createCopy(d) |
260 | dldir = bb.data.expand("${SSTATE_DIR}", pd) | 262 | bb.data.update_data(localdata) |
261 | mirror = bb.data.expand("${SSTATE_MIRROR}/", pd) | 263 | |
262 | srcuri = mirror + os.path.basename(sstatepkg) | 264 | dldir = bb.data.expand("${SSTATE_DIR}", localdata) |
263 | bb.data.setVar('DL_DIR', dldir, pd) | 265 | srcuri = "file://" + os.path.basename(sstatepkg) |
264 | bb.data.setVar('SRC_URI', srcuri, pd) | 266 | bb.data.setVar('DL_DIR', dldir, localdata) |
267 | bb.data.setVar('PREMIRRORS', mirrors, localdata) | ||
268 | bb.data.setVar('SRC_URI', srcuri, localdata) | ||
265 | 269 | ||
266 | # Try a fetch from the sstate mirror, if it fails just return and | 270 | # Try a fetch from the sstate mirror, if it fails just return and |
267 | # we will build the package | 271 | # we will build the package |
@@ -269,7 +273,7 @@ def pstaging_fetch(sstatepkg, d): | |||
269 | bb.fetch.init([srcuri], pd) | 273 | bb.fetch.init([srcuri], pd) |
270 | bb.fetch.go(pd, [srcuri]) | 274 | bb.fetch.go(pd, [srcuri]) |
271 | except: | 275 | except: |
272 | return | 276 | pass |
273 | 277 | ||
274 | def sstate_setscene(d): | 278 | def sstate_setscene(d): |
275 | shared_state = sstate_state_fromvars(d) | 279 | shared_state = sstate_state_fromvars(d) |
@@ -319,6 +323,7 @@ sstate_unpack_package () { | |||
319 | BB_HASHCHECK_FUNCTION = "sstate_checkhashes" | 323 | BB_HASHCHECK_FUNCTION = "sstate_checkhashes" |
320 | 324 | ||
321 | def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d): | 325 | def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d): |
326 | |||
322 | ret = [] | 327 | ret = [] |
323 | # This needs to go away, FIXME | 328 | # This needs to go away, FIXME |
324 | mapping = { | 329 | mapping = { |
@@ -332,10 +337,39 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d): | |||
332 | 337 | ||
333 | for task in range(len(sq_fn)): | 338 | for task in range(len(sq_fn)): |
334 | sstatefile = bb.data.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz", d) | 339 | sstatefile = bb.data.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz", d) |
335 | sstatefile= sstatefile.replace("${BB_TASKHASH}", sq_hash[task]) | 340 | sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task]) |
336 | #print("Checking for %s" % sstatefile) | 341 | #print("Checking for %s" % sstatefile) |
337 | if os.path.exists(sstatefile): | 342 | if os.path.exists(sstatefile): |
338 | ret.append(task) | 343 | ret.append(task) |
344 | continue | ||
345 | |||
346 | mirrors = bb.data.getVar("SSTATE_MIRRORS", d, True) | ||
347 | if mirrors: | ||
348 | # Copy the data object and override DL_DIR and SRC_URI | ||
349 | localdata = bb.data.createCopy(d) | ||
350 | bb.data.update_data(localdata) | ||
351 | |||
352 | dldir = bb.data.expand("${SSTATE_DIR}", localdata) | ||
353 | bb.data.setVar('DL_DIR', dldir, localdata) | ||
354 | bb.data.setVar('PREMIRRORS', mirrors, localdata) | ||
355 | |||
356 | for task in range(len(sq_fn)): | ||
357 | if task in ret: | ||
358 | continue | ||
359 | |||
360 | sstatefile = bb.data.expand("${SSTATE_DIR}/" + sq_hashfn[task] + "_" + mapping[sq_task[task]] + ".tgz", d) | ||
361 | sstatefile = sstatefile.replace("${BB_TASKHASH}", sq_hash[task]) | ||
362 | |||
363 | srcuri = "file://" + os.path.basename(sstatefile) | ||
364 | bb.data.setVar('SRC_URI', srcuri, localdata) | ||
365 | bb.note(str(srcuri)) | ||
366 | |||
367 | try: | ||
368 | bb.fetch.init(srcuri.split(), d) | ||
369 | bb.fetch.checkstatus(localdata) | ||
370 | ret.append(task) | ||
371 | except: | ||
372 | pass | ||
339 | 373 | ||
340 | return ret | 374 | return ret |
341 | 375 | ||