summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-05-06 12:22:44 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-05-06 12:22:44 +0100
commit14196cb03190d9dac93be309763e3076385eb831 (patch)
treea3505abab79d1d44e4f59995efe5bc20074fe9bb
parent89497d8057caa4cc905ad4476d4725f285d2e1e1 (diff)
downloadpoky-14196cb03190d9dac93be309763e3076385eb831.tar.gz
base.bbclass: Sync minor layout changes with OE.dev
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--meta/classes/base.bbclass145
1 files changed, 68 insertions, 77 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 4e8ae127a7..d17f485c02 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -1,53 +1,12 @@
1BB_DEFAULT_TASK ?= "build" 1BB_DEFAULT_TASK ?= "build"
2 2
3inherit utils 3inherit patch
4 4inherit staging
5def base_dep_prepend(d):
6 #
7 # Ideally this will check a flag so we will operate properly in
8 # the case where host == build == target, for now we don't work in
9 # that case though.
10 #
11
12 deps = ""
13
14 # bb.utils.sha256_file() will return None on Python 2.4 because hashlib
15 # isn't present. In this case we use a shasum-native to checksum, so if
16 # hashlib isn't present then add shasum-native to the dependencies.
17 try:
18 import hashlib
19 except ImportError:
20 # Adding shasum-native as a dependency of shasum-native would be
21 # stupid, so don't do that.
22 if bb.data.getVar('PN', d, True) != "shasum-native":
23 deps = "shasum-native "
24
25 # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
26 # we need that built is the responsibility of the patch function / class, not
27 # the application.
28 if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d):
29 if (bb.data.getVar('HOST_SYS', d, 1) !=
30 bb.data.getVar('BUILD_SYS', d, 1)):
31 deps += " virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc "
32 return deps
33
34
35DEPENDS_prepend="${@base_dep_prepend(d)} "
36DEPENDS_virtclass-native_prepend="${@base_dep_prepend(d)} "
37DEPENDS_virtclass-nativesdk_prepend="${@base_dep_prepend(d)} "
38
39
40def base_set_filespath(path, d):
41 filespath = []
42 # The ":" ensures we have an 'empty' override
43 overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":"
44 for p in path:
45 for o in overrides.split(":"):
46 filespath.append(os.path.join(p, o))
47 return ":".join(filespath)
48
49FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}"
50 5
6inherit mirrors
7inherit utils
8inherit utility-tasks
9inherit metadata_scm
51 10
52die() { 11die() {
53 oefatal "$*" 12 oefatal "$*"
@@ -103,10 +62,59 @@ package_stagefile_shell() {
103 fi 62 fi
104} 63}
105 64
106inherit utility-tasks 65def base_dep_prepend(d):
66 #
67 # Ideally this will check a flag so we will operate properly in
68 # the case where host == build == target, for now we don't work in
69 # that case though.
70 #
71
72 deps = ""
73
74 # bb.utils.sha256_file() will return None on Python 2.4 because hashlib
75 # isn't present. In this case we use a shasum-native to checksum, so if
76 # hashlib isn't present then add shasum-native to the dependencies.
77 try:
78 import hashlib
79 except ImportError:
80 # Adding shasum-native as a dependency of shasum-native would be
81 # stupid, so don't do that.
82 if bb.data.getVar('PN', d, True) != "shasum-native":
83 deps = "shasum-native "
84
85 # INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
86 # we need that built is the responsibility of the patch function / class, not
87 # the application.
88 if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d):
89 if (bb.data.getVar('HOST_SYS', d, 1) !=
90 bb.data.getVar('BUILD_SYS', d, 1)):
91 deps += " virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc "
92 return deps
93
94DEPENDS_prepend="${@base_dep_prepend(d)} "
95DEPENDS_virtclass-native_prepend="${@base_dep_prepend(d)} "
96DEPENDS_virtclass-nativesdk_prepend="${@base_dep_prepend(d)} "
97
98
99def base_set_filespath(path, d):
100 filespath = []
101 # The ":" ensures we have an 'empty' override
102 overrides = (bb.data.getVar("OVERRIDES", d, 1) or "") + ":"
103 for p in path:
104 for o in overrides.split(":"):
105 filespath.append(os.path.join(p, o))
106 return ":".join(filespath)
107
108FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}"
107 109
108SCENEFUNCS += "base_scenefunction" 110SCENEFUNCS += "base_scenefunction"
109 111
112python base_scenefunction () {
113 stamp = bb.data.getVar('STAMP', d, 1) + ".needclean"
114 if os.path.exists(stamp):
115 bb.build.exec_func("do_clean", d)
116}
117
110python base_do_setscene () { 118python base_do_setscene () {
111 for f in (bb.data.getVar('SCENEFUNCS', d, 1) or '').split(): 119 for f in (bb.data.getVar('SCENEFUNCS', d, 1) or '').split():
112 bb.build.exec_func(f, d) 120 bb.build.exec_func(f, d)
@@ -116,13 +124,6 @@ python base_do_setscene () {
116do_setscene[selfstamp] = "1" 124do_setscene[selfstamp] = "1"
117addtask setscene before do_fetch 125addtask setscene before do_fetch
118 126
119python base_scenefunction () {
120 stamp = bb.data.getVar('STAMP', d, 1) + ".needclean"
121 if os.path.exists(stamp):
122 bb.build.exec_func("do_clean", d)
123}
124
125
126addtask fetch 127addtask fetch
127do_fetch[dirs] = "${DL_DIR}" 128do_fetch[dirs] = "${DL_DIR}"
128python base_do_fetch() { 129python base_do_fetch() {
@@ -140,6 +141,9 @@ python base_do_fetch() {
140 except bb.fetch.NoMethodError: 141 except bb.fetch.NoMethodError:
141 (type, value, traceback) = sys.exc_info() 142 (type, value, traceback) = sys.exc_info()
142 raise bb.build.FuncFailed("No method: %s" % value) 143 raise bb.build.FuncFailed("No method: %s" % value)
144 except bb.MalformedUrl:
145 (type, value, traceback) = sys.exc_info()
146 raise bb.build.FuncFailed("Malformed URL: %s" % value)
143 147
144 try: 148 try:
145 bb.fetch.go(localdata) 149 bb.fetch.go(localdata)
@@ -213,6 +217,10 @@ def oe_unpack_file(file, data, url = None):
213 cmd = 'gzip -dc %s > %s' % (file, efile) 217 cmd = 'gzip -dc %s > %s' % (file, efile)
214 elif file.endswith('.bz2'): 218 elif file.endswith('.bz2'):
215 cmd = 'bzip2 -dc %s > %s' % (file, efile) 219 cmd = 'bzip2 -dc %s > %s' % (file, efile)
220 elif file.endswith('.tar.xz'):
221 cmd = 'xz -dc %s | tar x --no-same-owner -f -' % file
222 elif file.endswith('.xz'):
223 cmd = 'xz -dc %s > %s' % (file, efile)
216 elif file.endswith('.zip') or file.endswith('.jar'): 224 elif file.endswith('.zip') or file.endswith('.jar'):
217 cmd = 'unzip -q -o' 225 cmd = 'unzip -q -o'
218 (type, host, path, user, pswd, parm) = bb.decodeurl(url) 226 (type, host, path, user, pswd, parm) = bb.decodeurl(url)
@@ -277,7 +285,6 @@ python base_do_unpack() {
277 src_uri = bb.data.getVar('SRC_URI', localdata, True) 285 src_uri = bb.data.getVar('SRC_URI', localdata, True)
278 if not src_uri: 286 if not src_uri:
279 return 287 return
280
281 for url in src_uri.split(): 288 for url in src_uri.split():
282 try: 289 try:
283 local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata) 290 local = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
@@ -289,8 +296,6 @@ python base_do_unpack() {
289 raise bb.build.FuncFailed() 296 raise bb.build.FuncFailed()
290} 297}
291 298
292inherit metadata_scm
293
294GIT_CONFIG = "${STAGING_DIR_NATIVE}/usr/etc/gitconfig" 299GIT_CONFIG = "${STAGING_DIR_NATIVE}/usr/etc/gitconfig"
295 300
296def generate_git_config(e): 301def generate_git_config(e):
@@ -315,7 +320,7 @@ def generate_git_config(e):
315addhandler base_eventhandler 320addhandler base_eventhandler
316python base_eventhandler() { 321python base_eventhandler() {
317 from bb import note, error, data 322 from bb import note, error, data
318 from bb.event import Handled, NotHandled, getName 323 from bb.event import getName
319 324
320 messages = {} 325 messages = {}
321 messages["Completed"] = "completed" 326 messages["Completed"] = "completed"
@@ -364,7 +369,7 @@ python base_eventhandler() {
364 # 369 #
365 if name.startswith("StampUpdate"): 370 if name.startswith("StampUpdate"):
366 for (fn, task) in e.targets: 371 for (fn, task) in e.targets:
367 #print "%s %s" % (task, fn) 372 #print "%s %s" % (task, fn)
368 if task == "do_rebuild": 373 if task == "do_rebuild":
369 dir = "%s.*" % e.stampPrefix[fn] 374 dir = "%s.*" % e.stampPrefix[fn]
370 bb.note("Removing stamps: " + dir) 375 bb.note("Removing stamps: " + dir)
@@ -375,15 +380,13 @@ python base_eventhandler() {
375 generate_git_config(e) 380 generate_git_config(e)
376 381
377 if not data in e.__dict__: 382 if not data in e.__dict__:
378 return NotHandled 383 return
379 384
380 log = data.getVar("EVENTLOG", e.data, 1) 385 log = data.getVar("EVENTLOG", e.data, 1)
381 if log: 386 if log:
382 logfile = file(log, "a") 387 logfile = file(log, "a")
383 logfile.write("%s\n" % msg) 388 logfile.write("%s\n" % msg)
384 logfile.close() 389 logfile.close()
385
386 return NotHandled
387} 390}
388 391
389addtask configure after do_unpack do_patch 392addtask configure after do_unpack do_patch
@@ -403,8 +406,6 @@ base_do_compile() {
403 fi 406 fi
404} 407}
405 408
406inherit staging
407
408addtask install after do_compile 409addtask install after do_compile
409do_install[dirs] = "${D} ${S} ${B}" 410do_install[dirs] = "${D} ${S} ${B}"
410# Remove and re-create ${D} so that is it guaranteed to be empty 411# Remove and re-create ${D} so that is it guaranteed to be empty
@@ -422,8 +423,7 @@ addtask build after do_populate_sysroot
422do_build = "" 423do_build = ""
423do_build[func] = "1" 424do_build[func] = "1"
424 425
425 426python () {
426def base_after_parse(d):
427 import exceptions 427 import exceptions
428 428
429 source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0) 429 source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0)
@@ -527,9 +527,6 @@ def base_after_parse(d):
527 break 527 break
528 528
529 bb.data.setVar('MULTIMACH_ARCH', multiarch, d) 529 bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
530
531python () {
532 base_after_parse(d)
533} 530}
534 531
535def check_app_exists(app, d): 532def check_app_exists(app, d):
@@ -549,10 +546,4 @@ def check_gcc3(data):
549 546
550 return False 547 return False
551 548
552# Patch handling
553inherit patch
554
555EXPORT_FUNCTIONS do_setscene do_fetch do_unpack do_configure do_compile do_install do_package 549EXPORT_FUNCTIONS do_setscene do_fetch do_unpack do_configure do_compile do_install do_package
556
557inherit mirrors
558