Skip to contentSkip to conversation

libgpiod: refactor the recipe

PATCH In review Bartosz Golaszewski 3 participants 5 messages Sep 25, 2020 – Sep 28, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libgpiod: refactor the recipe

From: Bartosz Golaszewski <[email protected]>

After dropping the support for v0.3.x let's refactor the entire recipe. Let's move most definitions into libgpiod.inc and only leave the hashes in libgpiod_1.4.4.bb. Let's use ${BPN} in the URL, consolidate certain variables and add some explanatory comments.

---
 meta-oe/recipes-support/libgpiod/libgpiod.inc | 21 ++++++++++++++-----
 .../libgpiod/libgpiod_1.4.4.bb                | 15 -------------
 2 files changed, 16 insertions(+), 20 deletions(-)
meta-oe/recipes-support/libgpiod/libgpiod.inc +16 -5
index cae3145dd..ec81b3bdd 100644
@@ -3,17 +3,28 @@ SUMMARY = "C library and tools for interacting with the linux GPIO character dev
 LICENSE = "LGPLv2.1+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
 
-SRC_URI = "https://www.kernel.org/pub/software/libs/libgpiod/${BP}.tar.xz"
+SRC_URI = "https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig python3native
 
 PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev"
+PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
+PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
 
+# Enable cxx bindings by default.
+PACKAGECONFIG ?= "cxx"
+
+# Always build tools - they don't have any additional
+# requirements over the library.
 EXTRA_OECONF = "--enable-tools"
 
-PACKAGES =+ " ${PN}-tools"
+DEPENDS += "autoconf-archive-native"
 
+PACKAGES =+ "${PN}-tools libgpiodcxx"
 FILES_${PN}-tools = "${bindir}/*"
-
-PACKAGES =+ "libgpiodcxx"
 FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
+
+PACKAGES =+ "${PN}-python"
+FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
+RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}"
+RRECOMMENDS_${PN}-python += "${RRECOMMENDS_PYTHON}"
meta-oe/recipes-support/libgpiod/libgpiod_1.4.4.bb +0 -15
index b5a64a554..6cb43f994 100644
@@ -1,19 +1,4 @@
 require libgpiod.inc
 
-DEPENDS += "autoconf-archive-native"
-
 SRC_URI[md5sum] = "064c2627397e6641c52de09a26951112"
 SRC_URI[sha256sum] = "f1cda2789e6a13a92aefc012a76e5a7cc57a1b402d66f71df8719ee314b67699"
-
-# enable cxx bindings
-PACKAGECONFIG ?= "cxx"
-
-PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
-PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
-
-inherit python3native
-
-PACKAGES =+ "${PN}-python"
-FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
-RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}"
-RRECOMMENDS_${PN}-python += "${RRECOMMENDS_PYTHON}"
Signature · 1 line
2.26.1
#1 lore raw

Usually, the recipes are moving otherway. include files are useful only when there should be multiple recipes sharing common stuff. For a single recipe it would be an overkill IMO

Quoted 79 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

After dropping the support for v0.3.x let's refactor the entire recipe. Let's move most definitions into libgpiod.inc and only leave the hashes in libgpiod_1.4.4.bb. Let's use ${BPN} in the URL, consolidate certain variables and add some explanatory comments.

---
 meta-oe/recipes-support/libgpiod/libgpiod.inc | 21 ++++++++++++++-----
 .../libgpiod/libgpiod_1.4.4.bb                | 15 -------------
 2 files changed, 16 insertions(+), 20 deletions(-)
meta-oe/recipes-support/libgpiod/libgpiod.inc +16 -5
index cae3145dd..ec81b3bdd 100644
@@ -3,17 +3,28 @@ SUMMARY = "C library and tools for interacting with the linux GPIO character dev
 LICENSE = "LGPLv2.1+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2caced0b25dfefd4c601d92bd15116de"
 
-SRC_URI = "https://www.kernel.org/pub/software/libs/libgpiod/${BP}.tar.xz"
+SRC_URI = "https://www.kernel.org/pub/software/libs/${BPN}/${BP}.tar.xz"
 
-inherit autotools pkgconfig
+inherit autotools pkgconfig python3native
 
 PACKAGECONFIG[tests] = "--enable-tests,--disable-tests,kmod udev"
+PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
+PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
 
+# Enable cxx bindings by default.
+PACKAGECONFIG ?= "cxx"
+
+# Always build tools - they don't have any additional
+# requirements over the library.
 EXTRA_OECONF = "--enable-tools"
 
-PACKAGES =+ " ${PN}-tools"
+DEPENDS += "autoconf-archive-native"
 
+PACKAGES =+ "${PN}-tools libgpiodcxx"
 FILES_${PN}-tools = "${bindir}/*"
-
-PACKAGES =+ "libgpiodcxx"
 FILES_libgpiodcxx = "${libdir}/libgpiodcxx.so.*"
+
+PACKAGES =+ "${PN}-python"
+FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
+RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}"
+RRECOMMENDS_${PN}-python += "${RRECOMMENDS_PYTHON}"
meta-oe/recipes-support/libgpiod/libgpiod_1.4.4.bb +0 -16
index b5a64a554..6cb43f994 100644
@@ -1,19 +1,4 @@
 require libgpiod.inc
 
-DEPENDS += "autoconf-archive-native"
-
 SRC_URI[md5sum] = "064c2627397e6641c52de09a26951112"
 SRC_URI[sha256sum] = "f1cda2789e6a13a92aefc012a76e5a7cc57a1b402d66f71df8719ee314b67699"
-
-# enable cxx bindings
-PACKAGECONFIG ?= "cxx"
-
-PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
-PACKAGECONFIG[python3] = "--enable-bindings-python,--disable-bindings-python,python3"
-
-inherit python3native
-
-PACKAGES =+ "${PN}-python"
-FILES_${PN}-python = "${PYTHON_SITEPACKAGES_DIR}"
-RRECOMMENDS_PYTHON = "${@bb.utils.contains('PACKAGECONFIG', 'python3', '${PN}-python', '',d)}"
-RRECOMMENDS_${PN}-python += "${RRECOMMENDS_PYTHON}"
--

2.26.1

#2 lore raw

Em sex., 25 de set. de 2020 às 23:04, Khem Raj <[email protected]> escreveu:

Quoted 4 lines

Usually, the recipes are moving otherway. include files are useful only when there should be multiple recipes sharing common stuff. For a single recipe it would be an overkill IMO

Agreed; it adds an extra indirection for no good reason.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750
#3 lore raw
In reply to Khem Raj
Quoted 5 lines · Khem Raj

Usually, the recipes are moving otherway. include files are useful only when there should be multiple recipes sharing common stuff. For a single recipe it would be an overkill IMO

I considered pulling everything into libgpiod_1.4.4.bb but we're currently in the process of developing v2 of the GPIO user API in the kernel and libgpiod will get a new major, non compatible release after that's upstream. That means: even if we pull everything into .bb now, we'll revert back to having an .inc later.

What do you think is the best way to go about this?

Bartosz

#4 lore raw

Em seg., 28 de set. de 2020 às 05:38, Bartosz Golaszewski <[email protected]> escreveu:

Quoted 7 lines · Khem Raj
Quoted 5 lines

Usually, the recipes are moving otherway. include files are useful only when there should be multiple recipes sharing common stuff. For a single recipe it would be an overkill IMO

Quoted 7 lines

I considered pulling everything into libgpiod_1.4.4.bb but we're currently in the process of developing v2 of the GPIO user API in the kernel and libgpiod will get a new major, non compatible release after that's upstream. That means: even if we pull everything into .bb now, we'll revert back to having an .inc later.

What do you think is the best way to go about this?

If in future it makes sense to split it we can do. It is hard to predict what the v2 will be as for example the build options might end being different and then the .inc makes no sense.

I'd say let's consolidate it and whenever the v2 is out, we consider the best option depending on how it ends being done.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750