[OE-core] [PATCH v4 5/5] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 63 +++ 1 file changed, 63 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 776e44aac450c545f2329332f5390f6ff1b261ac..4aacd86085309389219d07b90bd307f1431178d5 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps, lru_cache +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu @@ -64,10 +65,13 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic.oe-selftest/" image_is_ready = False +native_sysroot = None wicenv_cache = {} def setUpLocal(self): """This code is executed before each test method.""" +if not self.native_sysroot: +Wic.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'wic-tools') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in @@ -618,3 +622,62 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) self.assertEqual(output, '3') + +@staticmethod +def _make_fixed_size_wks(size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tempf: +wkspath = tempf.name +tempf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return wkspath, wksname + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = Wic._make_fixed_size_wks(200) + +self.assertEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wkspath, self.resultdir)).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, + ignore_status=True, + native_sysroot=self.native_sysroot) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = Wic._make_fixed_size_wks(1) + +self.assertEqual(1, runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wkspath, self.resultdir), ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 4/5] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 224610c9d79467a5cb39e703854b76c55fd7e632..776e44aac450c545f2329332f5390f6ff1b261ac 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -228,7 +228,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct"))) -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 3/5] wic: selftest: avoid COMPATIBLE_HOST issues
Wic tests will unconditionally attempt to build images that may require dependencies that are incompatible with current target. Resolve this by consulting HOST_ARCH first (which defaults to TARGET_ARCH) before proceeding to build images that may be incompatible. A convenience decorator only_for_arch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 41 - 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 0fdd0e65eb4e5d6a2dc72c38a9597c187d82575c..224610c9d79467a5cb39e703854b76c55fd7e632 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,41 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps, lru_cache from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu from oeqa.utils.decorators import testcase +@lru_cache(maxsize=32) +def get_host_arch(recipe): +"""A cached call to get_bb_var('HOST_ARCH', )""" +return get_bb_var('HOST_ARCH', recipe) + + +def only_for_arch(archs, image='core-image-minimal'): +"""Decorator for wrapping test cases that can be run only for specific target +architectures. A list of compatible architectures is passed in `archs`. +Current architecture will be determined by parsing bitbake output for +`image` recipe. +""" +def wrapper(func): +@wraps(func) +def wrapped_f(*args, **kwargs): +arch = get_host_arch(image) +if archs and arch not in archs: +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return func(*args, **kwargs) +wrapped_f.__name__ = func.__name__ +return wrapped_f +return wrapper + + class Wic(oeSelfTest): """Wic test class.""" @@ -42,13 +68,13 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('MACHINE_FEATURES_append = " efi"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: bitbake('wic-tools') + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -141,6 +167,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1157) +@only_for_arch(['i586', 'i686', 'x86_64']) def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir @@ -148,6 +175,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1346) +@only_for_arch(['i586', 'i686', 'x86_64']) def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" config = 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\ @@ -161,6 +189,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) @testcase(1348) +@only_for_arch(['i586', 'i686', 'x86_64']) def test_qemux86_directdisk(self): """Test creation of qemux-86-directdisk image""" cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir @@ -168,6 +197,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct"))) @testcase(1350) +@only_for_arch(['i586', 'i686', 'x86_64']) def test_mkefidisk(self): """Test creation of mkefidisk image""" cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir @@ -175,6 +205,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct"))) @testcase(1385) +@only_for_arch(['i586', 'i686', 'x86_64']) def test_directdisk_bootloader_config(self): ""&quo
[OE-core] [PATCH v4 1/5] selftest: wictestdisk: machine agnostic WKS for use with selftest
Add a kickstart for an image that is not limited to use on x86 compatible machines. This allows us to run more wic tests on non-x86 architectures. Signed-off-by: Maciej Borzecki --- meta-selftest/wic/wictestdisk.wks | 7 +++ 1 file changed, 7 insertions(+) create mode 100644 meta-selftest/wic/wictestdisk.wks diff --git a/meta-selftest/wic/wictestdisk.wks b/meta-selftest/wic/wictestdisk.wks new file mode 100644 index ..d4de24d83097dab2851dbf5f2b6884679de7c77c --- /dev/null +++ b/meta-selftest/wic/wictestdisk.wks @@ -0,0 +1,7 @@ +# short-description: image for use in machine agnostic wic test cases + +# /boot is intentionally an empty partition +part /boot --ondisk sda --label boot --active --align 1024 --size 16 +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + +# bootloader is intentionally left out -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 2/5] selftest: wic: replace directdisk with wictestdisk where possible
Use wictestdisk instead of directdisk thus allowing more tests to be run on non-x86 compatible machines. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 64 +-- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 825312e5a55639129d88246e7335174484260fc1..0fdd0e65eb4e5d6a2dc72c38a9597c187d82575c 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -135,10 +135,10 @@ class Wic(oeSelfTest): @testcase(1211) def test_build_image_name(self): -"""Test wic create directdisk --image-name=core-image-minimal""" -cmd = "wic create directdisk --image-name=core-image-minimal -o %s" % self.resultdir +"""Test wic create wictestdisk --image-name=core-image-minimal""" +cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1157) def test_gpt_image(self): @@ -230,31 +230,31 @@ class Wic(oeSelfTest): @testcase(1264) def test_compress_gzip(self): """Test compressing an image with gzip""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name core-image-minimal " "-c gzip -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.gz"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.gz"))) @testcase(1265) def test_compress_bzip2(self): """Test compressing an image with bzip2""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-c bzip2 -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.bz2"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.bz2"))) @testcase(1266) def test_compress_xz(self): """Test compressing an image with xz""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "--compress-with=xz -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.xz"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.xz"))) @testcase(1267) def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""" -self.assertEqual(2, runCmd("wic create directdisk " +self.assertEqual(2, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-c wrong -o %s" % self.resultdir, ignore_status=True).status) @@ -262,49 +262,49 @@ class Wic(oeSelfTest): @testcase(1558) def test_debug_short(self): """Test -D option""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-D -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) def test_debug_long(self): """Test --debug option""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "--debug -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +
[OE-core] [PATCH v4 0/5] wic: selftest: enhancements for non-x86 MACHINE support & fixed-size tests
v4 of a series with enhancements and new test cases for wic selftest. The enhancements allow for running wic selftest for non-x86 MACHINE, such as qemuarm (the whole series was verified on qemux86-64 and qemuarm). The first patch adds a machine independent kickstart file - wictestdisk. Most of test cases build a disk image using one of the kickstart files shipped in Poky (mostly directdisk. These are usually x86 oriented due to use of syslinux and cannot be used when running with non-x86 compatible MACHINE. On the other hand, the image built during tests does not need to be bootable (with exception of TCs that verify if the image is indeed bootable). Patch 2 introduces wictestdisk in test cases where its use is possible. Patch 3 adds only_for_arch() convenience decorator and applies it to test cases where x86 specific image must be used. In the end, only 13 TCs are skipped on qemuarm. Changes from previous version: - renamed onlyForArch() to only_for_arch(), changed input arguments to take image name and list of compatible architectures - pylint fixes Patch 4 removes some assumptions about kernel image type. Patch 5 adds tests for --fixed-size partition flags. Changes from previous version: - pylint fixes Maciej Borzecki (5): selftest: wictestdisk: machine agnostic WKS for use with selftest selftest: wic: replace directdisk with wictestdisk where possible wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta-selftest/wic/wictestdisk.wks | 7 ++ meta/lib/oeqa/selftest/wic.py | 171 ++ 2 files changed, 144 insertions(+), 34 deletions(-) create mode 100644 meta-selftest/wic/wictestdisk.wks -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 5/5] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 62 +++ 1 file changed, 62 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index b9c06e56adb70376b6f6a4893026223077b708fd..f83d4a1b51367de42043bb0b840792f1bfddeaf6 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps, lru_cache +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu @@ -61,10 +62,13 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic.oe-selftest/" image_is_ready = False +native_sysroot = None wicenv_cache = {} def setUpLocal(self): """This code is executed before each test method.""" +if not self.native_sysroot: +Wic.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'wic-tools') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in @@ -615,3 +619,61 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) self.assertEqual(output, '3') + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return wkspath, wksname + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +self.assertEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wkspath, self.resultdir)).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, + ignore_status=True, + native_sysroot=self.native_sysroot) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +self.assertEqual(1, runCmd("wic create %s -e core-image-minimal -o %s" \ + % (wkspath, self.resultdir), ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 4/5] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 1cf26ce44411362873b5fa0b57da9f5a77613134..b9c06e56adb70376b6f6a4893026223077b708fd 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -225,7 +225,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" cmd = "wic create sdimage-bootpart -e core-image-minimal -o %s" % self.resultdir -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct"))) -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 3/5] wic: selftest: avoid COMPATIBLE_HOST issues
Wic tests will unconditionally attempt to build images that may require dependencies that are incompatible with current target. Resolve this by consulting HOST_ARCH first (which defaults to TARGET_ARCH) before proceeding to build images that may be incompatible. A convenience decorator onlyForArch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 38 +- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 0fdd0e65eb4e5d6a2dc72c38a9597c187d82575c..1cf26ce44411362873b5fa0b57da9f5a77613134 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,38 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps, lru_cache from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, get_bb_vars, runqemu from oeqa.utils.decorators import testcase +@lru_cache(maxsize=32) +def get_host_arch(target='core-image-minimal'): +return get_bb_var('HOST_ARCH', target) + + +class onlyForArch(object): + +def __init__(self, *args): +self.archs = args + +def __call__(self,f): +@wraps(f) +def wrapped_f(*args, **kwargs): +arch = get_host_arch() +if self.archs and arch not in self.archs : +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return f(*args, **kwargs) +wrapped_f.__name__ = f.__name__ +return wrapped_f + + class Wic(oeSelfTest): """Wic test class.""" @@ -42,13 +65,13 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('MACHINE_FEATURES_append = " efi"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: bitbake('wic-tools') + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -141,6 +164,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1157) +@onlyForArch('i586', 'i686', 'x86_64') def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" cmd = "wic create directdisk-gpt --image-name core-image-minimal -o %s" % self.resultdir @@ -148,6 +172,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1346) +@onlyForArch('i586', 'i686', 'x86_64') def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" config = 'INITRAMFS_IMAGE = "core-image-minimal-initramfs"\n'\ @@ -161,6 +186,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) @testcase(1348) +@onlyForArch('i586', 'i686', 'x86_64') def test_qemux86_directdisk(self): """Test creation of qemux-86-directdisk image""" cmd = "wic create qemux86-directdisk -e core-image-minimal -o %s" % self.resultdir @@ -168,6 +194,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct"))) @testcase(1350) +@onlyForArch('i586', 'i686', 'x86_64') def test_mkefidisk(self): """Test creation of mkefidisk image""" cmd = "wic create mkefidisk -e core-image-minimal -o %s" % self.resultdir @@ -175,6 +202,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "mkefidisk-*direct"))) @testcase(1385) +@onlyForArch('i586', 'i686', 'x86_64') def test_directdisk_bootloader_config(self): """Test creation of directdisk-bootloader-config image""" cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir @@ -182,6 +210,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-bootloader-config-*direct"))) @testcase(1560) +@onlyForArch('
[OE-core] [PATCH v3 2/5] selftest: wic: replace directdisk with wictestdisk where possible
Use wictestdisk instead of directdisk thus allowing more tests to be run on non-x86 compatible machines. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 64 +-- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 825312e5a55639129d88246e7335174484260fc1..0fdd0e65eb4e5d6a2dc72c38a9597c187d82575c 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -135,10 +135,10 @@ class Wic(oeSelfTest): @testcase(1211) def test_build_image_name(self): -"""Test wic create directdisk --image-name=core-image-minimal""" -cmd = "wic create directdisk --image-name=core-image-minimal -o %s" % self.resultdir +"""Test wic create wictestdisk --image-name=core-image-minimal""" +cmd = "wic create wictestdisk --image-name=core-image-minimal -o %s" % self.resultdir self.assertEqual(0, runCmd(cmd).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1157) def test_gpt_image(self): @@ -230,31 +230,31 @@ class Wic(oeSelfTest): @testcase(1264) def test_compress_gzip(self): """Test compressing an image with gzip""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name core-image-minimal " "-c gzip -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.gz"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.gz"))) @testcase(1265) def test_compress_bzip2(self): """Test compressing an image with bzip2""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-c bzip2 -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.bz2"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.bz2"))) @testcase(1266) def test_compress_xz(self): """Test compressing an image with xz""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "--compress-with=xz -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.xz"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.xz"))) @testcase(1267) def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""" -self.assertEqual(2, runCmd("wic create directdisk " +self.assertEqual(2, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-c wrong -o %s" % self.resultdir, ignore_status=True).status) @@ -262,49 +262,49 @@ class Wic(oeSelfTest): @testcase(1558) def test_debug_short(self): """Test -D option""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-D -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) def test_debug_long(self): """Test --debug option""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "--debug -o %s" % self.resultdir).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +
[OE-core] [PATCH v3 0/5] wic: selftest: enhancements for non-x86 MACHINE support & fixed-size tests
A series with enhancements and new test cases for wic selftest. The enhancements allow for running wic selftest for non-x86 MACHINE, such as qemuarm (the whole series was verified on qemux86-64 and qemuarm). The first patch adds a machine independent kickstart file - wictestdisk. Most of test cases build a disk image using one of the kickstart files shipped in Poky (mostly directdisk. These are usually x86 oriented due to use of syslinux and cannot be used when running with non-x86 compatible MACHINE. On the other hand, the image built during tests does not need to be bootable (with exception of TCs that verify if the image is indeed bootable). Patch 2 introduces wictestdisk in test cases where its use is possible. Patch 3 adds onlyForArch() convenience decorator and applies it to test cases where x86 specific image must be used. In the end, only 13 TCs are skipped on qemuarm. Patch 4 removes some assumptions about kernel image type. Patch 5 adds tests for --fixed-size partition flags Maciej Borzecki (5): selftest: wictestdisk: machine agnostic WKS for use with selftest selftest: wic: replace directdisk with wictestdisk where possible wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta-selftest/wic/wictestdisk.wks | 7 ++ meta/lib/oeqa/selftest/wic.py | 167 ++ 2 files changed, 140 insertions(+), 34 deletions(-) create mode 100644 meta-selftest/wic/wictestdisk.wks -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 1/5] selftest: wictestdisk: machine agnostic WKS for use with selftest
Add a kickstart for an image that is not limited to use on x86 compatible machines. This allows us to run more wic tests on non-x86 architectures. Signed-off-by: Maciej Borzecki --- meta-selftest/wic/wictestdisk.wks | 7 +++ 1 file changed, 7 insertions(+) create mode 100644 meta-selftest/wic/wictestdisk.wks diff --git a/meta-selftest/wic/wictestdisk.wks b/meta-selftest/wic/wictestdisk.wks new file mode 100644 index ..d4de24d83097dab2851dbf5f2b6884679de7c77c --- /dev/null +++ b/meta-selftest/wic/wictestdisk.wks @@ -0,0 +1,7 @@ +# short-description: image for use in machine agnostic wic test cases + +# /boot is intentionally an empty partition +part /boot --ondisk sda --label boot --active --align 1024 --size 16 +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + +# bootloader is intentionally left out -- 2.9.3 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: selftest: account for occasional newline in debugfs file names
Debugfs output may contain a newline in file names in 'ls -p' output. Make sure that output is correctly split into lines by matching '/\n' and newlines are removed from file names. Fixes the following error appearing in AB tests: Traceback (most recent call last): File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/wic.py", line 388, in test_exclude_path files = [line.split('/')[5] for line in res.output.split('\n')] File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-oe-selftest/build/meta/lib/oeqa/selftest/wic.py", line 388, in files = [line.split('/')[5] for line in res.output.split('\n')] IndexError: list index out of range Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 25 + 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index dcb88bacad13a2da4c725abf1c986b39ea70f0fc..825312e5a55639129d88246e7335174484260fc1 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -381,11 +381,28 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r self.assertEqual(0, runCmd("dd if=%s of=%s skip=%d count=%d" % (wicimg, part_file, start, length)).status) +def extract_files(debugfs_output): +# extract file names from the output of debugfs -R 'ls -p', +# which looks like this: +# +# /2/040755/0/0/.//\n +# /2/040755/0/0/..//\n +# /11/040700/0/0/lost+found^M//\n +# /12/040755/1002/1002/run//\n +# /13/040755/1002/1002/sys//\n +# /14/040755/1002/1002/bin//\n +# /80/040755/1002/1002/var//\n +# /92/040755/1002/1002/tmp//\n +# +# NOTE the occasional ^M in file names +return [line.split('/')[5].strip() for line in \ +debugfs_output.strip().split('/\n')] + # Test partition 1, should contain the normal root directories, except # /usr. res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1")) self.assertEqual(0, res.status) -files = [line.split('/')[5] for line in res.output.split('\n')] +files = extract_files(res.output) self.assertIn("etc", files) self.assertNotIn("usr", files) @@ -393,7 +410,7 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r # directories. res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2")) self.assertEqual(0, res.status) -files = [line.split('/')[5] for line in res.output.split('\n')] +files = extract_files(res.output) self.assertNotIn("etc", files) self.assertNotIn("usr", files) self.assertIn("share", files) @@ -402,14 +419,14 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r # directory, but not the files inside it. res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3")) self.assertEqual(0, res.status) -files = [line.split('/')[5] for line in res.output.split('\n')] +files = extract_files(res.output) self.assertNotIn("etc", files) self.assertNotIn("usr", files) self.assertIn("share", files) self.assertIn("bin", files) res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3")) self.assertEqual(0, res.status) -files = [line.split('/')[5] for line in res.output.split('\n')] +files = extract_files(res.output) self.assertIn(".", files) self.assertIn("..", files) self.assertEqual(2, len(files)) -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] staging: fix logic of guessing dependency manifest file in extend_recipe_sysroot
Recipe sysroots introduced a change where dependencies ending with "-cross" also count as native tools and (see setscene_depvalid() for details). The same logic was missing from extend_recipe_sysroot(), hence for depency named `go-cross` the manifest file would default to `manifest-allarch-go-cross.populate_sysroot`, while the correct name is `manifest-x86_64_arm-go-cross.populate_sysroot` Signed-off-by: Maciej Borzecki --- meta/classes/staging.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass index fc387eaf4bb52971e111ae7deac7d7d6fc389337..efea450e4f73661366d0929d5c39e42bfe9f8e8b 100644 --- a/meta/classes/staging.bbclass +++ b/meta/classes/staging.bbclass @@ -521,7 +521,7 @@ python extend_recipe_sysroot() { native = True elif c.startswith("nativesdk-"): manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${SDK_ARCH}_${SDK_OS}-%s.populate_sysroot" % c) -elif "-cross-" in c: +elif "-cross-" in c or c.endswith("-cross"): manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${BUILD_ARCH}_${TARGET_ARCH}-%s.populate_sysroot" % c) native = True elif "-crosssdk" in c: -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: partitionedfs: account for non-table partitions when checking if logical parititon is needed
Commit 8c1c43b7901a9fcd8b279eb4250b08157ad345b7 `wic: Create a logical partition only when it is really mandatory` did not account for partitions that are not present in partition table. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/utils/partitionedfs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index 68301f0b476ed48edfcb4dcad0df903474d13b50..721d51432605fe71c02c59a8d81c833cba1d445f 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -201,7 +201,8 @@ class Image(): part['num'] = 0 if disk['ptable_format'] == "msdos": -if len(self.partitions) > 4: +# only count the partitions that are in partition table +if len([p for p in self.partitions if not p['no_table']]) > 4: if disk['realpart'] > 3: part['type'] = 'logical' part['num'] = disk['realpart'] + 1 -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/5] selftest: wictestdisk: machine agnostic WKS for use with selftest
Add a kickstart for an image that is not limited to use on x86 compatible machines. This allows us to run more wic tests on non-x86 architectures. Signed-off-by: Maciej Borzecki --- meta-selftest/wic/wictestdisk.wks | 7 +++ 1 file changed, 7 insertions(+) create mode 100644 meta-selftest/wic/wictestdisk.wks diff --git a/meta-selftest/wic/wictestdisk.wks b/meta-selftest/wic/wictestdisk.wks new file mode 100644 index ..d4de24d83097dab2851dbf5f2b6884679de7c77c --- /dev/null +++ b/meta-selftest/wic/wictestdisk.wks @@ -0,0 +1,7 @@ +# short-description: image for use in machine agnostic wic test cases + +# /boot is intentionally an empty partition +part /boot --ondisk sda --label boot --active --align 1024 --size 16 +part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid + +# bootloader is intentionally left out -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 5/5] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 63 +++ 1 file changed, 63 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index ce9e9701280b758d3413aae29615f34a7bc909e4..f9e9854ede8162ff12467fa23a365b25c132ba54 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps, lru_cache +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu @@ -62,10 +63,14 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic/build/" alternate_resultdir = "/var/tmp/wic/build/alt/" image_is_ready = False +native_sysroot = None wicenv_cache = {} def setUpLocal(self): """This code is executed before each test method.""" +if not Wic.native_sysroot: +Wic.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') + arch = get_host_arch() is_x86 = arch in ['i586', 'i686', 'x86_64'] if is_x86: @@ -441,3 +446,61 @@ class Wic(oeSelfTest): status, output = qemu.run_serial(cmd) self.assertEqual(1, status, 'Failed to run command "%s": %s' % (cmd, output)) self.assertEqual(output, '/dev/root /\r\n/dev/vda3 /mnt') + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return wkspath, wksname + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ + % wkspath).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, + ignore_status=True, + native_sysroot=self.native_sysroot) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +self.assertEqual(1, runCmd("wic create %s -e core-image-minimal" \ + % wkspath, ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 0/5] wic: selftest: enhancements for non-x86 MACHINE support & fixes-size tests
A series with enhancements and new test cases for wic selftest. The enhancements mostly allow for running wic selftest on non-x86 MACHINE, such as qemuarm (the whole series was verified on qemux86 and qemuarm). Patches in this series were previously a part of [1], but since then --fixed-size was merged upstream. The remaining selftest patches were rebased and received performance enhancements. The first patch adds a machine independent kickstart file - wictestdisk. Most of test cases build a disk image using one of the kickstart files shipped in Poky (mostly directdisk. These are usually x86 oriented due to use of syslinux and cannot be used when running with non-x86 compatible MACHINE. On the other hand, the image built during tests does not need to be bootable (with exception of TCs that verify if the image is indeed bootable). Patch 2 introduces wictestdisk in test cases where its use is possible. Patch 3 adds onlyForArch() convenience decorator and applies it to test cases where x86 specific image must be used. Changes since previous versions: - only 11 TCs are skipped on non-x86 targets, 17 previously - performance improvements due to lru_cache() wrapped helper for get_bb_var() Patch 4 removes some assumptions about kernel image. Patch 5 adds tests for --fixed-size partition flags, changes: - cache native sysroot path in class The changes in this series depend on the following commit (https://patchwork.openembedded.org/patch/135482/): commit 4299a3de6789833a27cce4f7e4bc79f48946f171 Author: Ed Bartosh Date: Fri Dec 23 01:42:14 2016 +0200 image_types.bbclass: look for wks files in /wic Maciej Borzecki (5): selftest: wictestdisk: machine agnostic WKS for use with selftest selftest: wic: replace directdisk with wictestdisk where possible wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta-selftest/wic/wictestdisk.wks | 7 ++ meta/lib/oeqa/selftest/wic.py | 183 ++ 2 files changed, 151 insertions(+), 39 deletions(-) create mode 100644 meta-selftest/wic/wictestdisk.wks -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/5] wic: selftest: avoid COMPATIBLE_HOST issues
wic tests will unconditionally attempt to build syslinux and add configuration options that may not be compatible with current machine. Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build recipes, add configuration options or skip tests conditionally. A convenience decorator onlyForArch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 51 ++- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 1a5c6a7e88bf2c4194f2da87cfe36078848fa397..f7aac44a9ae91e8287f868540b8ca2e9ecf3409c 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,38 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps, lru_cache from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +@lru_cache(maxsize=32) +def get_host_arch(target='core-image-minimal'): +return get_bb_var('HOST_ARCH', target) + + +class onlyForArch(object): + +def __init__(self, *args): +self.archs = args + +def __call__(self,f): +@wraps(f) +def wrapped_f(*args, **kwargs): +arch = get_host_arch() +if self.archs and arch not in self.archs : +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return f(*args, **kwargs) +wrapped_f.__name__ = f.__name__ +return wrapped_f + + class Wic(oeSelfTest): """Wic test class.""" @@ -43,16 +66,23 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES += " hddimg"\n' - 'MACHINE_FEATURES_append = " efi"\n' - 'WKS_FILE = "wic-image-minimal"\n') +arch = get_host_arch() +is_x86 = arch in ['i586', 'i686', 'x86_64'] +if is_x86: +self.write_config('IMAGE_FSTYPES += " hddimg"\n' \ + 'MACHINE_FEATURES_append = " efi"\n' + 'WKS_FILE = "wic-image-minimal"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: -bitbake('syslinux syslinux-native parted-native gptfdisk-native ' -'dosfstools-native mtools-native bmap-tools-native') +tools = 'parted-native gptfdisk-native ' \ +'dosfstools-native mtools-native bmap-tools-native' +if is_x86: +tools += ' syslinux syslinux-native' +bitbake(tools) + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -141,6 +171,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1157) +@onlyForArch('i586', 'i686', 'x86_64') def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" cmd = "wic create directdisk-gpt --image-name core-image-minimal" @@ -148,6 +179,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1346) +@onlyForArch('i586', 'i686', 'x86_64') def test_iso_image(self): """Test creation of hybrid iso image with legacy and EFI boot""" cmd = "wic create mkhybridiso --image-name core-image-minimal" @@ -156,6 +188,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "HYBRID_ISO_IMG-*.iso"))) @testcase(1348) +@onlyForArch('i586', 'i686', 'x86_64') def test_qemux86_directdisk(self): """Test creation of qemux-86-directdisk image""" cmd = "wic create qemux86-directdisk -e core-image-minimal" @@ -163,6 +196,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "qemux86-directdisk-*direct"))) @testcase(1350) +@onlyForArch('i586', 'i686', 'x86_64&
[OE-core] [PATCH 4/5] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index f7aac44a9ae91e8287f868540b8ca2e9ecf3409c..ce9e9701280b758d3413aae29615f34a7bc909e4 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -223,7 +223,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" cmd = "wic create sdimage-bootpart -e core-image-minimal" -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) self.assertEqual(0, runCmd(cmd).status) self.assertEqual(1, len(glob(self.resultdir + "sdimage-bootpart-*direct"))) -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 2/5] selftest: wic: replace directdisk with wictestdisk where possible
Use wictestdisk instead of directdisk thus allowing more tests to be run on non-x86 compatible machines. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 66 +-- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 49bbfe3bce78d4a93ef032949637ce9de7f0351a..1a5c6a7e88bf2c4194f2da87cfe36078848fa397 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -135,10 +135,10 @@ class Wic(oeSelfTest): @testcase(1211) def test_build_image_name(self): -"""Test wic create directdisk --image-name=core-image-minimal""" -cmd = "wic create directdisk --image-name=core-image-minimal" +"""Test wic create wictestdisk --image-name=core-image-minimal""" +cmd = "wic create wictestdisk --image-name=core-image-minimal" self.assertEqual(0, runCmd(cmd).status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1157) def test_gpt_image(self): @@ -209,84 +209,84 @@ class Wic(oeSelfTest): @testcase(1212) def test_build_artifacts(self): -"""Test wic create directdisk providing all artifacts.""" +"""Test wic create wictestdisk providing all artifacts.""" bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) -status = runCmd("wic create directdisk " +status = runCmd("wic create wictestdisk " "-b %(staging_datadir)s " "-k %(deploy_dir_image)s " "-n %(staging_dir_native)s " "-r %(image_rootfs)s" % bbvars).status self.assertEqual(0, status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct"))) @testcase(1264) def test_compress_gzip(self): """Test compressing an image with gzip""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name core-image-minimal " "-c gzip").status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.gz"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.gz"))) @testcase(1265) def test_compress_bzip2(self): """Test compressing an image with bzip2""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-c bzip2").status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.bz2"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.bz2"))) @testcase(1266) def test_compress_xz(self): """Test compressing an image with xz""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "--compress-with=xz").status) -self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct.xz"))) +self.assertEqual(1, len(glob(self.resultdir + "wictestdisk-*.direct.xz"))) @testcase(1267) def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""" -self.assertEqual(2, runCmd("wic create directdisk " +self.assertEqual(2, runCmd("wic create wictestdisk " "--image-name=core-image-minimal " "-c wrong", ignore_status=True).status) @testcase(1558) def test_debug(self): """Test debug""" -self.assertEqual(0, runCmd("wic create directdisk " +self.assertEqual(0, runCmd
[OE-core] [PATCH v6 5/5] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 61 +++ 1 file changed, 61 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8efece3171db47ee622f2c0f712fff2c2fcf645b..9caf3b0b1e3d4b538fffd409b26f68f0101e78dc 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu @@ -59,6 +60,8 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" +self.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') + arch = get_bb_var('HOST_ARCH', 'core-image-minimal') is_x86 = arch in ['i586', 'i686', 'x86_64'] if is_x86: @@ -344,3 +347,61 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ % image).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return wkspath, wksname + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ + % wkspath).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, + ignore_status=True, + native_sysroot=self.native_sysroot) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +self.assertEqual(1, runCmd("wic create %s -e core-image-minimal" \ + % wkspath, ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v6 3/5] wic: selftest: avoid COMPATIBLE_HOST issues
wic tests will unconditionally attempt to build syslinux and add configuration options that may not be compatible with current machine. Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build recipes, add configuration options or skip tests conditionally. A convenience decorator onlyForArch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 53 +++ 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index e652fad24ab6dd7ab1b998b60a98a4052a2f1dd7..35cd14fb0c4a9b863a7a6324885f80da8e86d3eb 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,33 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +class onlyForArch(object): + +def __init__(self, *args): +self.archs = args + +def __call__(self,f): +@wraps(f) +def wrapped_f(*args, **kwargs): +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +if self.archs and arch not in self.archs : +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return f(*args, **kwargs) +wrapped_f.__name__ = f.__name__ +return wrapped_f + + class Wic(oeSelfTest): """Wic test class.""" @@ -41,16 +59,23 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES += " hddimg"\n' - 'MACHINE_FEATURES_append = " efi"\n' - 'WKS_FILE = "wic-image-minimal"\n') +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +is_x86 = arch in ['i586', 'i686', 'x86_64'] +if is_x86: +self.write_config('IMAGE_FSTYPES += " hddimg"\n' \ + 'MACHINE_FEATURES_append = " efi"\n' + 'WKS_FILE = "wic-image-minimal"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: -bitbake('syslinux syslinux-native parted-native gptfdisk-native ' -'dosfstools-native mtools-native bmap-tools-native') +tools = 'parted-native gptfdisk-native ' \ +'dosfstools-native mtools-native bmap-tools-native' +if is_x86: +tools += ' syslinux syslinux-native' +bitbake(tools) + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -72,6 +97,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic list --help').status) @testcase(1211) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " @@ -79,6 +105,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ @@ -93,6 +120,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1157) +@onlyForArch('i586', 'i686', 'x86_64') def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " @@ -126,6 +154,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic help kickstart').status) @testcase(1264) +@onlyForArch('i586', 'i686', 'x86_64') def test_compress_gzip(self): """Test compressing an image wit
[OE-core] [PATCH v6 4/5] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 35cd14fb0c4a9b863a7a6324885f80da8e86d3eb..8efece3171db47ee622f2c0f712fff2c2fcf645b 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -339,7 +339,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" image = "sdimage-bootpart" -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ % image).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v6 0/5] wic: bugfixes & --fixed-size support, tests, oeqa: enhancements
v6 of a patch series previously posted here [1]. Changes since v5: * `oe-selftest: enforce en_US.UTF-8 locale` was merged to master, hence it's no longer part of this series * rebased on top of master (d0d260b0b85790ceb136dd6b0445e8e33d038f5e) [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129187.html Maciej Borzecki (5): oeqa/utils/commands.py: allow use of binaries from native sysroot wic: add --fixed-size wks option wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta/lib/oeqa/selftest/wic.py | 117 +++-- meta/lib/oeqa/utils/commands.py| 9 ++- scripts/lib/wic/help.py| 14 +++- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 ++-- scripts/lib/wic/partition.py | 88 +++-- scripts/lib/wic/utils/partitionedfs.py | 2 +- 7 files changed, 224 insertions(+), 49 deletions(-) -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v6 2/5] wic: add --fixed-size wks option
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 14 -- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 ++-- scripts/lib/wic/partition.py | 88 +- scripts/lib/wic/utils/partitionedfs.py | 2 +- 5 files changed, 105 insertions(+), 42 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,12 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option @@ -719,13 +725,15 @@ DESCRIPTION space after the space filled by the content of the partition. The final size can go beyond the size specified by --size. -By default, 10MB. +By default, 10MB. This option cannot be used +with --fixed-size option. --overhead-factor: This option is specific to wic. The size of the partition is multiplied by this factor. It has to be greater than or -equal to 1. -The default value is 1.3. +equal to 1. The default value is 1.3. +This option cannot be used with --fixed-size +option. --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(int(part.size), +self.__image.add_partition(part.disk_size, part.disk, part.mountpoint, part.source_file, diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -113,6 +113,9 @@ def systemidtype(arg): class KickStart(): """"Kickstart parser implementation.""" +DEFAULT_EXTRA_SPACE = 10*1024 +DEFAULT_OVERHEAD_FACTOR = 1.3 + def __init__(self, confpath): self.partitions = [] @@ -127,16 +130,24 @@ class KickStart(): part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) -part.add_argument("--extra-space", type=sizetype, default=10*1024) +part.add_argument("--extra-space", type=sizetype) part.add_argument('--fsoptions', dest='fsopts') part.add_argument('--fstype') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk') -part.add_argument("--overhead-factor", type=overheadtype, default=1.3) +part.add_argument("--overhead-factor", type=overheadtype) part.add_argument('--part-type') part.add_argument(
[OE-core] [PATCH v6 1/5] oeqa/utils/commands.py: allow use of binaries from native sysroot
Tests may need to run a native tool that is not available on the host filesystem, but can be built using one of the *-native recipes. In such case, the tool will be available in native sysroot, and running in from that location will require adjustments to PATH. runCmd() can now take a path to native sysroot as one of its arguments and setup PATH accordingly. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/utils/commands.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 3a68b001b76ca89df17545912e2f75ca2cca6a38..0425c9fd98c7e8074ced6222156f5a1c2a393f50 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -97,9 +97,16 @@ class Result(object): pass -def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options): +def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options): result = Result() +if native_sysroot: +extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ + (native_sysroot, native_sysroot, native_sysroot) +nenv = dict(options.get('env', os.environ)) +nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '') +options['env'] = nenv + cmd = Command(command, timeout=timeout, **options) cmd.run() -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] selftest: wic: qemux86: use weak assignment for WKS_FILE
A follow-up of a fix introduced in 1b32c6ed025745cb06b7c28ca0fe9e416ce7abfa (selftest: wic: fix test_qemu). Wic test_qemu fails on qemux86 due to a direct assignment of WKS_FILE in machine configuration. Using default assignment allows WKS_FILE to be overwritten in test setup. Signed-off-by: Maciej Borzecki --- meta/conf/machine/qemux86.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/conf/machine/qemux86.conf b/meta/conf/machine/qemux86.conf index 8997f6ba701a91f0adc82dfaf410c7dd1a9777f3..1b478e92ad7fdf6f3cb2dd4f6dc35684a319848c 100644 --- a/meta/conf/machine/qemux86.conf +++ b/meta/conf/machine/qemux86.conf @@ -28,5 +28,5 @@ MACHINE_FEATURES += "x86" MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "v86d" -WKS_FILE = "directdisk.wks" +WKS_FILE ?= "directdisk.wks" do_image_wic[depends] += "syslinux:do_build syslinux-native:do_populate_sysroot mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot" -- 2.5.5 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v5 5/6] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 2db14445956bc5adcf1e755844bbdb69edcb468f..84ba08675b2995812a858e78b3678b2ab325b15b 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -338,7 +338,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" image = "sdimage-bootpart" -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', 'core-image-minimal') +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ % image).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v5 6/6] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 61 +++ 1 file changed, 61 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 84ba08675b2995812a858e78b3678b2ab325b15b..4cba61060cbd081b2288c970877d863ef42d9b7f 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu @@ -59,6 +60,8 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" +self.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') + arch = get_bb_var('HOST_ARCH', 'core-image-minimal') is_x86 = arch in ['i586', 'i686', 'x86_64'] if is_x86: @@ -343,3 +346,61 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ % image).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return wkspath, wksname + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +self.assertEqual(0, runCmd("wic create %s -e core-image-minimal" \ + % wkspath).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, + ignore_status=True, + native_sysroot=self.native_sysroot) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +self.assertEqual(1, runCmd("wic create %s -e core-image-minimal" \ + % wkspath, ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v5 3/6] wic: add --fixed-size wks option
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 14 -- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 ++-- scripts/lib/wic/partition.py | 88 +- scripts/lib/wic/utils/partitionedfs.py | 2 +- 5 files changed, 105 insertions(+), 42 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,12 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option @@ -719,13 +725,15 @@ DESCRIPTION space after the space filled by the content of the partition. The final size can go beyond the size specified by --size. -By default, 10MB. +By default, 10MB. This option cannot be used +with --fixed-size option. --overhead-factor: This option is specific to wic. The size of the partition is multiplied by this factor. It has to be greater than or -equal to 1. -The default value is 1.3. +equal to 1. The default value is 1.3. +This option cannot be used with --fixed-size +option. --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(int(part.size), +self.__image.add_partition(part.disk_size, part.disk, part.mountpoint, part.source_file, diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -113,6 +113,9 @@ def systemidtype(arg): class KickStart(): """"Kickstart parser implementation.""" +DEFAULT_EXTRA_SPACE = 10*1024 +DEFAULT_OVERHEAD_FACTOR = 1.3 + def __init__(self, confpath): self.partitions = [] @@ -127,16 +130,24 @@ class KickStart(): part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) -part.add_argument("--extra-space", type=sizetype, default=10*1024) +part.add_argument("--extra-space", type=sizetype) part.add_argument('--fsoptions', dest='fsopts') part.add_argument('--fstype') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk') -part.add_argument("--overhead-factor", type=overheadtype, default=1.3) +part.add_argument("--overhead-factor", type=overheadtype) part.add_argument('--part-type') part.add_argument(
[OE-core] [PATCH v5 2/6] oeqa/utils/commands.py: allow use of binaries from native sysroot
Tests may need to run a native tool that is not available on the host filesystem, but can be built using one of the *-native recipes. In such case, the tool will be available in native sysroot, and running in from that location will require adjustments to PATH. runCmd() can now take a path to native sysroot as one of its arguments and setup PATH accordingly. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/utils/commands.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 5cd0f7477baa5bb45f2b2b5b93fb1ff0efd02923..657c9dba34ea9d42aa416f3b889f4b04129e8da9 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -97,9 +97,16 @@ class Result(object): pass -def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options): +def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options): result = Result() +if native_sysroot: +extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ + (native_sysroot, native_sysroot, native_sysroot) +nenv = dict(options.get('env', os.environ)) +nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '') +options['env'] = nenv + cmd = Command(command, timeout=timeout, **options) cmd.run() -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v5 4/6] wic: selftest: avoid COMPATIBLE_HOST issues
wic tests will unconditionally attempt to build syslinux and add configuration options that may not be compatible with current machine. Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build recipes, add configuration options or skip tests conditionally. A convenience decorator onlyForArch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 51 +++ 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index faac11e21643e4c32a83b649b6ae986fead498f1..2db14445956bc5adcf1e755844bbdb69edcb468f 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,33 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +class onlyForArch(object): + +def __init__(self, *args): +self.archs = args + +def __call__(self,f): +@wraps(f) +def wrapped_f(*args, **kwargs): +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +if self.archs and arch not in self.archs : +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return f(*args, **kwargs) +wrapped_f.__name__ = f.__name__ +return wrapped_f + + class Wic(oeSelfTest): """Wic test class.""" @@ -41,15 +59,22 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES += " hddimg"\n' - 'MACHINE_FEATURES_append = " efi"\n') +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +is_x86 = arch in ['i586', 'i686', 'x86_64'] +if is_x86: +self.write_config('IMAGE_FSTYPES += " hddimg"\n' \ + 'MACHINE_FEATURES_append = " efi"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: -bitbake('syslinux syslinux-native parted-native gptfdisk-native ' -'dosfstools-native mtools-native bmap-tools-native') +tools = 'parted-native gptfdisk-native ' \ +'dosfstools-native mtools-native bmap-tools-native' +if is_x86: +tools += ' syslinux syslinux-native' +bitbake(tools) + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -71,6 +96,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic list --help').status) @testcase(1211) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " @@ -78,6 +104,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ @@ -92,6 +119,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1157) +@onlyForArch('i586', 'i686', 'x86_64') def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " @@ -125,6 +153,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic help kickstart').status) @testcase(1264) +@onlyForArch('i586', 'i686', 'x86_64') def test_compress_gzip(self): """Test compressing an image with gzip""" self.assertEqual(0, runCmd("wic create directdisk " @@ -134,6 +163,7 @@ class Wic(oeSelfTest):
[OE-core] [PATCH v5 0/6] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
v5 of a patch series previously posted here [1]. Changes since v4: * dropped `wic: selftest: do not repeat core-image-minimal` & rebased dependant patches * minor formatting fix in `wic: selftest: add tests for --fixed-size partition flags` [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/129103.html Maciej Borzecki (6): oe-selftest: enforce en_US.UTF-8 locale oeqa/utils/commands.py: allow use of binaries from native sysroot wic: add --fixed-size wks option wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta/lib/oeqa/selftest/wic.py | 123 +++-- meta/lib/oeqa/utils/commands.py| 9 ++- scripts/lib/wic/help.py| 14 +++- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 +-- scripts/lib/wic/partition.py | 88 ++- scripts/lib/wic/utils/partitionedfs.py | 2 +- scripts/oe-selftest| 3 + 8 files changed, 234 insertions(+), 48 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v5 1/6] oe-selftest: enforce en_US.UTF-8 locale
Replicate bitbake and eforce en_US.UTF-8 locale so that ouptut of locale-aware tools remains stable. Signed-off-by: Maciej Birzecki Signed-off-by: Maciej Borzecki --- scripts/oe-selftest | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/oe-selftest b/scripts/oe-selftest index c3215ea6592e128d17da550d778272985f5bd1a6..deaa4324cc888ea261687f90f83e8759c4436a15 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -468,6 +468,9 @@ def main(): sys.path.extend(layer_libdirs) imp.reload(oeqa.selftest) +# act like bitbake and enforce en_US.UTF-8 locale +os.environ["LC_ALL"] = "en_US.UTF-8" + if args.run_tests_by and len(args.run_tests_by) >= 2: valid_options = ['name', 'class', 'module', 'id', 'tag'] if args.run_tests_by[0] not in valid_options: -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 7/7] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 69 +++ 1 file changed, 69 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index ad783043b92130a023fd70120becec479c6253a7..45f68df1e74828e11401f57dd732a88a50dd1f00 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu @@ -61,6 +62,8 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" +self.native_sysroot = get_bb_var('STAGING_DIR_NATIVE', 'core-image-minimal') + arch = get_bb_var('HOST_ARCH', 'core-image-minimal') is_x86 = arch in ['i586', 'i686', 'x86_64'] if is_x86: @@ -378,3 +381,69 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd("wic create %(wks)s -e %(image)s" \ % wic_cmd_vars).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return (wkspath, wksname) + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +wic_cmd_vars = { +'wks': wkspath, +'image': self.OE_IMAGE, +} +self.assertEqual(0, runCmd("wic create %(wks)s -e %(image)s" \ + % wic_cmd_vars).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, + ignore_status=True, + native_sysroot=self.native_sysroot) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +wic_cmd_vars = { +'wks': wkspath, +'image': self.OE_IMAGE, +} +self.assertEqual(1, runCmd("wic create %(wks)s -e %(image)s" \ + % wic_cmd_vars, ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 2/7] oeqa/utils/commands.py: allow use of binaries from native sysroot
Tests may need to run a native tool that is not available on the host filesystem, but can be built using one of the *-native recipes. In such case, the tool will be available in native sysroot, and running in from that location will require adjustments to PATH. runCmd() can now take a path to native sysroot as one of its arguments and setup PATH accordingly. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/utils/commands.py | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 5cd0f7477baa5bb45f2b2b5b93fb1ff0efd02923..657c9dba34ea9d42aa416f3b889f4b04129e8da9 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -97,9 +97,16 @@ class Result(object): pass -def runCmd(command, ignore_status=False, timeout=None, assert_error=True, **options): +def runCmd(command, ignore_status=False, timeout=None, assert_error=True, native_sysroot=None, **options): result = Result() +if native_sysroot: +extra_paths = "%s/sbin:%s/usr/sbin:%s/usr/bin" % \ + (native_sysroot, native_sysroot, native_sysroot) +nenv = dict(options.get('env', os.environ)) +nenv['PATH'] = extra_paths + ':' + nenv.get('PATH', '') +options['env'] = nenv + cmd = Command(command, timeout=timeout, **options) cmd.run() -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 6/7] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 37ed2c6de5a7f22f982f921476fa392304995b2e..ad783043b92130a023fd70120becec479c6253a7 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -369,7 +369,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" image = "sdimage-bootpart" -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', self.OE_IMAGE) +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) wic_cmd_vars = { 'wks': image, 'image': self.OE_IMAGE, -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 3/7] wic: add --fixed-size wks option
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 14 -- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 ++-- scripts/lib/wic/partition.py | 88 +- scripts/lib/wic/utils/partitionedfs.py | 2 +- 5 files changed, 105 insertions(+), 42 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,12 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option @@ -719,13 +725,15 @@ DESCRIPTION space after the space filled by the content of the partition. The final size can go beyond the size specified by --size. -By default, 10MB. +By default, 10MB. This option cannot be used +with --fixed-size option. --overhead-factor: This option is specific to wic. The size of the partition is multiplied by this factor. It has to be greater than or -equal to 1. -The default value is 1.3. +equal to 1. The default value is 1.3. +This option cannot be used with --fixed-size +option. --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(int(part.size), +self.__image.add_partition(part.disk_size, part.disk, part.mountpoint, part.source_file, diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -113,6 +113,9 @@ def systemidtype(arg): class KickStart(): """"Kickstart parser implementation.""" +DEFAULT_EXTRA_SPACE = 10*1024 +DEFAULT_OVERHEAD_FACTOR = 1.3 + def __init__(self, confpath): self.partitions = [] @@ -127,16 +130,24 @@ class KickStart(): part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) -part.add_argument("--extra-space", type=sizetype, default=10*1024) +part.add_argument("--extra-space", type=sizetype) part.add_argument('--fsoptions', dest='fsopts') part.add_argument('--fstype') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk') -part.add_argument("--overhead-factor", type=overheadtype, default=1.3) +part.add_argument("--overhead-factor", type=overheadtype) part.add_argument('--part-type') part.add_argument(
[OE-core] [PATCH v4 4/7] wic: selftest: avoid COMPATIBLE_HOST issues
wic tests will unconditionally attempt to build syslinux and add configuration options that may not be compatible with current machine. Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build recipes, add configuration options or skip tests conditionally. A convenience decorator onlyForArch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 51 +++ 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index faac11e21643e4c32a83b649b6ae986fead498f1..2db14445956bc5adcf1e755844bbdb69edcb468f 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,33 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +class onlyForArch(object): + +def __init__(self, *args): +self.archs = args + +def __call__(self,f): +@wraps(f) +def wrapped_f(*args, **kwargs): +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +if self.archs and arch not in self.archs : +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return f(*args, **kwargs) +wrapped_f.__name__ = f.__name__ +return wrapped_f + + class Wic(oeSelfTest): """Wic test class.""" @@ -41,15 +59,22 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES += " hddimg"\n' - 'MACHINE_FEATURES_append = " efi"\n') +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +is_x86 = arch in ['i586', 'i686', 'x86_64'] +if is_x86: +self.write_config('IMAGE_FSTYPES += " hddimg"\n' \ + 'MACHINE_FEATURES_append = " efi"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: -bitbake('syslinux syslinux-native parted-native gptfdisk-native ' -'dosfstools-native mtools-native bmap-tools-native') +tools = 'parted-native gptfdisk-native ' \ +'dosfstools-native mtools-native bmap-tools-native' +if is_x86: +tools += ' syslinux syslinux-native' +bitbake(tools) + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -71,6 +96,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic list --help').status) @testcase(1211) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " @@ -78,6 +104,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ @@ -92,6 +119,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1157) +@onlyForArch('i586', 'i686', 'x86_64') def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " @@ -125,6 +153,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic help kickstart').status) @testcase(1264) +@onlyForArch('i586', 'i686', 'x86_64') def test_compress_gzip(self): """Test compressing an image with gzip""" self.assertEqual(0, runCmd("wic create directdisk " @@ -134,6 +163,7 @@ class Wic(oeSelfTest):
[OE-core] [PATCH v4 5/7] wic: selftest: do not repeat core-image-minimal
Replace repeated core-image-minimal with Wic class field. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 111 +++--- 1 file changed, 73 insertions(+), 38 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 2db14445956bc5adcf1e755844bbdb69edcb468f..37ed2c6de5a7f22f982f921476fa392304995b2e 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -57,6 +57,8 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic/build/" image_is_ready = False +OE_IMAGE = "core-image-minimal" + def setUpLocal(self): """This code is executed before each test method.""" arch = get_bb_var('HOST_ARCH', 'core-image-minimal') @@ -75,7 +77,7 @@ class Wic(oeSelfTest): tools += ' syslinux syslinux-native' bitbake(tools) -bitbake('core-image-minimal') +bitbake(self.OE_IMAGE) Wic.image_is_ready = True rmtree(self.resultdir, ignore_errors=True) @@ -100,14 +102,14 @@ class Wic(oeSelfTest): def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal").status) + "--image-name %s" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) @onlyForArch('i586', 'i686', 'x86_64') def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" -bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ +bbvars = dict((var.lower(), get_bb_var(var, self.OE_IMAGE)) \ for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) status = runCmd("wic create directdisk " @@ -123,7 +125,7 @@ class Wic(oeSelfTest): def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " - "--image-name core-image-minimal").status) + "--image-name %s" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1213) @@ -157,8 +159,8 @@ class Wic(oeSelfTest): def test_compress_gzip(self): """Test compressing an image with gzip""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c gzip").status) + "--image-name %s " + "-c gzip" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.gz"))) @@ -167,8 +169,8 @@ class Wic(oeSelfTest): def test_compress_bzip2(self): """Test compressing an image with bzip2""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c bzip2").status) + "--image-name %s " + "-c bzip2" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.bz2"))) @@ -177,8 +179,8 @@ class Wic(oeSelfTest): def test_compress_xz(self): """Test compressing an image with xz""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c xz").status) + "--image-name %s " + "-c xz" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.xz"))) @@ -187,26 +189,31 @@ class Wic(oeSelfTest): def test_wrong_compressor(self): """Test how wic breaks if wr
[OE-core] [PATCH v4 1/7] oe-selftest: enforce en_US.UTF-8 locale
Replicate bitbake and eforce en_US.UTF-8 locale so that ouptut of locale-aware tools remains stable. Signed-off-by: Maciej Birzecki Signed-off-by: Maciej Borzecki --- scripts/oe-selftest | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/oe-selftest b/scripts/oe-selftest index c3215ea6592e128d17da550d778272985f5bd1a6..deaa4324cc888ea261687f90f83e8759c4436a15 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -468,6 +468,9 @@ def main(): sys.path.extend(layer_libdirs) imp.reload(oeqa.selftest) +# act like bitbake and enforce en_US.UTF-8 locale +os.environ["LC_ALL"] = "en_US.UTF-8" + if args.run_tests_by and len(args.run_tests_by) >= 2: valid_options = ['name', 'class', 'module', 'id', 'tag'] if args.run_tests_by[0] not in valid_options: -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v4 0/7] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
v4 of patch series previously posted here [1]. Some of the patches that were posted as part of v3 are already in master. This version contains only the patches that were not merged yet. Changes since v3: * Running wic tests on Ubuntu resulted in test_fixed_size to fail. The reason was that `parted` is not a part of the base system, but is needed for verification of wic-produced partition layout. Parted is built as part of wic dependencies, hence oeqa/utils/commands.py:runCmd() was extended to include a new paramter - native_sysroot. This allows runCmd() to run binaries from STAGING_DIR_NATIVE{/sbin,/usr/bin,/usr/sbin}. [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/128785.html Maciej Borzecki (7): oe-selftest: enforce en_US.UTF-8 locale oeqa/utils/commands.py: allow use of binaries from native sysroot wic: add --fixed-size wks option wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not repeat core-image-minimal wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta/lib/oeqa/selftest/wic.py | 234 +++-- meta/lib/oeqa/utils/commands.py| 9 +- scripts/lib/wic/help.py| 14 +- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 +- scripts/lib/wic/partition.py | 88 - scripts/lib/wic/utils/partitionedfs.py | 2 +- scripts/oe-selftest| 3 + 8 files changed, 307 insertions(+), 86 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 11/11] oe-selftest: enforce en_US.UTF-8 locale
Replicate bitbake and eforce en_US.UTF-8 locale so that ouptut of locale-aware tools remains stable. Signed-off-by: Maciej Birzecki Signed-off-by: Maciej Borzecki --- scripts/oe-selftest | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/oe-selftest b/scripts/oe-selftest index c3215ea6592e128d17da550d778272985f5bd1a6..deaa4324cc888ea261687f90f83e8759c4436a15 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -468,6 +468,9 @@ def main(): sys.path.extend(layer_libdirs) imp.reload(oeqa.selftest) +# act like bitbake and enforce en_US.UTF-8 locale +os.environ["LC_ALL"] = "en_US.UTF-8" + if args.run_tests_by and len(args.run_tests_by) >= 2: valid_options = ['name', 'class', 'module', 'id', 'tag'] if args.run_tests_by[0] not in valid_options: -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 10/11] oe-selftest: fix handling of test cases without ID in --list-tests-by
Running `oe-selftest --list-tests-by module wic` will produce the following backtrace: Traceback (most recent call last): File "/poky/scripts/oe-selftest", line 668, in ret = main() File "/poky/scripts/oe-selftest", line 486, in main list_testsuite_by(criteria, keyword) File "/poky/scripts/oe-selftest", line 340, in list_testsuite_by ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) TypeError: unorderable types: int() < NoneType() The root cause is that a test case does not necessarily have an ID assigned, hence its value is None. Since Python 3 does not allow comparison of heterogeneous types, TypeError is raised. Signed-off-by: Maciej Borzecki --- scripts/oe-selftest | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/oe-selftest b/scripts/oe-selftest index d9ffd40e8c4caa734cd490d77304cc600cc75b73..c3215ea6592e128d17da550d778272985f5bd1a6 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -336,10 +336,15 @@ def list_testsuite_by(criteria, keyword): # Get a testsuite based on 'keyword' # criteria: name, class, module, id, tag # keyword: a list of tests, classes, modules, ids, tags - -ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) - -print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module')) +def tc_key(t): +if t[0] is None: +return (0,) + t[1:] +return t +# tcid may be None if no ID was assigned, in which case sorted() will throw +# a TypeError as Python 3 does not allow comparison (<,<=,>=,>) of +# heterogeneous types, handle this by using a custom key generator +ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) \ + for tc in get_testsuite_by(criteria, keyword) ], key=tc_key) print('_' * 150) for t in ts: if isinstance(t[1], (tuple, list)): -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 09/11] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 65 +++ 1 file changed, 65 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index ad783043b92130a023fd70120becec479c6253a7..052d77d510adf4b3fe56ab8fcc87a834c15b1d4c 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -29,6 +29,7 @@ import unittest from glob import glob from shutil import rmtree from functools import wraps +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu @@ -378,3 +379,67 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd("wic create %(wks)s -e %(image)s" \ % wic_cmd_vars).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return (wkspath, wksname) + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +wic_cmd_vars = { +'wks': wkspath, +'image': self.OE_IMAGE, +} +self.assertEqual(0, runCmd("wic create %(wks)s -e %(image)s" \ + % wic_cmd_vars).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, ignore_status=True) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0.00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0.00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +wic_cmd_vars = { +'wks': wkspath, +'image': self.OE_IMAGE, +} +self.assertEqual(1, runCmd("wic create %(wks)s -e %(image)s" \ + % wic_cmd_vars, ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 05/11] wic: add --fixed-size wks option
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 14 -- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 ++-- scripts/lib/wic/partition.py | 88 +- scripts/lib/wic/utils/partitionedfs.py | 2 +- 5 files changed, 105 insertions(+), 42 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,12 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option @@ -719,13 +725,15 @@ DESCRIPTION space after the space filled by the content of the partition. The final size can go beyond the size specified by --size. -By default, 10MB. +By default, 10MB. This option cannot be used +with --fixed-size option. --overhead-factor: This option is specific to wic. The size of the partition is multiplied by this factor. It has to be greater than or -equal to 1. -The default value is 1.3. +equal to 1. The default value is 1.3. +This option cannot be used with --fixed-size +option. --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(int(part.size), +self.__image.add_partition(part.disk_size, part.disk, part.mountpoint, part.source_file, diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -113,6 +113,9 @@ def systemidtype(arg): class KickStart(): """"Kickstart parser implementation.""" +DEFAULT_EXTRA_SPACE = 10*1024 +DEFAULT_OVERHEAD_FACTOR = 1.3 + def __init__(self, confpath): self.partitions = [] @@ -127,16 +130,24 @@ class KickStart(): part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) -part.add_argument("--extra-space", type=sizetype, default=10*1024) +part.add_argument("--extra-space", type=sizetype) part.add_argument('--fsoptions', dest='fsopts') part.add_argument('--fstype') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk') -part.add_argument("--overhead-factor", type=overheadtype, default=1.3) +part.add_argument("--overhead-factor", type=overheadtype) part.add_argument('--part-type') part.add_argument(
[OE-core] [PATCH v3 08/11] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 37ed2c6de5a7f22f982f921476fa392304995b2e..ad783043b92130a023fd70120becec479c6253a7 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -369,7 +369,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" image = "sdimage-bootpart" -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', self.OE_IMAGE) +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) wic_cmd_vars = { 'wks': image, 'image': self.OE_IMAGE, -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 07/11] wic: selftest: do not repeat core-image-minimal
Replace repeated core-image-minimal with Wic class field. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 111 +++--- 1 file changed, 73 insertions(+), 38 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 2db14445956bc5adcf1e755844bbdb69edcb468f..37ed2c6de5a7f22f982f921476fa392304995b2e 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -57,6 +57,8 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic/build/" image_is_ready = False +OE_IMAGE = "core-image-minimal" + def setUpLocal(self): """This code is executed before each test method.""" arch = get_bb_var('HOST_ARCH', 'core-image-minimal') @@ -75,7 +77,7 @@ class Wic(oeSelfTest): tools += ' syslinux syslinux-native' bitbake(tools) -bitbake('core-image-minimal') +bitbake(self.OE_IMAGE) Wic.image_is_ready = True rmtree(self.resultdir, ignore_errors=True) @@ -100,14 +102,14 @@ class Wic(oeSelfTest): def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal").status) + "--image-name %s" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) @onlyForArch('i586', 'i686', 'x86_64') def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" -bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ +bbvars = dict((var.lower(), get_bb_var(var, self.OE_IMAGE)) \ for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) status = runCmd("wic create directdisk " @@ -123,7 +125,7 @@ class Wic(oeSelfTest): def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " - "--image-name core-image-minimal").status) + "--image-name %s" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1213) @@ -157,8 +159,8 @@ class Wic(oeSelfTest): def test_compress_gzip(self): """Test compressing an image with gzip""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c gzip").status) + "--image-name %s " + "-c gzip" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.gz"))) @@ -167,8 +169,8 @@ class Wic(oeSelfTest): def test_compress_bzip2(self): """Test compressing an image with bzip2""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c bzip2").status) + "--image-name %s " + "-c bzip2" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.bz2"))) @@ -177,8 +179,8 @@ class Wic(oeSelfTest): def test_compress_xz(self): """Test compressing an image with xz""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c xz").status) + "--image-name %s " + "-c xz" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.xz"))) @@ -187,26 +189,31 @@ class Wic(oeSelfTest): def test_wrong_compressor(self): """Test how wic breaks if wr
[OE-core] [PATCH v3 04/11] wic: fix function comment typos
Fix typos in documentation of Image.add_partition() and Image.__format_disks(). Signed-off-by: Maciej Borzecki --- scripts/lib/wic/utils/partitionedfs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index cb03009fc7e3c97305079629ded7d2ff01eba4c4..9e76487844eebfffc7227d053a65dc9fdab3678b 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -92,7 +92,7 @@ class Image(): def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None, label=None, fsopts=None, boot=False, align=None, no_table=False, part_type=None, uuid=None, system_id=None): -""" Add the next partition. Prtitions have to be added in the +""" Add the next partition. Partitions have to be added in the first-to-last order. """ ks_pnum = len(self.partitions) @@ -292,7 +292,7 @@ class Image(): # even number of sectors. if part['mountpoint'] == "/boot" and part['fstype'] in ["vfat", "msdos"] \ and part['size'] % 2: -msger.debug("Substracting one sector from '%s' partition to " \ +msger.debug("Subtracting one sector from '%s' partition to " \ "get even number of sectors for the partition" % \ part['mountpoint']) part['size'] -= 1 -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 06/11] wic: selftest: avoid COMPATIBLE_HOST issues
wic tests will unconditionally attempt to build syslinux and add configuration options that may not be compatible with current machine. Resolve this by consulting HOST_ARCH (which defaults to TARGET_ARCH) and build recipes, add configuration options or skip tests conditionally. A convenience decorator onlyForArch() can be used to skip test cases for specific architectures. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 51 +++ 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index faac11e21643e4c32a83b649b6ae986fead498f1..2db14445956bc5adcf1e755844bbdb69edcb468f 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -24,15 +24,33 @@ """Test cases for wic.""" import os +import unittest from glob import glob from shutil import rmtree +from functools import wraps from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu from oeqa.utils.decorators import testcase +class onlyForArch(object): + +def __init__(self, *args): +self.archs = args + +def __call__(self,f): +@wraps(f) +def wrapped_f(*args, **kwargs): +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +if self.archs and arch not in self.archs : +raise unittest.SkipTest("Testcase arch dependency not met: %s" % arch) +return f(*args, **kwargs) +wrapped_f.__name__ = f.__name__ +return wrapped_f + + class Wic(oeSelfTest): """Wic test class.""" @@ -41,15 +59,22 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES += " hddimg"\n' - 'MACHINE_FEATURES_append = " efi"\n') +arch = get_bb_var('HOST_ARCH', 'core-image-minimal') +is_x86 = arch in ['i586', 'i686', 'x86_64'] +if is_x86: +self.write_config('IMAGE_FSTYPES += " hddimg"\n' \ + 'MACHINE_FEATURES_append = " efi"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: -bitbake('syslinux syslinux-native parted-native gptfdisk-native ' -'dosfstools-native mtools-native bmap-tools-native') +tools = 'parted-native gptfdisk-native ' \ +'dosfstools-native mtools-native bmap-tools-native' +if is_x86: +tools += ' syslinux syslinux-native' +bitbake(tools) + bitbake('core-image-minimal') Wic.image_is_ready = True @@ -71,6 +96,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic list --help').status) @testcase(1211) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " @@ -78,6 +104,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) +@onlyForArch('i586', 'i686', 'x86_64') def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ @@ -92,6 +119,7 @@ class Wic(oeSelfTest): self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1157) +@onlyForArch('i586', 'i686', 'x86_64') def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " @@ -125,6 +153,7 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd('wic help kickstart').status) @testcase(1264) +@onlyForArch('i586', 'i686', 'x86_64') def test_compress_gzip(self): """Test compressing an image with gzip""" self.assertEqual(0, runCmd("wic create directdisk " @@ -134,6 +163,7 @@ class Wic(oeSelfTest):
[OE-core] [PATCH v3 03/11] wic: check that filesystem is specified for a rootfs partition
We explicitly check for --fstype if no source was provided for a partition. However, this was not the case for rootfs partitions. Make sure to raise an error if filesystem was left unspecified when preparing a rootfs partition image. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 4 1 file changed, 4 insertions(+) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index f3835339afc5091604ffd7f0d0acf1d1ad4351cc..ac4c836bdb53300d3a4e4c09926b7b1514b8faf2 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -190,6 +190,10 @@ class Partition(): if os.path.isfile(rootfs): os.remove(rootfs) +if not self.fstype: +msger.error("File system for partition %s not specified in kickstart, " \ +"use --fstype option" % (self.mountpoint)) + for prefix in ("ext", "btrfs", "vfat", "squashfs"): if self.fstype.startswith(prefix): method = getattr(self, "prepare_rootfs_" + prefix) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 01/11] wic: make sure that partition size is always an integer in internal processing
The size field of Partition class is expected to be an integer and ought to be set inside prepare_*() method. Make sure that this is always the case. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 12 +--- scripts/lib/wic/plugins/source/bootimg-efi.py | 2 +- scripts/lib/wic/plugins/source/rawcopy.py | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 89c33ab8b7d54bb14678b2e07e706e3feb6ae57a..959035a97110244ffe56e95a886e122c400d4779 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -146,6 +146,12 @@ class Partition(): oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, native_sysroot) +# further processing required Partition.size to be an integer, make +# sure that it is one +if type(self.size) is not int: +msger.error("Partition %s internal size is not an integer. " \ + "This a bug in source plugin %s and needs to be fixed." \ + % (self.mountpoint, self.source)) def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir, rootfs_dir): @@ -157,7 +163,7 @@ class Partition(): out = exec_cmd(du_cmd) rootfs_size = out.split()[0] -self.size = rootfs_size +self.size = int(rootfs_size) self.source_file = rootfs def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, @@ -194,7 +200,7 @@ class Partition(): # get the rootfs size in the right units for kickstart (kB) du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) -self.size = out.split()[0] +self.size = int(out.split()[0]) break @@ -379,7 +385,7 @@ class Partition(): out = exec_cmd(du_cmd) fs_size = out.split()[0] -self.size = fs_size +self.size = int(fs_size) def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): """ diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 8bc362254d8c06511aa2cf0d5e1bf6f5aa93804b..4adb80becc11a6d30ffeae64ff87ebeb959dde86 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -234,5 +234,5 @@ class BootimgEFIPlugin(SourcePlugin): out = exec_cmd(du_cmd) bootimg_size = out.split()[0] -part.size = bootimg_size +part.size = int(bootimg_size) part.source_file = bootimg diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index e0b11f95adb5a2c55fdc3b5e3ff1f4b463e2be9d..5bd22fdeb55bc2f0b38ffcc2a46cf18ade5425ef 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -78,9 +78,9 @@ class RawCopyPlugin(SourcePlugin): # get the size in the right units for kickstart (kB) du_cmd = "du -Lbks %s" % dst out = exec_cmd(du_cmd) -filesize = out.split()[0] +filesize = int(out.split()[0]) -if int(filesize) > int(part.size): +if filesize > part.size: part.size = filesize part.source_file = dst -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 02/11] wic: use partition size when creating empty partition files
It seems that prepare_empty_partition_ext() and prepare_empty_partition_btrfs() got broken in commit c8669749e37fe865c197c98d5671d9de176ff4dd, thus one could observe the following backtrace: Backtrace: File "/poky/scripts/lib/wic/plugins/imager/direct_plugin.py", line 93, in do_create creator.create() File "/poky/scripts/lib/wic/imager/baseimager.py", line 159, in create self._create() File "/poky/scripts/lib/wic/imager/direct.py", line 290, in _create self.bootimg_dir, self.kernel_dir, self.native_sysroot) File "/poky/scripts/lib/wic/partition.py", line 146, in prepare method(rootfs, oe_builddir, native_sysroot) File "/poky/scripts/lib/wic/partition.py", line 325, in prepare_empty_partition_ext os.ftruncate(sparse.fileno(), rootfs_size * 1024) NameError: name 'rootfs_size' is not defined Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 959035a97110244ffe56e95a886e122c400d4779..f3835339afc5091604ffd7f0d0acf1d1ad4351cc 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -314,7 +314,7 @@ class Partition(): Prepare an empty ext2/3/4 partition. """ with open(rootfs, 'w') as sparse: -os.ftruncate(sparse.fileno(), rootfs_size * 1024) +os.ftruncate(sparse.fileno(), self.size * 1024) extra_imagecmd = "-i 8192" @@ -332,7 +332,7 @@ class Partition(): Prepare an empty btrfs partition. """ with open(rootfs, 'w') as sparse: -os.ftruncate(sparse.fileno(), rootfs_size * 1024) +os.ftruncate(sparse.fileno(), self.size * 1024) label_str = "" if self.label: -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v3 00/11] wic: bugfixes & --fixed-size support, tests, oe-selftest: minor fixes
v3 of patch series previously posted here [1]. I have noticed that Ross has cherry-picked some patches into his pull request to master. Just for reference, the patches are included in this series, but have not been changed since the previous version. The patches in question are: oe-selftest: fix handling of test cases without ID in --list-tests-by wic: make sure that partition size is always an integer in internal processing wic: use partition size when creating empty partition files wic: check that filesystem is specified for a rootfs partition wic: fix function comment typos wic: add --fixed-size wks option Changes since v2: * COMPATIBLE_HOST workarounds now selectively skip certain wic tests for archs that cannot build images included in the test (most commonly directdisk-* image is not usable on non x86 archs), wic tests were verified to pass for qemux86-64 and beaglebone * oe-selftest enforces en_US.UTF-8 encoding to enforce stable textual output of locaization aware programs [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/128630.html Maciej Borzecki (11): wic: make sure that partition size is always an integer in internal processing wic: use partition size when creating empty partition files wic: check that filesystem is specified for a rootfs partition wic: fix function comment typos wic: add --fixed-size wks option wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not repeat core-image-minimal wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags oe-selftest: fix handling of test cases without ID in --list-tests-by oe-selftest: enforce en_US.UTF-8 locale meta/lib/oeqa/selftest/wic.py | 230 +- scripts/lib/wic/help.py | 14 +- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py | 41 - scripts/lib/wic/partition.py | 104 scripts/lib/wic/plugins/source/bootimg-efi.py | 2 +- scripts/lib/wic/plugins/source/rawcopy.py | 4 +- scripts/lib/wic/utils/partitionedfs.py| 6 +- scripts/oe-selftest | 16 +- 9 files changed, 322 insertions(+), 97 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 06/10] oe-selftest: fix handling of test cases without ID in --list-tests-by
Running `oe-selftest --list-tests-by module wic` will produce the following backtrace: Traceback (most recent call last): File "/poky/scripts/oe-selftest", line 668, in ret = main() File "/poky/scripts/oe-selftest", line 486, in main list_testsuite_by(criteria, keyword) File "/poky/scripts/oe-selftest", line 340, in list_testsuite_by ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) TypeError: unorderable types: int() < NoneType() The root cause is that a test case does not necessarily have an ID assigned, hence its value is None. Since Python 3 does not allow comparison of heterogeneous types, TypeError is raised. Signed-off-by: Maciej Borzecki --- scripts/oe-selftest | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/oe-selftest b/scripts/oe-selftest index d9ffd40e8c4caa734cd490d77304cc600cc75b73..c3215ea6592e128d17da550d778272985f5bd1a6 100755 --- a/scripts/oe-selftest +++ b/scripts/oe-selftest @@ -336,10 +336,15 @@ def list_testsuite_by(criteria, keyword): # Get a testsuite based on 'keyword' # criteria: name, class, module, id, tag # keyword: a list of tests, classes, modules, ids, tags - -ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) for tc in get_testsuite_by(criteria, keyword) ]) - -print('%-4s\t%-20s\t%-60s\t%-25s\t%-20s' % ('id', 'tag', 'name', 'class', 'module')) +def tc_key(t): +if t[0] is None: +return (0,) + t[1:] +return t +# tcid may be None if no ID was assigned, in which case sorted() will throw +# a TypeError as Python 3 does not allow comparison (<,<=,>=,>) of +# heterogeneous types, handle this by using a custom key generator +ts = sorted([ (tc.tcid, tc.tctag, tc.tcname, tc.tcclass, tc.tcmodule) \ + for tc in get_testsuite_by(criteria, keyword) ], key=tc_key) print('_' * 150) for t in ts: if isinstance(t[1], (tuple, list)): -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 07/10] wic: selftest: avoid COMPATIBLE_HOST issues
wic tests will unconditionally attempt to build syslinux and add configuration options that may not be compatible with current machine. Resolve this by consulting TARGET_ARCH first and performing configuration changes or recipe builds for targets that are known to be compatible. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index faac11e21643e4c32a83b649b6ae986fead498f1..60e31de5825c84fca21d4dbe946e5cc7af8df511 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -41,15 +41,21 @@ class Wic(oeSelfTest): def setUpLocal(self): """This code is executed before each test method.""" -self.write_config('IMAGE_FSTYPES += " hddimg"\n' - 'MACHINE_FEATURES_append = " efi"\n') +targetarch = get_bb_var('TARGET_ARCH', 'core-image-minimal') +if 'x86' in targetarch: +self.write_config('IMAGE_FSTYPES += " hddimg"\n' + 'MACHINE_FEATURES_append = " efi"\n') # Do this here instead of in setUpClass as the base setUp does some # clean up which can result in the native tools built earlier in # setUpClass being unavailable. if not Wic.image_is_ready: -bitbake('syslinux syslinux-native parted-native gptfdisk-native ' -'dosfstools-native mtools-native bmap-tools-native') +tools = 'parted-native gptfdisk-native ' \ +'dosfstools-native mtools-native bmap-tools-native' +if 'x86' in targetarch: +tools += 'syslinux syslinux-native' +bitbake(tools) + bitbake('core-image-minimal') Wic.image_is_ready = True -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 08/10] wic: selftest: do not repeat core-image-minimal
Replace repeated core-image-minimal with Wic class field. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 111 +++--- 1 file changed, 73 insertions(+), 38 deletions(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 60e31de5825c84fca21d4dbe946e5cc7af8df511..8b86acb917134b389e38c8215a8dff6c7f91c005 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -39,6 +39,8 @@ class Wic(oeSelfTest): resultdir = "/var/tmp/wic/build/" image_is_ready = False +OE_IMAGE = "core-image-minimal" + def setUpLocal(self): """This code is executed before each test method.""" targetarch = get_bb_var('TARGET_ARCH', 'core-image-minimal') @@ -56,7 +58,7 @@ class Wic(oeSelfTest): tools += 'syslinux syslinux-native' bitbake(tools) -bitbake('core-image-minimal') +bitbake(self.OE_IMAGE) Wic.image_is_ready = True rmtree(self.resultdir, ignore_errors=True) @@ -80,13 +82,13 @@ class Wic(oeSelfTest): def test_build_image_name(self): """Test wic create directdisk --image-name core-image-minimal""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal").status) + "--image-name %s" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1212) def test_build_artifacts(self): """Test wic create directdisk providing all artifacts.""" -bbvars = dict((var.lower(), get_bb_var(var, 'core-image-minimal')) \ +bbvars = dict((var.lower(), get_bb_var(var, self.OE_IMAGE)) \ for var in ('STAGING_DATADIR', 'DEPLOY_DIR_IMAGE', 'STAGING_DIR_NATIVE', 'IMAGE_ROOTFS')) status = runCmd("wic create directdisk " @@ -101,7 +103,7 @@ class Wic(oeSelfTest): def test_gpt_image(self): """Test creation of core-image-minimal with gpt table and UUID boot""" self.assertEqual(0, runCmd("wic create directdisk-gpt " - "--image-name core-image-minimal").status) + "--image-name %s" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + "directdisk-*.direct"))) @testcase(1213) @@ -134,8 +136,8 @@ class Wic(oeSelfTest): def test_compress_gzip(self): """Test compressing an image with gzip""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c gzip").status) + "--image-name %s " + "-c gzip" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.gz"))) @@ -143,8 +145,8 @@ class Wic(oeSelfTest): def test_compress_bzip2(self): """Test compressing an image with bzip2""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c bzip2").status) + "--image-name %s " + "-c bzip2" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.bz2"))) @@ -152,8 +154,8 @@ class Wic(oeSelfTest): def test_compress_xz(self): """Test compressing an image with xz""" self.assertEqual(0, runCmd("wic create directdisk " - "--image-name core-image-minimal " - "-c xz").status) + "--image-name %s " + "-c xz" % self.OE_IMAGE).status) self.assertEqual(1, len(glob(self.resultdir + \ "directdisk-*.direct.xz"))) @@ -161,24 +163,29 @@ class Wic(oeSelfTest): def test_wrong_compressor(self): """Test how wic breaks if wrong compressor is provided""
[OE-core] [PATCH v2 04/10] wic: fix function comment typos
Fix typos in documentation of Image.add_partition() and Image.__format_disks(). Signed-off-by: Maciej Borzecki --- scripts/lib/wic/utils/partitionedfs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index cb03009fc7e3c97305079629ded7d2ff01eba4c4..9e76487844eebfffc7227d053a65dc9fdab3678b 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -92,7 +92,7 @@ class Image(): def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None, label=None, fsopts=None, boot=False, align=None, no_table=False, part_type=None, uuid=None, system_id=None): -""" Add the next partition. Prtitions have to be added in the +""" Add the next partition. Partitions have to be added in the first-to-last order. """ ks_pnum = len(self.partitions) @@ -292,7 +292,7 @@ class Image(): # even number of sectors. if part['mountpoint'] == "/boot" and part['fstype'] in ["vfat", "msdos"] \ and part['size'] % 2: -msger.debug("Substracting one sector from '%s' partition to " \ +msger.debug("Subtracting one sector from '%s' partition to " \ "get even number of sectors for the partition" % \ part['mountpoint']) part['size'] -= 1 -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 10/10] wic: selftest: add tests for --fixed-size partition flags
wic has a new flag for setting a fixed parition size --fixed-size. Add tests that verify if partition is indeed sized properly and that errors are signaled when there is not enough space to fit partition data. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 65 +++ 1 file changed, 65 insertions(+) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 799886c164a734bcc3226baf97f20d789ae55b56..954f8911eff6da6880d25b4fcd2d82fe0a26c4ba 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -27,6 +27,7 @@ import os from glob import glob from shutil import rmtree +from tempfile import NamedTemporaryFile from oeqa.selftest.base import oeSelfTest from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu @@ -341,3 +342,67 @@ class Wic(oeSelfTest): self.assertEqual(0, runCmd("wic create %(wks)s -e %(image)s" \ % wic_cmd_vars).status) self.assertEqual(1, len(glob(self.resultdir + "%s-*direct" % image))) + +def _make_fixed_size_wks(self, size): +""" +Create a wks of an image with a single partition. Size of the partition is set +using --fixed-size flag. Returns a tuple: (path to wks file, wks image name) +""" +with NamedTemporaryFile("w", suffix=".wks", delete=False) as tf: +wkspath = tf.name +tf.write("part " \ + "--source rootfs --ondisk hda --align 4 --fixed-size %d " + "--fstype=ext4\n" % size) +wksname = os.path.splitext(os.path.basename(wkspath))[0] + +return (wkspath, wksname) + +def test_fixed_size(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag +""" +wkspath, wksname = self._make_fixed_size_wks(200) + +wic_cmd_vars = { +'wks': wkspath, +'image': self.OE_IMAGE, +} +self.assertEqual(0, runCmd("wic create %(wks)s -e %(image)s" \ + % wic_cmd_vars).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(1, len(wicout)) + +wicimg = wicout[0] + +# verify partition size with wic +res = runCmd("parted -m %s unit mib p 2>/dev/null" % wicimg, ignore_status=True) +self.assertEqual(0, res.status) + +# parse parted output which looks like this: +# BYT;\n +# /var/tmp/wic/build/tmpfwvjjkf_-201611101222-hda.direct:200MiB:file:512:512:msdos::;\n +# 1:0,00MiB:200MiB:200MiB:ext4::;\n +partlns = res.output.splitlines()[2:] + +self.assertEqual(1, len(partlns)) +self.assertEqual("1:0,00MiB:200MiB:200MiB:ext4::;", partlns[0]) + +def test_fixed_size_error(self): +""" +Test creation of a simple image with partition size controlled through +--fixed-size flag. The size of partition is intentionally set to 1MiB +in order to trigger an error in wic. +""" +wkspath, wksname = self._make_fixed_size_wks(1) + +wic_cmd_vars = { +'wks': wkspath, +'image': self.OE_IMAGE, +} +self.assertEqual(1, runCmd("wic create %(wks)s -e %(image)s" \ + % wic_cmd_vars, ignore_status=True).status) +os.remove(wkspath) +wicout = glob(self.resultdir + "%s-*direct" % wksname) +self.assertEqual(0, len(wicout)) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 09/10] wic: selftest: do not assume bzImage kernel image
Instead of assuming that bzImage is available, query bitbake enviroment for KERNEL_IMAGETYPE. Signed-off-by: Maciej Borzecki --- meta/lib/oeqa/selftest/wic.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 8b86acb917134b389e38c8215a8dff6c7f91c005..799886c164a734bcc3226baf97f20d789ae55b56 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -332,7 +332,8 @@ class Wic(oeSelfTest): def test_sdimage_bootpart(self): """Test creation of sdimage-bootpart image""" image = "sdimage-bootpart" -self.write_config('IMAGE_BOOT_FILES = "bzImage"\n') +kimgtype = get_bb_var('KERNEL_IMAGETYPE', self.OE_IMAGE) +self.write_config('IMAGE_BOOT_FILES = "%s"\n' % kimgtype) wic_cmd_vars = { 'wks': image, 'image': self.OE_IMAGE, -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 05/10] wic: add --fixed-size wks option
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 14 -- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 ++-- scripts/lib/wic/partition.py | 88 +- scripts/lib/wic/utils/partitionedfs.py | 2 +- 5 files changed, 105 insertions(+), 42 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,12 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option @@ -719,13 +725,15 @@ DESCRIPTION space after the space filled by the content of the partition. The final size can go beyond the size specified by --size. -By default, 10MB. +By default, 10MB. This option cannot be used +with --fixed-size option. --overhead-factor: This option is specific to wic. The size of the partition is multiplied by this factor. It has to be greater than or -equal to 1. -The default value is 1.3. +equal to 1. The default value is 1.3. +This option cannot be used with --fixed-size +option. --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..11ec15e33f65885618c7adc83e55c6a39fedbe99 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(int(part.size), +self.__image.add_partition(part.disk_size, part.disk, part.mountpoint, part.source_file, diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -113,6 +113,9 @@ def systemidtype(arg): class KickStart(): """"Kickstart parser implementation.""" +DEFAULT_EXTRA_SPACE = 10*1024 +DEFAULT_OVERHEAD_FACTOR = 1.3 + def __init__(self, confpath): self.partitions = [] @@ -127,16 +130,24 @@ class KickStart(): part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) -part.add_argument("--extra-space", type=sizetype, default=10*1024) +part.add_argument("--extra-space", type=sizetype) part.add_argument('--fsoptions', dest='fsopts') part.add_argument('--fstype') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk') -part.add_argument("--overhead-factor", type=overheadtype, default=1.3) +part.add_argument("--overhead-factor", type=overheadtype) part.add_argument('--part-type') part.add_argument(
[OE-core] [PATCH v2 02/10] wic: use partition size when creating empty partition files
It seems that prepare_empty_partition_ext() and prepare_empty_partition_btrfs() got broken in commit c8669749e37fe865c197c98d5671d9de176ff4dd, thus one could observe the following backtrace: Backtrace: File "/poky/scripts/lib/wic/plugins/imager/direct_plugin.py", line 93, in do_create creator.create() File "/poky/scripts/lib/wic/imager/baseimager.py", line 159, in create self._create() File "/poky/scripts/lib/wic/imager/direct.py", line 290, in _create self.bootimg_dir, self.kernel_dir, self.native_sysroot) File "/poky/scripts/lib/wic/partition.py", line 146, in prepare method(rootfs, oe_builddir, native_sysroot) File "/poky/scripts/lib/wic/partition.py", line 325, in prepare_empty_partition_ext os.ftruncate(sparse.fileno(), rootfs_size * 1024) NameError: name 'rootfs_size' is not defined Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 959035a97110244ffe56e95a886e122c400d4779..f3835339afc5091604ffd7f0d0acf1d1ad4351cc 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -314,7 +314,7 @@ class Partition(): Prepare an empty ext2/3/4 partition. """ with open(rootfs, 'w') as sparse: -os.ftruncate(sparse.fileno(), rootfs_size * 1024) +os.ftruncate(sparse.fileno(), self.size * 1024) extra_imagecmd = "-i 8192" @@ -332,7 +332,7 @@ class Partition(): Prepare an empty btrfs partition. """ with open(rootfs, 'w') as sparse: -os.ftruncate(sparse.fileno(), rootfs_size * 1024) +os.ftruncate(sparse.fileno(), self.size * 1024) label_str = "" if self.label: -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 01/10] wic: make sure that partition size is always an integer in internal processing
The size field of Partition class is expected to be an integer and ought to be set inside prepare_*() method. Make sure that this is always the case. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 12 +--- scripts/lib/wic/plugins/source/bootimg-efi.py | 2 +- scripts/lib/wic/plugins/source/rawcopy.py | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 89c33ab8b7d54bb14678b2e07e706e3feb6ae57a..959035a97110244ffe56e95a886e122c400d4779 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -146,6 +146,12 @@ class Partition(): oe_builddir, bootimg_dir, kernel_dir, rootfs_dir, native_sysroot) +# further processing required Partition.size to be an integer, make +# sure that it is one +if type(self.size) is not int: +msger.error("Partition %s internal size is not an integer. " \ + "This a bug in source plugin %s and needs to be fixed." \ + % (self.mountpoint, self.source)) def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir, rootfs_dir): @@ -157,7 +163,7 @@ class Partition(): out = exec_cmd(du_cmd) rootfs_size = out.split()[0] -self.size = rootfs_size +self.size = int(rootfs_size) self.source_file = rootfs def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, @@ -194,7 +200,7 @@ class Partition(): # get the rootfs size in the right units for kickstart (kB) du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) -self.size = out.split()[0] +self.size = int(out.split()[0]) break @@ -379,7 +385,7 @@ class Partition(): out = exec_cmd(du_cmd) fs_size = out.split()[0] -self.size = fs_size +self.size = int(fs_size) def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): """ diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 8bc362254d8c06511aa2cf0d5e1bf6f5aa93804b..4adb80becc11a6d30ffeae64ff87ebeb959dde86 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py @@ -234,5 +234,5 @@ class BootimgEFIPlugin(SourcePlugin): out = exec_cmd(du_cmd) bootimg_size = out.split()[0] -part.size = bootimg_size +part.size = int(bootimg_size) part.source_file = bootimg diff --git a/scripts/lib/wic/plugins/source/rawcopy.py b/scripts/lib/wic/plugins/source/rawcopy.py index e0b11f95adb5a2c55fdc3b5e3ff1f4b463e2be9d..5bd22fdeb55bc2f0b38ffcc2a46cf18ade5425ef 100644 --- a/scripts/lib/wic/plugins/source/rawcopy.py +++ b/scripts/lib/wic/plugins/source/rawcopy.py @@ -78,9 +78,9 @@ class RawCopyPlugin(SourcePlugin): # get the size in the right units for kickstart (kB) du_cmd = "du -Lbks %s" % dst out = exec_cmd(du_cmd) -filesize = out.split()[0] +filesize = int(out.split()[0]) -if int(filesize) > int(part.size): +if filesize > part.size: part.size = filesize part.source_file = dst -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 00/10] wic: bugfixes & --fixed-size support, tests, selftest: minor fixes
v2 of patch series previously posted here [1]. The series introduces anumber of fixes to wic, as well as a new --fixed-size option applicable to `part` entries in kickstart files. The option makes it possible to have a fixed size partition, with additional verification that the file system image fits into the allocated disk space. This is in cotrast with --size option, which the minimum size, and partition may in fact be larger in the final disk image. The series introduces two tests that verify if wic has created the image with properly sized partition and that partition size checks work as expected. Patch `oe-selftest: fix handling of test cases without ID in --list-tests-by` is a small bugfix for oe-selftes tool which resolves an issue triggered by Python 3.x being more strict than 2.x. [1]. http://lists.openembedded.org/pipermail/openembedded-core/2016-November/128540.html Maciej Borzecki (10): wic: make sure that partition size is always an integer in internal processing wic: use partition size when creating empty partition files wic: check that filesystem is specified for a rootfs partition wic: fix function comment typos wic: add --fixed-size wks option oe-selftest: fix handling of test cases without ID in --list-tests-by wic: selftest: avoid COMPATIBLE_HOST issues wic: selftest: do not repeat core-image-minimal wic: selftest: do not assume bzImage kernel image wic: selftest: add tests for --fixed-size partition flags meta/lib/oeqa/selftest/wic.py | 193 -- scripts/lib/wic/help.py | 14 +- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py | 41 +- scripts/lib/wic/partition.py | 104 +- scripts/lib/wic/plugins/source/bootimg-efi.py | 2 +- scripts/lib/wic/plugins/source/rawcopy.py | 4 +- scripts/lib/wic/utils/partitionedfs.py| 6 +- scripts/oe-selftest | 13 +- 9 files changed, 282 insertions(+), 97 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 03/10] wic: check that filesystem is specified for a rootfs partition
We explicitly check for --fstype if no source was provided for a partition. However, this was not the case for rootfs partitions. Make sure to raise an error if filesystem was left unspecified when preparing a rootfs partition image. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 4 1 file changed, 4 insertions(+) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index f3835339afc5091604ffd7f0d0acf1d1ad4351cc..ac4c836bdb53300d3a4e4c09926b7b1514b8faf2 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -190,6 +190,10 @@ class Partition(): if os.path.isfile(rootfs): os.remove(rootfs) +if not self.fstype: +msger.error("File system for partition %s not specified in kickstart, " \ +"use --fstype option" % (self.mountpoint)) + for prefix in ("ext", "btrfs", "vfat", "squashfs"): if self.fstype.startswith(prefix): method = getattr(self, "prepare_rootfs_" + prefix) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 4/5] wic: fix function comment typos
Fix typos in documentation of Image.add_partition() and Image.__format_disks(). Signed-off-by: Maciej Borzecki --- scripts/lib/wic/utils/partitionedfs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index cb03009fc7e3c97305079629ded7d2ff01eba4c4..9e76487844eebfffc7227d053a65dc9fdab3678b 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -92,7 +92,7 @@ class Image(): def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None, label=None, fsopts=None, boot=False, align=None, no_table=False, part_type=None, uuid=None, system_id=None): -""" Add the next partition. Prtitions have to be added in the +""" Add the next partition. Partitions have to be added in the first-to-last order. """ ks_pnum = len(self.partitions) @@ -292,7 +292,7 @@ class Image(): # even number of sectors. if part['mountpoint'] == "/boot" and part['fstype'] in ["vfat", "msdos"] \ and part['size'] % 2: -msger.debug("Substracting one sector from '%s' partition to " \ +msger.debug("Subtracting one sector from '%s' partition to " \ "get even number of sectors for the partition" % \ part['mountpoint']) part['size'] -= 1 -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 2/5] wic: use partition size when creating empty partition files
It seems that prepare_empty_partition_ext() and prepare_empty_partition_btrfs() got broken in commit c8669749e37fe865c197c98d5671d9de176ff4dd, thus one could observe the following backtrace: Backtrace: File "/poky/scripts/lib/wic/plugins/imager/direct_plugin.py", line 93, in do_create creator.create() File "/poky/scripts/lib/wic/imager/baseimager.py", line 159, in create self._create() File "/poky/scripts/lib/wic/imager/direct.py", line 290, in _create self.bootimg_dir, self.kernel_dir, self.native_sysroot) File "/poky/scripts/lib/wic/partition.py", line 146, in prepare method(rootfs, oe_builddir, native_sysroot) File "/poky/scripts/lib/wic/partition.py", line 325, in prepare_empty_partition_ext os.ftruncate(sparse.fileno(), rootfs_size * 1024) NameError: name 'rootfs_size' is not defined Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 4b8d769437120adadb5dba2f3919d4eb96141292..8adc698240c8e3bd9f4118663a5d7a167e0bb4a4 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -308,7 +308,7 @@ class Partition(): Prepare an empty ext2/3/4 partition. """ with open(rootfs, 'w') as sparse: -os.ftruncate(sparse.fileno(), rootfs_size * 1024) +os.ftruncate(sparse.fileno(), self.size * 1024) extra_imagecmd = "-i 8192" @@ -326,7 +326,7 @@ class Partition(): Prepare an empty btrfs partition. """ with open(rootfs, 'w') as sparse: -os.ftruncate(sparse.fileno(), rootfs_size * 1024) +os.ftruncate(sparse.fileno(), self.size * 1024) label_str = "" if self.label: -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/5] wic: check that filesystem is specified for a rootfs partition
Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 4 1 file changed, 4 insertions(+) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 8adc698240c8e3bd9f4118663a5d7a167e0bb4a4..24e657592738dc7c5cdff78e3740d7c373021e9d 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -184,6 +184,10 @@ class Partition(): if os.path.isfile(rootfs): os.remove(rootfs) +if not self.fstype: +msger.error("File system for partition %s not specified in kickstart, " \ +"use --fstype option" % (self.mountpoint)) + for prefix in ("ext", "btrfs", "vfat", "squashfs"): if self.fstype.startswith(prefix): method = getattr(self, "prepare_rootfs_" + prefix) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 5/5] wic: add --fixed-size wks option
Added new option --fixed-size to wks. The option can be used to indicate the exact size of a partition. The option cannot be added together with --size, in which case an error will be raised. Other options that influence automatic partition size (--extra-space, --overhead-factor), if specifiec along with --fixed-size, will raise an error. If it partition data is larger than the amount of space specified with --fixed-size option wic will raise an error. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 14 -- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 +++-- scripts/lib/wic/partition.py | 83 -- scripts/lib/wic/utils/partitionedfs.py | 2 +- 5 files changed, 100 insertions(+), 42 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..daa11bf489c135627ddfe4cef968e48f8e3ad1d8 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,12 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --fixed-size: Exact partition size. Value format is the same + as for --size option. This option cannot be + specified along with --size. If partition data + is larger than --fixed-size and error will be + raised when assembling disk image. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option @@ -719,13 +725,15 @@ DESCRIPTION space after the space filled by the content of the partition. The final size can go beyond the size specified by --size. -By default, 10MB. +By default, 10MB. This option cannot be used +with --fixed-size option. --overhead-factor: This option is specific to wic. The size of the partition is multiplied by this factor. It has to be greater than or -equal to 1. -The default value is 1.3. +equal to 1. The default value is 1.3. +This option cannot be used with --fixed-size +option. --part-type: This option is specific to wic. It specifies partition type GUID for GPT partitions. diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 2bedef08d6450096c786def6f75a9ee53fcd4b3b..c01a1ea538428e36a75ac5b31a822e01901bea6a 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -290,7 +290,7 @@ class DirectImageCreator(BaseImageCreator): self.bootimg_dir, self.kernel_dir, self.native_sysroot) -self.__image.add_partition(int(part.size), +self.__image.add_partition(part.get_size(), part.disk, part.mountpoint, part.source_file, diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..62c490274aa92bf82aac304d9323250e3b728d0c 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -113,6 +113,9 @@ def systemidtype(arg): class KickStart(): """"Kickstart parser implementation.""" +DEFAULT_EXTRA_SPACE = 10*1024 +DEFAULT_OVERHEAD_FACTOR = 1.3 + def __init__(self, confpath): self.partitions = [] @@ -127,16 +130,24 @@ class KickStart(): part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) -part.add_argument("--extra-space", type=sizetype, default=10*1024) +part.add_argument("--extra-space", type=sizetype) part.add_argument('--fsoptions', dest='fsopts') part.add_argument('--fstype') part.add_argument('--label') part.add_argument('--no-table', action='store_true') part.add_argument('--ondisk', '--ondrive', dest='disk') -part.add_argument("--overhead-factor", type=overheadtype, default=1.3) +part.add_argument("--overhead-factor", type=overheadtype) part.add_argument('--part-type') part.add_argument(
[OE-core] [PATCH 0/5] wic: bugfixes & --fixed-size support
The patch series is a follow-up after a previous attempt of adding --reserved-size option to wic[1]. The series introduces a number of fixes in patches 1 - 4. The last patch in the series introduces --fixed-size option as discussed in [1]. The patch also introduces minor refactoring to code responsible for computing partition size. Aside from new option, another user-visible change is how the size rootfs partitions with vfat is calculated. In previous code, vfat rootfs partition size did not account for --extra-space nor --overhead-factor. Now, all rootfs partitions (except for squashfs) are subject to the same rules of partition sizing. http://lists.openembedded.org/pipermail/openembedded-core/2016-October/127634.html Maciej Borzecki (5): wic: make sure that partition size is always an integer in internal processing wic: use partition size when creating empty partition files wic: check that filesystem is specified for a rootfs partition wic: fix function comment typos wic: add --fixed-size wks option scripts/lib/wic/help.py| 14 +++-- scripts/lib/wic/imager/direct.py | 2 +- scripts/lib/wic/ksparser.py| 41 +-- scripts/lib/wic/partition.py | 93 +- scripts/lib/wic/utils/partitionedfs.py | 6 +-- 5 files changed, 109 insertions(+), 47 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/5] wic: make sure that partition size is always an integer in internal processing
Signed-off-by: Maciej Borzecki --- scripts/lib/wic/partition.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 89c33ab8b7d54bb14678b2e07e706e3feb6ae57a..4b8d769437120adadb5dba2f3919d4eb96141292 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -157,7 +157,7 @@ class Partition(): out = exec_cmd(du_cmd) rootfs_size = out.split()[0] -self.size = rootfs_size +self.size = int(rootfs_size) self.source_file = rootfs def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir, @@ -194,7 +194,7 @@ class Partition(): # get the rootfs size in the right units for kickstart (kB) du_cmd = "du -Lbks %s" % rootfs out = exec_cmd(du_cmd) -self.size = out.split()[0] +self.size = int(out.split()[0]) break @@ -379,7 +379,7 @@ class Partition(): out = exec_cmd(du_cmd) fs_size = out.split()[0] -self.size = fs_size +self.size = int(fs_size) def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot): """ -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: add --reserved-size wks option
Added new option --reserved-size to wks. The option can be used to indicate how much space should be reserved for a partition. This is useful if the disk will be a subject to full filesystem image updates and puts an upper limit of the size of filesystem images. The actual filesystem image may be smaller than the reserved space, thus leaving some room for growth. If it is larger, an error will be raised. Signed-off-by: Maciej Borzecki --- scripts/lib/wic/help.py| 11 ++ scripts/lib/wic/imager/direct.py | 3 ++- scripts/lib/wic/ksparser.py| 1 + scripts/lib/wic/partition.py | 1 + scripts/lib/wic/utils/partitionedfs.py | 37 +- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index e5347ec4b7c900c68fc64351a5293e75de0672b3..1a5c7020ba0cdc5ef2e477a2b14360e09098a896 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py @@ -646,6 +646,17 @@ DESCRIPTION not specified, the size is in MB. You do not need this option if you use --source. + --reserved-size: This option specifies that there should be + at least that many bytes reserved for + the partition during layout. This is useful + when the target disk will be a subject + to full system image updates in the future. + Specifying --reserved-size ensures that + there is extra space in the partition allowing + for future growth of the file system stored + inside. Value format is the same as for + --size option. + --source: This option is a wic-specific option that names the source of the data that will populate the partition. The most common value for this option diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index edf5e5d2214f8e78b6c2a98d7f6cd45fcc0065c4..02e293b9d744b760fcdf17610505dafef3e164ad 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -301,7 +301,8 @@ class DirectImageCreator(BaseImageCreator): no_table=part.no_table, part_type=part.part_type, uuid=part.uuid, - system_id=part.system_id) + system_id=part.system_id, + reserved_size=part.reserved_size) if fstab_path: shutil.move(fstab_path + ".orig", fstab_path) diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 0894e2b199a299fbbed272f2e1c95e9d692e3ab1..4118bffdf4337f2d2d393d7e096632cd7aa37402 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -137,6 +137,7 @@ class KickStart(): part.add_argument('--part-type') part.add_argument('--rootfs-dir') part.add_argument('--size', type=sizetype, default=0) +part.add_argument('--reserved-size', type=sizetype, default=0) part.add_argument('--source') part.add_argument('--sourceparams') part.add_argument('--system-id', type=systemidtype) diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 90f65a1e3976a5460cd1b265b238168cce22781f..162a3a289de891ccf81437876c1f7a6f3c797b3b 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py @@ -54,6 +54,7 @@ class Partition(): self.part_type = args.part_type self.rootfs_dir = args.rootfs_dir self.size = args.size +self.reserved_size = args.reserved_size self.source = args.source self.sourceparams = args.sourceparams self.system_id = args.system_id diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index cb03009fc7e3c97305079629ded7d2ff01eba4c4..5d3b1588231459dedf0142f807114736f0bb28ea 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -91,7 +91,7 @@ class Image(): def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None, label=None, fsopts=None, boot=False, align=None, no_table=False, - part_type=None, uuid=None, system_id=None): + part_type=None, uuid=None, system_id=None, reserved_size=0): """ Add the next partition. Prtitions have to be added in the first-to-last order. """ @@ -99,9 +99,11 @@ class Image(): # Converting kB to sectors for parted size = siz
[OE-core] [PATCH 2/2] systemd: use nss-resolve by default if resolved is enabled
Add nss-resolve to NSS hosts resolution service if systemd-resolved is enabled via PACKAGECONFIG. This enabled routing all DNS requests through systemd-networkd by default. Apply the following patches: - 0023-nss-install-nss-modules-into-lib - makes sure that libnss_resolve and other nss modules end up in ${rootlibdir} - 0024-resolved-when-processing-auxiliary-DNSSEC-transactio - backport v231 patch that fixes SERVFAIL handling, required for name resolution under qemu or in containers. Signed-off-by: Maciej Borzecki --- .../0023-nss-install-nss-modules-into-lib.patch| 64 ++ ...en-processing-auxiliary-DNSSEC-transactio.patch | 49 + meta/recipes-core/systemd/systemd_230.bb | 18 +- 3 files changed, 129 insertions(+), 2 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd/0023-nss-install-nss-modules-into-lib.patch create mode 100644 meta/recipes-core/systemd/systemd/0024-resolved-when-processing-auxiliary-DNSSEC-transactio.patch diff --git a/meta/recipes-core/systemd/systemd/0023-nss-install-nss-modules-into-lib.patch b/meta/recipes-core/systemd/systemd/0023-nss-install-nss-modules-into-lib.patch new file mode 100644 index ..747d848a3e3917a69872cf68d77e26d66506a18e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0023-nss-install-nss-modules-into-lib.patch @@ -0,0 +1,64 @@ +From eb76a59139c5ca6355cf1ef9594dab8b73b9b1f5 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: +References: +From: Maciek Borzecki +Date: Tue, 20 Sep 2016 21:24:45 +0200 +Subject: [PATCH 1/2] nss: install nss modules into /lib + +NSS modules (libnss_*.so.*) need to be installed into +${rootlibdir} (typically /lib) in order to be used. Previously, the +modules were installed into ${libdir} (usually ${prefix}/lib), where in +case of a split /usr, this would typically resolve to /usr/lib. + +Signed-off-by: Maciek Borzecki +Signed-off-by: Maciej Borzecki + +--- +Upstream-Status: Pending + + Makefile.am | 7 --- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index dbd3386..0e2dca5 100644 +--- a/Makefile.am b/Makefile.am +@@ -151,6 +151,7 @@ nodist_zshcompletion_DATA = $(nodist_zshcompletion_data) + endif + udevlibexec_PROGRAMS = + gperf_gperf_sources = ++rootlib_LTLIBRARIES = + + in_files = $(filter %.in,$(EXTRA_DIST)) + in_in_files = $(filter %.in.in, $(in_files)) +@@ -4931,7 +4932,7 @@ libnss_myhostname_la_LDFLAGS = \ + libnss_myhostname_la_LIBADD = \ + libsystemd-internal.la + +-lib_LTLIBRARIES += \ ++rootlib_LTLIBRARIES += \ + libnss_myhostname.la + endif + +@@ -5030,7 +5031,7 @@ libnss_mymachines_la_LDFLAGS = \ + libnss_mymachines_la_LIBADD = \ + libsystemd-internal.la + +-lib_LTLIBRARIES += \ ++rootlib_LTLIBRARIES += \ + libnss_mymachines.la + + endif +@@ -5321,7 +5322,7 @@ libnss_resolve_la_LIBADD = \ + libsystemd-internal.la \ + -ldl + +-lib_LTLIBRARIES += \ ++rootlib_LTLIBRARIES += \ + libnss_resolve.la + + systemd_resolve_SOURCES = \ +-- +2.5.0 + diff --git a/meta/recipes-core/systemd/systemd/0024-resolved-when-processing-auxiliary-DNSSEC-transactio.patch b/meta/recipes-core/systemd/systemd/0024-resolved-when-processing-auxiliary-DNSSEC-transactio.patch new file mode 100644 index ..6924ce712ca4e8bb3d9e59178515b8bef4e381a5 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0024-resolved-when-processing-auxiliary-DNSSEC-transactio.patch @@ -0,0 +1,49 @@ +From 44f04e32cb66676446b70895278348910f3666c3 Mon Sep 17 00:00:00 2001 +Message-Id: <44f04e32cb66676446b70895278348910f3666c3.1474443269.git.maciej.borze...@rndity.com> +In-Reply-To: +References: +From: Lennart Poettering +Date: Thu, 23 Jun 2016 23:46:56 +0200 +Subject: [PATCH 2/2] resolved: when processing auxiliary DNSSEC transactions, + accept those with SERVFAIL + +Some upstream DNS servers return SERVFAIL if we ask them for DNSSEC RRs, which +some forwarding DNS servers pass on to us as SERVFAIL (other though as +NOERROR...). This is should not be considered a problem, as long as the domain +in question didn't have DNSSEC enabled. Hence: when making use of auxiliary +transactions accept those that return SERVFAIL. + +Signed-off-by: Maciej Borzecki +--- +Upstream-Status: Backport from 231 + + src/resolve/resolved-dns-transaction.c | 9 + + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c +index a4a6762..aa49e65 100644 +--- a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c +@@ -626,14 +626,15 @@ static int dns_transaction_dnssec_ready(DnsTransaction *t) { + return 0; + + case DNS_TRANSACTION_RCODE_FAILURE: +-if (dt->answer_rcode != DNS_RCODE_NXDOMAIN) { ++
[OE-core] [PATCH 0/2] systemd: use nss-resolve when systemd-resoveld is enable
A patch series that enables use of nss-resolve (systemd's NSS service module) if systemd-networkd is enabled via PACKAGECONFIG. The first patch is a trivial formatting change. The second patch does the following: - replace dns with resolve in /etc/nsswitch.conf if systemd-resolved is enabled - applies a patch fixing the location of libnss_* services provided by systemd (the patch has been submitted upstream for inclusion in v232) - applies a patch that fixes SERVFAIL handling, this restores the ability to properly resolve names under qemu (backport from v231) Maciej Borzecki (2): systemd: fix indentation systemd: use nss-resolve by default if resolved is enabled .../0023-nss-install-nss-modules-into-lib.patch| 64 ++ ...en-processing-auxiliary-DNSSEC-transactio.patch | 49 + meta/recipes-core/systemd/systemd_230.bb | 22 ++-- 3 files changed, 131 insertions(+), 4 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd/0023-nss-install-nss-modules-into-lib.patch create mode 100644 meta/recipes-core/systemd/systemd/0024-resolved-when-processing-auxiliary-DNSSEC-transactio.patch -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/2] systemd: fix indentation
Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_230.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_230.bb b/meta/recipes-core/systemd/systemd_230.bb index 6e6ef76cfa2322fc0b833e4f38a4cdf7483a8782..1276316a0cddeefecb34cf9422c94c3ed12f5381 100644 --- a/meta/recipes-core/systemd/systemd_230.bb +++ b/meta/recipes-core/systemd/systemd_230.bb @@ -211,8 +211,8 @@ do_install() { chown root:systemd-journal ${D}/${localstatedir}/log/journal -# Delete journal README, as log can be symlinked inside volatile. -rm -f ${D}/${localstatedir}/log/README + # Delete journal README, as log can be symlinked inside volatile. + rm -f ${D}/${localstatedir}/log/README install -d ${D}${systemd_unitdir}/system/graphical.target.wants install -d ${D}${systemd_unitdir}/system/multi-user.target.wants -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] ca-certificates: remove -- separator
Options and directory separator -- slipped past the patch removing Debianims, thus resulting in failures on hosts running Fedora. Signed-off-by: Maciej Borzecki --- .../0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/meta/recipes-support/ca-certificates/ca-certificates/0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch b/meta/recipes-support/ca-certificates/ca-certificates/0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch index 4b4b287d4e6ce92fc38e4e19fbf87b152236c0e2..4a8ae5f4b5ef235d9bdfa7b947bbe2f0e415b50e 100644 --- a/meta/recipes-support/ca-certificates/ca-certificates/0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch +++ b/meta/recipes-support/ca-certificates/ca-certificates/0001-update-ca-certificates-don-t-use-Debianisms-in-run-p.patch @@ -6,9 +6,13 @@ This solves errors such as | Running hooks in [...]/rootfs/etc/ca-certificates/update.d... | [...]/usr/sbin/update-ca-certificates: line 194: Not: command not found +| [...]/usr/sbin/update-ca-certificates: line 230: Not a directory: --: command not found +| E: Not a directory: -- exited with code 127. + Upstream-Status: Inappropriate Signed-off-by: Ross Burton +Signed-off-by: Maciej Borzecki --- sbin/update-ca-certificates | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) @@ -24,7 +28,7 @@ Index: git/sbin/update-ca-certificates - VERBOSE_ARG= - [ "$verbose" = 0 ] || VERBOSE_ARG="--verbose" - eval run-parts "$VERBOSE_ARG" --test -- "$HOOKSDIR" | while read hook -+ eval run-parts --test -- "$HOOKSDIR" | while read hook ++ eval run-parts --test "$HOOKSDIR" | while read hook do ( cat "$ADDED" cat "$REMOVED" ) | "$hook" || echo "E: $hook exited with code $?." -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] wic: mountpoint is an optional argument
According to wic documentation partition mount point is an optional argument. Skipping mount point also makes sense in certain configurations when one needs to specify a partition that is not mounted by the running system, such as a recovery or a mirror partition (in dual rootfs setups). Signed-off-by: Maciej Borzecki --- scripts/lib/wic/ksparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 6887a7d02441165d7696318ddd132c739c8121b3..0894e2b199a299fbbed272f2e1c95e9d692e3ab1 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py @@ -124,7 +124,7 @@ class KickStart(): subparsers = parser.add_subparsers() part = subparsers.add_parser('part') -part.add_argument('mountpoint') +part.add_argument('mountpoint', nargs='?') part.add_argument('--active', action='store_true') part.add_argument('--align', type=int) part.add_argument("--extra-space", type=sizetype, default=10*1024) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 05/10] swupdbundle: new class to generate virtual images for swupd-image
On 02/24 14:52, Joshua Lock wrote: > Our initial strategy to generate bundles for consumption by swupd > is to generate images which contain the base image (os-core) plus > the additional contents of the bundle, then prune out the core > contents. By generating images in this manner we hope to accomodate > packages which modify the rootfs outside of installing files, i.e. > with postinsts. > > To that end this class, to be used via BBCLASSEXTEND, will generate > virtual image recipes that add extra packages to the extended > image. > > Only extensions matching entries in a SWUPD_BUNDLES variable are > valid and the bundle contents should be listed in a varFlag > matching the bundle's name on the BUNDLE_CONTENTS variable. > > An example of usage in an image recipe follows: > > SWUPD_BUNDLES = "foo bar" > BUNDLE_CONTENTS[foo] = "foo foo-bar foobaz" > BUNDLE_CONTENTS[bar] = "bar baz quux" > > BBCLASSEXTEND = "swupdbundle:foo" > > Signed-off-by: Joshua Lock > --- > meta/classes/swupdbundle.bbclass | 59 > > 1 file changed, 59 insertions(+) > create mode 100644 meta/classes/swupdbundle.bbclass > > diff --git a/meta/classes/swupdbundle.bbclass > b/meta/classes/swupdbundle.bbclass > new file mode 100644 > index 000..897666d > --- /dev/null > +++ b/meta/classes/swupdbundle.bbclass > @@ -0,0 +1,59 @@ > +# Our initial strategy to generate bundles for consumption by swupd is to > +# generate images which contain the base image (os-core) plus the additional > +# contents of the bundle, then prune out the core contents. By generating > +# images in this manner we hope to accomodate packages which modify the > rootfs > +# outside of installing files, i.e.with postinsts. > +# > +# To that end this class, to be used via BBCLASSEXTEND, will generate virtual > +# image recipes that add extra packages to the extended image. > +# > +# Only extensions matching entries in a SWUPD_BUNDLES variable are valid and > +# the bundle contents should be listed in a varFlag matching the bundle's > name > +# on the BUNDLE_CONTENTS variable. i.e in foo-image.bb: > +# > +# SWUPD_BUNDLES = "foo bar" > +# BUNDLE_CONTENTS[foo] = "foo foo-bar foobaz" > +# BUNDLE_CONTENTS[bar] = "bar baz quux" > +# BBCLASSEXTEND = "swupdbundle:foo" > + > +python swupdbundle_virtclass_handler () { > +pn = e.data.getVar("PN", True) > +cls = e.data.getVar("BBEXTENDCURR", True) > +bundle = e.data.getVar("BBEXTENDVARIANT", True) > + > +if cls != 'swupdbundle': > +return > + > +if not bundle: > +bb.fatal('swupdbundle must be used with a parameter i.e. > BBCLASSEXTEND="swupdbundle:foo"') > + > +# Rename the virtual recipe to create the desired image bundle variant. > +e.data.setVar("PN_BASE", pn) > +pn = pn + '-' + bundle > +e.data.setVar("PN", pn) > +e.data.setVar("BUNDLE_NAME", bundle) > + > +bundles = (e.data.getVar('SWUPD_BUNDLES', True) or "").split() > +if not bundles: > +bb.fatal('SWUPD_BUNDLES is not defined, this variable should list > bundles for the image.') > + > +curr_install = (e.data.getVar('IMAGE_INSTALL', True) or "").split() > + > +def get_bundle_contents(bndl): > +contents = e.data.getVarFlag('BUNDLE_CONTENTS', bndl, True) > +if contents: > +return contents.split() > +else: > +bb.fatal('BUNDLE_CONTENTS[%s] is not set, this should list the > packages to be included in the bundle.' % bndl) > + > +if bundle == 'mega': > +for bndl in bundles: > +curr_install += get_bundle_contents(bndl) Bundle named 'mega' seems to be very specific (a bundle of bundles) but is not documented as a reserved name. > +else: > +curr_install += get_bundle_contents(bundle) > + > +e.data.setVar('IMAGE_INSTALL', ' '.join(curr_install)) > +} > + > +addhandler swupdbundle_virtclass_handler > +swupdbundle_virtclass_handler[eventmask] = "bb.event.RecipePreFinalise" > -- > 2.5.0 > > -- > ___ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.openembedded.org/mailman/listinfo/openembedded-core -- Maciej Borzęcki Senior Software Developer at Open-RnD Sp. z o.o., Poland -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH 02/10] swupd-server: initial recipe 2.53
On 02/24 14:52, Joshua Lock wrote: > Include some patches to remove hard-coded state directory and backport some > fixes. > > Signed-off-by: Joshua Lock > --- > ...S-to-take-the-state-data-dir-as-an-argume.patch | 782 > + > ...argv-helper-for-safer-calls-to-system-uti.patch | 133 > ...re-option-to-re-enable-config-files-in-ma.patch | 66 ++ > ...ression-that-introduced-a-directory-named.patch | 29 + > meta/recipes-devtools/swupd/swupd-server_2.53.bb | 33 + > 5 files changed, 1043 insertions(+) > create mode 100644 > meta/recipes-devtools/swupd/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch > create mode 100644 > meta/recipes-devtools/swupd/swupd-server/0001-Add-system_argv-helper-for-safer-calls-to-system-uti.patch > create mode 100644 > meta/recipes-devtools/swupd/swupd-server/0002-Add-configure-option-to-re-enable-config-files-in-ma.patch > create mode 100644 > meta/recipes-devtools/swupd/swupd-server/0002-Fix-regression-that-introduced-a-directory-named.patch > create mode 100644 meta/recipes-devtools/swupd/swupd-server_2.53.bb > > diff --git > a/meta/recipes-devtools/swupd/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch > > b/meta/recipes-devtools/swupd/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch > new file mode 100644 > index 000..b771e0a > --- /dev/null > +++ > b/meta/recipes-devtools/swupd/swupd-server/0001-Add-option-S-to-take-the-state-data-dir-as-an-argume.patch > @@ -0,0 +1,782 @@ > +From 83fbb8a78594cf9047e37ed0aa1e931b9d691f2a Mon Sep 17 00:00:00 2001 > +From: Joshua Lock > +Date: Thu, 28 Jan 2016 10:24:56 + > +Subject: [PATCH 1/2] Add option -S to take the state data dir as an argument > + > +The optional -S option expects a full path to a directory > +swupd-server should use instead of the default /var/lib/update. > + > +Signed-off-by: Joshua Lock > + > +Upstream-Status: Accepted (v3.0+) > + > +--- > + include/swupd.h | 11 ++--- > + src/analyze_fs.c | 4 ++-- > + src/chroot.c | 13 ++- > + src/globals.c| 53 + > + src/main.c | 50 ++- > + src/make_fullfiles.c | 63 + > + src/make_packs.c | 66 > > + src/pack.c | 65 > +++ > + src/rename.c | 6 ++--- > + src/versions.c | 6 ++--- > + 10 files changed, 264 insertions(+), 73 deletions(-) > + > +diff --git a/include/swupd.h b/include/swupd.h > +index 775c28e..58307d9 100644 > +--- a/include/swupd.h > b/include/swupd.h > +@@ -16,9 +16,6 @@ > + #define SWUPD_DEFAULT_FORMAT3 > + > + #define SWUPD_SERVER_STATE_DIR "/var/lib/update" > +-#define PACKSTAGE_DIR SWUPD_SERVER_STATE_DIR "/packstage" > +-#define IMAGE_DIR SWUPD_SERVER_STATE_DIR "/image" > +-#define STAGING_DIR SWUPD_SERVER_STATE_DIR "/www" > + > + #if SWUPD_WITH_SELINUX > + #define TAR_PERM_ATTR_ARGS "--preserve-permissions --xattrs > --xattrs-include='*' --selinux" > +@@ -123,9 +120,17 @@ extern int newversion; > + extern int minversion; > + extern char *format_string; > + > ++extern char *state_dir; > ++extern char *packstage_dir; > ++extern char *image_dir; > ++extern char *staging_dir; > ++ > + extern bool init_globals(void); > + extern void free_globals(void); > + extern bool set_format_string(char *); > ++extern bool set_state_dir(char *); > ++extern bool init_state_globals(void); > ++extern void free_state_globals(void); > + > + extern int file_sort_hash(gconstpointer a, gconstpointer b); > + extern int file_sort_filename(gconstpointer a, gconstpointer b); > +diff --git a/src/analyze_fs.c b/src/analyze_fs.c > +index 2326237..fdc359a 100644 > +--- a/src/analyze_fs.c > b/src/analyze_fs.c > +@@ -389,7 +389,7 @@ struct manifest *full_manifest_from_directory(int > version) > + > + manifest = alloc_manifest(version, "full"); > + > +-string_or_die(&dir, "%s/%i/full", IMAGE_DIR, version); > ++string_or_die(&dir, "%s/%i/full", image_dir, version); > + > + threadpool = g_thread_pool_new(get_hash, dir, 12, FALSE, NULL); > + > +@@ -413,7 +413,7 @@ struct manifest *sub_manifest_from_directory(char > *component, int version) > + > + manifest = alloc_manifest(version, component); > + > +-string_or_die(&dir, "%s/%i/%s", IMAGE_DIR, version, component); > ++string_or_die(&dir, "%s/%i/%s", image_dir, version, component); > + > + iterate_directory(manifest, dir, "", false); > + > +diff --git a/src/chroot.c b/src/chroot.c > +index 1d7df95..c5bb942 100644 > +--- a/src/chroot.c > b/src/chroot.c > +@@ -40,14 +40,15 @@ void chroot_create_full(int newversion) > + char * command; > + char *full_dir; > + > +-string_or_die(&full_dir, "%s/%i/full/", IMAGE_DIR, newversion); > ++string_or_die(&full_dir,
Re: [OE-core] [PATCH 04/10] swupd-client: Add recipe
On 02/24 14:52, Joshua Lock wrote: > From: Mariano Lopez > > This commit adds the Clear Linux client updater. > This is experimental and bleeding edge, including the comments on the recipe. > > Signed-off-by: Mariano Lopez > Signed-off-by: Joshua Lock > --- > .../0001-Tolerate-quotes-in-os-release-files.patch | 59 > ++ > ...hange-systemctl-path-to-OE-systemctl-path.patch | 31 > .../swupd-client/Fix-build-failure-on-Yocto.patch | 36 + > .../Right-usage-of-AC_ARG_ENABLE-on-bzip2.patch| 38 ++ > meta/recipes-devtools/swupd/swupd-client_2.87.bb | 49 ++ > 5 files changed, 213 insertions(+) > create mode 100644 > meta/recipes-devtools/swupd/swupd-client/0001-Tolerate-quotes-in-os-release-files.patch > create mode 100644 > meta/recipes-devtools/swupd/swupd-client/Change-systemctl-path-to-OE-systemctl-path.patch > create mode 100644 > meta/recipes-devtools/swupd/swupd-client/Fix-build-failure-on-Yocto.patch > create mode 100644 > meta/recipes-devtools/swupd/swupd-client/Right-usage-of-AC_ARG_ENABLE-on-bzip2.patch > create mode 100644 meta/recipes-devtools/swupd/swupd-client_2.87.bb > > diff --git > a/meta/recipes-devtools/swupd/swupd-client/0001-Tolerate-quotes-in-os-release-files.patch > > b/meta/recipes-devtools/swupd/swupd-client/0001-Tolerate-quotes-in-os-release-files.patch > new file mode 100644 > index 000..49c71ae > --- /dev/null > +++ > b/meta/recipes-devtools/swupd/swupd-client/0001-Tolerate-quotes-in-os-release-files.patch > @@ -0,0 +1,59 @@ > +From 586e7b927461f6604ee3a3159cd7a6d4ac22ef30 Mon Sep 17 00:00:00 2001 > +From: Dmitry Rozhkov > +Date: Thu, 11 Feb 2016 13:29:57 +0200 > +Subject: [PATCH 1/2] Tolerate quotes in os-release files > + > +Some systems like Yocto or OpenSUSE prefer to wrap values in > +/etc/os-release file with quotes always and that still conforms > +to the format defined in systemd. > + > +This patch removes quotes from the values before trying to > +transform them into integer version id. > + > +Signed-off-by: Dmitry Rozhkov > + > +Upstream-Status: Backport (v3.0.0+) > + > +--- > + src/version.c | 18 +- > + 1 file changed, 17 insertions(+), 1 deletion(-) > + > +diff --git a/src/version.c b/src/version.c > +index 0e09cd9..83d6ad4 100644 > +--- a/src/version.c > b/src/version.c > +@@ -88,6 +88,7 @@ int read_version_from_subvol_file(char *path_prefix) > + FILE *file; > + int v = -1; > + char *buildstamp; > ++char *src, *dest; > + > + string_or_die(&buildstamp, "%s/usr/lib/os-release", path_prefix); > + file = fopen(buildstamp, "rm"); > +@@ -106,7 +107,22 @@ int read_version_from_subvol_file(char *path_prefix) > + break; > + } > + > +-if (strncmp(line,"VERSION_ID=", 11) == 0) { > ++if (strncmp(line, "VERSION_ID=", 11) == 0) { > ++src = &line[11]; > ++ > ++/* Drop quotes and newline in value */ > ++dest = src; > ++while (*src) { > ++if (*src == '\'' || *src == '"' || *src == > '\n') { > ++++src; > ++} else { > ++*dest = *src; > ++++dest; > ++++src; > ++} > ++} > ++*dest = 0; > ++ > + v = strtoull(&line[11], NULL, 10); > + break; > + } > +-- > +2.5.0 > + > diff --git > a/meta/recipes-devtools/swupd/swupd-client/Change-systemctl-path-to-OE-systemctl-path.patch > > b/meta/recipes-devtools/swupd/swupd-client/Change-systemctl-path-to-OE-systemctl-path.patch > new file mode 100644 > index 000..5ca6373 > --- /dev/null > +++ > b/meta/recipes-devtools/swupd/swupd-client/Change-systemctl-path-to-OE-systemctl-path.patch > @@ -0,0 +1,31 @@ > +From 259d86e64146c3156eccfcce0351a9cdc4714766 Mon Sep 17 00:00:00 2001 > +From: Jaska Uimonen > +Date: Thu, 14 Jan 2016 10:17:43 +0200 > +Subject: [PATCH] change systemctl path to OE systemctl path > + > +Upstream-Status: Inappropriate > + > +--- > + src/scripts.c | 4 ++-- > + 1 file changed, 2 insertions(+), 2 deletions(-) > + > +diff --git a/src/scripts.c b/src/scripts.c > +index e426272..9bec0f5 100644 > +--- a/src/scripts.c > b/src/scripts.c > +@@ -84,10 +84,10 @@ static void update_triggers(void) > + int ret; > + LOG_INFO(NULL, "calling systemd trigger", class_scripts, ""); > + > +-ret = system("/usr/bin/systemctl daemon-reload"); > ++ret = system("/bin/systemctl daemon-reload"); > + if (ret != 0) > + LOG_ERROR(NULL, "systemd daemon reload failed", class_scripts, > "%d", ret); > +-ret = system("/usr/bin/systemctl restart update-triggers.target"); > ++ret = system("/bin/systemctl restart update-trigger
Re: [OE-core] [PATCH 00/10] Integrate swupd software updater
> Dnia 24 luty 2016 o 17:35 Philip Balister napisał(a): > > > On 02/24/2016 11:06 AM, Trevor Woerner wrote: > > Ideally the work done here and the work done on meta-swupdate[1] would > > be somehow merged so people creating images/distros would only have to > > learn and integrate one software update solution, instead of having to > > evaluate and choose between the two (or more?). > > > > > > [1] https://github.com/sbabic/meta-swupdate > > Amen. I had the same thoughts reading the patch set intro. > > Maybe the swupd should go in a seperate layer so we can see which > project works best for oe users before moving something directly into > oe-core? > Frankly, swupdate is more embedded oriented. If I was to choose which one fits better into OE, I would say that swupdate does. However, in the end, both projects have their uses. `swupd` is a new thing and I'm not aware of it being used in any other project than ClearLinux. From what I've seen[1] there are some nice concepts that might prove useful in embedded (maybe even automotive applications?), but I have not tried it personally. `swupdate` on the other hand is very much embedded oriented. It's aware of u-boot, ubifs volumes, MTD, and is capable of updating firmware. I've used it, even contributed some code, and so far I've had a rather positive experience using it. There are some quirks in meta-swupdate that might need fixing, for ex. the actual process of building of update images is a bit convoluted, lack of systemd awareness, and certain assumptions about the update method that I don't agree with. I have some patches queued up, but they're more like shameful hacks than something worth upstreaming at this point. [1]. https://lists.clearlinux.org/pipermail/dev/2016-January/000159.html -- Maciej Borzęcki Senior Software Engineer at Open-RnD Sp. z o.o. www.open-rnd.pl, Facebook, Twitter -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] dbus-glib: 0.104 -> 0.106
Signed-off-by: Maciej Borzecki --- meta/recipes-core/dbus/dbus-glib_0.104.bb | 4 meta/recipes-core/dbus/dbus-glib_0.106.bb | 4 2 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 meta/recipes-core/dbus/dbus-glib_0.104.bb create mode 100644 meta/recipes-core/dbus/dbus-glib_0.106.bb diff --git a/meta/recipes-core/dbus/dbus-glib_0.104.bb b/meta/recipes-core/dbus/dbus-glib_0.104.bb deleted file mode 100644 index c1263c0aff5377a2c130e28570933bdb765dfa5c.. --- a/meta/recipes-core/dbus/dbus-glib_0.104.bb +++ /dev/null @@ -1,4 +0,0 @@ -require dbus-glib.inc - -SRC_URI[md5sum] = "5497d2070709cf796f1878c75a72a039" -SRC_URI[sha256sum] = "bfc1f1a82bfc3ec3ecafe04d0e87bab7e999f50dce4f4a34d0b89caf6bd821f6" diff --git a/meta/recipes-core/dbus/dbus-glib_0.106.bb b/meta/recipes-core/dbus/dbus-glib_0.106.bb new file mode 100644 index ..0ae848e4009882e7b9976fa39fbb3fff88ad52b0 --- /dev/null +++ b/meta/recipes-core/dbus/dbus-glib_0.106.bb @@ -0,0 +1,4 @@ +require dbus-glib.inc + +SRC_URI[md5sum] = "2eea0b7f52b49f600a07abfd8535d4e4" +SRC_URI[sha256sum] = "b38952706dcf68bad9c302999ef0f420b8cf1a2428227123f0ac4764b689c046" -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH] os-release: remove double-quotes around VERSION_ID value
> Dnia 12 luty 2016 o 22:49 Joshua G Lock > napisał(a): > > > On Fri, 2016-02-12 at 18:14 +0100, Maciej Borzecki wrote: > > > Dnia 12 luty 2016 o 13:15 Dmitry Rozhkov > > > napisał(a): > > > > > > This becomes crucial when ClearLinux's software > > > update mechanism is integrated into builds, because > > > its client side ignores VERSION_ID's value if it > > > doesn't conform the definition. > > > > Is this integration work already published somewhere? I'm interested > > in trying out swupdate with Yocto, but the lack of publicly available > > repo is kind of holding this back (yes, I'm ware of SRPMs). > > I'm working on integrating swupd into OE-Core, it's a work in progress > and so far nothing has been published (the work is not yet in a > functional state). > > The recipes we are currently using for swupd-server and swupd-client > use the src.rpm's from clearlinux.org > > > Do you mind sharing the some details if there is a larger plan for > > getting Clear closer to Yocto/OE? > > We have a couple of tickets in the Yocto Project bugzilla[1][2] which > give an overview of the approach I'm taking for this initial > implementation. > > The approach is fairly conservative in an attempt to get something > usable integrated that lets us work with the swupd developers to iron > out issues with utilising swupd from within OE. > Thanks for taking the time to respond. I'll keep an eye on both BZ issues. -- Maciej Borzęcki Senior Software Engineer at Open-RnD Sp. z o.o. www.open-rnd.pl, Facebook, Twitter -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
Re: [OE-core] [PATCH] os-release: remove double-quotes around VERSION_ID value
> Dnia 12 luty 2016 o 13:15 Dmitry Rozhkov > napisał(a): > > > man 5 os-release states that VERSION_ID is > > " > a lower-case string (mostly numeric, no spaces or other > characters outside of 0-9, a-z, ".", "_" and "-") > identifying the operating system version > " > > This becomes crucial when ClearLinux's software > update mechanism is integrated into builds, because > its client side ignores VERSION_ID's value if it > doesn't conform the definition. Is this integration work already published somewhere? I'm interested in trying out swupdate with Yocto, but the lack of publicly available repo is kind of holding this back (yes, I'm ware of SRPMs). When I was asking on the mailing list about Yocto and ClearLinux back in January[1][2] Arjan responded that there was a mismatch between the development models used by Clear and Yocto and that there was a number of reasons for not using Yocto tooling in Clear. Now, I'm still interested in getting swupdate to work outside of Clear, so I took some time to go through the source code to figure out the update mechanism[3]. IMO making it work with Yocto should not be a significant effort, even in embedded applications. Do you mind sharing the some details if there is a larger plan for getting Clear closer to Yocto/OE? [1]. https://lists.clearlinux.org/pipermail/dev/2016-January/000150.html [2]. https://lists.clearlinux.org/pipermail/dev/2016-January/000151.html [3]. https://lists.clearlinux.org/pipermail/dev/2016-January/000159.html -- Maciej Borzęcki Senior Software Engineer at Open-RnD Sp. z o.o. www.open-rnd.pl, Facebook, Twitter -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 0/7] systemd cleanups & trimming
This is a second iteration of patches aiming at providing more knobs for configuration of systemd. The default configuration of systemd produces a package of significant size. By carefully setting the knobs it is possible to enable/disable functionality that is required for particular use cases. The patches attempt to preserve the functionality of currently built packages. Parties interested in trimming systemd by a couple of MBs need to override PACKAGECONFIG manually. By disabling most of flags and skipping systemd-extra-utils package, depending on the architecture, systemd package should be roughly ~4MB in size. The first patch uses bash-completion class for wrapping up bash files. The second patch is just a small cosmetic change that allows for cleaner diffs when adding/removing packages. The third patch is required for the fourth one. The patch provides handling of a situation when USERADD/GROUPADD/GROUPMEMS are made up of spaces only. This may happen in a scenarion when the variables are appended/prepended with spaces, but the content of the append is conditional. In this case, in the fourth patch, certain users are only added if specific PACKAGECONFIG flag was set. The fourth patch adds a number of PACKAGECONFIG flags to systemd. Patch 5 splits all/most of nonessential binaries into a separate systemd-extra-utils package. The package is listed in RRECOMMENDS so that it gets included by default in images. Binaries that get created as a result of PACKAGECONFIG flags will be included in the main 'systemd' package to avoid the effect when use has set a flag but the desired binary is not in the target system. Patch 6 tightens the user accounts for systemd services: timesyncd and journal-gateway. The users will be created without separate /home directory, home set to / and shell set to /bin/nologin. The last patch renames zsh completion package systemd-zsh to systemd-zsh-completion to preserve consistency with its bash counterpart. If someone wishes to trim down systemd even further, I'd suggest looking first at generators (~350kB) as these are not essential if one provides proper unit files in advance. Another potential candidate is systemd-fsck (~300kB), as it should be possible to skip it completely. Also systemd-shutdown is large (~150kB), for reasons unclear to me at the moment. After going through system source code there is a room for further improvement by splitting the internal static libraries (libshared, libbase, libsystemd-internal) into shared ones, but I'm guessing this should be done in agreement with upstream. Maciej Borzecki (7): systemd: move bash completion into separate package systemd: realign packages list classes/useradd: handle whitespace only USERADD/GROUPADD/GROUPMEMS systemd: extend PACKAGECONFIG flags systemd: move some tools into systemd-extra-utils package systemd: tighten timesyncd and journal-gateway user accounts systemd: rename systemd-zsh to systemd-zsh-completion meta/classes/useradd.bbclass | 6 +- meta/recipes-core/systemd/systemd_228.bb | 131 --- 2 files changed, 121 insertions(+), 16 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 5/7] systemd: move some tools into systemd-extra-utils package
This patch attempts to split some of the extra functionality delivered by systemd utilities from the main package into a separate package. This allows for trimming the size of a default systemd installation down to ~7MB with all configuration features disabled. The new systemd-extra-utils package is added to RRECOMMENDS so that by default it will get installed into the target image. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 47 1 file changed, 47 insertions(+) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 97fc9f4c1333e246f79bc53f61439f5e4cf78352..4788d8680329d4a43cf8c6749f89422419f20901 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -297,6 +297,7 @@ PACKAGES =+ "\ ${PN}-pam \ ${PN}-zsh \ ${PN}-xorg-xinitrc \ +${PN}-extra-utils \ " SYSTEMD_PACKAGES = "${PN}-binfmt" @@ -342,6 +343,51 @@ RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" +FILES_${PN}-extra-utils = "\ +${base_bindir}/systemd-escape \ +${base_bindir}/systemd-inhibit \ +${bindir}/systemd-detect-virt \ +${bindir}/systemd-path \ +${bindir}/systemd-run \ +${bindir}/systemd-cat \ +${bindir}/systemd-delta \ +${bindir}/systemd-cgls \ +${bindir}/systemd-cgtop \ +${bindir}/systemd-stdio-bridge \ +${base_bindir}/systemd-ask-password \ +${base_bindir}/systemd-tty-ask-password-agent \ + ${systemd_unitdir}/system/systemd-ask-password-console.path \ + ${systemd_unitdir}/system/systemd-ask-password-console.service \ + ${systemd_unitdir}/system/systemd-ask-password-wall.path \ + ${systemd_unitdir}/system/systemd-ask-password-wall.service \ + ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \ + ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \ + ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \ +${rootlibexecdir}/systemd/systemd-resolve-host \ +${rootlibexecdir}/systemd/systemd-ac-power \ +${rootlibexecdir}/systemd/systemd-activate \ +${bindir}/systemd-nspawn \ +${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ +${systemd_unitdir}/system/systemd-nspawn@.service \ +${rootlibexecdir}/systemd/systemd-bus-proxyd \ +${systemd_unitdir}/system/systemd-bus-proxyd.service \ +${systemd_unitdir}/system/systemd-bus-proxyd.socket \ +${rootlibexecdir}/systemd/systemd-socket-proxyd \ +${rootlibexecdir}/systemd/systemd-reply-password \ +${rootlibexecdir}/systemd/systemd-sleep \ +${rootlibexecdir}/systemd/system-sleep \ +${systemd_unitdir}/system/systemd-hibernate.service \ +${systemd_unitdir}/system/systemd-hybrid-sleep.service \ +${systemd_unitdir}/system/systemd-suspend.service \ +${systemd_unitdir}/system/sleep.target \ +${rootlibexecdir}/systemd/systemd-initctl \ +${systemd_unitdir}/system/systemd-initctl.service \ +${systemd_unitdir}/system/systemd-initctl.socket \ + ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \ + ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ +${rootlibexecdir}/systemd/systemd-cgroups-agent \ +" + CONFFILES_${PN} = "${sysconfdir}/machine-id \ ${sysconfdir}/systemd/coredump.conf \ ${sysconfdir}/systemd/journald.conf \ @@ -396,6 +442,7 @@ RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})" RDEPENDS_${PN} += "volatile-binds update-rc.d" RRECOMMENDS_${PN} += "systemd-serialgetty systemd-vconsole-setup \ + systemd-extra-utils \ systemd-compat-units udev-hwdb \ util-linux-agetty util-linux-fsck e2fsprogs-e2fsck \ kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ -- 2.5.0 --
[OE-core] [PATCH v2 3/7] classes/useradd: handle whitespace only USERADD/GROUPADD/GROUPMEMS
Useradd attempts to add users/groups even when {USERADD,GROUPADD,GROUPMEMS}_PARAM is whitespace only. This scenario is possible when variables and modified using one of +=, =+ operator, yet the content being added is conditional (i.e. may depend on PACKAGECONFIG flags). Signed-off-by: Maciej Borzecki --- meta/classes/useradd.bbclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass index 4577e56f5a17940929c555b3f5d18d75e92f1476..c960656f02b3d11e5bb08dca259df3946f96aeaf 100644 --- a/meta/classes/useradd.bbclass +++ b/meta/classes/useradd.bbclass @@ -50,7 +50,7 @@ fi # Perform group additions first, since user additions may depend # on these groups existing -if test "x$GROUPADD_PARAM" != "x"; then +if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then echo "Running groupadd commands..." # Invoke multiple instances of groupadd for parameter lists # separated by ';' @@ -66,7 +66,7 @@ if test "x$GROUPADD_PARAM" != "x"; then done fi -if test "x$USERADD_PARAM" != "x"; then +if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then echo "Running useradd commands..." # Invoke multiple instances of useradd for parameter lists # separated by ';' @@ -82,7 +82,7 @@ if test "x$USERADD_PARAM" != "x"; then done fi -if test "x$GROUPMEMS_PARAM" != "x"; then +if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then echo "Running groupmems commands..." # Invoke multiple instances of groupmems for parameter lists # separated by ';' -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 2/7] systemd: realign packages list
Reformat list of built packages to a package per line format. Makes easier to cope with subsequent changes. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index cd793d7cba802dbba60a77df49e9d9695c8cf7b7..9d7851e0f285f6c24458e16e0c493c8481236bf6 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -237,8 +237,18 @@ python populate_packages_prepend (){ } PACKAGES_DYNAMIC += "^lib(udev|systemd).*" -PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \ - ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh ${PN}-xorg-xinitrc" +PACKAGES =+ "\ +${PN}-gui \ +${PN}-vconsole-setup \ +${PN}-initramfs \ +${PN}-analyze \ +${PN}-kernel-install \ +${PN}-rpm-macros \ +${PN}-binfmt \ +${PN}-pam \ +${PN}-zsh \ +${PN}-xorg-xinitrc \ +" SYSTEMD_PACKAGES = "${PN}-binfmt" SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 7/7] systemd: rename systemd-zsh to systemd-zsh-completion
Try to keep consistent naming with bash-completion package. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 72c7e0db122cf8fca370c76801a80fd6c188f613..fe2cfb529ffc6f44b7c6b13342d667df026d012f 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -295,7 +295,7 @@ PACKAGES =+ "\ ${PN}-rpm-macros \ ${PN}-binfmt \ ${PN}-pam \ -${PN}-zsh \ +${PN}-zsh-completion \ ${PN}-xorg-xinitrc \ ${PN}-extra-utils \ " @@ -332,7 +332,7 @@ FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ FILES_${PN}-xorg-xinitrc = "${sysconfdir}/X11/xinit/xinitrc.d/*" -FILES_${PN}-zsh = "${datadir}/zsh/site-functions" +FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions" FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ ${exec_prefix}/lib/binfmt.d \ -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 4/7] systemd: extend PACKAGECONFIG flags
We currently ship a rather full-blown setup of system. Very few configuration knobs are actually exposed through PACKAGECONFIG flags. This patch adds new PACKAGECONFIG flags for some finer tuning of systemd's functionality. The default setting attempts to preserve all of the features that were previously auto-enabled. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 64 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 9d7851e0f285f6c24458e16e0c493c8481236bf6..97fc9f4c1333e246f79bc53f61439f5e4cf78352 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -64,6 +64,28 @@ PACKAGECONFIG ??= "compat xz ldconfig \ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'efi', 'efi', '', d)} \ + sysusers \ + binfmt \ + randomseed \ + machined \ + backlight \ + quotacheck \ + bootchart \ + hostnamed \ + myhostname \ + hibernate \ + timedated \ + timesyncd \ + localed \ + kdbus \ + ima \ + smack \ + logind \ + firstboot \ + utmp \ + polkit \ " PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl" # Sign the journal for anti-tampering @@ -76,6 +98,30 @@ PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicroht PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils" PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved" PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd" +PACKAGECONFIG[machined] = "--enable-machined,--disable-machined" +PACKAGECONFIG[backlight] = "--enable-backlight,--disable-backlight" +PACKAGECONFIG[quotacheck] = "--enable-quotacheck,--disable-quotacheck" +PACKAGECONFIG[bootchart] = "--enable-bootchart,--disable-bootchart" +PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed" +PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname" +PACKAGECONFIG[rfkill] = "--enable-rfkill,--disable-rfkill" +PACKAGECONFIG[hibernate] = "--enable-hibernate,--disable-hibernate" +PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated" +PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd" +PACKAGECONFIG[localed] = "--enable-localed,--disable-localed" +PACKAGECONFIG[efi] = "--enable-efi,--disable-efi" +PACKAGECONFIG[kdbus] = "--enable-kdbus,--disable-kdbus" +PACKAGECONFIG[ima] = "--enable-ima,--disable-ima" +PACKAGECONFIG[smack] = "--enable-smack,--disable-smack" +# libseccomp is found in meta-security +PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" +PACKAGECONFIG[logind] = "--enable-logind,--disable-logind" +PACKAGECONFIG[sysusers] = "--enable-sysusers,--disable-sysusers" +PACKAGECONFIG[firstboot] = "--enable-firstboot,--disable-firstboot" +PACKAGECONFIG[randomseed] = "--enable-randomseed,--disable-randomseed" +PACKAGECONFIG[binfmt] = "--enable-binfmt,--disable-binfmt" +PACKAGECONFIG[utmp] = "--enable-utmp,--disable-utmp" +PACKAGECONFIG[polkit] = "--enable-polkit,--disable-polkit" # importd requires curl/xz/zlib/bzip2/gcrypt PACKAGECONFIG[importd] = "--enable-importd,--disable-importd" PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn" @@ -186,17 +232,20 @@ do_install() { # Delete journal README, as log can be symlinked inside volatile. rm -f ${D}/${localstatedir}/log/README - # Create symlinks for systemd-update-utmp-runlevel.service install -d ${D}${systemd_unitdir}/system/graphical.target.wants install -d ${D}${systemd_unitdir}/system/multi-user.target.wants install -d ${D}${systemd_unitdir}/system/poweroff.target.wants
[OE-core] [PATCH v2 6/7] systemd: tighten timesyncd and journal-gateway user accounts
Make sure that systemd-timesync and systemd-journal-gateway are created without dedicated home directories, home set to / and /bin/nologin as shell. This makes us in sync with what systemd-sysusers sets when adding users during startup. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 4788d8680329d4a43cf8c6749f89422419f20901..72c7e0db122cf8fca370c76801a80fd6c188f613 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -304,8 +304,8 @@ SYSTEMD_PACKAGES = "${PN}-binfmt" SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" USERADD_PACKAGES = "${PN}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system systemd-journal-gateway;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system systemd-timesync;', '', d)}" +USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '--system -d / -M --shell /bin/nologin systemd-journal-gateway;', '', d)}" +USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}" GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal" FILES_${PN}-analyze = "${bindir}/systemd-analyze" -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2 1/7] systemd: move bash completion into separate package
Inherit bash-completion for automatic systemd-bash-completion package. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index a110f0cdeaac7e46b5691a89aea237974e4114b3..cd793d7cba802dbba60a77df49e9d9695c8cf7b7 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -22,7 +22,7 @@ DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl rea SECTION = "base/shell" -inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext +inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext bash-completion SRCREV = "dd050decb6ad131ebdeabb71c4f9ecb4733269c0" @@ -290,13 +290,11 @@ CONFFILES_${PN} = "${sysconfdir}/machine-id \ ${sysconfdir}/systemd/user.conf" FILES_${PN} = " ${base_bindir}/* \ -${datadir}/bash-completion \ ${datadir}/dbus-1/services \ ${datadir}/dbus-1/system-services \ ${datadir}/polkit-1 \ ${datadir}/${BPN} \ ${datadir}/factory \ -${sysconfdir}/bash_completion.d/ \ ${sysconfdir}/dbus-1/ \ ${sysconfdir}/machine-id \ ${sysconfdir}/modules-load.d/ \ -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 5/6] systemd: move some tools into systemd-extra-utils package
This patch attempts to split some of the extra functionality delivered by systemd utilities from the main package into a separate package. This allows for trimming the size of a default systemd installation down to ~7MB with all configuration features disabled. The new systemd-extra-utils package is added to RRECOMMENDS so that by default it will get installed into the target image. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 47 1 file changed, 47 insertions(+) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 74abe39761bfb22eb9ed442b26c0233394503453..40ed81a37e78c67bae13f7ee7018d85efa2f6b7d 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -288,6 +288,7 @@ PACKAGES =+ "\ ${PN}-bash \ ${PN}-zsh \ ${PN}-xorg-xinitrc \ +${PN}-extra-utils \ " SYSTEMD_PACKAGES = "${PN}-binfmt" @@ -333,6 +334,51 @@ RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" +FILES_${PN}-extra-utils = "\ +${base_bindir}/systemd-escape \ +${base_bindir}/systemd-inhibit \ +${bindir}/systemd-detect-virt \ +${bindir}/systemd-path \ +${bindir}/systemd-run \ +${bindir}/systemd-cat \ +${bindir}/systemd-delta \ +${bindir}/systemd-cgls \ +${bindir}/systemd-cgtop \ +${bindir}/systemd-stdio-bridge \ +${base_bindir}/systemd-ask-password \ +${base_bindir}/systemd-tty-ask-password-agent \ + ${systemd_unitdir}/system/systemd-ask-password-console.path \ + ${systemd_unitdir}/system/systemd-ask-password-console.service \ + ${systemd_unitdir}/system/systemd-ask-password-wall.path \ + ${systemd_unitdir}/system/systemd-ask-password-wall.service \ + ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \ + ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \ + ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \ +${rootlibexecdir}/systemd/systemd-resolve-host \ +${rootlibexecdir}/systemd/systemd-ac-power \ +${rootlibexecdir}/systemd/systemd-activate \ +${bindir}/systemd-nspawn \ +${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ +${systemd_unitdir}/system/systemd-nspawn@.service \ +${rootlibexecdir}/systemd/systemd-bus-proxyd \ +${systemd_unitdir}/system/systemd-bus-proxyd.service \ +${systemd_unitdir}/system/systemd-bus-proxyd.socket \ +${rootlibexecdir}/systemd/systemd-socket-proxyd \ +${rootlibexecdir}/systemd/systemd-reply-password \ +${rootlibexecdir}/systemd/systemd-sleep \ +${rootlibexecdir}/systemd/system-sleep \ +${systemd_unitdir}/system/systemd-hibernate.service \ +${systemd_unitdir}/system/systemd-hybrid-sleep.service \ +${systemd_unitdir}/system/systemd-suspend.service \ +${systemd_unitdir}/system/sleep.target \ +${rootlibexecdir}/systemd/systemd-initctl \ +${systemd_unitdir}/system/systemd-initctl.service \ +${systemd_unitdir}/system/systemd-initctl.socket \ + ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \ + ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ +${rootlibexecdir}/systemd/systemd-cgroups-agent \ +" + CONFFILES_${PN} = "${sysconfdir}/machine-id \ ${sysconfdir}/systemd/coredump.conf \ ${sysconfdir}/systemd/journald.conf \ @@ -387,6 +433,7 @@ RDEPENDS_${PN} += "kmod dbus util-linux-mount udev (= ${EXTENDPKGV})" RDEPENDS_${PN} += "volatile-binds update-rc.d" RRECOMMENDS_${PN} += "systemd-serialgetty systemd-vconsole-setup \ + systemd-extra-utils \ systemd-compat-units udev-hwdb \ util-linux-agetty util-linux-fsck e2fsprogs-e2fsck \ kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 \ -- 2.5.0 --
[OE-core] [PATCH 6/6] systemd: remove unnecessary code
Remove unnecessary chown on journal file. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 40ed81a37e78c67bae13f7ee7018d85efa2f6b7d..03434ff9d5ff19fe043332b0b53a4fa96ab2b120 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -209,7 +209,7 @@ do_install() { sed -i s%@UDEVD@%${rootlibexecdir}/systemd/systemd-udevd% ${D}${sysconfdir}/init.d/systemd-udevd fi - chown root:systemd-journal ${D}/${localstatedir}/log/journal +# chown root:systemd-journal ${D}/${localstatedir}/log/journal # Delete journal README, as log can be symlinked inside volatile. rm -f ${D}/${localstatedir}/log/README -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 2/6] systemd: realign packages list
Reformat list of built packages to a package per line format. Makes easier to cope with subsequent changes. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 8e3cb6047588b286df728ff28423e469d0b0745d..2be77deefeb265259b1c269b81e015738f780475 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -237,8 +237,19 @@ python populate_packages_prepend (){ } PACKAGES_DYNAMIC += "^lib(udev|systemd).*" -PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \ - ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-bash ${PN}-zsh ${PN}-xorg-xinitrc" +PACKAGES =+ "\ +${PN}-gui \ +${PN}-vconsole-setup \ +${PN}-initramfs \ +${PN}-analyze \ +${PN}-kernel-install \ +${PN}-rpm-macros \ +${PN}-binfmt \ +${PN}-pam \ +${PN}-bash \ +${PN}-zsh \ +${PN}-xorg-xinitrc \ +" SYSTEMD_PACKAGES = "${PN}-binfmt" SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 1/6] systemd: move bash completion into separate package
Add systemd-bash package that ships bash completion files Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index a110f0cdeaac7e46b5691a89aea237974e4114b3..8e3cb6047588b286df728ff28423e469d0b0745d 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -238,7 +238,7 @@ python populate_packages_prepend (){ PACKAGES_DYNAMIC += "^lib(udev|systemd).*" PACKAGES =+ "${PN}-gui ${PN}-vconsole-setup ${PN}-initramfs ${PN}-analyze ${PN}-kernel-install \ - ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-zsh ${PN}-xorg-xinitrc" + ${PN}-rpm-macros ${PN}-binfmt ${PN}-pam ${PN}-bash ${PN}-zsh ${PN}-xorg-xinitrc" SYSTEMD_PACKAGES = "${PN}-binfmt" SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" @@ -271,6 +271,11 @@ FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ FILES_${PN}-xorg-xinitrc = "${sysconfdir}/X11/xinit/xinitrc.d/*" +FILES_${PN}-bash = " \ +${datadir}/bash-completion \ +${sysconfdir}/bash_completion.d/ \ +" + FILES_${PN}-zsh = "${datadir}/zsh/site-functions" FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ @@ -290,13 +295,11 @@ CONFFILES_${PN} = "${sysconfdir}/machine-id \ ${sysconfdir}/systemd/user.conf" FILES_${PN} = " ${base_bindir}/* \ -${datadir}/bash-completion \ ${datadir}/dbus-1/services \ ${datadir}/dbus-1/system-services \ ${datadir}/polkit-1 \ ${datadir}/${BPN} \ ${datadir}/factory \ -${sysconfdir}/bash_completion.d/ \ ${sysconfdir}/dbus-1/ \ ${sysconfdir}/machine-id \ ${sysconfdir}/modules-load.d/ \ -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 0/6] systemd cleanup & package split
A couple of patches that allow us to build a slimmer variant of systemd. As of now, systemd is configured with most options enabled. The resulting package is large, roughly 14359kB (for x86 builds) and is a bit of concern if one is trying to build smaller images. This patch series attempts to address the problem, while trying to remain compatible with current way of doing things. After applying patches, leaving default PACKAGECONFIG flags and skipping systemd-extra-utils, the systemd takes ~4000kB in the image. It should be possible to strip it even further just leaving systemd and systemctl in the target image, but figuring out which units are necessary yet failed to work might be a bit of a pain. The first patch follows the approach of zsh completion files and splits bash completion handlers into separate package - systemd-bash. The second patch is just a small cosmetic change that allows for cleaner diffs when adding/removing packages. The third patch adds a number of PACKAGECONFIG flags to systemd. By default only a handful of these is enabled, plus a couple of features that stem from DISTRO or MACHINE features. Flag 'binfmt' is enabled as we're building systemd-binfmt package. Flag 'sysusers' is enabled as well, as this enabled cleanups in patch 4. Flag 'randomseed' is enabled as it just made sense to have systemd-random-seed run during boot. Almost every --enable-feature configure switch has been exposed as PACKAGECONFIG flag, so it's fairly easy to opt-in for particular functionality if needed. Patch 4 uses sysusers for creating users. The user accounts created by systemd are by default slightly more restricted than ones brought up by useradd class. Namely the shell is set to /bin/nologin and no home directory is created. Patch 5 splits all/most of nonessential binaries into a separate systemd-extra-utils package. The package is listed in RRECOMMENDS so that it gets included by default in images. Binaries that get created as a result of PACKAGECONFIG flags will be included in the main 'systemd' package to avoid the effect when use has set a flag but the desired binary is not in the target system. Patch 6 removes chown on /var/lib/journal that may no longer be necessary. Maciej Borzecki (6): systemd: move bash completion into separate package systemd: realign packages list systemd: extend PACKAGECONFIG flags systemd: use sysusers for setting up required users/groups systemd: move some tools into systemd-extra-utils package systemd: remove unnecessary code meta/recipes-core/systemd/systemd_228.bb | 128 +++ 1 file changed, 112 insertions(+), 16 deletions(-) -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 4/6] systemd: use sysusers for setting up required users/groups
Use sysusers functionality of systemd allows setting up necessary user accounts during startup. This functionality is already partially used for journald and networkd (as we ship the default systemd.conf). The patch removes useradd class in favor of the native systemd mechanism. Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index f4cab27ba590901230f30229d54636d019f541d6..74abe39761bfb22eb9ed442b26c0233394503453 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -22,7 +22,7 @@ DEPENDS = "kmod docbook-sgml-dtd-4.1-native intltool-native gperf-native acl rea SECTION = "base/shell" -inherit useradd pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext +inherit pkgconfig autotools perlnative update-rc.d update-alternatives qemu systemd ptest gettext SRCREV = "dd050decb6ad131ebdeabb71c4f9ecb4733269c0" @@ -244,6 +244,14 @@ do_install() { echo 'f /run/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf fi install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install + if ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', 'true', 'false', d)}; then + echo 'u systemd-journal-gateway - -' >> ${D}${libdir}/sysusers.d/systemd.conf + fi + + if ${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', 'true', 'false', d)}; then + echo 'u systemd-timesync - -' >> ${D}${libdir}/sysusers.d/systemd.conf + fi + echo 'g lock - -' >> ${D}${libdir}/sysusers.d/systemd.conf } do_install_ptest () { @@ -285,10 +293,6 @@ PACKAGES =+ "\ SYSTEMD_PACKAGES = "${PN}-binfmt" SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" -USERADD_PACKAGES = "${PN}" -USERADD_PARAM_${PN} += "--system systemd-journal-gateway; --system systemd-timesync" -GROUPADD_PARAM_${PN} = "-r lock; -r systemd-journal" - FILES_${PN}-analyze = "${bindir}/systemd-analyze" FILES_${PN}-initramfs = "/init" -- 2.5.0 -- ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH 3/6] systemd: extend PACKAGECONFIG flags
We currently ship a rather full-blown setup of system. Very few configuration knobs are actually exposed through PACKAGECONFIG flags. This patch adds new PACKAGECONFIG flags for some finer tuning of systemd's functionality. By default most of functionality is disabled, with exeception of: - sysusers - systemd needs to setup some of required users - binfmt - so that package systemd-binfmt can be built - randomseed - rfkill (only if wifi is enabled in DISTRO_FEATURES) - efi (only if efi is present in MACHINE_FEATURES) Signed-off-by: Maciej Borzecki --- meta/recipes-core/systemd/systemd_228.bb | 43 +++- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/meta/recipes-core/systemd/systemd_228.bb b/meta/recipes-core/systemd/systemd_228.bb index 2be77deefeb265259b1c269b81e015738f780475..f4cab27ba590901230f30229d54636d019f541d6 100644 --- a/meta/recipes-core/systemd/systemd_228.bb +++ b/meta/recipes-core/systemd/systemd_228.bb @@ -64,6 +64,11 @@ PACKAGECONFIG ??= "compat xz ldconfig \ ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ + ${@bb.utils.contains('MACHINE_FEATURES', 'efi', 'efi', '', d)} \ + sysusers \ + binfmt \ + randomseed \ " PACKAGECONFIG[journal-upload] = "--enable-libcurl,--disable-libcurl,curl" # Sign the journal for anti-tampering @@ -76,12 +81,35 @@ PACKAGECONFIG[microhttpd] = "--enable-microhttpd,--disable-microhttpd,libmicroht PACKAGECONFIG[elfutils] = "--enable-elfutils,--disable-elfutils,elfutils" PACKAGECONFIG[resolved] = "--enable-resolved,--disable-resolved" PACKAGECONFIG[networkd] = "--enable-networkd,--disable-networkd" +PACKAGECONFIG[machined] = "--enable-machined,--disable-machined" +PACKAGECONFIG[backlight] = "--enable-backlight,--disable-backlight" +PACKAGECONFIG[quotacheck] = "--enable-quotacheck,--disable-quotacheck" +PACKAGECONFIG[bootchart] = "--enable-bootchart,--disable-bootchart" +PACKAGECONFIG[hostnamed] = "--enable-hostnamed,--disable-hostnamed" +PACKAGECONFIG[myhostname] = "--enable-myhostname,--disable-myhostname" +PACKAGECONFIG[rfkill] = "--enable-rfkill,--disable-rfkill" +PACKAGECONFIG[hibernate] = "--enable-hibernate,--disable-hibernate" +PACKAGECONFIG[timedated] = "--enable-timedated,--disable-timedated" +PACKAGECONFIG[timesyncd] = "--enable-timesyncd,--disable-timesyncd" +PACKAGECONFIG[localed] = "--enable-localed,--disable-localed" +PACKAGECONFIG[efi] = "--enable-efi,--disable-efi" +PACKAGECONFIG[kdbus] = "--enable-kdbus,--disable-kdbus" +PACKAGECONFIG[ima] = "--enable-ima,--disable-ima" +PACKAGECONFIG[smack] = "--enable-smack,--disable-smack" +PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" +PACKAGECONFIG[logind] = "--enable-logind,--disable-logind" +PACKAGECONFIG[sysusers] = "--enable-sysusers,--disable-sysusers" +PACKAGECONFIG[firstboot] = "--enable-firstboot,--disable-firstboot" +PACKAGECONFIG[randomseed] = "--enable-randomseed,--disable-randomseed" +PACKAGECONFIG[binfmt] = "--enable-binfmt,--disable-binfmt" +PACKAGECONFIG[utmp] = "--enable-utmp,--disable-utmp" # importd requires curl/xz/zlib/bzip2/gcrypt PACKAGECONFIG[importd] = "--enable-importd,--disable-importd" PACKAGECONFIG[libidn] = "--enable-libidn,--disable-libidn,libidn" PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit" PACKAGECONFIG[manpages] = "--enable-manpages,--disable-manpages,libxslt-native xmlto-native docbook-xml-dtd4-native docbook-xsl-stylesheets-native" PACKAGECONFIG[pam] = "--enable-pam,--disable-pam,libpam" +PACKAGECONFIG[polkit] = "--enable-polkit,--disable-polkit" # Verify keymaps on locale change PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" # Update NAT firewall rules @@ -186,17 +214,20 @@ do_install() { # Delete journal README, as log can be symlinked inside volatile. rm -f ${D}/${localstatedir}/log/README - # Create symlinks for systemd-update-utmp-runlevel.service install -d ${D}${systemd_unitdir}/system/graphical.target.wants install -d ${D}${systemd_unitdir}/system/m