Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/phython-libevdev: new package
@ 2022-08-09 13:27 Romain Naour
  2022-08-09 13:27 ` [Buildroot] [PATCH 2/2] package/libinput: remove python tools scripts if python is missing Romain Naour
  2022-08-24 10:13 ` [Buildroot] [PATCH 1/2] package/phython-libevdev: new package Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Romain Naour @ 2022-08-09 13:27 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour

python-libevdev is needed for libinput replay command:

$ libinput replay recording.yml
Error: No module named 'libevdev'
One or more python modules are missing. Please install those modules and re-run this tool.

Indeed only libinput-replay tool is a python script
(like libinput-analyze-recording, libinput-measure-fuzz...)

phython-libevdev itself requires a kernel built with
CONFIG_INPUT_UINPUT option enabled, enable this option
if a kernel is built by Buildroot.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
---
 DEVELOPERS                                   |  1 +
 package/Config.in                            |  1 +
 package/python-libevdev/Config.in            |  7 +++++++
 package/python-libevdev/python-libevdev.hash |  5 +++++
 package/python-libevdev/python-libevdev.mk   | 20 ++++++++++++++++++++
 5 files changed, 34 insertions(+)
 create mode 100644 package/python-libevdev/Config.in
 create mode 100644 package/python-libevdev/python-libevdev.hash
 create mode 100644 package/python-libevdev/python-libevdev.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index d2bd0d809a..5f1ef3df52 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2580,6 +2580,7 @@ F:	package/ogre/
 F:	package/openpowerlink/
 F:	package/physfs/
 F:	package/piglit/
+F:	package/python-libevdev/
 F:	package/qemu/
 F:	package/solarus/
 F:	package/stress-ng/
diff --git a/package/Config.in b/package/Config.in
index 2ddd240150..25562ac839 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1094,6 +1094,7 @@ menu "External python modules"
 	source "package/python-kiwisolver/Config.in"
 	source "package/python-lark/Config.in"
 	source "package/python-libconfig/Config.in"
+	source "package/python-libevdev/Config.in"
 	source "package/python-libusb1/Config.in"
 	source "package/python-lmdb/Config.in"
 	source "package/python-lockfile/Config.in"
diff --git a/package/python-libevdev/Config.in b/package/python-libevdev/Config.in
new file mode 100644
index 0000000000..2d6aa49ce0
--- /dev/null
+++ b/package/python-libevdev/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_LIBEVDEV
+	bool "python-libevdev"
+	select BR2_PACKAGE_LIBEVDEV # runtime
+	help
+	  Python wrapper for libevdev.
+
+	  https://gitlab.freedesktop.org/libevdev/python-libevdev
diff --git a/package/python-libevdev/python-libevdev.hash b/package/python-libevdev/python-libevdev.hash
new file mode 100644
index 0000000000..2799078cc8
--- /dev/null
+++ b/package/python-libevdev/python-libevdev.hash
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/libevdev/json
+md5  34b48098c1fba26de79a0d67a17a588a  libevdev-0.11.tar.gz
+sha256  e9ca006a4df2488a60bd9a740011ee948d81904be2364f017e560169508f560f  libevdev-0.11.tar.gz
+# Locally computed sha256 checksums
+sha256  a547b196da4e5bb9588a6e24f1f36ae9e2349ca5375e2cf9c315186e237d9f6d  COPYING
diff --git a/package/python-libevdev/python-libevdev.mk b/package/python-libevdev/python-libevdev.mk
new file mode 100644
index 0000000000..e5256064c9
--- /dev/null
+++ b/package/python-libevdev/python-libevdev.mk
@@ -0,0 +1,20 @@
+################################################################################
+#
+# python-libevdev
+#
+################################################################################
+
+PYTHON_LIBEVDEV_VERSION = 0.11
+PYTHON_LIBEVDEV_SOURCE = libevdev-$(PYTHON_LIBEVDEV_VERSION).tar.gz
+PYTHON_LIBEVDEV_SITE = https://files.pythonhosted.org/packages/b0/49/2fe589ce1fa6ca0f05ae0b1717923650f2cc6eec6307c71fbc7789738902
+PYTHON_LIBEVDEV_SETUP_TYPE = setuptools
+PYTHON_LIBEVDEV_LICENSE = MIT
+PYTHON_LIBEVDEV_LICENSE_FILES = COPYING
+
+# Requires a kernel built with user level driver support (uinput).
+define PYTHON_LIBEVDEV_LINUX_CONFIG_FIXUPS
+	$(call KCONFIG_ENABLE_OPT,CONFIG_INPUT_MISC)
+	$(call KCONFIG_ENABLE_OPT,CONFIG_INPUT_UINPUT)
+endef
+
+$(eval $(python-package))
-- 
2.34.3

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

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

* [Buildroot] [PATCH 2/2] package/libinput: remove python tools scripts if python is missing
  2022-08-09 13:27 [Buildroot] [PATCH 1/2] package/phython-libevdev: new package Romain Naour
@ 2022-08-09 13:27 ` Romain Naour
  2022-08-24 10:13 ` [Buildroot] [PATCH 1/2] package/phython-libevdev: new package Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Romain Naour @ 2022-08-09 13:27 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Yann E . MORIN

Some libinput tools are actually python scripts and requires
at least tree python modules: libevdev, pyudev and pyyaml:

libinput]$ file *
libinput-analyze:                   ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-analyze-per-slot-delta:    Python script, UTF-8 Unicode text executable
libinput-analyze-recording:         Python script, UTF-8 Unicode text executable
libinput-analyze-touch-down-state:  Python script, UTF-8 Unicode text executable
libinput-debug-events:              ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-debug-tablet:              ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-list-devices:              ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-measure:                   ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-measure-fuzz:              Python script, UTF-8 Unicode text executable
libinput-measure-touchpad-pressure: Python script, UTF-8 Unicode text executable
libinput-measure-touchpad-size:     Python script, UTF-8 Unicode text executable
libinput-measure-touchpad-tap:      Python script, UTF-8 Unicode text executable
libinput-measure-touch-size:        Python script, UTF-8 Unicode text executable
libinput-quirks:                    ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-record:                    ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-uClibc.so.0, stripped
libinput-replay:                    Python script, UTF-8 Unicode text executable

To avoid adding a python interpreter dependency on libinput package,
add a new libinput option to keep these tools (installed by
default) only when python is available on the target. Otherwise
remove them from the target.

Signed-off-by: Romain Naour <romain.naour@smile.fr>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
libinput install unconditionally python scripts without checking if python is available.
It's not really nice to have to remove them from .mk.
---
 package/libinput/Config.in   | 22 ++++++++++++++++++++++
 package/libinput/libinput.mk | 20 ++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/package/libinput/Config.in b/package/libinput/Config.in
index 14e4e70f96..1a8fcc7ed4 100644
--- a/package/libinput/Config.in
+++ b/package/libinput/Config.in
@@ -13,5 +13,27 @@ config BR2_PACKAGE_LIBINPUT
 
 	  http://freedesktop.org/wiki/Software/libinput/
 
+if BR2_PACKAGE_LIBINPUT
+
+config BR2_PACKAGE_LIBINPUT_PYTHON_TOOLS
+	bool "install python tools "
+	depends on BR2_PACKAGE_PYTHON3
+	select BR2_PACKAGE_PYTHON_LIBEVDEV # runtime
+	select BR2_PACKAGE_PYTHON_PYUDEV # runtime
+	select BR2_PACKAGE_PYTHON_PYYAML # runtime
+	help
+	  Install python tools:
+	  libinput-analyze-per-slot-delta,
+	  libinput-analyze-recording,
+	  libinput-analyze-touch-down-state,
+	  libinput-measure-fuzz,
+	  libinput-measure-touchpad-pressure,
+	  libinput-measure-touchpad-size,
+	  libinput-measure-touchpad-tap,
+	  libinput-measure-touch-size,
+	  libinput-replay
+
+endif
+
 comment "libinput needs udev /dev management"
 	depends on !BR2_PACKAGE_HAS_UDEV
diff --git a/package/libinput/libinput.mk b/package/libinput/libinput.mk
index a66b0afde5..8c8e0a49a3 100644
--- a/package/libinput/libinput.mk
+++ b/package/libinput/libinput.mk
@@ -30,4 +30,24 @@ else
 LIBINPUT_CONF_OPTS += -Ddebug-gui=false
 endif
 
+ifeq ($(BR2_PACKAGE_LIBINPUT_PYTHON_TOOLS),)
+LIBINPUT_PYTHON_TOOLS = libinput-analyze-per-slot-delta \
+	libinput-analyze-recording \
+	libinput-analyze-touch-down-state \
+	libinput-measure-fuzz \
+	libinput-measure-touchpad-pressure \
+	libinput-measure-touchpad-size \
+	libinput-measure-touchpad-tap \
+	libinput-measure-touch-size \
+	libinput-replay
+
+define LIBINPUT_REMOVE_UNNEEDED_FILES
+	for i in $(LIBINPUT_PYTHON_TOOLS) ; do \
+		rm -f $(TARGET_DIR)/usr/libexec/libinput/$$i ; \
+	done
+endef
+
+LIBINPUT_POST_INSTALL_TARGET_HOOKS += LIBINPUT_REMOVE_UNNEEDED_FILES
+endif
+
 $(eval $(meson-package))
-- 
2.34.3

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

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

* Re: [Buildroot] [PATCH 1/2] package/phython-libevdev: new package
  2022-08-09 13:27 [Buildroot] [PATCH 1/2] package/phython-libevdev: new package Romain Naour
  2022-08-09 13:27 ` [Buildroot] [PATCH 2/2] package/libinput: remove python tools scripts if python is missing Romain Naour
@ 2022-08-24 10:13 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-08-24 10:13 UTC (permalink / raw)
  To: Romain Naour; +Cc: buildroot

On Tue,  9 Aug 2022 15:27:29 +0200
Romain Naour <romain.naour@smile.fr> wrote:

> python-libevdev is needed for libinput replay command:
> 
> $ libinput replay recording.yml
> Error: No module named 'libevdev'
> One or more python modules are missing. Please install those modules and re-run this tool.
> 
> Indeed only libinput-replay tool is a python script
> (like libinput-analyze-recording, libinput-measure-fuzz...)
> 
> phython-libevdev itself requires a kernel built with
> CONFIG_INPUT_UINPUT option enabled, enable this option
> if a kernel is built by Buildroot.
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
>  DEVELOPERS                                   |  1 +
>  package/Config.in                            |  1 +
>  package/python-libevdev/Config.in            |  7 +++++++
>  package/python-libevdev/python-libevdev.hash |  5 +++++
>  package/python-libevdev/python-libevdev.mk   | 20 ++++++++++++++++++++
>  5 files changed, 34 insertions(+)
>  create mode 100644 package/python-libevdev/Config.in
>  create mode 100644 package/python-libevdev/python-libevdev.hash
>  create mode 100644 package/python-libevdev/python-libevdev.mk

So, I have applied both patches, but I had to split things up:

 * From PATCH 2/2, I took the removal of the Python tools, made it
   unconditional, and applied that to master.

 * In next, I cherry-picked the patch from master that unconditionally
   removes Python tools of libinput, then applied the python-libevdev
   patch, then applied a patch that adds the libinput option for Python
   tools.

This way, we have the fix in master (removal of Python tools) and the
new feature in next.

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] 3+ messages in thread

end of thread, other threads:[~2022-08-24 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09 13:27 [Buildroot] [PATCH 1/2] package/phython-libevdev: new package Romain Naour
2022-08-09 13:27 ` [Buildroot] [PATCH 2/2] package/libinput: remove python tools scripts if python is missing Romain Naour
2022-08-24 10:13 ` [Buildroot] [PATCH 1/2] package/phython-libevdev: new package Thomas Petazzoni via buildroot

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