summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard@openedhand.com>2006-11-20 09:16:34 +0000
committerRichard Purdie <richard@openedhand.com>2006-11-20 09:16:34 +0000
commit8aee6b32a09dbbce304018f169eb6623182622c5 (patch)
tree24f1f9de0d57e15e126e840c6905805cbf9386a6 /meta
parent8174ba42226d2e590879c0adb03272c35b1b9946 (diff)
downloadpoky-8aee6b32a09dbbce304018f169eb6623182622c5.tar.gz
classes: Standardise whitespace in anonymous python methods and factor out functions for more efficent use by bitbake (as also patched in OE)
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@875 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/base.bbclass92
-rw-r--r--meta/classes/ccache.inc6
-rw-r--r--meta/classes/ccdv.bbclass12
-rw-r--r--meta/classes/flow-lossage.bbclass4
-rw-r--r--meta/classes/gettext.bbclass18
-rw-r--r--meta/classes/multimachine.bbclass29
-rw-r--r--meta/classes/update-alternatives.bbclass12
-rw-r--r--meta/classes/update-rc.d.bbclass70
8 files changed, 132 insertions, 111 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 299bf7bee2..d8853e5464 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -666,52 +666,56 @@ python read_subpackage_metadata () {
666 bb.data.setVar(key, sdata[key], d) 666 bb.data.setVar(key, sdata[key], d)
667} 667}
668 668
669python __anonymous () { 669def base_after_parse_two(d):
670 import exceptions 670 import bb
671 need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1) 671 import exceptions
672 if need_host: 672 need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
673 import re 673 if need_host:
674 this_host = bb.data.getVar('HOST_SYS', d, 1) 674 import re
675 if not re.match(need_host, this_host): 675 this_host = bb.data.getVar('HOST_SYS', d, 1)
676 raise bb.parse.SkipPackage("incompatible with host %s" % this_host) 676 if not re.match(need_host, this_host):
677 677 raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
678 need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1) 678
679 if need_machine: 679 need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
680 import re 680 if need_machine:
681 this_machine = bb.data.getVar('MACHINE', d, 1) 681 import re
682 if this_machine and not re.match(need_machine, this_machine): 682 this_machine = bb.data.getVar('MACHINE', d, 1)
683 raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine) 683 if this_machine and not re.match(need_machine, this_machine):
684 684 raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
685 pn = bb.data.getVar('PN', d, 1) 685
686 686 pn = bb.data.getVar('PN', d, 1)
687 srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1) 687
688 if srcdate != None: 688 srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
689 bb.data.setVar('SRCDATE', srcdate, d) 689 if srcdate != None:
690 690 bb.data.setVar('SRCDATE', srcdate, d)
691 use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1) 691
692 if use_nls != None: 692 use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
693 bb.data.setVar('USE_NLS', use_nls, d) 693 if use_nls != None:
694} 694 bb.data.setVar('USE_NLS', use_nls, d)
695
696def base_after_parse(d):
697 import bb, os
698 mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1)
699 old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1)
700 if (old_arch == mach_arch):
701 # Nothing to do
702 return
703 if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'):
704 return
705 paths = []
706 for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]:
707 paths.append(bb.data.expand(os.path.join(p, mach_arch), d))
708 for s in bb.data.getVar('SRC_URI', d, 1).split():
709 local = bb.data.expand(bb.fetch.localpath(s, d), d)
710 for mp in paths:
711 if local.startswith(mp):
712 #bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch))
713 bb.data.setVar('PACKAGE_ARCH', mach_arch, d)
714 return
695 715
696python () { 716python () {
697 import bb, os 717 base_after_parse_two(d)
698 mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1) 718 base_after_parse(d)
699 old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1)
700 if (old_arch == mach_arch):
701 # Nothing to do
702 return
703 if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'):
704 return
705 paths = []
706 for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]:
707 paths.append(bb.data.expand(os.path.join(p, mach_arch), d))
708 for s in bb.data.getVar('SRC_URI', d, 1).split():
709 local = bb.data.expand(bb.fetch.localpath(s, d), d)
710 for mp in paths:
711 if local.startswith(mp):
712# bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch))
713 bb.data.setVar('PACKAGE_ARCH', mach_arch, d)
714 return
715} 719}
716 720
717# Patch handling 721# Patch handling
diff --git a/meta/classes/ccache.inc b/meta/classes/ccache.inc
index 5e9356104b..d830a1b8fe 100644
--- a/meta/classes/ccache.inc
+++ b/meta/classes/ccache.inc
@@ -5,7 +5,7 @@
5CCACHE_DIR_TARGET = "${TMPDIR}/ccache" 5CCACHE_DIR_TARGET = "${TMPDIR}/ccache"
6 6
7python () { 7python () {
8 if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d): 8 if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
9 bb.data.setVar('CCACHE_DIR', '${CCACHE_DIR_TARGET}', d) 9 bb.data.setVar('CCACHE_DIR', '${CCACHE_DIR_TARGET}', d)
10 bb.data.setVarFlag('CCACHE_DIR', 'export', '1', d) 10 bb.data.setVarFlag('CCACHE_DIR', 'export', '1', d)
11} 11}
diff --git a/meta/classes/ccdv.bbclass b/meta/classes/ccdv.bbclass
index edd151ef8c..a28ea672e5 100644
--- a/meta/classes/ccdv.bbclass
+++ b/meta/classes/ccdv.bbclass
@@ -1,10 +1,10 @@
1python () { 1python () {
2 if bb.data.getVar('PN', d, 1) in ['ccdv-native']: 2 if bb.data.getVar('PN', d, 1) in ['ccdv-native']:
3 if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1): 3 if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
4 bb.data.setVar("DEPENDS", '%s %s' % ("ccdv-native", bb.data.getVar("DEPENDS", d, 1) or ""), d) 4 bb.data.setVar("DEPENDS", '%s %s' % ("ccdv-native", bb.data.getVar("DEPENDS", d, 1) or ""), d)
5 bb.data.setVar("CC", '%s %s' % ("ccdv", bb.data.getVar("CC", d, 1) or ""), d) 5 bb.data.setVar("CC", '%s %s' % ("ccdv", bb.data.getVar("CC", d, 1) or ""), d)
6 bb.data.setVar("BUILD_CC", '%s %s' % ("ccdv", bb.data.getVar("BUILD_CC", d, 1) or ""), d) 6 bb.data.setVar("BUILD_CC", '%s %s' % ("ccdv", bb.data.getVar("BUILD_CC", d, 1) or ""), d)
7 bb.data.setVar("CCLD", '%s %s' % ("ccdv", bb.data.getVar("CCLD", d, 1) or ""), d) 7 bb.data.setVar("CCLD", '%s %s' % ("ccdv", bb.data.getVar("CCLD", d, 1) or ""), d)
8} 8}
9 9
10def quiet_libtool(bb,d): 10def quiet_libtool(bb,d):
diff --git a/meta/classes/flow-lossage.bbclass b/meta/classes/flow-lossage.bbclass
index 3e841e3cae..00e6bf0257 100644
--- a/meta/classes/flow-lossage.bbclass
+++ b/meta/classes/flow-lossage.bbclass
@@ -1,5 +1,5 @@
1# gcc-3.4 blows up in gtktext with -frename-registers on arm-linux 1# gcc-3.4 blows up in gtktext with -frename-registers on arm-linux
2python () { 2python () {
3 cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '') 3 cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '')
4 bb.data.setVar('CFLAGS', cflags, d) 4 bb.data.setVar('CFLAGS', cflags, d)
5} 5}
diff --git a/meta/classes/gettext.bbclass b/meta/classes/gettext.bbclass
index 3785f5acd3..a1e00e72c1 100644
--- a/meta/classes/gettext.bbclass
+++ b/meta/classes/gettext.bbclass
@@ -1,11 +1,15 @@
1def gettext_after_parse(d):
2 import bb
3 # Remove the NLS bits if USE_NLS is no.
4 if bb.data.getVar('USE_NLS', d, 1) == 'no':
5 cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
6 cfg += " --disable-nls"
7 depends = bb.data.getVar('DEPENDS', d, 1) or ""
8 bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d)
9 bb.data.setVar('EXTRA_OECONF', cfg, d)
10
1python () { 11python () {
2 # Remove the NLS bits if USE_NLS is no. 12 gettext_after_parse(d)
3 if bb.data.getVar('USE_NLS', d, 1) == 'no':
4 cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
5 cfg += " --disable-nls"
6 depends = bb.data.getVar('DEPENDS', d, 1) or ""
7 bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d)
8 bb.data.setVar('EXTRA_OECONF', cfg, d)
9} 13}
10 14
11DEPENDS =+ "gettext-native" 15DEPENDS =+ "gettext-native"
diff --git a/meta/classes/multimachine.bbclass b/meta/classes/multimachine.bbclass
index 4359d6c669..0bd6abe419 100644
--- a/meta/classes/multimachine.bbclass
+++ b/meta/classes/multimachine.bbclass
@@ -4,19 +4,24 @@ STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_ARCH}-${TARGET_OS}/kernel"
4 4
5# Find any machine specific sub packages and if present, mark the 5# Find any machine specific sub packages and if present, mark the
6# whole package as machine specific for multimachine purposes. 6# whole package as machine specific for multimachine purposes.
7python __anonymous () {
8 packages = bb.data.getVar('PACKAGES', d, 1).split()
9 macharch = bb.data.getVar('MACHINE_ARCH', d, 1)
10 multiarch = bb.data.getVar('PACKAGE_ARCH', d, 1)
11 7
12 for pkg in packages: 8def multi_machine_after_parse(d):
13 pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1) 9 import bb
10 packages = bb.data.getVar('PACKAGES', d, 1).split()
11 macharch = bb.data.getVar('MACHINE_ARCH', d, 1)
12 multiarch = bb.data.getVar('PACKAGE_ARCH', d, 1)
13
14 for pkg in packages:
15 pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1)
14 16
15 # We could look for != PACKAGE_ARCH here but how to choose 17 # We could look for != PACKAGE_ARCH here but how to choose
16 # if multiple differences are present? 18 # if multiple differences are present?
17 # Look through PACKAGE_ARCHS for the priority order? 19 # Look through PACKAGE_ARCHS for the priority order?
18 if pkgarch and pkgarch == macharch: 20 if pkgarch and pkgarch == macharch:
19 multiarch = macharch 21 multiarch = macharch
20 22
21 bb.data.setVar('MULTIMACH_ARCH', multiarch, d) 23 bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
24
25python __anonymous () {
26 multi_machine_after_parse(d)
22} 27}
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index 6b2b547d5f..c63581c5d1 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -10,11 +10,15 @@ update_alternatives_postrm() {
10update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH} 10update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH}
11} 11}
12 12
13def update_alternatives_after_parse(d):
14 import bb
15 if bb.data.getVar('ALTERNATIVE_NAME', d) == None:
16 raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d)
17 if bb.data.getVar('ALTERNATIVE_PATH', d) == None:
18 raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d)
19
13python __anonymous() { 20python __anonymous() {
14 if bb.data.getVar('ALTERNATIVE_NAME', d) == None: 21 update_alternatives_after_parse(d)
15 raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d)
16 if bb.data.getVar('ALTERNATIVE_PATH', d) == None:
17 raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d)
18} 22}
19 23
20python populate_packages_prepend () { 24python populate_packages_prepend () {
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 0bfba467c1..df0d62c2c5 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -26,44 +26,48 @@ updatercd_postrm() {
26update-rc.d $D ${INITSCRIPT_NAME} remove 26update-rc.d $D ${INITSCRIPT_NAME} remove
27} 27}
28 28
29def update_rc_after_parse(d):
30 import bb
31 if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None:
32 if bb.data.getVar('INITSCRIPT_NAME', d) == None:
33 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
34 if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
35 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
36
29python __anonymous() { 37python __anonymous() {
30 if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None: 38 update_rc_after_parse(d)
31 if bb.data.getVar('INITSCRIPT_NAME', d) == None:
32 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
33 if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
34 raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
35} 39}
36 40
37python populate_packages_prepend () { 41python populate_packages_prepend () {
38 def update_rcd_package(pkg): 42 def update_rcd_package(pkg):
39 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg) 43 bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
40 localdata = bb.data.createCopy(d) 44 localdata = bb.data.createCopy(d)
41 overrides = bb.data.getVar("OVERRIDES", localdata, 1) 45 overrides = bb.data.getVar("OVERRIDES", localdata, 1)
42 bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata) 46 bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata)
43 bb.data.update_data(localdata) 47 bb.data.update_data(localdata)
44 48
45 postinst = bb.data.getVar('pkg_postinst', localdata, 1) 49 postinst = bb.data.getVar('pkg_postinst', localdata, 1)
46 if not postinst: 50 if not postinst:
47 postinst = '#!/bin/sh\n' 51 postinst = '#!/bin/sh\n'
48 postinst += bb.data.getVar('updatercd_postinst', localdata, 1) 52 postinst += bb.data.getVar('updatercd_postinst', localdata, 1)
49 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d) 53 bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
50 prerm = bb.data.getVar('pkg_prerm', localdata, 1) 54 prerm = bb.data.getVar('pkg_prerm', localdata, 1)
51 if not prerm: 55 if not prerm:
52 prerm = '#!/bin/sh\n' 56 prerm = '#!/bin/sh\n'
53 prerm += bb.data.getVar('updatercd_prerm', localdata, 1) 57 prerm += bb.data.getVar('updatercd_prerm', localdata, 1)
54 bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d) 58 bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
55 postrm = bb.data.getVar('pkg_postrm', localdata, 1) 59 postrm = bb.data.getVar('pkg_postrm', localdata, 1)
56 if not postrm: 60 if not postrm:
57 postrm = '#!/bin/sh\n' 61 postrm = '#!/bin/sh\n'
58 postrm += bb.data.getVar('updatercd_postrm', localdata, 1) 62 postrm += bb.data.getVar('updatercd_postrm', localdata, 1)
59 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d) 63 bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
60 64
61 pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1) 65 pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1)
62 if pkgs == None: 66 if pkgs == None:
63 pkgs = bb.data.getVar('PN', d, 1) 67 pkgs = bb.data.getVar('PN', d, 1)
64 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split() 68 packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
65 if not pkgs in packages and packages != []: 69 if not pkgs in packages and packages != []:
66 pkgs = packages[0] 70 pkgs = packages[0]
67 for pkg in pkgs.split(): 71 for pkg in pkgs.split():
68 update_rcd_package(pkg) 72 update_rcd_package(pkg)
69} 73}