Skip to contentSkip to conversation

image_types.bbclass: get rid of IMAGE_DEPENDS

PATCH Superseded Ed Bartosh 4 participants 12 messages Jun 15, 2017 – Jun 16, 2017

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 image_types.bbclass: get rid of IMAGE_DEPENDS

The IMAGE_DEPENDS variable can be overriden to add dependencies for individual image types. Those dependencies are added to the do_rootfs task, while they really should be added to the specific image type tasks.

Also, the IMAGE_DEPENDS variable is not documented anywhere.

Replaced usage of IMAGE_DEPENDS with explicitly added dependencies to do_image_<image type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)
meta/classes/image_types.bbclass +14 -22
index 7749b00..ea55c05 100644
@@ -29,12 +29,6 @@ def imagetypes_getdepends(d):
     deps = set()
     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps)
-
-        for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
-            base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps)
-            resttypes += rest
 
         for ctype in resttypes:
             adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
@@ -101,7 +95,7 @@ IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAM
 # you need special parameters (like --xattrs) which are only supported
 # by GNU tar upstream >= 1.27, then override that default:
 # IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
-# IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+# do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
 # EXTRANATIVEPATH += "tar-native"
 #
 # The GNU documentation does not specify whether --xattrs-include is necessary.
@@ -209,21 +203,19 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"
 EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""
 
-IMAGE_DEPENDS = ""
-IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
-IMAGE_DEPENDS_cramfs = "util-linux-native"
-IMAGE_DEPENDS_ext2 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext3 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext4 = "e2fsprogs-native"
-IMAGE_DEPENDS_btrfs = "btrfs-tools-native"
-IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
-IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
-IMAGE_DEPENDS_ubi = "mtd-utils-native"
-IMAGE_DEPENDS_ubifs = "mtd-utils-native"
-IMAGE_DEPENDS_multiubi = "mtd-utils-native"
-IMAGE_DEPENDS_wic = "parted-native"
+do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
+do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
+do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-xz[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_elf[depends] += "virtual/kernel-native:do_populate_sysroot mkelfimage-native:do_populate_sysroot"
+do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
Signature · 1 line
2.1.4
#1 lore raw
Quoted 4 lines · Ed Bartosh

The IMAGE_DEPENDS variable can be overriden to add dependencies for individual image types. Those dependencies are added to the do_rootfs task, while they really should be added to the specific image type tasks.

Other layers such as meta-raspberrypi use IMAGE_DEPENDS, should we move oe-core to use [depends] but handle IMAGE_DEPENDS (with a deprecation warning) for some of the 2.4 cycle?

Ross

#2 lore raw
Quoted 9 lines · Ross
Quoted 6 lines · Ed Bartosh

The IMAGE_DEPENDS variable can be overriden to add dependencies for individual image types.  Those dependencies are added to the do_rootfs
task, while they really should be added to the specific image type tasks.

Quoted 3 lines

Other layers such as meta-raspberrypi use IMAGE_DEPENDS, should we move oe-core to use [depends] but handle IMAGE_DEPENDS (with a deprecation warning) for some of the 2.4 cycle?

Yes, a fatal error if IMAGE_DEPENDS is set and telling the user what to change it to would be best IMO.

Cheers,

Richard

author
#3 lore raw

PATCH v2 1/1 image_types.bbclass: get rid of IMAGE_DEPENDS

The IMAGE_DEPENDS variable can be overriden to add dependencies for individual image types. Those dependencies are added to the do_rootfs task, while they really should be added to the specific image type tasks.

Also, the IMAGE_DEPENDS variable is not documented anywhere.

Replaced usage of IMAGE_DEPENDS with explicitly added dependencies to do_image_<image type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 41 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 22 deletions(-)
meta/classes/image_types.bbclass +19 -22
index 7749b00..cca2a07 100644
@@ -29,12 +29,6 @@ def imagetypes_getdepends(d):
     deps = set()
     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps)
-
-        for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
-            base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps)
-            resttypes += rest
 
         for ctype in resttypes:
             adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
@@ -101,7 +95,7 @@ IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAM
 # you need special parameters (like --xattrs) which are only supported
 # by GNU tar upstream >= 1.27, then override that default:
 # IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
-# IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+# do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
 # EXTRANATIVEPATH += "tar-native"
 #
 # The GNU documentation does not specify whether --xattrs-include is necessary.
@@ -209,21 +203,24 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"
 EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""
 
-IMAGE_DEPENDS = ""
-IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
-IMAGE_DEPENDS_cramfs = "util-linux-native"
-IMAGE_DEPENDS_ext2 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext3 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext4 = "e2fsprogs-native"
-IMAGE_DEPENDS_btrfs = "btrfs-tools-native"
-IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
-IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
-IMAGE_DEPENDS_ubi = "mtd-utils-native"
-IMAGE_DEPENDS_ubifs = "mtd-utils-native"
-IMAGE_DEPENDS_multiubi = "mtd-utils-native"
-IMAGE_DEPENDS_wic = "parted-native"
+python () {
+    if d.getVar('IMAGE_DEPENDS') != None:
+        bb.fatal('IMAGE_DEPENDS is deprecated. Use do_image_<type>[depends] += "<recipe>:<task>>" instead')
+}
+
+do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
+do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
+do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-xz[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_elf[depends] += "virtual/kernel-native:do_populate_sysroot mkelfimage-native:do_populate_sysroot"
+do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
Signature · 1 line
2.1.4
#4 lore raw

meta/classes/image_types.bbclass EXTRA_IMAGECMD_ext4 ?= "-i 4096" · line 208

Quoted 2 lines · Ed Bartosh
meta/classes/image_types.bbclass +2 -0
+    if d.getVar('IMAGE_DEPENDS') != None:
+        bb.fatal('IMAGE_DEPENDS is deprecated. Use do_image_<type>[depends] += "<recipe>:<task>>" instead')

s/>>/>/

also, should it be a warning instead?

#5 lore raw
Quoted 2 lines · Leonardo Sandoval

also, should it be a warning instead?

Not if the logic to use the value has been deleted!

Ross

#6 lore raw
Quoted 8 lines · Ross

On 15 June 2017 at 17:51, Leonardo Sandoval <[email protected]> wrote:
also, should it be a warning instead?

Not if the logic to use the value has been deleted!

Oh, I see that logic removal! sorry for the noise.

Quoted 4 lines

Ross

author
#7 lore raw

PATCH v3 1/1 image_types.bbclass: get rid of IMAGE_DEPENDS

In reply to Leonardo Sandoval

The IMAGE_DEPENDS variable can be overriden to add dependencies for individual image types. Those dependencies are added to the do_rootfs task, while they really should be added to the specific image type tasks.

Also, the IMAGE_DEPENDS variable is not documented anywhere.

Replaced usage of IMAGE_DEPENDS with explicitly added dependencies to do_image_<image type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 41 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 22 deletions(-)
meta/classes/image_types.bbclass +19 -22
index 7749b00..0d7c27e 100644
@@ -29,12 +29,6 @@ def imagetypes_getdepends(d):
     deps = set()
     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps)
-
-        for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
-            base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps)
-            resttypes += rest
 
         for ctype in resttypes:
             adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
@@ -101,7 +95,7 @@ IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAM
 # you need special parameters (like --xattrs) which are only supported
 # by GNU tar upstream >= 1.27, then override that default:
 # IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
-# IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+# do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
 # EXTRANATIVEPATH += "tar-native"
 #
 # The GNU documentation does not specify whether --xattrs-include is necessary.
@@ -209,21 +203,24 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"
 EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""
 
-IMAGE_DEPENDS = ""
-IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
-IMAGE_DEPENDS_cramfs = "util-linux-native"
-IMAGE_DEPENDS_ext2 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext3 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext4 = "e2fsprogs-native"
-IMAGE_DEPENDS_btrfs = "btrfs-tools-native"
-IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
-IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
-IMAGE_DEPENDS_ubi = "mtd-utils-native"
-IMAGE_DEPENDS_ubifs = "mtd-utils-native"
-IMAGE_DEPENDS_multiubi = "mtd-utils-native"
-IMAGE_DEPENDS_wic = "parted-native"
+python () {
+    if d.getVar('IMAGE_DEPENDS') != None:
+        bb.fatal('IMAGE_DEPENDS is deprecated. Use do_image_<type>[depends] += "<recipe>:<task>" instead')
+}
+
+do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
+do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
+do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-xz[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_elf[depends] += "virtual/kernel-native:do_populate_sysroot mkelfimage-native:do_populate_sysroot"
+do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
Signature · 1 line
2.1.4
#8 lore raw
Quoted 26 lines · Ed Bartosh

The IMAGE_DEPENDS variable can be overriden to add dependencies for individual image types.  Those dependencies are added to the do_rootfs
task, while they really should be added to the specific image type tasks.

Also, the IMAGE_DEPENDS variable is not documented anywhere.

Replaced usage of IMAGE_DEPENDS with explicitly added dependencies to do_image_<image type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 41 +++++++++++++++++++-----------
----------

 1 file changed, 19 insertions(+), 22 deletions(-)
meta/classes/image_types.bbclass +0 -0
index 7749b00..0d7c27e 100644
@@ -29,12 +29,6 @@ def imagetypes_getdepends(d):
      deps = set()
Quoted 8 lines

     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps) -
-        for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
-            base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps)

You need to do the compatibility checking here I'm afraid since d.getVar('IMAGE_DEPENDS') is not the same thing as d.getVar('IMAGE_DEPENDS_%s' % base.

Cheers,

Richard

author
#9 lore raw

PATCH v4 1/1 image_types.bbclass: get rid of IMAGE_DEPENDS

The IMAGE_DEPENDS_<type> variables can be set to add dependencies for individual image types. Those dependencies are added to the do_rootfs task, while they really should be added to the specific image type tasks.

These variables are not documented anywhere.

Replaced usage of IMAGE_DEPENDS_<type> with explicitly added dependencies to do_image_<type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)
meta/classes/image_types.bbclass +21 -19
index 7749b00..ae6ac7a 100644
@@ -29,11 +29,8 @@ def imagetypes_getdepends(d):
     deps = set()
     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps)
-
         for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
             base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps)
             resttypes += rest
 
         for ctype in resttypes:
@@ -101,7 +98,7 @@ IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAM
 # you need special parameters (like --xattrs) which are only supported
 # by GNU tar upstream >= 1.27, then override that default:
 # IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
-# IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+# do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
 # EXTRANATIVEPATH += "tar-native"
 #
 # The GNU documentation does not specify whether --xattrs-include is necessary.
@@ -209,21 +206,26 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"
 EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""
 
-IMAGE_DEPENDS = ""
-IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
-IMAGE_DEPENDS_cramfs = "util-linux-native"
-IMAGE_DEPENDS_ext2 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext3 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext4 = "e2fsprogs-native"
-IMAGE_DEPENDS_btrfs = "btrfs-tools-native"
-IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
-IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
-IMAGE_DEPENDS_ubi = "mtd-utils-native"
-IMAGE_DEPENDS_ubifs = "mtd-utils-native"
-IMAGE_DEPENDS_multiubi = "mtd-utils-native"
-IMAGE_DEPENDS_wic = "parted-native"
+python () {
+    vars = [key for key in d if key.startswith('IMAGE_DEPENDS')]
+    if vars:
+        bb.fatal('Deprecated variable(s) found: "%s". '
+                 'Use do_image_<type>[depends] += "<recipe>:<task>" instead' % ', '.join(vars))
+}
+
+do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
+do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
+do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-xz[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_elf[depends] += "virtual/kernel-native:do_populate_sysroot mkelfimage-native:do_populate_sysroot"
+do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
Signature · 1 line
2.1.4
#10 lore raw
Quoted 74 lines · Ed Bartosh

The IMAGE_DEPENDS_<type> variables can be set to add dependencies for individual image types.  Those dependencies are added to the do_rootfs
task, while they really should be added to the specific image type tasks.

These variables are not documented anywhere.

Replaced usage of IMAGE_DEPENDS_<type> with explicitly added dependencies to do_image_<type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 40 +++++++++++++++++++++---------
----------

 1 file changed, 21 insertions(+), 19 deletions(-)
meta/classes/image_types.bbclass +0 -0
index 7749b00..ae6ac7a 100644
@@ -29,11 +29,8 @@ def imagetypes_getdepends(d):
      deps = set()

     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps) -
         for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
             base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps) resttypes += rest

         for ctype in resttypes:

meta/classes/image_types.bbclass +0 -0
@@ -101,7 +98,7 @@ IMAGE_CMD_squashfs-lzo = "mksquashfs

${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAM

 # you need special parameters (like --xattrs) which are only
supported
 # by GNU tar upstream >= 1.27, then override that default:
 # IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
meta/classes/image_types.bbclass +1 -1
-# IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+# do_image_tar[depends] += "tar-replacement-

native:do_populate_sysroot"
 # EXTRANATIVEPATH += "tar-native"
 #
 # The GNU documentation does not specify whether --xattrs-include is necessary.

meta/classes/image_types.bbclass +0 -0
@@ -209,21 +206,26 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"

 EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""

meta/classes/image_types.bbclass +5 -15
-IMAGE_DEPENDS = ""
-IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
-IMAGE_DEPENDS_cramfs = "util-linux-native"
-IMAGE_DEPENDS_ext2 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext3 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext4 = "e2fsprogs-native"
-IMAGE_DEPENDS_btrfs = "btrfs-tools-native"
-IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
-IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
-IMAGE_DEPENDS_ubi = "mtd-utils-native"
-IMAGE_DEPENDS_ubifs = "mtd-utils-native"
-IMAGE_DEPENDS_multiubi = "mtd-utils-native"
-IMAGE_DEPENDS_wic = "parted-native"
+python () {
+    vars = [key for key in d if key.startswith('IMAGE_DEPENDS')]
+    if vars:
+        bb.fatal('Deprecated variable(s) found: "%s". '
+                 'Use do_image_<type>[depends] += "<recipe>:<task>"
Quoted 2 lines

instead' % ', '.join(vars))
+}

I appreciate this looks like a good idea but iterating the data store is about the worst thing we can do for parsing performance. Please just put the error message into the other function. I suspect if you time parsing before and after this change you could see this on a profile graph although since it only affects image recipes, it might be harder to spot within the noise, not sure.

Cheers,

Richard

author
#11 lore raw

PATCH v5 1/1 image_types.bbclass: get rid of IMAGE_DEPENDS

The IMAGE_DEPENDS_<type> variables can be set to add dependencies for individual image types. Those dependencies are added to the do_rootfs task, while they really should be added to the specific image type tasks.

These variables are not documented anywhere.

Replaced usage of IMAGE_DEPENDS_<type> with explicitly added dependencies to do_image_<type> tasks.

[YOCTO #11302]

---
 meta/classes/image_types.bbclass | 45 ++++++++++++++++++++++++----------------
 1 file changed, 27 insertions(+), 18 deletions(-)
meta/classes/image_types.bbclass +27 -18
index 7749b00..82ef65f 100644
@@ -26,20 +26,31 @@ def imagetypes_getdepends(d):
     fstypes = set((d.getVar('IMAGE_FSTYPES') or "").split())
     fstypes |= set((d.getVar('IMAGE_FSTYPES_DEBUGFS') or "").split())
 
+    deprecated = set()
     deps = set()
     for typestring in fstypes:
         basetype, resttypes = split_types(typestring)
-        adddep(d.getVar('IMAGE_DEPENDS_%s' % basetype) , deps)
+
+        var = "IMAGE_DEPENDS_%s" % basetype
+        if d.getVar(var) is not None:
+            deprecated.add(var)
 
         for typedepends in (d.getVar("IMAGE_TYPEDEP_%s" % basetype) or "").split():
             base, rest = split_types(typedepends)
-            adddep(d.getVar('IMAGE_DEPENDS_%s' % base) , deps)
             resttypes += rest
 
+            var = "IMAGE_DEPENDS_%s" % base
+            if d.getVar(var) is not None:
+                deprecated.add(var)
+
         for ctype in resttypes:
             adddep(d.getVar("CONVERSION_DEPENDS_%s" % ctype), deps)
             adddep(d.getVar("COMPRESS_DEPENDS_%s" % ctype), deps)
 
+    if deprecated:
+        bb.fatal('Deprecated variable(s) found: "%s". '
+                 'Use do_image_<type>[depends] += "<recipe>:<task>" instead' % ', '.join(deprecated))
+
     # Sort the set so that ordering is consistant
     return " ".join(sorted(deps))
 
@@ -101,7 +112,7 @@ IMAGE_CMD_squashfs-lzo = "mksquashfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAM
 # you need special parameters (like --xattrs) which are only supported
 # by GNU tar upstream >= 1.27, then override that default:
 # IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
-# IMAGE_DEPENDS_tar_append = " tar-replacement-native"
+# do_image_tar[depends] += "tar-replacement-native:do_populate_sysroot"
 # EXTRANATIVEPATH += "tar-native"
 #
 # The GNU documentation does not specify whether --xattrs-include is necessary.
@@ -209,21 +220,19 @@ EXTRA_IMAGECMD_ext4 ?= "-i 4096"
 EXTRA_IMAGECMD_btrfs ?= "-n 4096"
 EXTRA_IMAGECMD_elf ?= ""
 
-IMAGE_DEPENDS = ""
-IMAGE_DEPENDS_jffs2 = "mtd-utils-native"
-IMAGE_DEPENDS_cramfs = "util-linux-native"
-IMAGE_DEPENDS_ext2 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext3 = "e2fsprogs-native"
-IMAGE_DEPENDS_ext4 = "e2fsprogs-native"
-IMAGE_DEPENDS_btrfs = "btrfs-tools-native"
-IMAGE_DEPENDS_squashfs = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-xz = "squashfs-tools-native"
-IMAGE_DEPENDS_squashfs-lzo = "squashfs-tools-native"
-IMAGE_DEPENDS_elf = "virtual/kernel mkelfimage-native"
-IMAGE_DEPENDS_ubi = "mtd-utils-native"
-IMAGE_DEPENDS_ubifs = "mtd-utils-native"
-IMAGE_DEPENDS_multiubi = "mtd-utils-native"
-IMAGE_DEPENDS_wic = "parted-native"
+do_image_jffs2[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_cramfs[depends] += "util-linux-native:do_populate_sysroot"
+do_image_ext2[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext3[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_ext4[depends] += "e2fsprogs-native:do_populate_sysroot"
+do_image_btrfs[depends] += "btrfs-tools-native:do_populate_sysroot"
+do_image_squashfs[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-xz[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_squashfs-lzo[depends] += "squashfs-tools-native:do_populate_sysroot"
+do_image_elf[depends] += "virtual/kernel-native:do_populate_sysroot mkelfimage-native:do_populate_sysroot"
+do_image_ubi[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_ubifs[depends] += "mtd-utils-native:do_populate_sysroot"
+do_image_multiubi[depends] += "mtd-utils-native:do_populate_sysroot"
 
 # This variable is available to request which values are suitable for IMAGE_FSTYPES
 IMAGE_TYPES = " \
Signature · 1 line
2.1.4