Micro-Optimisation decreasing initial parsing time by 10%
authorHolger Freyther <zecke@selfish.org>
Sat, 18 Nov 2006 16:55:13 +0000 (16:55 +0000)
committerHolger Freyther <zecke@selfish.org>
Sat, 18 Nov 2006 16:55:13 +0000 (16:55 +0000)
    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

30 files changed:
classes/base.bbclass
classes/flow-lossage.bbclass
classes/gettext.bbclass
classes/multimachine.bbclass
classes/update-alternatives.bbclass
classes/update-rc.d.bbclass
packages/apache/apache_2.0.54.bb
packages/glib-2.0/glib-2.0.inc [new file with mode: 0644]
packages/glib-2.0/glib-2.0_2.12.0.bb
packages/glib-2.0/glib-2.0_2.12.1.bb
packages/glib-2.0/glib-2.0_2.12.3.bb
packages/glib-2.0/glib-2.0_2.2.3.bb
packages/glib-2.0/glib-2.0_2.4.5.bb
packages/glib-2.0/glib-2.0_2.4.6.bb
packages/glib-2.0/glib-2.0_2.6.0.bb
packages/glib-2.0/glib-2.0_2.6.1.bb
packages/glib-2.0/glib-2.0_2.6.2.bb
packages/glib-2.0/glib-2.0_2.6.3.bb
packages/glib-2.0/glib-2.0_2.6.4.bb
packages/glib-2.0/glib-2.0_2.8.1.bb
packages/glib-2.0/glib-2.0_2.8.2.bb
packages/glib-2.0/glib-2.0_2.8.4.bb
packages/glib-2.0/glib-2.0_2.8.6.bb
packages/grub/grub_0.97.bb
packages/images/slugos-image.bb
packages/linux/ixp4xx-kernel.inc
packages/linux/linux-amsdelta-2.6_2.6.16-omap2.bb
packages/lockstat/lockstat_1.4.10.bb
packages/nis/nis.inc
packages/pam/libpam_0.79.bb

index cbf164f..18e6aec 100644 (file)
@@ -676,55 +676,61 @@ python read_subpackage_metadata () {
                        bb.data.setVar(key, sdata[key], d)
 }
 
-python __anonymous () {
-       import exceptions
-       need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
-       if need_host:
-               import re
-               this_host = bb.data.getVar('HOST_SYS', d, 1)
-               if not re.match(need_host, this_host):
-                       raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
-
-       need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
-       if need_machine:
-               import re
-               this_machine = bb.data.getVar('MACHINE', d, 1)
-               if this_machine and not re.match(need_machine, this_machine):
-                       raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
-
-       pn = bb.data.getVar('PN', d, 1)
-
-        # OBSOLETE in bitbake 1.7.4
-       srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
-       if srcdate != None:
-               bb.data.setVar('SRCDATE', srcdate, d)
+def base_after_parse_two(d):
+    import bb
+    import exceptions
+    need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
+    if need_host:
+        import re
+        this_host = bb.data.getVar('HOST_SYS', d, 1)
+        if not re.match(need_host, this_host):
+            raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
+
+    need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
+    if need_machine:
+           import re
+           this_machine = bb.data.getVar('MACHINE', d, 1)
+           if this_machine and not re.match(need_machine, this_machine):
+                   raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
+
+    pn = bb.data.getVar('PN', d, 1)
+
+    # OBSOLETE in bitbake 1.7.4
+    srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
+    if srcdate != None:
+           bb.data.setVar('SRCDATE', srcdate, d)
+
+    use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
+    if use_nls != None:
+        bb.data.setVar('USE_NLS', use_nls, d)
+
+def base_after_parse(d):
+    import bb, os
+    mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1)
+    old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1)
+    if (old_arch == mach_arch):
+        # Nothing to do
+        return
+    if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'):
+        return
+    paths = []
+    for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]:
+           paths.append(bb.data.expand(os.path.join(p, mach_arch), d))
+    for s in bb.data.getVar('SRC_URI', d, 1).split():
+        local = bb.data.expand(bb.fetch.localpath(s, d), d)
+        for mp in paths:
+            if local.startswith(mp):
+                #bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch))
+                bb.data.setVar('PACKAGE_ARCH', mach_arch, d)
+                return
 
-       use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
-       if use_nls != None:
-               bb.data.setVar('USE_NLS', use_nls, d)
-}
 
 python () {
-       import bb, os
-       mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1)
-       old_arch = bb.data.getVar('PACKAGE_ARCH', d, 1)
-       if (old_arch == mach_arch):
-               # Nothing to do
-               return
-       if (bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1) == '0'):
-               return
-       paths = []
-       for p in [ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ]:
-               paths.append(bb.data.expand(os.path.join(p, mach_arch), d))
-       for s in bb.data.getVar('SRC_URI', d, 1).split():
-               local = bb.data.expand(bb.fetch.localpath(s, d), d)
-               for mp in paths:
-                       if local.startswith(mp):
-#                              bb.note("overriding PACKAGE_ARCH from %s to %s" % (old_arch, mach_arch))
-                               bb.data.setVar('PACKAGE_ARCH', mach_arch, d)
-                               return
+    base_after_parse_two(d)
+    base_after_parse(d)
 }
 
+
 # Patch handling
 inherit patch
 
index 3e841e3..00e6bf0 100644 (file)
@@ -1,5 +1,5 @@
 # gcc-3.4 blows up in gtktext with -frename-registers on arm-linux
 python () {
-       cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '')
-       bb.data.setVar('CFLAGS', cflags, d)
+    cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '')
+    bb.data.setVar('CFLAGS', cflags, d)
 }
index 3785f5a..a1e00e7 100644 (file)
@@ -1,11 +1,15 @@
+def gettext_after_parse(d):
+    import bb
+    # Remove the NLS bits if USE_NLS is no.
+    if bb.data.getVar('USE_NLS', d, 1) == 'no':
+        cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
+        cfg += " --disable-nls"
+        depends = bb.data.getVar('DEPENDS', d, 1) or ""
+        bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d)
+        bb.data.setVar('EXTRA_OECONF', cfg, d)
+
 python () {
-       # Remove the NLS bits if USE_NLS is no.
-       if bb.data.getVar('USE_NLS', d, 1) == 'no':
-               cfg = oe_filter_out('^--(dis|en)able-nls$', bb.data.getVar('EXTRA_OECONF', d, 1) or "", d)
-               cfg += " --disable-nls"
-               depends = bb.data.getVar('DEPENDS', d, 1) or ""
-               bb.data.setVar('DEPENDS', oe_filter_out('^(virtual/libiconv|virtual/libintl)$', depends, d), d)
-               bb.data.setVar('EXTRA_OECONF', cfg, d)
+    gettext_after_parse(d)
 }
 
 DEPENDS =+ "gettext-native"
index 30a285e..d63aeb6 100644 (file)
@@ -4,19 +4,26 @@ STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_
 
 # Find any machine specific sub packages and if present, mark the 
 # whole package as machine specific for multimachine purposes.
-python __anonymous () {
-       packages = bb.data.getVar('PACKAGES', d, 1).split()
-       macharch = bb.data.getVar('MACHINE_ARCH', d, 1)
-       multiarch  = bb.data.getVar('PACKAGE_ARCH', d, 1)
 
-       for pkg in packages:
-               pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1)
 
-               # We could look for != PACKAGE_ARCH here but how to choose 
-               # if multiple differences are present?
-               # Look through IPKG_ARCHS for the priority order?
-               if pkgarch and pkgarch == macharch:
-                       multiarch = macharch
+def multi_machine_after_parse(d):
+    import bb
+    packages = bb.data.getVar('PACKAGES', d, 1).split()
+    macharch = bb.data.getVar('MACHINE_ARCH', d, 1)
+    multiarch  = bb.data.getVar('PACKAGE_ARCH', d, 1)
+
+    for pkg in packages:
+        pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1)
+
+        # We could look for != PACKAGE_ARCH here but how to choose 
+        # if multiple differences are present?
+        # Look through IPKG_ARCHS for the priority order?
+        if pkgarch and pkgarch == macharch:
+            multiarch = macharch
 
-       bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
+    bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
+
+
+python __anonymous () {
+    multi_machine_after_parse(d)
 }
index 6b2b547..2e24eee 100644 (file)
@@ -10,11 +10,15 @@ update_alternatives_postrm() {
 update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH}
 }
 
+def updatealternativesafterparse(d):
+    import bb
+    if bb.data.getVar('ALTERNATIVE_NAME', d) == None:
+        raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d)
+    if bb.data.getVar('ALTERNATIVE_PATH', d) == None:
+        raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d)
+
 python __anonymous() {
-       if bb.data.getVar('ALTERNATIVE_NAME', d) == None:
-               raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_NAME" % bb.data.getVar('FILE', d)
-       if bb.data.getVar('ALTERNATIVE_PATH', d) == None:
-               raise bb.build.FuncFailed, "%s inherits update-alternatives but doesn't set ALTERNATIVE_PATH" % bb.data.getVar('FILE', d)
+    updatealternativesafterparse(d)
 }
 
 python populate_packages_prepend () {
index 0bfba46..581859a 100644 (file)
@@ -26,12 +26,17 @@ updatercd_postrm() {
 update-rc.d $D ${INITSCRIPT_NAME} remove
 }
 
+
+def update_rc_after_parse(d):
+    import bb
+    if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None:
+           if bb.data.getVar('INITSCRIPT_NAME', d) == None:
+                   raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
+           if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
+                   raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
+
 python __anonymous() {
-       if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None:
-               if bb.data.getVar('INITSCRIPT_NAME', d) == None:
-                       raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_NAME" % bb.data.getVar('FILE', d)
-               if bb.data.getVar('INITSCRIPT_PARAMS', d) == None:
-                       raise bb.build.FuncFailed, "%s inherits update-rc.d but doesn't set INITSCRIPT_PARAMS" % bb.data.getVar('FILE', d)
+    update_rc_after_parse(d)
 }
 
 python populate_packages_prepend () {
index 7f71472..ff0f23e 100644 (file)
@@ -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 (file)
index 0000000..c8bde21
--- /dev/null
@@ -0,0 +1,5 @@
+
+python () {
+    if bb.data.getVar("USE_NLS", d, 1) == "no":
+        raise bb.parse.SkipPackage("${PN} requires native language support.")
+}
index e60d465..7d666b5 100644 (file)
@@ -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 () {
index 064f2f7..90904d0 100644 (file)
@@ -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 () {
index 064f2f7..90904d0 100644 (file)
@@ -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 () {
index 4288cb6..cf9722f 100644 (file)
@@ -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 () {
index c6f06e8..a1a6012 100644 (file)
@@ -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 () {
index d5b9b6f..5b47bc5 100644 (file)
@@ -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 () {
index 9e55bf0..e59d9cc 100644 (file)
@@ -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 () {
index 289b81a..682df4d 100644 (file)
@@ -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 () {
index 289b81a..682df4d 100644 (file)
@@ -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 () {
index 289b81a..682df4d 100644 (file)
@@ -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 () {
index 289b81a..682df4d 100644 (file)
@@ -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 () {
index ecb7115..218cb53 100644 (file)
@@ -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 () {
index d72803b..d26f248 100644 (file)
@@ -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 () {
index 778e311..c11e8bf 100644 (file)
@@ -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 () {
index eea0531..f28b370 100644 (file)
@@ -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 () {
index d0dddd0..051296a 100644 (file)
@@ -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() {
index 231dcd8..388a975 100644 (file)
@@ -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")
 }
 
 #--------------------------------------------------------------------------------
index 28c321e..4e62025 100644 (file)
@@ -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")
 }
index 9a80ce6..6906fdd 100644 (file)
@@ -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"
index 7c6c84d..61f4a61 100644 (file)
@@ -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 () {
index 479718c..18dd004 100644 (file)
@@ -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")
 }
index e76903e..ef66fcf 100644 (file)
@@ -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")
 }