mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
bitbake: implement command to find configuration files for a config variable
Some configuration variables (MACHINE, MACHINE-SDK and DISTRO) set which confguration files bitbake should use. The added command , findConfigFiles, enables a UI to query which files are suitable values for a specified parameter. Signed-off-by: Joshua Lock <josh@linux.intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
1b3eb0c35f
commit
3939a216a5
@@ -232,6 +232,17 @@ class CommandsAsync:
|
|||||||
command.finishAsyncCommand()
|
command.finishAsyncCommand()
|
||||||
generateTargetsTree.needcache = True
|
generateTargetsTree.needcache = True
|
||||||
|
|
||||||
|
def findConfigFiles(self, command, params):
|
||||||
|
"""
|
||||||
|
Find config files which provide appropriate values
|
||||||
|
for the passed configuration variable. i.e. MACHINE
|
||||||
|
"""
|
||||||
|
varname = params[0]
|
||||||
|
|
||||||
|
command.cooker.findConfigFiles(varname)
|
||||||
|
command.finishAsyncCommand()
|
||||||
|
findConfigFiles.needcache = True
|
||||||
|
|
||||||
def showVersions(self, command, params):
|
def showVersions(self, command, params):
|
||||||
"""
|
"""
|
||||||
Show the currently selected versions
|
Show the currently selected versions
|
||||||
|
|||||||
@@ -430,8 +430,32 @@ class BBCooker:
|
|||||||
if not regex in matched:
|
if not regex in matched:
|
||||||
collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
|
collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
|
||||||
|
|
||||||
|
def findConfigFiles(self, varname):
|
||||||
|
"""
|
||||||
|
Find config files which are appropriate values for varname.
|
||||||
|
i.e. MACHINE, DISTRO
|
||||||
|
"""
|
||||||
|
possible = []
|
||||||
|
var = varname.lower()
|
||||||
|
|
||||||
|
data = self.configuration.data
|
||||||
|
# iterate configs
|
||||||
|
bbpaths = bb.data.getVar('BBPATH', data, True).split(':')
|
||||||
|
for path in bbpaths:
|
||||||
|
confpath = os.path.join(path, "conf", var)
|
||||||
|
if os.path.exists(confpath):
|
||||||
|
for root, dirs, files in os.walk(confpath):
|
||||||
|
# get all child files, these are appropriate values
|
||||||
|
for f in files:
|
||||||
|
val, sep, end = f.rpartition('.')
|
||||||
|
if end == 'conf':
|
||||||
|
possible.append(val)
|
||||||
|
|
||||||
|
bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
|
||||||
|
|
||||||
def checkInheritsClass(self, klass):
|
def checkInheritsClass(self, klass):
|
||||||
pkg_list = []
|
pkg_list = []
|
||||||
|
|
||||||
for pfn in self.status.pkg_fn:
|
for pfn in self.status.pkg_fn:
|
||||||
inherits = self.status.inherits.get(pfn, None)
|
inherits = self.status.inherits.get(pfn, None)
|
||||||
if inherits and inherits.count(klass) > 0:
|
if inherits and inherits.count(klass) > 0:
|
||||||
|
|||||||
@@ -359,6 +359,16 @@ class TargetsTreeGenerated(Event):
|
|||||||
Event.__init__(self)
|
Event.__init__(self)
|
||||||
self._model = model
|
self._model = model
|
||||||
|
|
||||||
|
class ConfigFilesFound(Event):
|
||||||
|
"""
|
||||||
|
Event when a list of appropriate config files has been generated
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, variable, values):
|
||||||
|
Event.__init__(self)
|
||||||
|
self._variable = variable
|
||||||
|
self._values = values
|
||||||
|
|
||||||
class MsgBase(Event):
|
class MsgBase(Event):
|
||||||
"""Base class for messages"""
|
"""Base class for messages"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user