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
This commit is contained in:
parent
8174ba4222
commit
8aee6b32a0
|
@ -666,52 +666,56 @@ python read_subpackage_metadata () {
|
||||||
bb.data.setVar(key, sdata[key], d)
|
bb.data.setVar(key, sdata[key], d)
|
||||||
}
|
}
|
||||||
|
|
||||||
python __anonymous () {
|
def base_after_parse_two(d):
|
||||||
import exceptions
|
import bb
|
||||||
need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
|
import exceptions
|
||||||
if need_host:
|
need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
|
||||||
import re
|
if need_host:
|
||||||
this_host = bb.data.getVar('HOST_SYS', d, 1)
|
import re
|
||||||
if not re.match(need_host, this_host):
|
this_host = bb.data.getVar('HOST_SYS', d, 1)
|
||||||
raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
|
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)
|
need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
|
||||||
if need_machine:
|
if need_machine:
|
||||||
import re
|
import re
|
||||||
this_machine = bb.data.getVar('MACHINE', d, 1)
|
this_machine = bb.data.getVar('MACHINE', d, 1)
|
||||||
if this_machine and not re.match(need_machine, this_machine):
|
if this_machine and not re.match(need_machine, this_machine):
|
||||||
raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
|
raise bb.parse.SkipPackage("incompatible with machine %s" % this_machine)
|
||||||
|
|
||||||
pn = bb.data.getVar('PN', d, 1)
|
pn = bb.data.getVar('PN', d, 1)
|
||||||
|
|
||||||
srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
|
srcdate = bb.data.getVar('SRCDATE_%s' % pn, d, 1)
|
||||||
if srcdate != None:
|
if srcdate != None:
|
||||||
bb.data.setVar('SRCDATE', srcdate, d)
|
bb.data.setVar('SRCDATE', srcdate, d)
|
||||||
|
|
||||||
use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
|
use_nls = bb.data.getVar('USE_NLS_%s' % pn, d, 1)
|
||||||
if use_nls != None:
|
if use_nls != None:
|
||||||
bb.data.setVar('USE_NLS', use_nls, d)
|
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
|
||||||
|
|
||||||
python () {
|
python () {
|
||||||
import bb, os
|
base_after_parse_two(d)
|
||||||
mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1)
|
base_after_parse(d)
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Patch handling
|
# Patch handling
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
CCACHE_DIR_TARGET = "${TMPDIR}/ccache"
|
CCACHE_DIR_TARGET = "${TMPDIR}/ccache"
|
||||||
|
|
||||||
python () {
|
python () {
|
||||||
if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
|
if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
|
||||||
bb.data.setVar('CCACHE_DIR', '${CCACHE_DIR_TARGET}', d)
|
bb.data.setVar('CCACHE_DIR', '${CCACHE_DIR_TARGET}', d)
|
||||||
bb.data.setVarFlag('CCACHE_DIR', 'export', '1', d)
|
bb.data.setVarFlag('CCACHE_DIR', 'export', '1', d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
python () {
|
python () {
|
||||||
if bb.data.getVar('PN', d, 1) in ['ccdv-native']:
|
if bb.data.getVar('PN', d, 1) in ['ccdv-native']:
|
||||||
if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
|
if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d, 1):
|
||||||
bb.data.setVar("DEPENDS", '%s %s' % ("ccdv-native", bb.data.getVar("DEPENDS", d, 1) or ""), d)
|
bb.data.setVar("DEPENDS", '%s %s' % ("ccdv-native", bb.data.getVar("DEPENDS", d, 1) or ""), d)
|
||||||
bb.data.setVar("CC", '%s %s' % ("ccdv", bb.data.getVar("CC", d, 1) or ""), d)
|
bb.data.setVar("CC", '%s %s' % ("ccdv", bb.data.getVar("CC", d, 1) or ""), d)
|
||||||
bb.data.setVar("BUILD_CC", '%s %s' % ("ccdv", bb.data.getVar("BUILD_CC", d, 1) or ""), d)
|
bb.data.setVar("BUILD_CC", '%s %s' % ("ccdv", bb.data.getVar("BUILD_CC", d, 1) or ""), d)
|
||||||
bb.data.setVar("CCLD", '%s %s' % ("ccdv", bb.data.getVar("CCLD", d, 1) or ""), d)
|
bb.data.setVar("CCLD", '%s %s' % ("ccdv", bb.data.getVar("CCLD", d, 1) or ""), d)
|
||||||
}
|
}
|
||||||
|
|
||||||
def quiet_libtool(bb,d):
|
def quiet_libtool(bb,d):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# gcc-3.4 blows up in gtktext with -frename-registers on arm-linux
|
# gcc-3.4 blows up in gtktext with -frename-registers on arm-linux
|
||||||
python () {
|
python () {
|
||||||
cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '')
|
cflags = (bb.data.getVar('CFLAGS', d, 1) or '').replace('-frename-registers', '')
|
||||||
bb.data.setVar('CFLAGS', cflags, d)
|
bb.data.setVar('CFLAGS', cflags, d)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 () {
|
python () {
|
||||||
# Remove the NLS bits if USE_NLS is no.
|
gettext_after_parse(d)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEPENDS =+ "gettext-native"
|
DEPENDS =+ "gettext-native"
|
||||||
|
|
|
@ -4,19 +4,24 @@ STAGING_KERNEL_DIR = "${STAGING_DIR}/${MULTIMACH_ARCH}-${TARGET_OS}/kernel"
|
||||||
|
|
||||||
# Find any machine specific sub packages and if present, mark the
|
# Find any machine specific sub packages and if present, mark the
|
||||||
# whole package as machine specific for multimachine purposes.
|
# whole package as machine specific for multimachine purposes.
|
||||||
|
|
||||||
|
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 PACKAGE_ARCHS for the priority order?
|
||||||
|
if pkgarch and pkgarch == macharch:
|
||||||
|
multiarch = macharch
|
||||||
|
|
||||||
|
bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
|
||||||
|
|
||||||
python __anonymous () {
|
python __anonymous () {
|
||||||
packages = bb.data.getVar('PACKAGES', d, 1).split()
|
multi_machine_after_parse(d)
|
||||||
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 PACKAGE_ARCHS for the priority order?
|
|
||||||
if pkgarch and pkgarch == macharch:
|
|
||||||
multiarch = macharch
|
|
||||||
|
|
||||||
bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,11 +10,15 @@ update_alternatives_postrm() {
|
||||||
update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH}
|
update-alternatives --remove ${ALTERNATIVE_NAME} ${ALTERNATIVE_PATH}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def update_alternatives_after_parse(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() {
|
python __anonymous() {
|
||||||
if bb.data.getVar('ALTERNATIVE_NAME', d) == None:
|
update_alternatives_after_parse(d)
|
||||||
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 populate_packages_prepend () {
|
python populate_packages_prepend () {
|
||||||
|
|
|
@ -26,44 +26,48 @@ updatercd_postrm() {
|
||||||
update-rc.d $D ${INITSCRIPT_NAME} remove
|
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() {
|
python __anonymous() {
|
||||||
if bb.data.getVar('INITSCRIPT_PACKAGES', d) == None:
|
update_rc_after_parse(d)
|
||||||
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 populate_packages_prepend () {
|
python populate_packages_prepend () {
|
||||||
def update_rcd_package(pkg):
|
def update_rcd_package(pkg):
|
||||||
bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
|
bb.debug(1, 'adding update-rc.d calls to postinst/postrm for %s' % pkg)
|
||||||
localdata = bb.data.createCopy(d)
|
localdata = bb.data.createCopy(d)
|
||||||
overrides = bb.data.getVar("OVERRIDES", localdata, 1)
|
overrides = bb.data.getVar("OVERRIDES", localdata, 1)
|
||||||
bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata)
|
bb.data.setVar("OVERRIDES", "%s:%s" % (pkg, overrides), localdata)
|
||||||
bb.data.update_data(localdata)
|
bb.data.update_data(localdata)
|
||||||
|
|
||||||
postinst = bb.data.getVar('pkg_postinst', localdata, 1)
|
postinst = bb.data.getVar('pkg_postinst', localdata, 1)
|
||||||
if not postinst:
|
if not postinst:
|
||||||
postinst = '#!/bin/sh\n'
|
postinst = '#!/bin/sh\n'
|
||||||
postinst += bb.data.getVar('updatercd_postinst', localdata, 1)
|
postinst += bb.data.getVar('updatercd_postinst', localdata, 1)
|
||||||
bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
|
bb.data.setVar('pkg_postinst_%s' % pkg, postinst, d)
|
||||||
prerm = bb.data.getVar('pkg_prerm', localdata, 1)
|
prerm = bb.data.getVar('pkg_prerm', localdata, 1)
|
||||||
if not prerm:
|
if not prerm:
|
||||||
prerm = '#!/bin/sh\n'
|
prerm = '#!/bin/sh\n'
|
||||||
prerm += bb.data.getVar('updatercd_prerm', localdata, 1)
|
prerm += bb.data.getVar('updatercd_prerm', localdata, 1)
|
||||||
bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
|
bb.data.setVar('pkg_prerm_%s' % pkg, prerm, d)
|
||||||
postrm = bb.data.getVar('pkg_postrm', localdata, 1)
|
postrm = bb.data.getVar('pkg_postrm', localdata, 1)
|
||||||
if not postrm:
|
if not postrm:
|
||||||
postrm = '#!/bin/sh\n'
|
postrm = '#!/bin/sh\n'
|
||||||
postrm += bb.data.getVar('updatercd_postrm', localdata, 1)
|
postrm += bb.data.getVar('updatercd_postrm', localdata, 1)
|
||||||
bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
|
bb.data.setVar('pkg_postrm_%s' % pkg, postrm, d)
|
||||||
|
|
||||||
pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1)
|
pkgs = bb.data.getVar('INITSCRIPT_PACKAGES', d, 1)
|
||||||
if pkgs == None:
|
if pkgs == None:
|
||||||
pkgs = bb.data.getVar('PN', d, 1)
|
pkgs = bb.data.getVar('PN', d, 1)
|
||||||
packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
|
packages = (bb.data.getVar('PACKAGES', d, 1) or "").split()
|
||||||
if not pkgs in packages and packages != []:
|
if not pkgs in packages and packages != []:
|
||||||
pkgs = packages[0]
|
pkgs = packages[0]
|
||||||
for pkg in pkgs.split():
|
for pkg in pkgs.split():
|
||||||
update_rcd_package(pkg)
|
update_rcd_package(pkg)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue