diff mbox series

[meta-arago,scarthgap,09/10] libyang: Do the version bump in a yocto-check-layer compliant manner

Message ID 20251113225017.22994-9-reatmon@ti.com
State New
Headers show
Series [meta-arago,scarthgap,01/10] offscreendemo: Add REQUIRED_DISTRO_FEATURES | expand

Commit Message

Ryan Eatmon Nov. 13, 2025, 10:50 p.m. UTC
Yocto Project Compatibility requires that including a layer in a build
not change recipes in other layers.  In this case, we were providing a
newer version of a recipe that another layer provides.

The proper way of doing this is to create a bbappend and only change the
minimal things needed to perform your changes.  Additionally, to pass
the yocto-check-layer the bbappend needs to be wrapped in a manner that
only applies your changes in the event that you are making use of your
layer.  For Arago, that means only if we are building Arago.

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
 .../sysrepo/libyang-arago.inc                 |  9 ++++
 .../sysrepo/libyang_%.bbappend                |  5 +++
 .../recipes-extended/sysrepo/libyang_3.7.8.bb | 45 -------------------
 3 files changed, 14 insertions(+), 45 deletions(-)
 create mode 100644 meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
 delete mode 100644 meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb

Comments

Denys Dmytriyenko Nov. 13, 2025, 11:09 p.m. UTC | #1
On Thu, Nov 13, 2025 at 04:50:16PM -0600, Ryan Eatmon via lists.yoctoproject.org wrote:
> Yocto Project Compatibility requires that including a layer in a build
> not change recipes in other layers.  In this case, we were providing a
> newer version of a recipe that another layer provides.
> 
> The proper way of doing this is to create a bbappend and only change the
> minimal things needed to perform your changes.  Additionally, to pass
> the yocto-check-layer the bbappend needs to be wrapped in a manner that
> only applies your changes in the event that you are making use of your
> layer.  For Arago, that means only if we are building Arago.

Thanks for this descriptive commit message - it captures reasoning and a 
proper solution! It is a great example we can refer to in the future.


> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
> ---
>  .../sysrepo/libyang-arago.inc                 |  9 ++++
>  .../sysrepo/libyang_%.bbappend                |  5 +++
>  .../recipes-extended/sysrepo/libyang_3.7.8.bb | 45 -------------------
>  3 files changed, 14 insertions(+), 45 deletions(-)
>  create mode 100644 meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
>  delete mode 100644 meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
> 
> diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc b/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
> new file mode 100644
> index 00000000..b76701a8
> --- /dev/null
> +++ b/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
> @@ -0,0 +1,9 @@
> +PV = "3.7.8"
> +
> +LIC_FILES_CHKSUM = "file://LICENSE;md5=9bb3d334294e8719f41c531e28a9a697"

May want to explicitly mention why the checksum is different vs. upstream.


> +SRCREV = "03e294d83b610f89e8ba7b2156a80dc0ad534443"
> +
> +do_install:append () {
> +    oe_multilib_header  libyang/ly_config.h
> +}
> diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend b/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
> index 608377e3..60d1258e 100644
> --- a/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
> +++ b/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
> @@ -1 +1,6 @@
> +LIBYANG_ARAGO = ""
> +LIBYANG_ARAGO:arago = "libyang-arago.inc"
> +
> +require ${LIBYANG_ARAGO}
> +
>  BBCLASSEXTEND = "native nativesdk"
> diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb b/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
> deleted file mode 100644
> index 3bea9bc2..00000000
> --- a/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
> +++ /dev/null
> @@ -1,45 +0,0 @@
> -SUMMARY = "YANG data modeling language library"
> -DESCRIPTION = "libyang is a YANG data modelling language parser and toolkit written (and providing API) in C."
> -HOMEPAGE = "https://github.com/CESNET/libyang"
> -SECTION = "libs"
> -LICENSE = "BSD-3-Clause"
> -
> -LIC_FILES_CHKSUM = "file://LICENSE;md5=9bb3d334294e8719f41c531e28a9a697"
> -
> -SRCREV = "03e294d83b610f89e8ba7b2156a80dc0ad534443"
> -
> -SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
> -           file://0001-test_context-skip-test-case-test_searchdirs.patch \
> -           file://run-ptest \
> -           "
> -
> -S = "${WORKDIR}/git"
> -
> -# Main dependencies
> -inherit cmake pkgconfig lib_package ptest multilib_header
> -DEPENDS = "libpcre2"
> -DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'cmocka', '', d)}"
> -
> -EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
> -EXTRA_OECMAKE += " ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF', '', d)}"
> -
> -do_compile:prepend () {
> -    if [ ${PTEST_ENABLED} = "1" ]; then
> -        sed -i -e 's|${S}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
> -        sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
> -    fi
> -}
> -
> -do_install:append () {
> -        oe_multilib_header  libyang/ly_config.h
> -}
> -
> -do_install_ptest () {
> -    install -d ${D}${PTEST_PATH}/tests
> -    cp -f ${B}/tests/utest_* ${D}${PTEST_PATH}/tests/
> -    cp -fR ${S}/tests/modules ${D}${PTEST_PATH}/tests/
> -    install -d ${D}${PTEST_PATH}/tests/plugins
> -    cp -f ${B}/tests/plugins/plugin_*.so ${D}${PTEST_PATH}/tests/plugins/
> -}
> -
> -FILES:${PN} += "${datadir}/yang/*"
> -- 
> 2.17.1
Ryan Eatmon Nov. 14, 2025, 12:53 a.m. UTC | #2
On 11/13/2025 5:09 PM, Denys Dmytriyenko wrote:
> On Thu, Nov 13, 2025 at 04:50:16PM -0600, Ryan Eatmon via lists.yoctoproject.org wrote:
>> Yocto Project Compatibility requires that including a layer in a build
>> not change recipes in other layers.  In this case, we were providing a
>> newer version of a recipe that another layer provides.
>>
>> The proper way of doing this is to create a bbappend and only change the
>> minimal things needed to perform your changes.  Additionally, to pass
>> the yocto-check-layer the bbappend needs to be wrapped in a manner that
>> only applies your changes in the event that you are making use of your
>> layer.  For Arago, that means only if we are building Arago.
> 
> Thanks for this descriptive commit message - it captures reasoning and a
> proper solution! It is a great example we can refer to in the future.
> 
> 
>> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
>> ---
>>   .../sysrepo/libyang-arago.inc                 |  9 ++++
>>   .../sysrepo/libyang_%.bbappend                |  5 +++
>>   .../recipes-extended/sysrepo/libyang_3.7.8.bb | 45 -------------------
>>   3 files changed, 14 insertions(+), 45 deletions(-)
>>   create mode 100644 meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
>>   delete mode 100644 meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
>>
>> diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc b/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
>> new file mode 100644
>> index 00000000..b76701a8
>> --- /dev/null
>> +++ b/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
>> @@ -0,0 +1,9 @@
>> +PV = "3.7.8"
>> +
>> +LIC_FILES_CHKSUM = "file://LICENSE;md5=9bb3d334294e8719f41c531e28a9a697"
> 
> May want to explicitly mention why the checksum is different vs. upstream.

Since this was just a repackaging of the existing recipe, I didn't think 
it was needed to list all that out.

> 
>> +SRCREV = "03e294d83b610f89e8ba7b2156a80dc0ad534443"
>> +
>> +do_install:append () {
>> +    oe_multilib_header  libyang/ly_config.h
>> +}
>> diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend b/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
>> index 608377e3..60d1258e 100644
>> --- a/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
>> +++ b/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
>> @@ -1 +1,6 @@
>> +LIBYANG_ARAGO = ""
>> +LIBYANG_ARAGO:arago = "libyang-arago.inc"
>> +
>> +require ${LIBYANG_ARAGO}
>> +
>>   BBCLASSEXTEND = "native nativesdk"
>> diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb b/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
>> deleted file mode 100644
>> index 3bea9bc2..00000000
>> --- a/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
>> +++ /dev/null
>> @@ -1,45 +0,0 @@
>> -SUMMARY = "YANG data modeling language library"
>> -DESCRIPTION = "libyang is a YANG data modelling language parser and toolkit written (and providing API) in C."
>> -HOMEPAGE = "https://github.com/CESNET/libyang"
>> -SECTION = "libs"
>> -LICENSE = "BSD-3-Clause"
>> -
>> -LIC_FILES_CHKSUM = "file://LICENSE;md5=9bb3d334294e8719f41c531e28a9a697"
>> -
>> -SRCREV = "03e294d83b610f89e8ba7b2156a80dc0ad534443"
>> -
>> -SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
>> -           file://0001-test_context-skip-test-case-test_searchdirs.patch \
>> -           file://run-ptest \
>> -           "
>> -
>> -S = "${WORKDIR}/git"
>> -
>> -# Main dependencies
>> -inherit cmake pkgconfig lib_package ptest multilib_header
>> -DEPENDS = "libpcre2"
>> -DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'cmocka', '', d)}"
>> -
>> -EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
>> -EXTRA_OECMAKE += " ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF', '', d)}"
>> -
>> -do_compile:prepend () {
>> -    if [ ${PTEST_ENABLED} = "1" ]; then
>> -        sed -i -e 's|${S}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
>> -        sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
>> -    fi
>> -}
>> -
>> -do_install:append () {
>> -        oe_multilib_header  libyang/ly_config.h
>> -}
>> -
>> -do_install_ptest () {
>> -    install -d ${D}${PTEST_PATH}/tests
>> -    cp -f ${B}/tests/utest_* ${D}${PTEST_PATH}/tests/
>> -    cp -fR ${S}/tests/modules ${D}${PTEST_PATH}/tests/
>> -    install -d ${D}${PTEST_PATH}/tests/plugins
>> -    cp -f ${B}/tests/plugins/plugin_*.so ${D}${PTEST_PATH}/tests/plugins/
>> -}
>> -
>> -FILES:${PN} += "${datadir}/yang/*"
>> -- 
>> 2.17.1
diff mbox series

Patch

diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc b/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
new file mode 100644
index 00000000..b76701a8
--- /dev/null
+++ b/meta-arago-extras/recipes-extended/sysrepo/libyang-arago.inc
@@ -0,0 +1,9 @@ 
+PV = "3.7.8"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=9bb3d334294e8719f41c531e28a9a697"
+
+SRCREV = "03e294d83b610f89e8ba7b2156a80dc0ad534443"
+
+do_install:append () {
+    oe_multilib_header  libyang/ly_config.h
+}
diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend b/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
index 608377e3..60d1258e 100644
--- a/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
+++ b/meta-arago-extras/recipes-extended/sysrepo/libyang_%.bbappend
@@ -1 +1,6 @@ 
+LIBYANG_ARAGO = ""
+LIBYANG_ARAGO:arago = "libyang-arago.inc"
+
+require ${LIBYANG_ARAGO}
+
 BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb b/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
deleted file mode 100644
index 3bea9bc2..00000000
--- a/meta-arago-extras/recipes-extended/sysrepo/libyang_3.7.8.bb
+++ /dev/null
@@ -1,45 +0,0 @@ 
-SUMMARY = "YANG data modeling language library"
-DESCRIPTION = "libyang is a YANG data modelling language parser and toolkit written (and providing API) in C."
-HOMEPAGE = "https://github.com/CESNET/libyang"
-SECTION = "libs"
-LICENSE = "BSD-3-Clause"
-
-LIC_FILES_CHKSUM = "file://LICENSE;md5=9bb3d334294e8719f41c531e28a9a697"
-
-SRCREV = "03e294d83b610f89e8ba7b2156a80dc0ad534443"
-
-SRC_URI = "git://github.com/CESNET/libyang.git;branch=master;protocol=https \
-           file://0001-test_context-skip-test-case-test_searchdirs.patch \
-           file://run-ptest \
-           "
-
-S = "${WORKDIR}/git"
-
-# Main dependencies
-inherit cmake pkgconfig lib_package ptest multilib_header
-DEPENDS = "libpcre2"
-DEPENDS += "${@bb.utils.contains('PTEST_ENABLED', '1', 'cmocka', '', d)}"
-
-EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
-EXTRA_OECMAKE += " ${@bb.utils.contains('PTEST_ENABLED', '1', '-DENABLE_TESTS=ON -DENABLE_VALGRIND_TESTS=OFF', '', d)}"
-
-do_compile:prepend () {
-    if [ ${PTEST_ENABLED} = "1" ]; then
-        sed -i -e 's|${S}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
-        sed -i -e 's|${B}|${PTEST_PATH}|g' ${B}/tests/tests_config.h
-    fi
-}
-
-do_install:append () {
-        oe_multilib_header  libyang/ly_config.h
-}
-
-do_install_ptest () {
-    install -d ${D}${PTEST_PATH}/tests
-    cp -f ${B}/tests/utest_* ${D}${PTEST_PATH}/tests/
-    cp -fR ${S}/tests/modules ${D}${PTEST_PATH}/tests/
-    install -d ${D}${PTEST_PATH}/tests/plugins
-    cp -f ${B}/tests/plugins/plugin_*.so ${D}${PTEST_PATH}/tests/plugins/
-}
-
-FILES:${PN} += "${datadir}/yang/*"