summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-10-22 10:22:34 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-10-22 10:22:34 +0100
commitfd4457199ef604dc4d5f8346c8b2a09dc3939129 (patch)
tree32234080a437751424a79bd170f62858c1527e13 /meta/classes
parent2a69c58046a86d0f783acebd8a77e9419b43139a (diff)
downloadpoky-fd4457199ef604dc4d5f8346c8b2a09dc3939129.tar.gz
base/sstate: Add cleanall task to remove downloads and sstate cached files
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/base.bbclass28
-rw-r--r--meta/classes/sstate.bbclass21
2 files changed, 44 insertions, 5 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index aee75297eb..1547ed0305 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -621,4 +621,32 @@ def check_gcc3(data):
621 621
622 return False 622 return False
623 623
624addtask cleanall after do_clean
625python do_cleanall() {
626 sstate_clean_cachefiles(d)
627
628 localdata = bb.data.createCopy(d)
629 bb.data.update_data(localdata)
630
631 dl_dir = bb.data.getVar('DL_DIR', localdata, True)
632 dl_dir = os.path.realpath(dl_dir)
633
634 src_uri = bb.data.getVar('SRC_URI', localdata, True)
635 if not src_uri:
636 return
637 for url in src_uri.split():
638 try:
639 local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
640 except bb.MalformedUrl, e:
641 raise FuncFailed('Unable to generate local path for malformed uri: %s' % e)
642 if local is None:
643 continue
644 local = os.path.realpath(local)
645 if local.startswith(dl_dir):
646 bb.note("Removing %s*" % local)
647 oe.path.remove(local + "*")
648}
649do_cleanall[nostamp] = "1"
650
651
624EXPORT_FUNCTIONS do_setscene do_fetch do_unpack do_configure do_compile do_install do_package 652EXPORT_FUNCTIONS do_setscene do_fetch do_unpack do_configure do_compile do_install do_package
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 4a63d37d20..92c3a274f0 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -44,11 +44,12 @@ def sstate_init(name, d):
44 ss['lockfiles'] = [] 44 ss['lockfiles'] = []
45 return ss 45 return ss
46 46
47def sstate_state_fromvars(d): 47def sstate_state_fromvars(d, task = None):
48 task = bb.data.getVar('BB_CURRENTTASK', d, True) 48 if task is None:
49 if not task: 49 task = bb.data.getVar('BB_CURRENTTASK', d, True)
50 bb.fatal("sstate code running without task context?!") 50 if not task:
51 task = task.replace("_setscene", "") 51 bb.fatal("sstate code running without task context?!")
52 task = task.replace("_setscene", "")
52 53
53 name = bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-name', d), d) 54 name = bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-name', d), d)
54 inputs = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-inputdirs', d) or "", d)).split() 55 inputs = (bb.data.expand(bb.data.getVarFlag("do_" + task, 'sstate-inputdirs', d) or "", d)).split()
@@ -158,6 +159,16 @@ def sstate_installpkg(ss, d):
158 159
159 return True 160 return True
160 161
162def sstate_clean_cachefile(ss, d):
163 sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz"
164 bb.note("Removing %s" % sstatepkg)
165 oe.path.remove(sstatepkg)
166
167def sstate_clean_cachefiles(d):
168 for task in (bb.data.getVar('SSTATETASKS', d, True) or "").split():
169 ss = sstate_state_fromvars(d, task[3:])
170 sstate_clean_cachefile(ss, d)
171
161def sstate_clean_manifest(manifest, d): 172def sstate_clean_manifest(manifest, d):
162 import oe.path 173 import oe.path
163 174