From fd4457199ef604dc4d5f8346c8b2a09dc3939129 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 22 Oct 2010 10:22:34 +0100 Subject: base/sstate: Add cleanall task to remove downloads and sstate cached files Signed-off-by: Richard Purdie --- meta/classes/base.bbclass | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'meta/classes/base.bbclass') 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): return False +addtask cleanall after do_clean +python do_cleanall() { + sstate_clean_cachefiles(d) + + localdata = bb.data.createCopy(d) + bb.data.update_data(localdata) + + dl_dir = bb.data.getVar('DL_DIR', localdata, True) + dl_dir = os.path.realpath(dl_dir) + + src_uri = bb.data.getVar('SRC_URI', localdata, True) + if not src_uri: + return + for url in src_uri.split(): + try: + local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) + except bb.MalformedUrl, e: + raise FuncFailed('Unable to generate local path for malformed uri: %s' % e) + if local is None: + continue + local = os.path.realpath(local) + if local.startswith(dl_dir): + bb.note("Removing %s*" % local) + oe.path.remove(local + "*") +} +do_cleanall[nostamp] = "1" + + EXPORT_FUNCTIONS do_setscene do_fetch do_unpack do_configure do_compile do_install do_package -- cgit v1.2.3-54-g00ecf