aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/image.bbclass21
-rw-r--r--meta/classes/image_types.bbclass16
2 files changed, 26 insertions, 11 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 5edbca1295d..d49774795ba 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -372,7 +372,7 @@ python () {
alltypes.append("debugfs_" + t)
def _add_type(t):
- baset = image_split_type(t, ctypes)[0]
+ baset = image_split_type(t, ctypes, d)[0]
input_t = t
if baset not in basetypes:
basetypes[baset]= []
@@ -391,7 +391,7 @@ python () {
if dep not in alltypes:
alltypes.append(dep)
_add_type(dep)
- basedep = image_split_type(dep, ctypes)[0]
+ basedep = image_split_type(dep, ctypes, d)[0]
typedeps[baset].add(basedep)
if baset != input_t:
@@ -442,14 +442,17 @@ python () {
d.delVarFlag('IMAGE_CMD_' + realt, 'func')
rm_tmp_images = set()
- def gen_conversion_cmds(bt):
+ def gen_conversion_cmds(basetype, type):
+ if basetype == type:
+ # Done, no further conversions needed.
+ return
for ctype in ctypes:
- if bt[bt.find('.') + 1:] == ctype:
- type = bt[0:-len(ctype) - 1]
+ if type.endswith("." + ctype):
+ type = type[0:-len(ctype) - 1]
if type.startswith("debugfs_"):
type = type[8:]
# Create input image first.
- gen_conversion_cmds(type)
+ gen_conversion_cmds(basetype, type)
localdata.setVar('type', type)
cmd = "\t" + (localdata.getVar("CONVERSION_CMD_" + ctype, True) or localdata.getVar("COMPRESS_CMD_" + ctype, True))
if cmd not in cmds:
@@ -462,8 +465,10 @@ python () {
if type not in alltypes:
rm_tmp_images.add(localdata.expand("${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}"))
- for bt in basetypes[t]:
- gen_conversion_cmds(bt)
+ for type in basetypes[t]:
+ # Probably t == bt, but better check explicitly, perhaps that'll change.
+ bt = image_split_type(type, ctypes, d)[0]
+ gen_conversion_cmds(bt, type)
localdata.setVar('type', realt)
if t not in alltypes:
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index e632fd111ca..8a5346e6bd2 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -9,10 +9,20 @@ IMAGE_NAME_SUFFIX ??= ".rootfs"
# set this value to 2048 (2MiB alignment).
IMAGE_ROOTFS_ALIGNMENT ?= "1"
-def image_split_type(type, allctypes):
+def image_split_type(type, allctypes, d):
'''Returns (basetype, set of compression types in use).'''
basetype = type
compressiontypes = set()
+
+ # Abort stripping the type further if "basetype" has a matching
+ # IMAGE_CMD or is a masked image type. For example, if there
+ # was a fictional IMAGE_CMD_ext4.xz which creates a compressed
+ # file directly, then we should use that instead of using
+ # IMAGE_CMD_ext4 + CONVERSION_CMD_xz.
+ if d.getVar('IMAGE_CMD_' + basetype, True) or \
+ basetype in d.getVar('IMAGE_TYPES_MASKED', True).split():
+ return (basetype, compressiontypes)
+
for ctype in allctypes:
if type.endswith("." + ctype):
basetype = type[:-len("." + ctype)]
@@ -21,7 +31,7 @@ def image_split_type(type, allctypes):
if basetype != type:
# New base type itself might be generated by a conversion command.
- basetype, newctypes = image_split_type(basetype, allctypes)
+ basetype, newctypes = image_split_type(basetype, allctypes, d)
compressiontypes.update(newctypes)
return (basetype, compressiontypes)
@@ -38,7 +48,7 @@ def image_getdepends(d):
deps = []
ctypes = set(d.getVar('CONVERSIONTYPES', True).split())
for type in (d.getVar('IMAGE_FSTYPES', True) or "").split():
- basetype, compressiontypes = image_split_type(type, ctypes)
+ basetype, compressiontypes = image_split_type(type, ctypes, d)
for ctype in compressiontypes:
adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype, True), deps)
for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype, True) or "").split():