nm-applet: fix some buildproblems
[openembedded.git] / classes / clean.bbclass
blob65c1ab5d76a7c56e8b0c10a2f772836ec7111d9e
1 def clean_builddir(d):
2         from shutil import rmtree
4         builddir = d.getVar("B", True)
5         srcdir = d.getVar("S", True)
6         if builddir != srcdir:
7                 rmtree(builddir, ignore_errors=True)
9 def clean_stamps(d):
10         from glob import glob
11         from bb import note
12         from bb.data import expand
13         from os import unlink
15         note("Removing stamps")
16         for stamp in glob(expand('${STAMP}.*', d)):
17                 try:
18                         unlink(stamp)
19                 except OSError:
20                         pass
22 def clean_workdir(d):
23         from shutil import rmtree
24         from bb import note
26         workdir = d.getVar("WORKDIR", 1)
27         note("Removing %s" % workdir)
28         rmtree(workdir, ignore_errors=True)
30 def clean_git(d):
31         from subprocess import call
33         call(["git", "clean", "-d", "-f", "-X"], cwd=d.getVar("S", True))
35 def clean_make(d):
36         import bb
38         bb.note("Running make clean")
39         try:
40                 bb.build.exec_func("__do_clean_make", d)
41         except bb.build.FuncFailed:
42                 pass
44 __do_clean_make () {
45         oe_runmake clean
48 python do_clean () {
49         clean_stamps(d)
50         clean_workdir(d)
51         clean_builddir(d)
52         clean_make(d)