angstrom: prefer the git version of tslib
[openembedded.git] / classes / utility-tasks.bbclass
blobce110bc503eeb6b8a56d6214efa292f4058a05d6
1 addtask listtasks
2 do_listtasks[nostamp] = "1"
3 python do_listtasks() {
4         import sys
5         # emit variables and shell functions
6         #bb.data.emit_env(sys.__stdout__, d)
7         # emit the metadata which isnt valid shell
8         for e in d.keys():
9                 if bb.data.getVarFlag(e, 'task', d):
10                         sys.__stdout__.write("%s\n" % e)
13 addtask clean
14 do_clean[dirs] = "${TOPDIR}"
15 do_clean[nostamp] = "1"
16 python do_clean() {
17         """clear the build and temp directories"""
18         dir = bb.data.expand("${WORKDIR}", d)
19         if dir == '//': raise bb.build.FuncFailed("wrong DATADIR")
20         bb.note("removing " + base_path_out(dir, d))
21         os.system('rm -rf ' + dir)
23         dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d)
24         bb.note("removing " + base_path_out(dir, d))
25         os.system('rm -f '+ dir)
28 python do_cleanall() {
29     pass
31 do_cleanall[recrdeptask] = "do_clean"
32 addtask cleanall after do_clean
34 addtask distclean
35 do_distclean[dirs] = "${TOPDIR}"
36 do_distclean[nostamp] = "1"
37 python do_distclean() {
38         """clear downloaded sources, build and temp directories"""
40         bb.build.exec_func('do_clean', d)
42         src_uri = bb.data.getVar('SRC_URI', d, 1)
43         if not src_uri:
44                 return
46         for uri in src_uri.split():
47                 if bb.decodeurl(uri)[0] == "file":
48                         continue
50                 try:
51                         local = bb.data.expand(bb.fetch.localpath(uri, d), d)
52                 except bb.MalformedUrl, e:
53                         bb.debug(1, 'Unable to generate local path for malformed uri: %s' % e)
54                 else:
55                         bb.note("removing %s" % base_path_out(local, d))
56                         try:
57                                 if os.path.exists(local + ".md5"):
58                                         os.remove(local + ".md5")
59                                 if os.path.exists(local):
60                                         os.remove(local)
61                         except OSError, e:
62                                 bb.note("Error in removal: %s" % e)
65 addtask checkuri
66 do_checkuri[nostamp] = "1"
67 python do_checkuri() {
68         import sys
70         localdata = bb.data.createCopy(d)
71         bb.data.update_data(localdata)
73         src_uri = bb.data.getVar('SRC_URI', localdata, 1)
75         try:
76                 bb.fetch.init(src_uri.split(),d)
77         except bb.fetch.NoMethodError:
78                 (type, value, traceback) = sys.exc_info()
79                 raise bb.build.FuncFailed("No method: %s" % value)
81         try:
82                 bb.fetch.checkstatus(localdata)
83         except bb.fetch.MissingParameterError:
84                 (type, value, traceback) = sys.exc_info()
85                 raise bb.build.FuncFailed("Missing parameters: %s" % value)
86         except bb.fetch.FetchError:
87                 (type, value, traceback) = sys.exc_info()
88                 raise bb.build.FuncFailed("Fetch failed: %s" % value)
89         except bb.fetch.MD5SumError:
90                 (type, value, traceback) = sys.exc_info()
91                 raise bb.build.FuncFailed("MD5  failed: %s" % value)
92         except:
93                 (type, value, traceback) = sys.exc_info()
94                 raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
97 addtask checkuriall after do_checkuri
98 do_checkuriall[recrdeptask] = "do_checkuri"
99 do_checkuriall[nostamp] = "1"
100 do_checkuriall() {
101         :
104 addtask fetchall after do_fetch
105 do_fetchall[recrdeptask] = "do_fetch"
106 do_fetchall() {
107         :
110 addtask buildall after do_build
111 do_buildall[recrdeptask] = "do_build"
112 do_buildall() {
113         :