Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency
@ 2024-05-09 19:37 Julien Olivain
  2024-05-09 19:37 ` [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test Julien Olivain
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Julien Olivain @ 2024-05-09 19:37 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, Volkov Viacheslav

When ImageMagick is selected, the "zbarimg" program is compiled and
installed on target. It allows to decode a QR code from an image file.

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 package/zbar/zbar.mk | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/package/zbar/zbar.mk b/package/zbar/zbar.mk
index 0e79004bb30..86f33796a24 100644
--- a/package/zbar/zbar.mk
+++ b/package/zbar/zbar.mk
@@ -18,7 +18,6 @@ ZBAR_CONF_ENV = \
 	LIBS=$(TARGET_NLS_LIBS)
 ZBAR_CONF_OPTS = \
 	--disable-doc \
-	--without-imagemagick \
 	--without-qt \
 	--without-qt5 \
 	--without-gtk \
@@ -32,6 +31,13 @@ else
 ZBAR_CONF_OPTS += --without-dbus
 endif
 
+ifeq ($(BR2_PACKAGE_IMAGEMAGICK),y)
+ZBAR_DEPENDENCIES += imagemagick
+ZBAR_CONF_OPTS += --with-imagemagick
+else
+ZBAR_CONF_OPTS += --without-imagemagick
+endif
+
 ifeq ($(BR2_PACKAGE_PYTHON3),y)
 ZBAR_DEPENDENCIES += host-python3 python3
 ZBAR_CONF_OPTS += --with-python=python3
-- 
2.45.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test
  2024-05-09 19:37 [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Julien Olivain
@ 2024-05-09 19:37 ` Julien Olivain
  2024-06-03 17:32   ` Peter Korsgaard
  2024-05-09 20:09 ` [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Thomas Petazzoni via buildroot
  2024-06-03 17:31 ` Peter Korsgaard
  2 siblings, 1 reply; 5+ messages in thread
From: Julien Olivain @ 2024-05-09 19:37 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, Volkov Viacheslav

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested on branch master at commit 1223c11 with commands:

    make check-package
    ...
    0 warnings generated

    support/testing/run-tests \
        -d dl -o output_folder \
        tests.package.test_zbar
    ...
    OK
---
 DEVELOPERS                                 |  1 +
 support/testing/tests/package/test_zbar.py | 37 ++++++++++++++++++++++
 2 files changed, 38 insertions(+)
 create mode 100644 support/testing/tests/package/test_zbar.py

diff --git a/DEVELOPERS b/DEVELOPERS
index ce0c7d62ded..b60321f01fa 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1900,6 +1900,7 @@ F:	support/testing/tests/package/test_wine.py
 F:	support/testing/tests/package/test_xz.py
 F:	support/testing/tests/package/test_z3.py
 F:	support/testing/tests/package/test_z3/
+F:	support/testing/tests/package/test_zbar.py
 F:	support/testing/tests/package/test_zchunk.py
 F:	support/testing/tests/package/test_zstd.py
 
diff --git a/support/testing/tests/package/test_zbar.py b/support/testing/tests/package/test_zbar.py
new file mode 100644
index 00000000000..b840df089af
--- /dev/null
+++ b/support/testing/tests/package/test_zbar.py
@@ -0,0 +1,37 @@
+import os
+
+import infra.basetest
+
+
+class TestZbar(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_IMAGEMAGICK=y
+        BR2_PACKAGE_LIBQRENCODE=y
+        BR2_PACKAGE_LIBQRENCODE_TOOLS=y
+        BR2_PACKAGE_ZBAR=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        txt_msg = "Hello Buildroot!"
+        qr_img = "qr.png"
+
+        # We check the program can execute.
+        self.assertRunOk("zbarimg --version")
+
+        # We generate a QR code image containing a message.
+        self.assertRunOk(f"qrencode -o '{qr_img}' '{txt_msg}'")
+
+        # We decode the QR code image and check the extracted message
+        # is the expected one.
+        out, ret = self.emulator.run(f"zbarimg -q --raw {qr_img}")
+        self.assertEqual(ret, 0)
+        self.assertEqual(out[0], txt_msg)
-- 
2.45.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency
  2024-05-09 19:37 [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Julien Olivain
  2024-05-09 19:37 ` [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test Julien Olivain
@ 2024-05-09 20:09 ` Thomas Petazzoni via buildroot
  2024-06-03 17:31 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-09 20:09 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Volkov Viacheslav, buildroot

On Thu,  9 May 2024 21:37:36 +0200
Julien Olivain <ju.o@free.fr> wrote:

> When ImageMagick is selected, the "zbarimg" program is compiled and
> installed on target. It allows to decode a QR code from an image file.
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
>  package/zbar/zbar.mk | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Series applied, thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency
  2024-05-09 19:37 [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Julien Olivain
  2024-05-09 19:37 ` [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test Julien Olivain
  2024-05-09 20:09 ` [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Thomas Petazzoni via buildroot
@ 2024-06-03 17:31 ` Peter Korsgaard
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2024-06-03 17:31 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Volkov Viacheslav, buildroot

>>>>> "Julien" == Julien Olivain <ju.o@free.fr> writes:

 > When ImageMagick is selected, the "zbarimg" program is compiled and
 > installed on target. It allows to decode a QR code from an image file.

 > Signed-off-by: Julien Olivain <ju.o@free.fr>

Committed to 2024.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test
  2024-05-09 19:37 ` [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test Julien Olivain
@ 2024-06-03 17:32   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2024-06-03 17:32 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Volkov Viacheslav, buildroot

>>>>> "Julien" == Julien Olivain <ju.o@free.fr> writes:

 > Signed-off-by: Julien Olivain <ju.o@free.fr>
 > ---
 > Patch tested on branch master at commit 1223c11 with commands:

Committed to 2024.02.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-06-03 17:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 19:37 [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Julien Olivain
2024-05-09 19:37 ` [Buildroot] [PATCH 2/2] support/testing: add zbar runtime test Julien Olivain
2024-06-03 17:32   ` Peter Korsgaard
2024-05-09 20:09 ` [Buildroot] [PATCH 1/2] package/zbar: add the optional imagemagick dependency Thomas Petazzoni via buildroot
2024-06-03 17:31 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox