From 56b7d78a034187f66e08f3b3e2de55bd878cf9b5 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Sat, 18 Nov 2006 16:55:13 +0000 Subject: Micro-Optimisation decreasing initial parsing time by 10% python () {} and python __anonymous () {} are as the same says functions without a name. They get executed when the main bb file is completely parsed. This is used to set information like FILESDIR. This is a python method so it gets evaled which means compiled and executed a lot of times. By moving the code of the anonfunc into a proper method this is only compiled once. The result is is the 10% speed up when parsing. Reindent anonfuncs and new defs without tabs and four spaces --- packages/apache/apache_2.0.54.bb | 10 ++-- packages/glib-2.0/glib-2.0.inc | 5 ++ packages/glib-2.0/glib-2.0_2.12.0.bb | 5 +- packages/glib-2.0/glib-2.0_2.12.1.bb | 5 +- packages/glib-2.0/glib-2.0_2.12.3.bb | 5 +- packages/glib-2.0/glib-2.0_2.2.3.bb | 5 +- packages/glib-2.0/glib-2.0_2.4.5.bb | 5 +- packages/glib-2.0/glib-2.0_2.4.6.bb | 5 +- packages/glib-2.0/glib-2.0_2.6.0.bb | 5 +- packages/glib-2.0/glib-2.0_2.6.1.bb | 5 +- packages/glib-2.0/glib-2.0_2.6.2.bb | 5 +- packages/glib-2.0/glib-2.0_2.6.3.bb | 5 +- packages/glib-2.0/glib-2.0_2.6.4.bb | 5 +- packages/glib-2.0/glib-2.0_2.8.1.bb | 5 +- packages/glib-2.0/glib-2.0_2.8.2.bb | 5 +- packages/glib-2.0/glib-2.0_2.8.4.bb | 5 +- packages/glib-2.0/glib-2.0_2.8.6.bb | 5 +- packages/grub/grub_0.97.bb | 8 +-- packages/images/slugos-image.bb | 8 +-- packages/linux/ixp4xx-kernel.inc | 70 +++++++++++------------ packages/linux/linux-amsdelta-2.6_2.6.16-omap2.bb | 8 +-- packages/lockstat/lockstat_1.4.10.bb | 6 +- packages/nis/nis.inc | 6 +- packages/pam/libpam_0.79.bb | 6 +- 24 files changed, 81 insertions(+), 121 deletions(-) create mode 100644 packages/glib-2.0/glib-2.0.inc (limited to 'packages') diff --git a/packages/apache/apache_2.0.54.bb b/packages/apache/apache_2.0.54.bb index 7f714724db..ff0f23e010 100644 --- a/packages/apache/apache_2.0.54.bb +++ b/packages/apache/apache_2.0.54.bb @@ -82,10 +82,10 @@ do_install_append () { } python () { - # Don't build apache unless we are building nativly - target = bb.data.getVar("TARGET_ARCH", d, 1) - build = bb.data.getVar("BUILD_ARCH", d, 1) - if target != build: - raise bb.parse.SkipPackage("Apache will only build nativly (TARGET_ARCH == BUILD_ARCH)") + # Don't build apache unless we are building nativly + target = bb.data.getVar("TARGET_ARCH", d, 1) + build = bb.data.getVar("BUILD_ARCH", d, 1) + if target != build: + raise bb.parse.SkipPackage("Apache will only build nativly (TARGET_ARCH == BUILD_ARCH)") } diff --git a/packages/glib-2.0/glib-2.0.inc b/packages/glib-2.0/glib-2.0.inc new file mode 100644 index 0000000000..c8bde21cf2 --- /dev/null +++ b/packages/glib-2.0/glib-2.0.inc @@ -0,0 +1,5 @@ + +python () { + if bb.data.getVar("USE_NLS", d, 1) == "no": + raise bb.parse.SkipPackage("${PN} requires native language support.") +} diff --git a/packages/glib-2.0/glib-2.0_2.12.0.bb b/packages/glib-2.0/glib-2.0_2.12.0.bb index e60d465fd5..7d666b5903 100644 --- a/packages/glib-2.0/glib-2.0_2.12.0.bb +++ b/packages/glib-2.0/glib-2.0_2.12.0.bb @@ -24,10 +24,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.12.1.bb b/packages/glib-2.0/glib-2.0_2.12.1.bb index 064f2f7f96..90904d0b54 100644 --- a/packages/glib-2.0/glib-2.0_2.12.1.bb +++ b/packages/glib-2.0/glib-2.0_2.12.1.bb @@ -24,10 +24,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.12.3.bb b/packages/glib-2.0/glib-2.0_2.12.3.bb index 064f2f7f96..90904d0b54 100644 --- a/packages/glib-2.0/glib-2.0_2.12.3.bb +++ b/packages/glib-2.0/glib-2.0_2.12.3.bb @@ -24,10 +24,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.2.3.bb b/packages/glib-2.0/glib-2.0_2.2.3.bb index 4288cb62eb..cf9722f2aa 100644 --- a/packages/glib-2.0/glib-2.0_2.2.3.bb +++ b/packages/glib-2.0/glib-2.0_2.2.3.bb @@ -19,10 +19,7 @@ PR = "r1" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.4.5.bb b/packages/glib-2.0/glib-2.0_2.4.5.bb index c6f06e88b6..a1a6012398 100644 --- a/packages/glib-2.0/glib-2.0_2.4.5.bb +++ b/packages/glib-2.0/glib-2.0_2.4.5.bb @@ -30,10 +30,7 @@ PR = "r1" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.4.6.bb b/packages/glib-2.0/glib-2.0_2.4.6.bb index d5b9b6f73f..5b47bc5d3c 100644 --- a/packages/glib-2.0/glib-2.0_2.4.6.bb +++ b/packages/glib-2.0/glib-2.0_2.4.6.bb @@ -31,10 +31,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.6.0.bb b/packages/glib-2.0/glib-2.0_2.6.0.bb index 9e55bf0305..e59d9cc282 100644 --- a/packages/glib-2.0/glib-2.0_2.6.0.bb +++ b/packages/glib-2.0/glib-2.0_2.6.0.bb @@ -30,10 +30,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.6.1.bb b/packages/glib-2.0/glib-2.0_2.6.1.bb index 289b81aaaf..682df4dbbb 100644 --- a/packages/glib-2.0/glib-2.0_2.6.1.bb +++ b/packages/glib-2.0/glib-2.0_2.6.1.bb @@ -30,10 +30,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.6.2.bb b/packages/glib-2.0/glib-2.0_2.6.2.bb index 289b81aaaf..682df4dbbb 100644 --- a/packages/glib-2.0/glib-2.0_2.6.2.bb +++ b/packages/glib-2.0/glib-2.0_2.6.2.bb @@ -30,10 +30,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.6.3.bb b/packages/glib-2.0/glib-2.0_2.6.3.bb index 289b81aaaf..682df4dbbb 100644 --- a/packages/glib-2.0/glib-2.0_2.6.3.bb +++ b/packages/glib-2.0/glib-2.0_2.6.3.bb @@ -30,10 +30,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.6.4.bb b/packages/glib-2.0/glib-2.0_2.6.4.bb index 289b81aaaf..682df4dbbb 100644 --- a/packages/glib-2.0/glib-2.0_2.6.4.bb +++ b/packages/glib-2.0/glib-2.0_2.6.4.bb @@ -30,10 +30,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.8.1.bb b/packages/glib-2.0/glib-2.0_2.8.1.bb index ecb7115dd1..218cb53c46 100644 --- a/packages/glib-2.0/glib-2.0_2.8.1.bb +++ b/packages/glib-2.0/glib-2.0_2.8.1.bb @@ -29,10 +29,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.8.2.bb b/packages/glib-2.0/glib-2.0_2.8.2.bb index d72803b564..d26f248447 100644 --- a/packages/glib-2.0/glib-2.0_2.8.2.bb +++ b/packages/glib-2.0/glib-2.0_2.8.2.bb @@ -29,10 +29,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.8.4.bb b/packages/glib-2.0/glib-2.0_2.8.4.bb index 778e3118d1..c11e8bf887 100644 --- a/packages/glib-2.0/glib-2.0_2.8.4.bb +++ b/packages/glib-2.0/glib-2.0_2.8.4.bb @@ -27,10 +27,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/glib-2.0/glib-2.0_2.8.6.bb b/packages/glib-2.0/glib-2.0_2.8.6.bb index eea05316b1..f28b370f89 100644 --- a/packages/glib-2.0/glib-2.0_2.8.6.bb +++ b/packages/glib-2.0/glib-2.0_2.8.6.bb @@ -26,10 +26,7 @@ S = "${WORKDIR}/glib-${PV}" inherit autotools pkgconfig gettext -python () { - if bb.data.getVar("USE_NLS", d, 1) == "no": - raise bb.parse.SkipPackage("${PN} requires native language support.") -} +require glib-2.0.inc acpaths = "" do_configure_prepend () { diff --git a/packages/grub/grub_0.97.bb b/packages/grub/grub_0.97.bb index d0dddd0189..051296a31a 100644 --- a/packages/grub/grub_0.97.bb +++ b/packages/grub/grub_0.97.bb @@ -8,10 +8,10 @@ S = "${WORKDIR}/grub-${PV}" inherit autotools python __anonymous () { - import re - host = bb.data.getVar('HOST_SYS', d, 1) - if not re.match('i.86.*-linux', host): - raise bb.parse.SkipPackage("incompatible with host %s" % host) + import re + host = bb.data.getVar('HOST_SYS', d, 1) + if not re.match('i.86.*-linux', host): + raise bb.parse.SkipPackage("incompatible with host %s" % host) } do_install_append_vmware() { diff --git a/packages/images/slugos-image.bb b/packages/images/slugos-image.bb index 231dcd8891..388a97583f 100644 --- a/packages/images/slugos-image.bb +++ b/packages/images/slugos-image.bb @@ -98,10 +98,10 @@ IPKG_INSTALL = "${RDEPENDS}" inherit image_ipk python () { - # Don't build slugos images unless the configuration is set up - # for an image build! - if bb.data.getVar("SLUGOS_IMAGENAME", d, 1) == '' or bb.data.getVar("SLUGOS_IMAGESEX", d, 1) == '': - raise bb.parse.SkipPackage("absent or broken SlugOS configuration") + # Don't build slugos images unless the configuration is set up + # for an image build! + if bb.data.getVar("SLUGOS_IMAGENAME", d, 1) == '' or bb.data.getVar("SLUGOS_IMAGESEX", d, 1) == '': + raise bb.parse.SkipPackage("absent or broken SlugOS configuration") } #-------------------------------------------------------------------------------- diff --git a/packages/linux/ixp4xx-kernel.inc b/packages/linux/ixp4xx-kernel.inc index 28c321e079..4e62025083 100644 --- a/packages/linux/ixp4xx-kernel.inc +++ b/packages/linux/ixp4xx-kernel.inc @@ -84,38 +84,38 @@ python () { pref = 10 mmac = 0 for patch in pv[1:]: - name.append(patch) - pname = '-'.join(name) - if patch[0:2] == "rc" or patch[0:3] == "pre": - patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/v%s/testing/patch-%s.bz2;patch=1;pname=%s" % (major, pname, pname)) - kernel[-1] = str(int(kernel[-1]) - 1) - if patch[0:2] == "rc" and pref == 10: - pref = 6 - filepath[0:0] = [ filedir % name[0] ] - filepath[0:0] = [ filedir % (name[0] + "-rc") ] - else: - pref = 2 - elif patch[0:2] == "bk" or patch[0:3] == "git": - patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/v%s/snapshots/patch-%s.bz2;patch=1;pname=%s" % (major, pname, pname)) - pref = 2 - elif patch[0:2] == "ac": - patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/people/alan/linux-%s/%s/patch-%s" % (major, base, pname)) - mmac = 2 - filepath[0:0] = [ filedir % (name[0] + "-ac") ] - elif patch[0:2] == "mm": - patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/%s/%s/%s/%s.bz2;patch=1;pname=%s" % (major, base, pname, pname, pname)) - mmac = 2 - filepath[0:0] = [ filedir % (name[0] + "-mm") ] - else: - raise bb.build.FuncFailed("ixp4xx-kernel: patch %s not recognized in %s" % (patch, '-'.join(pv))) - filepath[0:0] = [ filedir % pname ] - base = pname + name.append(patch) + pname = '-'.join(name) + if patch[0:2] == "rc" or patch[0:3] == "pre": + patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/v%s/testing/patch-%s.bz2;patch=1;pname=%s" % (major, pname, pname)) + kernel[-1] = str(int(kernel[-1]) - 1) + if patch[0:2] == "rc" and pref == 10: + pref = 6 + filepath[0:0] = [ filedir % name[0] ] + filepath[0:0] = [ filedir % (name[0] + "-rc") ] + else: + pref = 2 + elif patch[0:2] == "bk" or patch[0:3] == "git": + patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/v%s/snapshots/patch-%s.bz2;patch=1;pname=%s" % (major, pname, pname)) + pref = 2 + elif patch[0:2] == "ac": + patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/people/alan/linux-%s/%s/patch-%s" % (major, base, pname)) + mmac = 2 + filepath[0:0] = [ filedir % (name[0] + "-ac") ] + elif patch[0:2] == "mm": + patch_uri.append("ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/%s/%s/%s/%s.bz2;patch=1;pname=%s" % (major, base, pname, pname, pname)) + mmac = 2 + filepath[0:0] = [ filedir % (name[0] + "-mm") ] + else: + raise bb.build.FuncFailed("ixp4xx-kernel: patch %s not recognized in %s" % (patch, '-'.join(pv))) + filepath[0:0] = [ filedir % pname ] + base = pname base = '.'.join(kernel) patch_uri[0] = "ftp://ftp.kernel.org/pub/linux/kernel/v%s/linux-%s.tar.bz2" % (major, base) filepath[-1:-1] = [ filedir % base ] if base != minor: - filepath[-1:-1] = [ filedir % minor ] + filepath[-1:-1] = [ filedir % minor ] filepath[-1:-1] = [ filedir % major ] bb.data.setVar("IXP4XX_SRCMAJ", major, d) @@ -395,12 +395,12 @@ do_deploy() { addtask deploy before do_build after do_compile python () { - # check for IXP4XX_SUFFIX - if not set then we don't know what to build, - # also sanity check the SLUGOS_IMAGESEX - sex = bb.data.getVar("SLUGOS_IMAGESEX", d, 1) - if sex != 'little-endian' and sex != 'big-endian': - raise bb.parse.SkipPackage("slugos kernels require SLUGOS_IMAGESEX") - suffix = bb.data.getVar("IXP4XX_SUFFIX", d, 1) - if suffix == '': - raise bb.parse.SkipPackage("slugos kernels require IXP4XX_SUFFIX") + # check for IXP4XX_SUFFIX - if not set then we don't know what to build, + # also sanity check the SLUGOS_IMAGESEX + sex = bb.data.getVar("SLUGOS_IMAGESEX", d, 1) + if sex != 'little-endian' and sex != 'big-endian': + raise bb.parse.SkipPackage("slugos kernels require SLUGOS_IMAGESEX") + suffix = bb.data.getVar("IXP4XX_SUFFIX", d, 1) + if suffix == '': + raise bb.parse.SkipPackage("slugos kernels require IXP4XX_SUFFIX") } diff --git a/packages/linux/linux-amsdelta-2.6_2.6.16-omap2.bb b/packages/linux/linux-amsdelta-2.6_2.6.16-omap2.bb index 9a80ce626f..6906fdd14e 100644 --- a/packages/linux/linux-amsdelta-2.6_2.6.16-omap2.bb +++ b/packages/linux/linux-amsdelta-2.6_2.6.16-omap2.bb @@ -20,10 +20,10 @@ S = "${WORKDIR}/linux-2.6.16" inherit kernel python __anonymous () { - import re - host = bb.data.getVar('HOST_SYS', d, 1) - if not re.match('arm.*-linux', host): - raise bb.parse.SkipPackage("incompatible with host %s" % host) + import re + host = bb.data.getVar('HOST_SYS', d, 1) + if not re.match('arm.*-linux', host): + raise bb.parse.SkipPackage("incompatible with host %s" % host) } KERNEL_IMAGETYPE = "uImage" diff --git a/packages/lockstat/lockstat_1.4.10.bb b/packages/lockstat/lockstat_1.4.10.bb index 7c6c84dd01..61f4a61b0d 100644 --- a/packages/lockstat/lockstat_1.4.10.bb +++ b/packages/lockstat/lockstat_1.4.10.bb @@ -10,9 +10,9 @@ export KERNEL_SOURCE = ${@base_read_file('${STAGING_KERNEL_DIR}/kernel-source')} CFLAGS += " -I${KERNEL_SOURCE}/include" python () { -# NOTE: any target machines with kernels supporting spinlock metering should -# check the MACHINE variable here to prevent the SkipPackage. - raise bb.parse.SkipPackage("The target machine's kernel does not appear able to use spinlock metering.") + # NOTE: any target machines with kernels supporting spinlock metering should + # check the MACHINE variable here to prevent the SkipPackage. + raise bb.parse.SkipPackage("The target machine's kernel does not appear able to use spinlock metering.") } do_compile () { diff --git a/packages/nis/nis.inc b/packages/nis/nis.inc index 479718cf5e..18dd00437a 100644 --- a/packages/nis/nis.inc +++ b/packages/nis/nis.inc @@ -28,7 +28,7 @@ do_install() { # so force the package to be skipped here (this will cause a # 'nothing provides' error) python () { - os = bb.data.getVar("TARGET_OS", d, 1) - if os == "linux-uclibc": - raise bb.parse.SkipPackage("NIS functionality requires rpcsvc/yp.h, uClibC does not provide this") + os = bb.data.getVar("TARGET_OS", d, 1) + if os == "linux-uclibc": + raise bb.parse.SkipPackage("NIS functionality requires rpcsvc/yp.h, uClibC does not provide this") } diff --git a/packages/pam/libpam_0.79.bb b/packages/pam/libpam_0.79.bb index e76903e845..ef66fcf1da 100644 --- a/packages/pam/libpam_0.79.bb +++ b/packages/pam/libpam_0.79.bb @@ -66,7 +66,7 @@ do_stage() { # that those which use YP don't get built on uClibC, this looks # like a big patch... python () { - os = bb.data.getVar("TARGET_OS", d, 1) - if os == "linux-uclibc": - raise bb.parse.SkipPackage("Some PAM modules require rpcsvc/yp.h, uClibC does not provide this") + os = bb.data.getVar("TARGET_OS", d, 1) + if os == "linux-uclibc": + raise bb.parse.SkipPackage("Some PAM modules require rpcsvc/yp.h, uClibC does not provide this") } -- cgit v1.2.3