summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-03 10:59:25 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-05 10:22:56 -0800
commit06f2f8ce0a3093973ca54b48f542f8485b666079 (patch)
treedbcfa5c491eb2e5d237aa539cb7c6e77dc07dd6f /meta/classes/kernel.bbclass
parentd01dadfb87cfd2284b3e849d35a35fe5df0239c4 (diff)
downloadpoky-06f2f8ce0a3093973ca54b48f542f8485b666079.tar.gz
meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True)
Using "1" with getVar is bad coding style and "True" is preferred. This patch is a sed over the meta directory of the form: sed \ -e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \ -e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \ -i `grep -ril getVar *` Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel.bbclass')
-rw-r--r--meta/classes/kernel.bbclass46
1 files changed, 23 insertions, 23 deletions
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index ec5d65e186..8fbec90ef1 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -11,9 +11,9 @@ INITRAMFS_IMAGE ?= ""
11INITRAMFS_TASK ?= "" 11INITRAMFS_TASK ?= ""
12 12
13python __anonymous () { 13python __anonymous () {
14 kerneltype = d.getVar('KERNEL_IMAGETYPE', 1) or '' 14 kerneltype = d.getVar('KERNEL_IMAGETYPE', True) or ''
15 if kerneltype == 'uImage': 15 if kerneltype == 'uImage':
16 depends = d.getVar("DEPENDS", 1) 16 depends = d.getVar("DEPENDS", True)
17 depends = "%s u-boot-mkimage-native" % depends 17 depends = "%s u-boot-mkimage-native" % depends
18 d.setVar("DEPENDS", depends) 18 d.setVar("DEPENDS", depends)
19 19
@@ -75,7 +75,7 @@ EXTRA_OEMAKE = ""
75 75
76KERNEL_ALT_IMAGETYPE ??= "" 76KERNEL_ALT_IMAGETYPE ??= ""
77 77
78KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.getVar('KERNEL_IMAGETYPE', 1))}" 78KERNEL_IMAGETYPE_FOR_MAKE = "${@(lambda s: s[:-3] if s[-3:] == ".gz" else s)(d.getVar('KERNEL_IMAGETYPE', True))}"
79 79
80kernel_do_compile() { 80kernel_do_compile() {
81 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE 81 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
@@ -306,10 +306,10 @@ module_conf_rfcomm = "alias bt-proto-3 rfcomm"
306python populate_packages_prepend () { 306python populate_packages_prepend () {
307 def extract_modinfo(file): 307 def extract_modinfo(file):
308 import tempfile, re 308 import tempfile, re
309 tempfile.tempdir = d.getVar("WORKDIR", 1) 309 tempfile.tempdir = d.getVar("WORKDIR", True)
310 tf = tempfile.mkstemp() 310 tf = tempfile.mkstemp()
311 tmpfile = tf[1] 311 tmpfile = tf[1]
312 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", 1), d.getVar("HOST_PREFIX", 1) or "", file, tmpfile) 312 cmd = "PATH=\"%s\" %sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("PATH", True), d.getVar("HOST_PREFIX", True) or "", file, tmpfile)
313 os.system(cmd) 313 os.system(cmd)
314 f = open(tmpfile) 314 f = open(tmpfile)
315 l = f.read().split("\000") 315 l = f.read().split("\000")
@@ -328,18 +328,18 @@ python populate_packages_prepend () {
328 def parse_depmod(): 328 def parse_depmod():
329 import re 329 import re
330 330
331 dvar = d.getVar('PKGD', 1) 331 dvar = d.getVar('PKGD', True)
332 if not dvar: 332 if not dvar:
333 bb.error("PKGD not defined") 333 bb.error("PKGD not defined")
334 return 334 return
335 335
336 kernelver = d.getVar('KERNEL_VERSION', 1) 336 kernelver = d.getVar('KERNEL_VERSION', True)
337 kernelver_stripped = kernelver 337 kernelver_stripped = kernelver
338 m = re.match('^(.*-hh.*)[\.\+].*$', kernelver) 338 m = re.match('^(.*-hh.*)[\.\+].*$', kernelver)
339 if m: 339 if m:
340 kernelver_stripped = m.group(1) 340 kernelver_stripped = m.group(1)
341 path = d.getVar("PATH", 1) 341 path = d.getVar("PATH", True)
342 host_prefix = d.getVar("HOST_PREFIX", 1) or "" 342 host_prefix = d.getVar("HOST_PREFIX", True) or ""
343 343
344 cmd = "PATH=\"%s\" %sdepmod -n -a -r -b %s -F %s/boot/System.map-%s %s" % (path, host_prefix, dvar, dvar, kernelver, kernelver_stripped) 344 cmd = "PATH=\"%s\" %sdepmod -n -a -r -b %s -F %s/boot/System.map-%s %s" % (path, host_prefix, dvar, dvar, kernelver, kernelver_stripped)
345 f = os.popen(cmd, 'r') 345 f = os.popen(cmd, 'r')
@@ -377,9 +377,9 @@ python populate_packages_prepend () {
377 377
378 def get_dependencies(file, pattern, format): 378 def get_dependencies(file, pattern, format):
379 # file no longer includes PKGD 379 # file no longer includes PKGD
380 file = file.replace(d.getVar('PKGD', 1) or '', '', 1) 380 file = file.replace(d.getVar('PKGD', True) or '', '', 1)
381 # instead is prefixed with /lib/modules/${KERNEL_VERSION} 381 # instead is prefixed with /lib/modules/${KERNEL_VERSION}
382 file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', 1) or '', '', 1) 382 file = file.replace("/lib/modules/%s/" % d.getVar('KERNEL_VERSION', True) or '', '', 1)
383 383
384 if module_deps.has_key(file): 384 if module_deps.has_key(file):
385 import re 385 import re
@@ -398,40 +398,40 @@ python populate_packages_prepend () {
398 import re 398 import re
399 vals = extract_modinfo(file) 399 vals = extract_modinfo(file)
400 400
401 dvar = d.getVar('PKGD', 1) 401 dvar = d.getVar('PKGD', True)
402 402
403 # If autoloading is requested, output /etc/modutils/<name> and append 403 # If autoloading is requested, output /etc/modutils/<name> and append
404 # appropriate modprobe commands to the postinst 404 # appropriate modprobe commands to the postinst
405 autoload = d.getVar('module_autoload_%s' % basename, 1) 405 autoload = d.getVar('module_autoload_%s' % basename, True)
406 if autoload: 406 if autoload:
407 name = '%s/etc/modutils/%s' % (dvar, basename) 407 name = '%s/etc/modutils/%s' % (dvar, basename)
408 f = open(name, 'w') 408 f = open(name, 'w')
409 for m in autoload.split(): 409 for m in autoload.split():
410 f.write('%s\n' % m) 410 f.write('%s\n' % m)
411 f.close() 411 f.close()
412 postinst = d.getVar('pkg_postinst_%s' % pkg, 1) 412 postinst = d.getVar('pkg_postinst_%s' % pkg, True)
413 if not postinst: 413 if not postinst:
414 bb.fatal("pkg_postinst_%s not defined" % pkg) 414 bb.fatal("pkg_postinst_%s not defined" % pkg)
415 postinst += d.getVar('autoload_postinst_fragment', 1) % autoload 415 postinst += d.getVar('autoload_postinst_fragment', True) % autoload
416 d.setVar('pkg_postinst_%s' % pkg, postinst) 416 d.setVar('pkg_postinst_%s' % pkg, postinst)
417 417
418 # Write out any modconf fragment 418 # Write out any modconf fragment
419 modconf = d.getVar('module_conf_%s' % basename, 1) 419 modconf = d.getVar('module_conf_%s' % basename, True)
420 if modconf: 420 if modconf:
421 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) 421 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
422 f = open(name, 'w') 422 f = open(name, 'w')
423 f.write("%s\n" % modconf) 423 f.write("%s\n" % modconf)
424 f.close() 424 f.close()
425 425
426 files = d.getVar('FILES_%s' % pkg, 1) 426 files = d.getVar('FILES_%s' % pkg, True)
427 files = "%s /etc/modutils/%s /etc/modutils/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename, basename) 427 files = "%s /etc/modutils/%s /etc/modutils/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename, basename)
428 d.setVar('FILES_%s' % pkg, files) 428 d.setVar('FILES_%s' % pkg, files)
429 429
430 if vals.has_key("description"): 430 if vals.has_key("description"):
431 old_desc = d.getVar('DESCRIPTION_' + pkg, 1) or "" 431 old_desc = d.getVar('DESCRIPTION_' + pkg, True) or ""
432 d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"]) 432 d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"])
433 433
434 rdepends_str = d.getVar('RDEPENDS_' + pkg, 1) 434 rdepends_str = d.getVar('RDEPENDS_' + pkg, True)
435 if rdepends_str: 435 if rdepends_str:
436 rdepends = rdepends_str.split() 436 rdepends = rdepends_str.split()
437 else: 437 else:
@@ -443,12 +443,12 @@ python populate_packages_prepend () {
443 module_regex = '^(.*)\.k?o$' 443 module_regex = '^(.*)\.k?o$'
444 module_pattern = 'kernel-module-%s' 444 module_pattern = 'kernel-module-%s'
445 445
446 postinst = d.getVar('pkg_postinst_modules', 1) 446 postinst = d.getVar('pkg_postinst_modules', True)
447 postrm = d.getVar('pkg_postrm_modules', 1) 447 postrm = d.getVar('pkg_postrm_modules', True)
448 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 448 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.bin$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
449 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 449 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.fw$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
450 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 450 do_split_packages(d, root='/lib/firmware', file_regex='^(.*)\.cis$', output_pattern='kernel-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
451 do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", 1)) 451 do_split_packages(d, root='/lib/modules', file_regex=module_regex, output_pattern=module_pattern, description='%s kernel module', postinst=postinst, postrm=postrm, recursive=True, hook=frob_metadata, extra_depends='update-modules kernel-%s' % d.getVar("KERNEL_VERSION", True))
452 452
453 import re 453 import re
454 metapkg = "kernel-modules" 454 metapkg = "kernel-modules"
@@ -460,7 +460,7 @@ python populate_packages_prepend () {
460 pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1)) 460 pkg = module_pattern % legitimize_package_name(re.match(module_regex, os.path.basename(i)).group(1))
461 blacklist.append(pkg) 461 blacklist.append(pkg)
462 metapkg_rdepends = [] 462 metapkg_rdepends = []
463 packages = d.getVar('PACKAGES', 1).split() 463 packages = d.getVar('PACKAGES', True).split()
464 for pkg in packages[1:]: 464 for pkg in packages[1:]:
465 if not pkg in blacklist and not pkg in metapkg_rdepends: 465 if not pkg in blacklist and not pkg in metapkg_rdepends:
466 metapkg_rdepends.append(pkg) 466 metapkg_rdepends.append(pkg)