summaryrefslogtreecommitdiffstats
path: root/meta/classes/utility-tasks.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-03-19 23:12:06 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2010-03-19 23:12:06 +0000
commit9c5386c1fd74d832cf6e2acad3c69b1cc90de6b2 (patch)
treeaa2db23da10e883f0f8627f5993cd2cfade2e705 /meta/classes/utility-tasks.bbclass
parent185cb38f1319856b4bdaaf4d9a73b5056be53d54 (diff)
downloadpoky-9c5386c1fd74d832cf6e2acad3c69b1cc90de6b2.tar.gz
base.bbclass: Split up as per the patch in OE.dev by Chris Larson making code more readable and modularised
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/classes/utility-tasks.bbclass')
-rw-r--r--meta/classes/utility-tasks.bbclass97
1 files changed, 97 insertions, 0 deletions
diff --git a/meta/classes/utility-tasks.bbclass b/meta/classes/utility-tasks.bbclass
new file mode 100644
index 0000000000..d4d47bfa42
--- /dev/null
+++ b/meta/classes/utility-tasks.bbclass
@@ -0,0 +1,97 @@
1addtask listtasks
2do_listtasks[nostamp] = "1"
3python 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)
11}
12
13addtask clean
14do_clean[dirs] = "${TOPDIR}"
15do_clean[nostamp] = "1"
16python base_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 " + dir)
21 os.system('rm -rf ' + dir)
22
23 dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d)
24 bb.note("removing " + dir)
25 os.system('rm -f '+ dir)
26}
27
28addtask rebuild after do_${BB_DEFAULT_TASK}
29do_rebuild[dirs] = "${TOPDIR}"
30do_rebuild[nostamp] = "1"
31python base_do_rebuild() {
32 """rebuild a package"""
33}
34
35#addtask mrproper
36#do_mrproper[dirs] = "${TOPDIR}"
37#do_mrproper[nostamp] = "1"
38#python base_do_mrproper() {
39# """clear downloaded sources, build and temp directories"""
40# dir = bb.data.expand("${DL_DIR}", d)
41# if dir == '/': bb.build.FuncFailed("wrong DATADIR")
42# bb.debug(2, "removing " + dir)
43# os.system('rm -rf ' + dir)
44# bb.build.exec_func('do_clean', d)
45#}
46
47addtask checkuri
48do_checkuri[nostamp] = "1"
49python do_checkuri() {
50 import sys
51
52 localdata = bb.data.createCopy(d)
53 bb.data.update_data(localdata)
54
55 src_uri = bb.data.getVar('SRC_URI', localdata, 1)
56
57 try:
58 bb.fetch.init(src_uri.split(),d)
59 except bb.fetch.NoMethodError:
60 (type, value, traceback) = sys.exc_info()
61 raise bb.build.FuncFailed("No method: %s" % value)
62
63 try:
64 bb.fetch.checkstatus(localdata)
65 except bb.fetch.MissingParameterError:
66 (type, value, traceback) = sys.exc_info()
67 raise bb.build.FuncFailed("Missing parameters: %s" % value)
68 except bb.fetch.FetchError:
69 (type, value, traceback) = sys.exc_info()
70 raise bb.build.FuncFailed("Fetch failed: %s" % value)
71 except bb.fetch.MD5SumError:
72 (type, value, traceback) = sys.exc_info()
73 raise bb.build.FuncFailed("MD5 failed: %s" % value)
74 except:
75 (type, value, traceback) = sys.exc_info()
76 raise bb.build.FuncFailed("Unknown fetch Error: %s" % value)
77}
78
79addtask checkuriall after do_checkuri
80do_checkuriall[recrdeptask] = "do_checkuri"
81do_checkuriall[nostamp] = "1"
82base_do_checkuriall() {
83 :
84}
85
86addtask fetchall after do_fetch
87do_fetchall[recrdeptask] = "do_fetch"
88base_do_fetchall() {
89 :
90}
91
92addtask buildall after do_build
93do_buildall[recrdeptask] = "do_build"
94base_do_buildall() {
95 :
96}
97