summaryrefslogtreecommitdiffstats
path: root/meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy_0.1.2.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy_0.1.2.bb')
-rw-r--r--meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy_0.1.2.bb85
1 files changed, 85 insertions, 0 deletions
diff --git a/meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy_0.1.2.bb b/meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy_0.1.2.bb
new file mode 100644
index 0000000000..3e68a52b09
--- /dev/null
+++ b/meta-filesystems/dynamic-layers/meta-python/recipes-support/gpiod-sysfs-proxy/gpiod-sysfs-proxy_0.1.2.bb
@@ -0,0 +1,85 @@
1SUMMARY = "User-space, libgpiod-based compatibility layer for linux GPIO sysfs interface."
2
3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://COPYING;md5=0dcf8b702b5c96178978c7223f64a73b"
5
6inherit systemd update-rc.d ptest pypi python_pep517 python_setuptools_build_meta useradd
7
8PYPI_PACKAGE = "gpiod_sysfs_proxy"
9
10SRC_URI += " \
11 file://gpiod-sysfs-proxy.service.in \
12 file://run-gpio-sys.mount \
13 file://sys-class.mount \
14 file://gpiod-sysfs-proxy.init.in \
15 file://run-ptest.in \
16"
17
18SRC_URI[sha256sum] = "4bdd4b8a7042f63a40507ae0f16b360011e67cbb2f0276289636487a54849530"
19
20# For full backward compatibility with the kernel sysfs interface, this option
21# must be selected. However, we don't make it the default as - with kernel sysfs
22# disabled - it plays a silly game with /sys/class, where it mounts a read-only
23# overlay containing the missing /sys/class/gpio directory. This is a rather
24# non-standard behavior so make sure the user actually wants it.
25PACKAGECONFIG[sys-class-mount] = ""
26
27export MOUNTPOINT = "${@bb.utils.contains('PACKAGECONFIG', 'sys-class-mount', '/sys/class/gpio', '/run/gpio', d)}"
28
29do_install:append() {
30 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
31 install -d ${D}${systemd_system_unitdir}
32 install -m 0644 ${UNPACKDIR}/gpiod-sysfs-proxy.service.in ${D}${systemd_system_unitdir}/gpiod-sysfs-proxy.service
33
34 if ${@bb.utils.contains('PACKAGECONFIG', 'sys-class-mount', 'true', 'false', d)}; then
35 install -d ${D}${systemd_system_unitdir}/sysinit.target.wants/
36
37 install -m 0644 ${UNPACKDIR}/run-gpio-sys.mount ${D}${systemd_system_unitdir}/run-gpio-sys.mount
38 install -m 0644 ${UNPACKDIR}/sys-class.mount ${D}${systemd_system_unitdir}/sys-class.mount
39
40 ln -sf ../run-gpio-sys.mount ${D}${systemd_system_unitdir}/sysinit.target.wants/run-gpio-sys.mount
41 ln -sf ../sys-class.mount ${D}${systemd_system_unitdir}/sysinit.target.wants/sys-class.mount
42 fi
43
44 sed -i "s:@mountpoint@:$MOUNTPOINT:g" ${D}${systemd_system_unitdir}/gpiod-sysfs-proxy.service
45 elif ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
46 install -d ${D}${sysconfdir}/init.d
47 install -m 0755 ${UNPACKDIR}/gpiod-sysfs-proxy.init.in ${D}${sysconfdir}/init.d/gpiod-sysfs-proxy
48 sed -i "s:@mountpoint@:$MOUNTPOINT:g" ${D}${sysconfdir}/init.d/gpiod-sysfs-proxy
49 fi
50}
51
52SYSTEMD_SERVICE:${PN} = "gpiod-sysfs-proxy.service"
53SYSTEMD_AUTO_ENABLE = "enable"
54
55INITSCRIPT_NAME = "gpiod-sysfs-proxy"
56INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 20 0 1 6 ."
57
58FILES:${PN} += "/usr/lib/systemd/system"
59
60RDEPENDS:${PN} += " \
61 python3-fuse \
62 python3-gpiod \
63 python3-pyudev \
64"
65
66python __anonymous() {
67 if d.getVar("PTEST_ENABLED") == "1":
68 d.appendVar("SRC_URI", "git://github.com/brgl/gpio-sysfs-compat-tests;protocol=https;branch=main;destsuffix=tests;name=tests")
69 d.setVar("SRCREV_tests", "a3c9daa4650dd1e8d7fd8972db68d9c2c204263d")
70}
71
72do_install_ptest() {
73 install -d ${D}${PTEST_PATH}/tests/
74 install -m 0755 ${UNPACKDIR}/run-ptest.in ${D}${PTEST_PATH}/run-ptest
75 sed -i "s:@mountpoint@:$MOUNTPOINT:g" ${D}${PTEST_PATH}/run-ptest
76 install -m 0755 ${UNPACKDIR}/tests/gpio-sysfs-compat-tests ${D}${PTEST_PATH}/tests/gpio-sysfs-compat-tests
77}
78
79# Test user is created for verifying chown() and chmod() operations.
80USERADD_PACKAGES = "${PN}-ptest"
81GROUPADD_PARAM:${PN}-ptest = "--system gpio-test"
82USERADD_PARAM:${PN}-ptest = "--system -M -s /bin/nologin -g gpio-test gpio-test"
83
84RDEPENDS:${PN}-ptest += "kmod"
85RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim kernel-module-configfs"