Add initial container IMAGE_FSTYPES support
cover Add initial container IMAGE_FSTYPES support
The following changes since commit 63f899a950daf1018999455bafa7a2be8b22f164:
bitbake: toaster: bin/toaster whitelist TOASTER_DIR (2017-01-17 13:18:47 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib rewitt/contwip
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=rewitt/contwip
Randy Witt (3):
image-container.bbclass: Add the "container" IMAGE_FSTYPES image-container.bbclass: Error if not using linux-dummy selftest/containerimage.py: Add container IMAGE_FSTYPES test
.../container-image/container-image-testpkg.bb | 8 +++ .../container-image/container-test-image.bb | 8 +++ meta/classes/image-container.bbclass | 21 ++++++++ meta/classes/image.bbclass | 3 ++ meta/classes/image_types.bbclass | 1 + meta/lib/oeqa/selftest/containerimage.py | 57 ++++++++++++++++++++++ 6 files changed, 98 insertions(+) create mode 100644 meta-selftest/recipes-test/container-image/container-image-testpkg.bb create mode 100644 meta-selftest/recipes-test/container-image/container-test-image.bb create mode 100644 meta/classes/image-container.bbclass create mode 100644 meta/lib/oeqa/selftest/containerimage.py
Signature · 1 line
2.9.3
PATCH 1/3 image-container.bbclass: Add the "container" IMAGE_FSTYPES
The "container" fstype does very little other than pick tar.bz2 as the actual image type and disable installation of ROOTFS_BOOTSTRAP_INSTALL.
[YOCTO #9502]
--- meta/classes/image-container.bbclass | 3 +++ meta/classes/image.bbclass | 3 +++ meta/classes/image_types.bbclass | 1 + 3 files changed, 7 insertions(+) create mode 100644 meta/classes/image-container.bbclass
meta/classes/image-container.bbclass new file +3 -0
@@ -0,0 +1,3 @@ +ROOTFS_BOOTSTRAP_INSTALL = "" +IMAGE_TYPES_MASKED += "container" +IMAGE_TYPEDEP_container = "tar.bz2"
meta/classes/image.bbclass +3 -0
@@ -144,6 +144,9 @@ inherit ${IMAGE_TYPE_live} IMAGE_TYPE_vm = '${@bb.utils.contains_any("IMAGE_FSTYPES", ["vmdk", "vdi", "qcow2", "hdddirect"], "image-vm", "", d)}' inherit ${IMAGE_TYPE_vm} +IMAGE_TYPE_container = '${@bb.utils.contains("IMAGE_FSTYPES", "container", "image-container", "", d)}' +inherit ${IMAGE_TYPE_container} + def build_uboot(d): if 'u-boot' in (d.getVar('IMAGE_FSTYPES') or ''): return "image_types_uboot"
meta/classes/image_types.bbclass +1 -0
@@ -328,6 +328,7 @@ IMAGE_TYPES = " \ hdddirect \ elf \ wic wic.gz wic.bz2 wic.lzma \ + container \ " # Compression is a special case of conversion. The old variable
Signature · 1 line
2.9.3
PATCH 2/3 image-container.bbclass: Error if not using linux-dummy
In reply to Randy WittIn the typical case of a container, the user doesn't particularly care about the kernel version used. Since using linux-dummy prevents building a kernel in the most common case, alert the user if they choose a container image, but don't also specify linux-dummy.
In the cases the user actually does want to build against particular kernel headers, etc, they can override by setting IMAGE_CONTAINER_NO_DUMMY = "1".
[YOCTO #9502]
--- meta/classes/image-container.bbclass | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
meta/classes/image-container.bbclass +18 -0
@@ -1,3 +1,21 @@ ROOTFS_BOOTSTRAP_INSTALL = "" IMAGE_TYPES_MASKED += "container" IMAGE_TYPEDEP_container = "tar.bz2" + +python __anonymous() { + if "container" in d.getVar("IMAGE_FSTYPES") and \ + d.getVar("IMAGE_CONTAINER_NO_DUMMY") != "1" and \ + "linux-dummy" not in d.getVar("PREFERRED_PROVIDER_virtual/kernel"): + msg = '"container" is in IMAGE_FSTYPES, but ' \ + 'PREFERRED_PROVIDER_virtual/kernel is not "linux-dummy". ' \ + 'Unless a particular kernel is needed, using linux-dummy will ' \ + 'prevent a kernel from being built, which can reduce ' \ + 'build times. If you don\'t want to use "linux-dummy", set ' \ + '"IMAGE_CONTAINER_NO_DUMMY" to "1".' + + # Raising skip recipe was Paul's clever idea. It causes the error to + # only be shown for the recipes actually requested to build, rather + # than bb.fatal which would appear for all recipes inheriting the + # class. + raise bb.parse.SkipRecipe(msg) +}
Signature · 1 line
2.9.3
PATCH 3/3 selftest/containerimage.py: Add container IMAGE_FSTYPES test
In reply to Randy WittThis test checks to make sure only the files expected exist in a container image. Currently only ROOTFS_BOOTSTRAP_INSTALL, gets added to all images without the user specifying it.
But this test should help if a developer in the future ever silently adds more than just ROOTFS_BOOTSTRAP_INSTALL, and that the developer can make sure it also gets removed from a container image.
[YOCTO #9502]
--- .../container-image/container-image-testpkg.bb | 8 +++ .../container-image/container-test-image.bb | 8 +++ meta/lib/oeqa/selftest/containerimage.py | 57 ++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 meta-selftest/recipes-test/container-image/container-image-testpkg.bb create mode 100644 meta-selftest/recipes-test/container-image/container-test-image.bb create mode 100644 meta/lib/oeqa/selftest/containerimage.py
meta-selftest/recipes-test/container-image/container-image-testpkg.bb new file +8 -0
@@ -0,0 +1,8 @@ +LICENSE = "MIT" + +INHIBIT_DEFAULT_DEPS = "1" + +do_install_append() { + install -d ${D}${base_bindir} + touch ${D}${base_bindir}/theapp +}
meta-selftest/recipes-test/container-image/container-test-image.bb new file +8 -0
@@ -0,0 +1,8 @@ +IMAGE_INSTALL += "container-image-testpkg" + +LICENSE = "MIT" + +IMAGE_FSTYPES = "container" +IMAGE_LINGUAS = "" + +inherit core-image
meta/lib/oeqa/selftest/containerimage.py new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
2.9.3
Re: [PATCH 3/3] selftest/containerimage.py: Add container IMAGE_FSTYPES test
Quoted 20 lines · Randy Witt
meta/lib/oeqa/selftest/containerimage.py new file +19
-0+ expected_files = [ + './', + './bin/', + './bin/theapp', + './etc/', + './etc/default/', + './etc/default/postinst', + './etc/ld.so.cache', + './etc/timestamp', + './etc/version', + './run/', + './var/', + './var/cache/', + './var/cache/ldconfig/', + './var/cache/ldconfig/aux-cache', + './var/cache/opkg/', + './var/lib/', + './var/lib/opkg/' + ]
Quoted 1 line
These should use ${bindir} etc so they're resilient to distros changing
the paths (please use get_bb_vars() to only invoke bitbake once).
+ image = os.path.join(self.builddir, "tmp/deploy/images/qemux86/
Quoted 2 lines
container-test-image-qemux86.tar.bz2")
Don't hardcode this path, use ${DEPLOY_DIR_IMAGE} (fetch it with the paths above for speed) which will get you to tmp/deploy/images/[machine]. Again, these paths can change (poky sets TMPDIR to tmp, nodistro uses tmp-${TCLIBC}).
Ross
Re: [PATCH 3/3] selftest/containerimage.py: Add container IMAGE_FSTYPES test
Quoted 30 lines · Ross
Quoted 20 lines · Randy Witt
meta/lib/oeqa/selftest/containerimage.py new file +19
-0+ expected_files = [ + './', + './bin/', + './bin/theapp', + './etc/', + './etc/default/', + './etc/default/postinst', + './etc/ld.so.cache', + './etc/timestamp', + './etc/version', + './run/', + './var/', + './var/cache/', + './var/cache/ldconfig/', + './var/cache/ldconfig/aux-cache', + './var/cache/opkg/', + './var/lib/', + './var/lib/opkg/' + ]Quoted 1 line
These should use ${bindir} etc so they're resilient to distros changing
the paths (please use
get_bb_vars()to only invoke bitbake once).+ image = os.path.join(self.builddir, "tmp/deploy/images/qemux86/
Quoted 2 lines
container-test-image-qemux86.tar.bz2")
Quoted 7 lines
Don't hardcode this path, use ${DEPLOY_DIR_IMAGE} (fetch it with the paths above for speed) which will get you to tmp/deploy/images/[machine]. Again, these paths can change (poky sets TMPDIR to tmp, nodistro uses tmp-${TCLIBC}).
Ross
I just sent a v2, but screwed up the subject. I'll resend the whole series again even though only 3/3 changed, to hopefully make it easier on you.
PATCH 1/1 selftest/containerimage.py: Add container IMAGE_FSTYPES test
In reply to Randy WittThis test checks to make sure only the files expected exist in a container image. Currently only ROOTFS_BOOTSTRAP_INSTALL, gets added to all images without the user specifying it.
But this test should help if a developer in the future ever silently adds more than just ROOTFS_BOOTSTRAP_INSTALL, and that the developer can make sure it also gets removed from a container image.
[YOCTO #9502]
--- .../container-image/container-image-testpkg.bb | 8 +++ .../container-image/container-test-image.bb | 8 +++ meta/lib/oeqa/selftest/containerimage.py | 82 ++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 meta-selftest/recipes-test/container-image/container-image-testpkg.bb create mode 100644 meta-selftest/recipes-test/container-image/container-test-image.bb create mode 100644 meta/lib/oeqa/selftest/containerimage.py
meta-selftest/recipes-test/container-image/container-image-testpkg.bb new file +8 -0
@@ -0,0 +1,8 @@ +LICENSE = "MIT" + +INHIBIT_DEFAULT_DEPS = "1" + +do_install_append() { + install -d ${D}${bindir} + touch ${D}${bindir}/theapp +}
meta-selftest/recipes-test/container-image/container-test-image.bb new file +8 -0
@@ -0,0 +1,8 @@ +IMAGE_INSTALL += "container-image-testpkg" + +LICENSE = "MIT" + +IMAGE_FSTYPES = "container" +IMAGE_LINGUAS = "" + +inherit core-image
meta/lib/oeqa/selftest/containerimage.py new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
2.9.3