gpiod-sysfs-proxy_0.1.2.bb 3.6 KB

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