* [PATCH 01/12] oe.utils: add bb, bb.data imports
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
@ 2011-03-17 16:18 ` Chris Larson
2011-03-17 16:19 ` [PATCH 02/12] oe.patch: add missing imports Chris Larson
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:18 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
While the metadata can and should rely on bb always being available, this
needn't necessarily be the case for imported python modules.
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/lib/oe/utils.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 3469700..69f9384 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -1,3 +1,5 @@
+import bb, bb.data
+
def read_file(filename):
try:
f = file( filename, "r" )
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 02/12] oe.patch: add missing imports
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
2011-03-17 16:18 ` [PATCH 01/12] oe.utils: add bb, bb.data imports Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 03/12] oe.path: sync up with current OE Chris Larson
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/lib/oe/patch.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index c8eeb8b..5fb687d 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -1,4 +1,6 @@
import oe.path
+import os
+import bb.utils, bb.msg, bb.data, bb.fetch2
class NotFoundError(Exception):
def __init__(self, path):
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 03/12] oe.path: sync up with current OE
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
2011-03-17 16:18 ` [PATCH 01/12] oe.utils: add bb, bb.data imports Chris Larson
2011-03-17 16:19 ` [PATCH 02/12] oe.patch: add missing imports Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 04/12] oe.utils: add inherits (sync from OE) Chris Larson
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/lib/oe/path.py | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 08ddbf2..8eaa3c5 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -1,9 +1,12 @@
+import bb
+import errno
+import glob
+import os
import shutil
import subprocess
def join(*paths):
"""Like os.path.join but doesn't treat absolute RHS specially"""
- import os.path
return os.path.normpath("/".join(paths))
def relative(src, dest):
@@ -18,7 +21,6 @@ def relative(src, dest):
>>> relative("/tmp", "/tmp/foo/bar")
foo/bar
"""
- import os.path
if hasattr(os.path, "relpath"):
return os.path.relpath(dest, src)
@@ -57,21 +59,19 @@ def copytree(src, dst):
check_output(cmd, shell=True, stderr=subprocess.STDOUT)
-def remove(path):
+def remove(path, recurse=True):
"""Equivalent to rm -f or rm -rf"""
- import os, errno, shutil, glob
for name in glob.glob(path):
try:
os.unlink(name)
except OSError, exc:
- if exc.errno == errno.EISDIR:
- shutil.rmtree(path)
+ if recurse and exc.errno == errno.EISDIR:
+ shutil.rmtree(name)
elif exc.errno != errno.ENOENT:
raise
def symlink(source, destination, force=False):
"""Create a symbolic link"""
- import os, errno
try:
if force:
remove(destination)
@@ -121,3 +121,10 @@ def check_output(*popenargs, **kwargs):
raise CalledProcessError(retcode, cmd, output=output)
return output
+def find(dir, **walkoptions):
+ """ Given a directory, recurses into that directory,
+ returning all files as absolute paths. """
+
+ for root, dirs, files in os.walk(dir, **walkoptions):
+ for file in files:
+ yield os.path.join(root, file)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 04/12] oe.utils: add inherits (sync from OE)
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (2 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 03/12] oe.path: sync up with current OE Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 05/12] base.bbclass: switch to current OE's imports handling Chris Larson
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/lib/oe/utils.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 69f9384..f6d4142 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -80,3 +80,7 @@ def param_bool(cfg, field, dflt = None):
elif strvalue in ('no', 'n', 'false', 'f', '0'):
return False
raise ValueError("invalid value for boolean parameter '%s': '%s'" % (field, value))
+
+def inherits(d, *classes):
+ """Return True if the metadata inherits any of the specified classes"""
+ return any(bb.data.inherits_class(cls, d) for cls in classes)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 05/12] base.bbclass: switch to current OE's imports handling
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (3 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 04/12] oe.utils: add inherits (sync from OE) Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 06/12] Shift oe import logic out of the event handler Chris Larson
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
The current mechanism makes it easier for classes to add new oe modules to be
automatically imported, and thereby made available to python snippets (${@}).
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/base.bbclass | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index e53ebe4..7a87f57 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -9,31 +9,28 @@ inherit utility-tasks
inherit metadata_scm
inherit buildstats
-python sys_path_eh () {
+OE_IMPORTS += "oe.path oe.utils sys os time"
+
+python oe_import () {
if isinstance(e, bb.event.ConfigParsed):
- import sys
- import os
- import time
+ import os, sys
bbpath = e.data.getVar("BBPATH", True).split(":")
sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
def inject(name, value):
- """Make a python object accessible from everywhere for the metadata"""
+ """Make a python object accessible from the metadata"""
if hasattr(bb.utils, "_context"):
bb.utils._context[name] = value
else:
__builtins__[name] = value
- import oe.path
- import oe.utils
- inject("bb", bb)
- inject("sys", sys)
- inject("time", time)
- inject("oe", oe)
+ for toimport in e.data.getVar("OE_IMPORTS", True).split():
+ imported = __import__(toimport)
+ inject(toimport.split(".", 1)[0], imported)
}
-addhandler sys_path_eh
+addhandler oe_import
die() {
oefatal "$*"
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 06/12] Shift oe import logic out of the event handler
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (4 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 05/12] base.bbclass: switch to current OE's imports handling Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 07/12] Implement variable typing (sync from OE) Chris Larson
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
This can be useful if we need the imports from another config parsed event
handler, and can't rely upon the base one running before that one.
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/base.bbclass | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 7a87f57..a3d4086 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -11,26 +11,29 @@ inherit buildstats
OE_IMPORTS += "oe.path oe.utils sys os time"
-python oe_import () {
- if isinstance(e, bb.event.ConfigParsed):
- import os, sys
+def oe_import(d):
+ import os, sys
+
+ bbpath = d.getVar("BBPATH", True).split(":")
+ sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
- bbpath = e.data.getVar("BBPATH", True).split(":")
- sys.path[0:0] = [os.path.join(dir, "lib") for dir in bbpath]
+ def inject(name, value):
+ """Make a python object accessible from the metadata"""
+ if hasattr(bb.utils, "_context"):
+ bb.utils._context[name] = value
+ else:
+ __builtins__[name] = value
- def inject(name, value):
- """Make a python object accessible from the metadata"""
- if hasattr(bb.utils, "_context"):
- bb.utils._context[name] = value
- else:
- __builtins__[name] = value
+ for toimport in d.getVar("OE_IMPORTS", True).split():
+ imported = __import__(toimport)
+ inject(toimport.split(".", 1)[0], imported)
- for toimport in e.data.getVar("OE_IMPORTS", True).split():
- imported = __import__(toimport)
- inject(toimport.split(".", 1)[0], imported)
+python oe_import_eh () {
+ if isinstance(e, bb.event.ConfigParsed):
+ oe_import(e.data)
}
-addhandler oe_import
+addhandler oe_import_eh
die() {
oefatal "$*"
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 07/12] Implement variable typing (sync from OE)
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (5 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 06/12] Shift oe import logic out of the event handler Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 08/12] oe.packagegroup: add code for package groups " Chris Larson
` (5 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
This implementation consists of two components:
- Type creation python modules, whose job it is to construct objects of the
defined type for a given variable in the metadata
- typecheck.bbclass, which iterates over all configuration variables with a
type defined and uses oe.types to check the validity of the values
This gives us a few benefits:
- Automatic sanity checking of all configuration variables with a defined type
- Avoid duplicating the "how do I make use of the value of this variable"
logic between its users. For variables like PATH, this is simply a split(),
for boolean variables, the duplication can result in confusing, or even
mismatched semantics (is this 0/1, empty/nonempty, what?)
- Make it easier to create a configuration UI, as the type information could
be used to provide a better interface than a text edit box (e.g checkbox for
'boolean', dropdown for 'choice')
This functionality is entirely opt-in right now. To enable the configuration
variable type checking, simply INHERIT += "typecheck". Example of a failing
type check:
BAZ = "foo"
BAZ[type] = "boolean"
$ bitbake -p
FATAL: BAZ: Invalid boolean value 'foo'
$
Examples of leveraging oe.types in a python snippet:
PACKAGES[type] = "list"
python () {
import oe.data
for pkg in oe.data.typed_value("PACKAGES", d):
bb.note("package: %s" % pkg)
}
LIBTOOL_HAS_SYSROOT = "yes"
LIBTOOL_HAS_SYSROOT[type] = "boolean"
python () {
import oe.data
assert(oe.data.typed_value("LIBTOOL_HAS_SYSROOT", d) == True)
}
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/base.bbclass | 2 +-
meta/classes/typecheck.bbclass | 12 +++++
meta/lib/oe/data.py | 13 +++++
meta/lib/oe/maketype.py | 97 +++++++++++++++++++++++++++++++++++++
meta/lib/oe/test_types.py | 62 ++++++++++++++++++++++++
meta/lib/oe/types.py | 104 ++++++++++++++++++++++++++++++++++++++++
6 files changed, 289 insertions(+), 1 deletions(-)
create mode 100644 meta/classes/typecheck.bbclass
create mode 100644 meta/lib/oe/data.py
create mode 100644 meta/lib/oe/maketype.py
create mode 100644 meta/lib/oe/test_types.py
create mode 100644 meta/lib/oe/types.py
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index a3d4086..27a68de 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -9,7 +9,7 @@ inherit utility-tasks
inherit metadata_scm
inherit buildstats
-OE_IMPORTS += "oe.path oe.utils sys os time"
+OE_IMPORTS += "sys os time oe.path oe.utils oe.data"
def oe_import(d):
import os, sys
diff --git a/meta/classes/typecheck.bbclass b/meta/classes/typecheck.bbclass
new file mode 100644
index 0000000..646cd4e
--- /dev/null
+++ b/meta/classes/typecheck.bbclass
@@ -0,0 +1,12 @@
+# Check types of bitbake configuration variables
+#
+# See oe.types for details.
+
+python check_types() {
+ import oe.types
+ if isinstance(e, bb.event.ConfigParsed):
+ for key in e.data.keys():
+ if e.data.getVarFlag(key, "type"):
+ oe.types.value(key, e.data)
+}
+addhandler check_types
diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py
new file mode 100644
index 0000000..8b7c3cd
--- /dev/null
+++ b/meta/lib/oe/data.py
@@ -0,0 +1,13 @@
+import oe.maketype
+import bb.msg
+
+def typed_value(key, d):
+ """Construct a value for the specified metadata variable, using its flags
+ to determine the type and parameters for construction."""
+ var_type = d.getVarFlag(key, 'type')
+ flags = d.getVarFlags(key)
+
+ try:
+ return oe.maketype.create(d.getVar(key, True) or '', var_type, **flags)
+ except (TypeError, ValueError), exc:
+ bb.msg.fatal(bb.msg.domain.Data, "%s: %s" % (key, str(exc)))
diff --git a/meta/lib/oe/maketype.py b/meta/lib/oe/maketype.py
new file mode 100644
index 0000000..04a0e7c
--- /dev/null
+++ b/meta/lib/oe/maketype.py
@@ -0,0 +1,97 @@
+"""OpenEmbedded variable typing support
+
+Types are defined in the metadata by name, using the 'type' flag on a
+variable. Other flags may be utilized in the construction of the types. See
+the arguments of the type's factory for details.
+"""
+
+import bb
+import inspect
+import types
+
+available_types = {}
+
+class MissingFlag(TypeError):
+ """A particular flag is required to construct the type, but has not been
+ provided."""
+ def __init__(self, flag, type):
+ self.flag = flag
+ self.type = type
+ TypeError.__init__(self)
+
+ def __str__(self):
+ return "Type '%s' requires flag '%s'" % (self.type, self.flag)
+
+def factory(var_type):
+ """Return the factory for a specified type."""
+ try:
+ return available_types[var_type]
+ except KeyError:
+ raise TypeError("Invalid type '%s':\n Valid types: %s" %
+ (var_type, ', '.join(types)))
+
+def create(value, var_type, **flags):
+ """Create an object of the specified type, given the specified flags and
+ string value."""
+ obj = factory(var_type)
+ objflags = {}
+ for flag in obj.flags:
+ if flag not in flags:
+ if flag not in obj.optflags:
+ raise MissingFlag(flag, var_type)
+ else:
+ objflags[flag] = flags[flag]
+
+ return obj(value, **objflags)
+
+def get_callable_args(obj):
+ """Grab all but the first argument of the specified callable, returning
+ the list, as well as a list of which of the arguments have default
+ values."""
+ if type(obj) is type:
+ obj = obj.__init__
+
+ args, varargs, keywords, defaults = inspect.getargspec(obj)
+ flaglist = []
+ if args:
+ if len(args) > 1 and args[0] == 'self':
+ args = args[1:]
+ flaglist.extend(args)
+
+ optional = set()
+ if defaults:
+ optional |= set(flaglist[-len(defaults):])
+ return flaglist, optional
+
+def factory_setup(name, obj):
+ """Prepare a factory for use."""
+ args, optional = get_callable_args(obj)
+ extra_args = args[1:]
+ if extra_args:
+ obj.flags, optional = extra_args, optional
+ obj.optflags = set(optional)
+ else:
+ obj.flags = obj.optflags = ()
+
+ if not hasattr(obj, 'name'):
+ obj.name = name
+
+def register(name, factory):
+ """Register a type, given its name and a factory callable.
+
+ Determines the required and optional flags from the factory's
+ arguments."""
+ factory_setup(name, factory)
+ available_types[factory.name] = factory
+
+
+# Register all our included types
+for name in dir(types):
+ if name.startswith('_'):
+ continue
+
+ obj = getattr(types, name)
+ if not callable(obj):
+ continue
+
+ register(name, obj)
diff --git a/meta/lib/oe/test_types.py b/meta/lib/oe/test_types.py
new file mode 100644
index 0000000..367cc30
--- /dev/null
+++ b/meta/lib/oe/test_types.py
@@ -0,0 +1,62 @@
+import unittest
+from oe.maketype import create, factory
+
+class TestTypes(unittest.TestCase):
+ def assertIsInstance(self, obj, cls):
+ return self.assertTrue(isinstance(obj, cls))
+
+ def assertIsNot(self, obj, other):
+ return self.assertFalse(obj is other)
+
+ def assertFactoryCreated(self, value, type, **flags):
+ cls = factory(type)
+ self.assertIsNot(cls, None)
+ self.assertIsInstance(create(value, type, **flags), cls)
+
+class TestBooleanType(TestTypes):
+ def test_invalid(self):
+ self.assertRaises(ValueError, create, '', 'boolean')
+ self.assertRaises(ValueError, create, 'foo', 'boolean')
+ self.assertRaises(TypeError, create, object(), 'boolean')
+
+ def test_true(self):
+ self.assertTrue(create('y', 'boolean'))
+ self.assertTrue(create('yes', 'boolean'))
+ self.assertTrue(create('1', 'boolean'))
+ self.assertTrue(create('t', 'boolean'))
+ self.assertTrue(create('true', 'boolean'))
+ self.assertTrue(create('TRUE', 'boolean'))
+ self.assertTrue(create('truE', 'boolean'))
+
+ def test_false(self):
+ self.assertFalse(create('n', 'boolean'))
+ self.assertFalse(create('no', 'boolean'))
+ self.assertFalse(create('0', 'boolean'))
+ self.assertFalse(create('f', 'boolean'))
+ self.assertFalse(create('false', 'boolean'))
+ self.assertFalse(create('FALSE', 'boolean'))
+ self.assertFalse(create('faLse', 'boolean'))
+
+ def test_bool_equality(self):
+ self.assertEqual(create('n', 'boolean'), False)
+ self.assertNotEqual(create('n', 'boolean'), True)
+ self.assertEqual(create('y', 'boolean'), True)
+ self.assertNotEqual(create('y', 'boolean'), False)
+
+class TestList(TestTypes):
+ def assertListEqual(self, value, valid, sep=None):
+ obj = create(value, 'list', separator=sep)
+ self.assertEqual(obj, valid)
+ if sep is not None:
+ self.assertEqual(obj.separator, sep)
+ self.assertEqual(str(obj), obj.separator.join(obj))
+
+ def test_list_nosep(self):
+ testlist = ['alpha', 'beta', 'theta']
+ self.assertListEqual('alpha beta theta', testlist)
+ self.assertListEqual('alpha beta\ttheta', testlist)
+ self.assertListEqual('alpha', ['alpha'])
+
+ def test_list_usersep(self):
+ self.assertListEqual('foo:bar', ['foo', 'bar'], ':')
+ self.assertListEqual('foo:bar:baz', ['foo', 'bar', 'baz'], ':')
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
new file mode 100644
index 0000000..ea31cf4
--- /dev/null
+++ b/meta/lib/oe/types.py
@@ -0,0 +1,104 @@
+import re
+
+class OEList(list):
+ """OpenEmbedded 'list' type
+
+ Acts as an ordinary list, but is constructed from a string value and a
+ separator (optional), and re-joins itself when converted to a string with
+ str(). Set the variable type flag to 'list' to use this type, and the
+ 'separator' flag may be specified (defaulting to whitespace)."""
+
+ name = "list"
+
+ def __init__(self, value, separator = None):
+ if value is not None:
+ list.__init__(self, value.split(separator))
+ else:
+ list.__init__(self)
+
+ if separator is None:
+ self.separator = " "
+ else:
+ self.separator = separator
+
+ def __str__(self):
+ return self.separator.join(self)
+
+def choice(value, choices):
+ """OpenEmbedded 'choice' type
+
+ Acts as a multiple choice for the user. To use this, set the variable
+ type flag to 'choice', and set the 'choices' flag to a space separated
+ list of valid values."""
+ if not isinstance(value, basestring):
+ raise TypeError("choice accepts a string, not '%s'" % type(value))
+
+ value = value.lower()
+ choices = choices.lower()
+ if value not in choices.split():
+ raise ValueError("Invalid choice '%s'. Valid choices: %s" %
+ (value, choices))
+ return value
+
+def regex(value, regexflags=None):
+ """OpenEmbedded 'regex' type
+
+ Acts as a regular expression, returning the pre-compiled regular
+ expression pattern object. To use this type, set the variable type flag
+ to 'regex', and optionally, set the 'regexflags' type to a space separated
+ list of the flags to control the regular expression matching (e.g.
+ FOO[regexflags] += 'ignorecase'). See the python documentation on the
+ 're' module for a list of valid flags."""
+
+ flagval = 0
+ if regexflags:
+ for flag in regexflags.split():
+ flag = flag.upper()
+ try:
+ flagval |= getattr(re, flag)
+ except AttributeError:
+ raise ValueError("Invalid regex flag '%s'" % flag)
+
+ try:
+ return re.compile(value, flagval)
+ except re.error, exc:
+ raise ValueError("Invalid regex value '%s': %s" %
+ (value, exc.args[0]))
+
+def boolean(value):
+ """OpenEmbedded 'boolean' type
+
+ Valid values for true: 'yes', 'y', 'true', 't', '1'
+ Valid values for false: 'no', 'n', 'false', 'f', '0'
+ """
+
+ if not isinstance(value, basestring):
+ raise TypeError("boolean accepts a string, not '%s'" % type(value))
+
+ value = value.lower()
+ if value in ('yes', 'y', 'true', 't', '1'):
+ return True
+ elif value in ('no', 'n', 'false', 'f', '0'):
+ return False
+ raise ValueError("Invalid boolean value '%s'" % value)
+
+def integer(value, numberbase=10):
+ """OpenEmbedded 'integer' type
+
+ Defaults to base 10, but this can be specified using the optional
+ 'numberbase' flag."""
+
+ return int(value, int(numberbase))
+
+_float = float
+def float(value, fromhex='false'):
+ """OpenEmbedded floating point type
+
+ To use this type, set the type flag to 'float', and optionally set the
+ 'fromhex' flag to a true value (obeying the same rules as for the
+ 'boolean' type) if the value is in base 16 rather than base 10."""
+
+ if boolean(fromhex):
+ return _float.fromhex(value)
+ else:
+ return _float(value)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 08/12] oe.packagegroup: add code for package groups (sync from OE)
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (6 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 07/12] Implement variable typing (sync from OE) Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 09/12] Move packagedata code into oe.packagedata " Chris Larson
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
This includes some utility functions for dealing with groups of packages
defined in the metadata. Metadata syntax:
PACKAGE_GROUP_<group> = "<list of packages>"
If the packages in the group are optional:
PACKAGE_GROUP_<group>[optional] = "1"
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/base.bbclass | 2 +-
meta/lib/oe/packagegroup.py | 29 +++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletions(-)
create mode 100644 meta/lib/oe/packagegroup.py
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 27a68de..8e8d572 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -9,7 +9,7 @@ inherit utility-tasks
inherit metadata_scm
inherit buildstats
-OE_IMPORTS += "sys os time oe.path oe.utils oe.data"
+OE_IMPORTS += "sys os time oe.path oe.utils oe.data oe.packagegroup"
def oe_import(d):
import os, sys
diff --git a/meta/lib/oe/packagegroup.py b/meta/lib/oe/packagegroup.py
new file mode 100644
index 0000000..b04c45a
--- /dev/null
+++ b/meta/lib/oe/packagegroup.py
@@ -0,0 +1,29 @@
+import itertools
+
+def is_optional(group, d):
+ return bool(d.getVarFlag("PACKAGE_GROUP_%s" % group, "optional"))
+
+def packages(groups, d):
+ for group in groups:
+ for pkg in (d.getVar("PACKAGE_GROUP_%s" % group, True) or "").split():
+ yield pkg
+
+def required_packages(groups, d):
+ req = filter(lambda group: not is_optional(group, d), groups)
+ return packages(req, d)
+
+def optional_packages(groups, d):
+ opt = filter(lambda group: is_optional(group, d), groups)
+ return packages(opt, d)
+
+def active_packages(features, d):
+ return itertools.chain(required_packages(features, d),
+ optional_packages(features, d))
+
+def active_recipes(features, d):
+ import oe.packagedata
+
+ for pkg in active_packages(features, d):
+ recipe = oe.packagedata.recipename(pkg, d)
+ if recipe:
+ yield recipe
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 09/12] Move packagedata code into oe.packagedata (sync from OE)
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (7 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 08/12] oe.packagegroup: add code for package groups " Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 10/12] packagedata: don't choke on empty PACKAGES Chris Larson
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/package.bbclass | 4 +-
meta/classes/package_rpm.bbclass | 3 +-
meta/classes/packagedata.bbclass | 68 ++-----------------------
meta/lib/oe/packagedata.py | 106 ++++++++++++++++++++++++++++++++++++++
4 files changed, 115 insertions(+), 66 deletions(-)
create mode 100644 meta/lib/oe/packagedata.py
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index e6b3df7..fddf5b1 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -295,7 +295,9 @@ def runstrip(file, elftype, d):
#
def get_package_mapping (pkg, d):
- data = read_subpkgdata(pkg, d)
+ import oe.packagedata
+
+ data = oe.packagedata.read_subpkgdata(pkg, d)
key = "PKG_%s" % pkg
if key in data:
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 4647116..236e613 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -316,6 +316,7 @@ package_install_internal_rpm () {
python write_specfile () {
import textwrap
+ import oe.packagedata
# We need to change '-' in a version field to '+'
# This needs to be done BEFORE the mapping_rename_hook
@@ -328,7 +329,7 @@ python write_specfile () {
ver = depends_dict[dep]
if dep and ver:
if '-' in ver:
- subd = read_subpkgdata_dict(dep, d)
+ subd = oe.packagedata.read_subpkgdata_dict(dep, d)
pv = subd['PV']
reppv = pv.replace('-', '+')
ver = ver.replace(pv, reppv)
diff --git a/meta/classes/packagedata.bbclass b/meta/classes/packagedata.bbclass
index 86f18a9..bf051fe 100644
--- a/meta/classes/packagedata.bbclass
+++ b/meta/classes/packagedata.bbclass
@@ -1,73 +1,13 @@
-def packaged(pkg, d):
- return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK)
-
-def read_pkgdatafile(fn):
- pkgdata = {}
-
- def decode(str):
- import codecs
- c = codecs.getdecoder("string_escape")
- return c(str)[0]
-
- if os.access(fn, os.R_OK):
- import re
- f = file(fn, 'r')
- lines = f.readlines()
- f.close()
- r = re.compile("([^:]+):\s*(.*)")
- for l in lines:
- m = r.match(l)
- if m:
- pkgdata[m.group(1)] = decode(m.group(2))
-
- return pkgdata
-
-def get_subpkgedata_fn(pkg, d):
- archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ")
- archs.reverse()
- pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d)
- targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d)
- for arch in archs:
- fn = pkgdata + arch + targetdir + pkg
- if os.path.exists(fn):
- return fn
- return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d)
-
-def has_subpkgdata(pkg, d):
- return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
-
-def read_subpkgdata(pkg, d):
- return read_pkgdatafile(get_subpkgedata_fn(pkg, d))
-
-def has_pkgdata(pn, d):
- fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
- return os.access(fn, os.R_OK)
-
-def read_pkgdata(pn, d):
- fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
- return read_pkgdatafile(fn)
-
python read_subpackage_metadata () {
- data = read_pkgdata(bb.data.getVar('PN', d, 1), d)
+ import oe.packagedata
+
+ data = oe.packagedata.read_pkgdata(bb.data.getVar('PN', d, 1), d)
for key in data.keys():
bb.data.setVar(key, data[key], d)
for pkg in bb.data.getVar('PACKAGES', d, 1).split():
- sdata = read_subpkgdata(pkg, d)
+ sdata = oe.packagedata.read_subpkgdata(pkg, d)
for key in sdata.keys():
bb.data.setVar(key, sdata[key], d)
}
-
-
-#
-# Collapse FOO_pkg variables into FOO
-#
-def read_subpkgdata_dict(pkg, d):
- ret = {}
- subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d))
- for var in subd:
- newvar = var.replace("_" + pkg, "")
- ret[newvar] = subd[var]
- return ret
-
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
new file mode 100644
index 0000000..7f0a89d
--- /dev/null
+++ b/meta/lib/oe/packagedata.py
@@ -0,0 +1,106 @@
+import os
+import bb.data
+import codecs
+
+def packaged(pkg, d):
+ return os.access(get_subpkgedata_fn(pkg, d) + '.packaged', os.R_OK)
+
+def read_pkgdatafile(fn):
+ pkgdata = {}
+
+ def decode(str):
+ c = codecs.getdecoder("string_escape")
+ return c(str)[0]
+
+ if os.access(fn, os.R_OK):
+ import re
+ f = file(fn, 'r')
+ lines = f.readlines()
+ f.close()
+ r = re.compile("([^:]+):\s*(.*)")
+ for l in lines:
+ m = r.match(l)
+ if m:
+ pkgdata[m.group(1)] = decode(m.group(2))
+
+ return pkgdata
+
+def get_subpkgedata_fn(pkg, d):
+ archs = bb.data.expand("${PACKAGE_ARCHS}", d).split(" ")
+ archs.reverse()
+ pkgdata = bb.data.expand('${TMPDIR}/pkgdata/', d)
+ targetdir = bb.data.expand('${TARGET_VENDOR}-${TARGET_OS}/runtime/', d)
+ for arch in archs:
+ fn = pkgdata + arch + targetdir + pkg
+ if os.path.exists(fn):
+ return fn
+ return bb.data.expand('${PKGDATA_DIR}/runtime/%s' % pkg, d)
+
+def has_subpkgdata(pkg, d):
+ return os.access(get_subpkgedata_fn(pkg, d), os.R_OK)
+
+def read_subpkgdata(pkg, d):
+ return read_pkgdatafile(get_subpkgedata_fn(pkg, d))
+
+def has_pkgdata(pn, d):
+ fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
+ return os.access(fn, os.R_OK)
+
+def read_pkgdata(pn, d):
+ fn = bb.data.expand('${PKGDATA_DIR}/%s' % pn, d)
+ return read_pkgdatafile(fn)
+
+#
+# Collapse FOO_pkg variables into FOO
+#
+def read_subpkgdata_dict(pkg, d):
+ ret = {}
+ subd = read_pkgdatafile(get_subpkgedata_fn(pkg, d))
+ for var in subd:
+ newvar = var.replace("_" + pkg, "")
+ ret[newvar] = subd[var]
+ return ret
+
+def _pkgmap(d):
+ """Return a dictionary mapping package to recipe name."""
+
+ target_os = d.getVar("TARGET_OS", True)
+ target_vendor = d.getVar("TARGET_VENDOR", True)
+ basedir = os.path.dirname(d.getVar("PKGDATA_DIR", True))
+
+ dirs = ("%s%s-%s" % (arch, target_vendor, target_os)
+ for arch in d.getVar("PACKAGE_ARCHS", True).split())
+
+ pkgmap = {}
+ for pkgdatadir in (os.path.join(basedir, sys) for sys in dirs):
+ try:
+ files = os.listdir(pkgdatadir)
+ except OSError:
+ continue
+
+ for pn in filter(lambda f: not os.path.isdir(os.path.join(pkgdatadir, f)), files):
+ try:
+ pkgdata = read_pkgdatafile(os.path.join(pkgdatadir, pn))
+ except OSError:
+ continue
+
+ for pkg in pkgdata["PACKAGES"].split():
+ pkgmap[pkg] = pn
+
+ return pkgmap
+
+def pkgmap(d):
+ """Return a dictionary mapping package to recipe name.
+ Cache the mapping in the metadata"""
+
+ pkgmap_data = d.getVar("__pkgmap_data", False)
+ if pkgmap_data is None:
+ pkgmap_data = _pkgmap(d)
+ d.setVar("__pkgmap_data", pkgmap_data)
+
+ return pkgmap_data
+
+def recipename(pkg, d):
+ """Return the recipe name for the given binary package name."""
+
+ return pkgmap(d).get(pkg)
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 10/12] packagedata: don't choke on empty PACKAGES
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (8 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 09/12] Move packagedata code into oe.packagedata " Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 11/12] image.bbclass: switch to OE's IMAGE_FEATURES Chris Larson
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/lib/oe/packagedata.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 7f0a89d..ee10a23 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -84,7 +84,8 @@ def _pkgmap(d):
except OSError:
continue
- for pkg in pkgdata["PACKAGES"].split():
+ packages = pkgdata.get("PACKAGES") or ""
+ for pkg in packages.split():
pkgmap[pkg] = pn
return pkgmap
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 11/12] image.bbclass: switch to OE's IMAGE_FEATURES
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (9 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 10/12] packagedata: don't choke on empty PACKAGES Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:19 ` [PATCH 12/12] Use oe.data for IMAGE_FEATURES Chris Larson
2011-03-17 16:23 ` [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Currently, all image features are assumed to be package groups defined with
oe.packagegroup (PACKAGE_GROUP_<group> = "<list of packages>").
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/image.bbclass | 41 +++++++++-
meta/classes/poky-image.bbclass | 88 +++++---------------
meta/conf/bitbake.conf | 1 +
meta/recipes-core/images/poky-image-minimal-dev.bb | 2 +-
meta/recipes-extended/images/poky-image-lsb-dev.bb | 2 +-
meta/recipes-extended/images/poky-image-lsb-sdk.bb | 2 +-
meta/recipes-sato/images/poky-image-sato-dev.bb | 2 +-
meta/recipes-sato/images/poky-image-sato-sdk.bb | 2 +-
8 files changed, 67 insertions(+), 73 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 2cc17e1..5d89598 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -11,8 +11,45 @@ INHIBIT_DEFAULT_DEPS = "1"
# "export IMAGE_BASENAME" not supported at this time
IMAGE_BASENAME[export] = "1"
-export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}"
-PACKAGE_INSTALL_ATTEMPTONLY ?= ""
+
+PACKAGE_INSTALL = "${@' '.join(oe.packagegroup.required_packages('${IMAGE_FEATURES}'.split(), d))}"
+PACKAGE_INSTALL_ATTEMPTONLY = "${@' '.join(oe.packagegroup.optional_packages('${IMAGE_FEATURES}'.split(), d))}"
+RDEPENDS += "${@' '.join(oe.packagegroup.active_packages('${IMAGE_FEATURES}'.split(), d))}"
+
+
+IMAGE_FEATURES ?= ""
+IMAGE_FEATURES[type] = "list"
+IMAGE_FEATURES_prepend = "image_base "
+
+# Define our always included package group
+PACKAGE_GROUP_image_base = "${IMAGE_INSTALL}"
+
+# The following package groups allow one to add debugging, development, and
+# documentation files for all packages installed in the image.
+
+def string_set(iterable):
+ return ' '.join(set(iterable))
+
+def image_features_noextras(d):
+ for f in d.getVar("IMAGE_FEATURES", True).split():
+ if not f in ('dbg', 'dev', 'doc'):
+ yield f
+
+def dbg_packages(d):
+ from itertools import chain
+
+ features = image_features_noextras(d)
+ return string_set("%s-dbg" % pkg
+ for pkg in chain(oe.packagegroup.active_packages(features, d),
+ oe.packagegroup.active_recipes(features, d)))
+
+PACKAGE_GROUP_dbg = "${@dbg_packages(d)}"
+PACKAGE_GROUP_dbg[optional] = "1"
+PACKAGE_GROUP_dev = "${@string_set('%s-dev' % pn for pn in oe.packagegroup.active_recipes(image_features_noextras(d), d))}"
+PACKAGE_GROUP_dev[optional] = "1"
+PACKAGE_GROUP_doc = "${@string_set('%s-doc' % pn for pn in oe.packagegroup.active_recipes(image_features_noextras(d), d))}"
+PACKAGE_GROUP_doc[optional] = "1"
+
# We need to recursively follow RDEPENDS and RRECOMMENDS for images
do_rootfs[recrdeptask] += "do_deploy do_populate_sysroot"
diff --git a/meta/classes/poky-image.bbclass b/meta/classes/poky-image.bbclass
index a261a6a..567d493 100644
--- a/meta/classes/poky-image.bbclass
+++ b/meta/classes/poky-image.bbclass
@@ -13,10 +13,10 @@ LIC_FILES_CHKSUM = "file://${POKYBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3
# Available IMAGE_FEATURES:
#
# - apps-console-core
-# - x11-base - X11 server + minimal desktop
-# - x11-sato - OpenedHand Sato environment
-# - x11-netbook - Metacity based environment for netbooks
-# - apps-x11-core - X Terminal, file manager, file editor
+# - x11-base - X11 server + minimal desktop
+# - x11-sato - OpenedHand Sato environment
+# - x11-netbook - Metacity based environment for netbooks
+# - apps-x11-core - X Terminal, file manager, file editor
# - apps-x11-games
# - apps-x11-pimlico - OpenedHand Pimlico apps
# - tools-sdk - SDK
@@ -26,73 +26,29 @@ LIC_FILES_CHKSUM = "file://${POKYBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3
# - nfs-server - NFS server (exports / over NFS to everybody)
# - ssh-server-dropbear - SSH server (dropbear)
# - ssh-server-openssh - SSH server (openssh)
-# - dev-pkgs - development packages
-# - dbg-pkgs - debug packages
+# - dev - development packages
+# - dbg - debug packages
#
+PACKAGE_GROUP_apps-console-core = "task-poky-apps-console"
+PACKAGE_GROUP_x11-base = "task-poky-x11-base"
+PACKAGE_GROUP_x11-sato = "task-poky-x11-sato"
+PACKAGE_GROUP_x11-netbook = "task-poky-x11-netbook"
+PACKAGE_GROUP_apps-x11-core = "task-poky-apps-x11-core"
+PACKAGE_GROUP_apps-x11-games = "task-poky-apps-x11-games"
+PACKAGE_GROUP_apps-x11-pimlico = "task-poky-apps-x11-pimlico"
+PACKAGE_GROUP_tools-debug = "task-poky-tools-debug"
+PACKAGE_GROUP_tools-profile = "task-poky-tools-profile"
+PACKAGE_GROUP_tools-testapps = "task-poky-tools-testapps"
+PACKAGE_GROUP_tools-sdk = "task-poky-tools-sdk"
+PACKAGE_GROUP_nfs-server = "task-poky-nfs-server"
+PACKAGE_GROUP_package-management = "${ROOTFS_PKGMANAGE}"
+PACKAGE_GROUP_qt4-pkgs = "task-poky-qt-demos"
+PACKAGE_GROUP_ssh-server-dropbear = "task-poky-ssh-dropbear"
+PACKAGE_GROUP_ssh-server-openssh = "task-poky-ssh-openssh"
POKY_BASE_INSTALL = '\
task-poky-boot \
task-base-extended \
- ${@base_contains("IMAGE_FEATURES", "dbg-pkgs", "task-poky-boot-dbg task-base-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", "dev-pkgs", "task-poky-boot-dev task-base-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "apps-console-core", "task-poky-apps-console", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-console-core", "dbg-pkgs"], "task-poky-apps-console-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-console-core", "dev-pkgs"], "task-poky-apps-console-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "x11-base", "task-poky-x11-base", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["x11-base", "dbg-pkgs"], "task-poky-x11-base-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["x11-base", "dev-pkgs"], "task-poky-x11-base-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "x11-sato", "task-poky-x11-sato", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["x11-sato", "dbg-pkgs"], "task-poky-x11-sato-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["x11-sato", "dev-pkgs"], "task-poky-x11-sato-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "x11-netbook", "task-poky-x11-netbook", "", d)} \
- ${@base_contains("IMAGE_FEATURES", ["x11-netbook", "dbg-pkgs"], "task-poky-x11-netbook-dbg", "", d)} \
- ${@base_contains("IMAGE_FEATURES", ["x11-netbook", "dev-pkgs"], "task-poky-x11-netbook-dev", "", d)} \
- ${@base_contains("IMAGE_FEATURES", "apps-x11-core", "task-poky-apps-x11-core", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-x11-core", "dbg-pkgs"], "task-poky-apps-x11-core-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-x11-core", "dev-pkgs"], "task-poky-apps-x11-core-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "apps-x11-games", "task-poky-apps-x11-games", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-x11-games", "dbg-pkgs"], "task-poky-apps-x11-games-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-x11-games", "dev-pkgs"], "task-poky-apps-x11-games-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "apps-x11-pimlico", "task-poky-apps-x11-pimlico", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-x11-pimlico", "dbg-pkgs"], "task-poky-apps-x11-pimlico-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["apps-x11-pimlico", "dev-pkgs"], "task-poky-apps-x11-pimlico-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "tools-debug", "task-poky-tools-debug", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-debug", "dbg-pkgs"], "task-poky-tools-debug-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-debug", "dev-pkgs"], "task-poky-tools-debug-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "tools-profile", "task-poky-tools-profile", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-profile", "dbg-pkgs"], "task-poky-tools-profile-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-profile", "dev-pkgs"], "task-poky-tools-profile-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "tools-testapps", "task-poky-tools-testapps", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-testapps", "dbg-pkgs"], "task-poky-tools-testapps-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-testapps", "dev-pkgs"], "task-poky-tools-testapps-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "tools-sdk", "task-poky-sdk task-poky-standalone-sdk-target", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-sdk", "dbg-pkgs"], "task-poky-sdk-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["tools-sdk", "dev-pkgs"], "task-poky-sdk-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "nfs-server", "task-poky-nfs-server", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["nfs-server", "dbg-pkgs"], "task-poky-nfs-server-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["nfs-server", "dev-pkgs"], "task-poky-nfs-server-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "ssh-server-dropbear", "task-poky-ssh-dropbear", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["ssh-server-dropbear", "dbg-pkgs"], "task-poky-ssh-dropbear-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["ssh-server-dropbear", "dev-pkgs"], "task-poky-ssh-dropbear-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "ssh-server-openssh", "task-poky-ssh-openssh", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["ssh-server-openssh", "dbg-pkgs"], "task-poky-ssh-openssh-dbg", "",d)} \
- ${@base_contains("IMAGE_FEATURES", ["ssh-server-openssh", "dev-pkgs"], "task-poky-ssh-openssh-dev", "",d)} \
- \
- ${@base_contains("IMAGE_FEATURES", "package-management", "${ROOTFS_PKGMANAGE}", "${ROOTFS_PKGMANAGE_BOOTSTRAP}",d)} \
- ${@base_contains("IMAGE_FEATURES", "qt4-pkgs", "task-poky-qt-demos", "",d)} \
${POKY_EXTRA_INSTALL} \
'
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 42b9825..c49a737 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -726,6 +726,7 @@ MACHINE_EXTRA_RDEPENDS ?= ""
MACHINE_EXTRA_RRECOMMENDS ?= ""
MACHINE_ESSENTIAL_EXTRA_RDEPENDS ?= ""
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS ?= ""
+EXTRA_IMAGE_FEATURES ?= ""
IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}"
COMBINED_FEATURES = "\
diff --git a/meta/recipes-core/images/poky-image-minimal-dev.bb b/meta/recipes-core/images/poky-image-minimal-dev.bb
index c64b657..e65a942 100644
--- a/meta/recipes-core/images/poky-image-minimal-dev.bb
+++ b/meta/recipes-core/images/poky-image-minimal-dev.bb
@@ -3,7 +3,7 @@
#
IMAGE_INSTALL = "task-poky-boot ${ROOTFS_PKGMANAGE}"
-IMAGE_FEATURES += "dev-pkgs"
+IMAGE_FEATURES += "dev"
IMAGE_LINGUAS = " "
diff --git a/meta/recipes-extended/images/poky-image-lsb-dev.bb b/meta/recipes-extended/images/poky-image-lsb-dev.bb
index 578fbd0..f549ba0 100644
--- a/meta/recipes-extended/images/poky-image-lsb-dev.bb
+++ b/meta/recipes-extended/images/poky-image-lsb-dev.bb
@@ -1,4 +1,4 @@
-IMAGE_FEATURES += "apps-console-core dev-pkgs ssh-server-openssh"
+IMAGE_FEATURES += "apps-console-core dev ssh-server-openssh"
IMAGE_INSTALL = "\
${POKY_BASE_INSTALL} \
diff --git a/meta/recipes-extended/images/poky-image-lsb-sdk.bb b/meta/recipes-extended/images/poky-image-lsb-sdk.bb
index 967bb02..54a1d73 100644
--- a/meta/recipes-extended/images/poky-image-lsb-sdk.bb
+++ b/meta/recipes-extended/images/poky-image-lsb-sdk.bb
@@ -1,4 +1,4 @@
-IMAGE_FEATURES += "apps-console-core tools-debug tools-profile tools-sdk dev-pkgs ssh-server-openssh"
+IMAGE_FEATURES += "apps-console-core tools-debug tools-profile tools-sdk dev ssh-server-openssh"
IMAGE_INSTALL = "\
${POKY_BASE_INSTALL} \
diff --git a/meta/recipes-sato/images/poky-image-sato-dev.bb b/meta/recipes-sato/images/poky-image-sato-dev.bb
index 429095e..50b3c34 100644
--- a/meta/recipes-sato/images/poky-image-sato-dev.bb
+++ b/meta/recipes-sato/images/poky-image-sato-dev.bb
@@ -2,7 +2,7 @@
# Copyright (C) 2007 OpenedHand Ltd.
#
-IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} dev-pkgs"
+IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} dev"
LICENSE = "MIT"
diff --git a/meta/recipes-sato/images/poky-image-sato-sdk.bb b/meta/recipes-sato/images/poky-image-sato-sdk.bb
index 9f8eef9..d15236e 100644
--- a/meta/recipes-sato/images/poky-image-sato-sdk.bb
+++ b/meta/recipes-sato/images/poky-image-sato-sdk.bb
@@ -2,7 +2,7 @@
# Copyright (C) 2007 OpenedHand Ltd.
#
-IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} tools-debug tools-profile tools-sdk dev-pkgs qt4-pkgs"
+IMAGE_FEATURES += "apps-console-core ${SATO_IMAGE_FEATURES} tools-debug tools-profile tools-sdk dev qt4-pkgs"
LICENSE = "MIT"
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH 12/12] Use oe.data for IMAGE_FEATURES
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (10 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 11/12] image.bbclass: switch to OE's IMAGE_FEATURES Chris Larson
@ 2011-03-17 16:19 ` Chris Larson
2011-03-17 16:23 ` [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
12 siblings, 0 replies; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:19 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
From: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
meta/classes/image.bbclass | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 5d89598..9b5c287 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -12,9 +12,9 @@ INHIBIT_DEFAULT_DEPS = "1"
# "export IMAGE_BASENAME" not supported at this time
IMAGE_BASENAME[export] = "1"
-PACKAGE_INSTALL = "${@' '.join(oe.packagegroup.required_packages('${IMAGE_FEATURES}'.split(), d))}"
-PACKAGE_INSTALL_ATTEMPTONLY = "${@' '.join(oe.packagegroup.optional_packages('${IMAGE_FEATURES}'.split(), d))}"
-RDEPENDS += "${@' '.join(oe.packagegroup.active_packages('${IMAGE_FEATURES}'.split(), d))}"
+PACKAGE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
+PACKAGE_INSTALL_ATTEMPTONLY = "${@' '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
+RDEPENDS += "${@' '.join(oe.packagegroup.active_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
IMAGE_FEATURES ?= ""
@@ -31,9 +31,9 @@ def string_set(iterable):
return ' '.join(set(iterable))
def image_features_noextras(d):
- for f in d.getVar("IMAGE_FEATURES", True).split():
- if not f in ('dbg', 'dev', 'doc'):
- yield f
+ for feature in oe.data.typed_value('IMAGE_FEATURES', d):
+ if not feature in ('dbg', 'dev', 'doc'):
+ yield feature
def dbg_packages(d):
from itertools import chain
--
1.7.2.3
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH 00/12] Pull request - some sync bits from OE
2011-03-17 16:18 [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
` (11 preceding siblings ...)
2011-03-17 16:19 ` [PATCH 12/12] Use oe.data for IMAGE_FEATURES Chris Larson
@ 2011-03-17 16:23 ` Chris Larson
2011-03-21 17:53 ` Richard Purdie
12 siblings, 1 reply; 15+ messages in thread
From: Chris Larson @ 2011-03-17 16:23 UTC (permalink / raw)
To: openembedded-core; +Cc: Chris Larson
On Thu, Mar 17, 2011 at 9:18 AM, Chris Larson <kergoth@gmail.com> wrote:
> From: Chris Larson <chris_larson@mentor.com>
>
> This is primarily a sync of a couple OE features, along with a few minor
> changes to ensure those features work fine for us. More OE sync bits will be
> forthcoming. These certainly need review. In particular, I haven't gotten
> any feedback on how the poky folk feel about this approach to IMAGE_FEATURES
> relative to their own, so please do comment on that, if you would :)
>
> Pull URL: https://github.com/kergoth/oe-core
>
> Branch: oe-sync
> Browse: https://github.com/kergoth/oe-core/commits/oe-sync
>
>
> Thanks,
> Chris Larson <chris_larson@mentor.com>
Erm, I forgot I hadn't yet dealt with ROOTFS_PACKAGEMANAGE_BOOTSTRAP,
in the IMAGE_FEATURES changes, don't pull this until I resolve that :)
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
^ permalink raw reply [flat|nested] 15+ messages in thread* Re: [PATCH 00/12] Pull request - some sync bits from OE
2011-03-17 16:23 ` [PATCH 00/12] Pull request - some sync bits from OE Chris Larson
@ 2011-03-21 17:53 ` Richard Purdie
0 siblings, 0 replies; 15+ messages in thread
From: Richard Purdie @ 2011-03-21 17:53 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer; +Cc: Chris Larson
On Thu, 2011-03-17 at 09:23 -0700, Chris Larson wrote:
> On Thu, Mar 17, 2011 at 9:18 AM, Chris Larson <kergoth@gmail.com> wrote:
> > From: Chris Larson <chris_larson@mentor.com>
> >
> > This is primarily a sync of a couple OE features, along with a few minor
> > changes to ensure those features work fine for us. More OE sync bits will be
> > forthcoming. These certainly need review. In particular, I haven't gotten
> > any feedback on how the poky folk feel about this approach to IMAGE_FEATURES
> > relative to their own, so please do comment on that, if you would :)
> >
> > Pull URL: https://github.com/kergoth/oe-core
> >
> > Branch: oe-sync
> > Browse: https://github.com/kergoth/oe-core/commits/oe-sync
> >
> >
> > Thanks,
> > Chris Larson <chris_larson@mentor.com>
>
> Erm, I forgot I hadn't yet dealt with ROOTFS_PACKAGEMANAGE_BOOTSTRAP,
> in the IMAGE_FEATURES changes, don't pull this until I resolve that :)
Ok, I've pulled the first four commits for now since there were fairly
obvious fixes and not part of what you mention above, I'll wait for
another pull request for the rest.
Cheers,
Richard
^ permalink raw reply [flat|nested] 15+ messages in thread