summaryrefslogtreecommitdiffstats
path: root/meta/classes/kernel-module-split.bbclass
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-12-14 21:13:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-16 10:23:23 +0000
commitc4e2c59088765d1f1de7ec57cde91980f887c2ff (patch)
treea2fda8ac5916fb59a711e9220c2177008cca9347 /meta/classes/kernel-module-split.bbclass
parentd5e67725ac11e3296cad104470931ffa16824b90 (diff)
downloadpoky-c4e2c59088765d1f1de7ec57cde91980f887c2ff.tar.gz
meta: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/kernel-module-split.bbclass')
-rw-r--r--meta/classes/kernel-module-split.bbclass38
1 files changed, 19 insertions, 19 deletions
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index 08d226276e..efe1b42656 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -39,10 +39,10 @@ python split_kernel_module_packages () {
39 39
40 def extract_modinfo(file): 40 def extract_modinfo(file):
41 import tempfile, subprocess 41 import tempfile, subprocess
42 tempfile.tempdir = d.getVar("WORKDIR", True) 42 tempfile.tempdir = d.getVar("WORKDIR")
43 tf = tempfile.mkstemp() 43 tf = tempfile.mkstemp()
44 tmpfile = tf[1] 44 tmpfile = tf[1]
45 cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX", True) or "", file, tmpfile) 45 cmd = "%sobjcopy -j .modinfo -O binary %s %s" % (d.getVar("HOST_PREFIX") or "", file, tmpfile)
46 subprocess.call(cmd, shell=True) 46 subprocess.call(cmd, shell=True)
47 f = open(tmpfile) 47 f = open(tmpfile)
48 l = f.read().split("\000") 48 l = f.read().split("\000")
@@ -60,12 +60,12 @@ python split_kernel_module_packages () {
60 def frob_metadata(file, pkg, pattern, format, basename): 60 def frob_metadata(file, pkg, pattern, format, basename):
61 vals = extract_modinfo(file) 61 vals = extract_modinfo(file)
62 62
63 dvar = d.getVar('PKGD', True) 63 dvar = d.getVar('PKGD')
64 64
65 # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append 65 # If autoloading is requested, output /etc/modules-load.d/<name>.conf and append
66 # appropriate modprobe commands to the postinst 66 # appropriate modprobe commands to the postinst
67 autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD", True) or "").split() 67 autoloadlist = (d.getVar("KERNEL_MODULE_AUTOLOAD") or "").split()
68 autoload = d.getVar('module_autoload_%s' % basename, True) 68 autoload = d.getVar('module_autoload_%s' % basename)
69 if autoload and autoload == basename: 69 if autoload and autoload == basename:
70 bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename) 70 bb.warn("module_autoload_%s was replaced by KERNEL_MODULE_AUTOLOAD for cases where basename == module name, please drop it" % basename)
71 if autoload and basename not in autoloadlist: 71 if autoload and basename not in autoloadlist:
@@ -79,15 +79,15 @@ python split_kernel_module_packages () {
79 else: 79 else:
80 f.write('%s\n' % basename) 80 f.write('%s\n' % basename)
81 f.close() 81 f.close()
82 postinst = d.getVar('pkg_postinst_%s' % pkg, True) 82 postinst = d.getVar('pkg_postinst_%s' % pkg)
83 if not postinst: 83 if not postinst:
84 bb.fatal("pkg_postinst_%s not defined" % pkg) 84 bb.fatal("pkg_postinst_%s not defined" % pkg)
85 postinst += d.getVar('autoload_postinst_fragment', True) % (autoload or basename) 85 postinst += d.getVar('autoload_postinst_fragment') % (autoload or basename)
86 d.setVar('pkg_postinst_%s' % pkg, postinst) 86 d.setVar('pkg_postinst_%s' % pkg, postinst)
87 87
88 # Write out any modconf fragment 88 # Write out any modconf fragment
89 modconflist = (d.getVar("KERNEL_MODULE_PROBECONF", True) or "").split() 89 modconflist = (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()
90 modconf = d.getVar('module_conf_%s' % basename, True) 90 modconf = d.getVar('module_conf_%s' % basename)
91 if modconf and basename in modconflist: 91 if modconf and basename in modconflist:
92 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename) 92 name = '%s/etc/modprobe.d/%s.conf' % (dvar, basename)
93 f = open(name, 'w') 93 f = open(name, 'w')
@@ -96,15 +96,15 @@ python split_kernel_module_packages () {
96 elif modconf: 96 elif modconf:
97 bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename)) 97 bb.error("Please ensure module %s is listed in KERNEL_MODULE_PROBECONF since module_conf_%s is set" % (basename, basename))
98 98
99 files = d.getVar('FILES_%s' % pkg, True) 99 files = d.getVar('FILES_%s' % pkg)
100 files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename) 100 files = "%s /etc/modules-load.d/%s.conf /etc/modprobe.d/%s.conf" % (files, basename, basename)
101 d.setVar('FILES_%s' % pkg, files) 101 d.setVar('FILES_%s' % pkg, files)
102 102
103 if "description" in vals: 103 if "description" in vals:
104 old_desc = d.getVar('DESCRIPTION_' + pkg, True) or "" 104 old_desc = d.getVar('DESCRIPTION_' + pkg) or ""
105 d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"]) 105 d.setVar('DESCRIPTION_' + pkg, old_desc + "; " + vals["description"])
106 106
107 rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg, True) or "") 107 rdepends = bb.utils.explode_dep_versions2(d.getVar('RDEPENDS_' + pkg) or "")
108 modinfo_deps = [] 108 modinfo_deps = []
109 if "depends" in vals and vals["depends"] != "": 109 if "depends" in vals and vals["depends"] != "":
110 for dep in vals["depends"].split(","): 110 for dep in vals["depends"].split(","):
@@ -121,24 +121,24 @@ python split_kernel_module_packages () {
121 121
122 module_regex = '^(.*)\.k?o$' 122 module_regex = '^(.*)\.k?o$'
123 123
124 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX', True) 124 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
125 module_pattern = module_pattern_prefix + 'kernel-module-%s' 125 module_pattern = module_pattern_prefix + 'kernel-module-%s'
126 126
127 postinst = d.getVar('pkg_postinst_modules', True) 127 postinst = d.getVar('pkg_postinst_modules')
128 postrm = d.getVar('pkg_postrm_modules', True) 128 postrm = d.getVar('pkg_postrm_modules')
129 129
130 modules = 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='kernel-%s' % (d.getVar("KERNEL_VERSION", True))) 130 modules = 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='kernel-%s' % (d.getVar("KERNEL_VERSION")))
131 if modules: 131 if modules:
132 metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE', True) 132 metapkg = d.getVar('KERNEL_MODULES_META_PACKAGE')
133 d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules)) 133 d.appendVar('RDEPENDS_' + metapkg, ' '+' '.join(modules))
134 134
135 # If modules-load.d and modprobe.d are empty at this point, remove them to 135 # If modules-load.d and modprobe.d are empty at this point, remove them to
136 # avoid warnings. removedirs only raises an OSError if an empty 136 # avoid warnings. removedirs only raises an OSError if an empty
137 # directory cannot be removed. 137 # directory cannot be removed.
138 dvar = d.getVar('PKGD', True) 138 dvar = d.getVar('PKGD')
139 for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]: 139 for dir in ["%s/etc/modprobe.d" % (dvar), "%s/etc/modules-load.d" % (dvar), "%s/etc" % (dvar)]:
140 if len(os.listdir(dir)) == 0: 140 if len(os.listdir(dir)) == 0:
141 os.rmdir(dir) 141 os.rmdir(dir)
142} 142}
143 143
144do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF", True) or "").split()))}' 144do_package[vardeps] += '${@" ".join(map(lambda s: "module_conf_" + s, (d.getVar("KERNEL_MODULE_PROBECONF") or "").split()))}'