diff mbox series

rpm: Allow setting platform macro settings externally

Message ID 20230725135719.388231-1-zboszor@gmail.com
State New
Headers show
Series rpm: Allow setting platform macro settings externally | expand

Commit Message

Böszörményi Zoltán July 25, 2023, 1:57 p.m. UTC
Feed platform settings to installplatform externally. Based on the patch
submitted under https://github.com/rpm-software-management/rpm/pull/2579

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
 2 files changed, 73 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch

Comments

Alexander Kanavin July 25, 2023, 4:30 p.m. UTC | #1
I would want to hold this until we have a reaction from upstream.

RPM_CUSTOM_* exports should go to specific tasks where they are needed.

Alex

On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
>
> Feed platform settings to installplatform externally. Based on the patch
> submitted under https://github.com/rpm-software-management/rpm/pull/2579
>
> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
> ---
>  ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
>  meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
>  2 files changed, 73 insertions(+)
>  create mode 100644 meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>
> diff --git a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
> new file mode 100644
> index 0000000000..8b3220f114
> --- /dev/null
> +++ b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
> @@ -0,0 +1,56 @@
> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
> + <zboszor@gmail.com>
> +Date: Tue, 25 Jul 2023 10:56:44 +0200
> +Subject: [PATCH] Allow setting plaform macro settings externally
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +Yocto has their own way to set the platform names via BSPs
> +(Board Support Packages). These names are more specific than
> +basic CPU architectures, and such a platform name ends up in
> +/etc/rpm/platform but the corresponding subdirectory under
> +/usr/lib/rpm/platform does not exist.
> +
> +Allow creating such custom platform subdirectory with feeding
> +the necessary data using external variables: RPM_CUSTOM_ARCH,
> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
> +and RPM_CUSTOM_CANONCOLOR
> +
> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
> +---
> + installplatform | 9 ++++++++-
> + 1 file changed, 8 insertions(+), 1 deletion(-)
> +
> +diff --git a/installplatform b/installplatform
> +index a5ad7c5b8..59f57697b 100755
> +--- a/installplatform
> ++++ b/installplatform
> +@@ -11,7 +11,7 @@ VENDOR="${4}"
> + OS="${5}"
> + RPMRC_GNU="${6}"
> +
> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2` ${RPM_CUSTOM_ARCH:+custom}; do
> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
> +   case $RPMRC_OPTFLAGS in
> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
> +   CANONCOLOR=
> +   FILTER=cat
> +   case "${ARCH}" in
> ++    custom)
> ++      ARCH=$RPM_CUSTOM_ARCH
> ++      ISANAME=$RPM_CUSTOM_ISANAME
> ++      ISABITS=$RPM_CUSTOM_ISABITS
> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
> ++    ;;
> +     sparc64*)
> +       ISANAME=sparc
> +       ISABITS=64
> +--
> +2.41.0
> +
> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> index 95a9e92f96..bc036fc843 100644
> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> @@ -40,6 +40,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
>             file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
>             file://fix-declaration.patch \
>             file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
> +           file://0001-Allow-setting-plaform-macro-settings-externally.patch \
>             "
>
>  PE = "1"
> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
>     ${libdir}/rpm/rpmdeps \
>  "
>
> +def rpm_isaname(d):
> +    import re
> +    arch = d.getVar('TARGET_ARCH')
> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
> +        return "x86"
> +    # Add more platform tweaks for ISANAME as needed
> +    return arch
> +
> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib', '3', '0', d)}"
> +
>  do_configure:prepend() {
>          mkdir -p ${S}/build-aux
>  }
> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
>  do_install:append:class-target() {
>      rm -rf ${D}/var
>  }
> +
>  do_install:append:class-nativesdk() {
>      rm -rf ${D}${SDKPATHNATIVE}/var
>      # Ensure find-debuginfo is located correctly inside SDK
> --
> 2.41.0
>
Böszörményi Zoltán July 26, 2023, 5:51 a.m. UTC | #2
Sure, $SUBJECT should have been [RFC][PATCH].

Thanks.

2023. 07. 25. 18:30 keltezéssel, Alexander Kanavin írta:
> I would want to hold this until we have a reaction from upstream.
>
> RPM_CUSTOM_* exports should go to specific tasks where they are needed.
>
> Alex
>
> On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
>> Feed platform settings to installplatform externally. Based on the patch
>> submitted under https://github.com/rpm-software-management/rpm/pull/2579
>>
>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>> ---
>>   ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
>>   meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
>>   2 files changed, 73 insertions(+)
>>   create mode 100644 meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>
>> diff --git a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>> new file mode 100644
>> index 0000000000..8b3220f114
>> --- /dev/null
>> +++ b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>> @@ -0,0 +1,56 @@
>> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
>> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
>> + <zboszor@gmail.com>
>> +Date: Tue, 25 Jul 2023 10:56:44 +0200
>> +Subject: [PATCH] Allow setting plaform macro settings externally
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +Yocto has their own way to set the platform names via BSPs
>> +(Board Support Packages). These names are more specific than
>> +basic CPU architectures, and such a platform name ends up in
>> +/etc/rpm/platform but the corresponding subdirectory under
>> +/usr/lib/rpm/platform does not exist.
>> +
>> +Allow creating such custom platform subdirectory with feeding
>> +the necessary data using external variables: RPM_CUSTOM_ARCH,
>> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
>> +and RPM_CUSTOM_CANONCOLOR
>> +
>> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
>> +---
>> + installplatform | 9 ++++++++-
>> + 1 file changed, 8 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/installplatform b/installplatform
>> +index a5ad7c5b8..59f57697b 100755
>> +--- a/installplatform
>> ++++ b/installplatform
>> +@@ -11,7 +11,7 @@ VENDOR="${4}"
>> + OS="${5}"
>> + RPMRC_GNU="${6}"
>> +
>> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2` ${RPM_CUSTOM_ARCH:+custom}; do
>> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
>> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
>> +   case $RPMRC_OPTFLAGS in
>> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>> +   CANONCOLOR=
>> +   FILTER=cat
>> +   case "${ARCH}" in
>> ++    custom)
>> ++      ARCH=$RPM_CUSTOM_ARCH
>> ++      ISANAME=$RPM_CUSTOM_ISANAME
>> ++      ISABITS=$RPM_CUSTOM_ISABITS
>> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
>> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
>> ++    ;;
>> +     sparc64*)
>> +       ISANAME=sparc
>> +       ISABITS=64
>> +--
>> +2.41.0
>> +
>> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>> index 95a9e92f96..bc036fc843 100644
>> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>> @@ -40,6 +40,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
>>              file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
>>              file://fix-declaration.patch \
>>              file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
>> +           file://0001-Allow-setting-plaform-macro-settings-externally.patch \
>>              "
>>
>>   PE = "1"
>> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
>>      ${libdir}/rpm/rpmdeps \
>>   "
>>
>> +def rpm_isaname(d):
>> +    import re
>> +    arch = d.getVar('TARGET_ARCH')
>> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
>> +        return "x86"
>> +    # Add more platform tweaks for ISANAME as needed
>> +    return arch
>> +
>> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
>> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
>> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
>> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
>> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
>> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib', '3', '0', d)}"
>> +
>>   do_configure:prepend() {
>>           mkdir -p ${S}/build-aux
>>   }
>> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
>>   do_install:append:class-target() {
>>       rm -rf ${D}/var
>>   }
>> +
>>   do_install:append:class-nativesdk() {
>>       rm -rf ${D}${SDKPATHNATIVE}/var
>>       # Ensure find-debuginfo is located correctly inside SDK
>> --
>> 2.41.0
>>
Böszörményi Zoltán July 26, 2023, 1:05 p.m. UTC | #3
2023. 07. 25. 18:30 keltezéssel, Alexander Kanavin írta:
> I would want to hold this until we have a reaction from upstream.

Now we have reaction. Both PRs were closed because they were not
against master, my bad. Now reopened against master as
https://github.com/rpm-software-management/rpm/pull/2585

But there was some real comment here:
https://github.com/rpm-software-management/rpm/pull/2580#issuecomment-1651647277

The discussion may/should be taken to the issue at
https://github.com/rpm-software-management/rpm/issues/2578

> RPM_CUSTOM_* exports should go to specific tasks where they are needed.
>
> Alex
>
> On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
>> Feed platform settings to installplatform externally. Based on the patch
>> submitted under https://github.com/rpm-software-management/rpm/pull/2579
>>
>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>> ---
>>   ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
>>   meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
>>   2 files changed, 73 insertions(+)
>>   create mode 100644 meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>
>> diff --git a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>> new file mode 100644
>> index 0000000000..8b3220f114
>> --- /dev/null
>> +++ b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>> @@ -0,0 +1,56 @@
>> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
>> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
>> + <zboszor@gmail.com>
>> +Date: Tue, 25 Jul 2023 10:56:44 +0200
>> +Subject: [PATCH] Allow setting plaform macro settings externally
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +Yocto has their own way to set the platform names via BSPs
>> +(Board Support Packages). These names are more specific than
>> +basic CPU architectures, and such a platform name ends up in
>> +/etc/rpm/platform but the corresponding subdirectory under
>> +/usr/lib/rpm/platform does not exist.
>> +
>> +Allow creating such custom platform subdirectory with feeding
>> +the necessary data using external variables: RPM_CUSTOM_ARCH,
>> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
>> +and RPM_CUSTOM_CANONCOLOR
>> +
>> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
>> +---
>> + installplatform | 9 ++++++++-
>> + 1 file changed, 8 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/installplatform b/installplatform
>> +index a5ad7c5b8..59f57697b 100755
>> +--- a/installplatform
>> ++++ b/installplatform
>> +@@ -11,7 +11,7 @@ VENDOR="${4}"
>> + OS="${5}"
>> + RPMRC_GNU="${6}"
>> +
>> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2` ${RPM_CUSTOM_ARCH:+custom}; do
>> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
>> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
>> +   case $RPMRC_OPTFLAGS in
>> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>> +   CANONCOLOR=
>> +   FILTER=cat
>> +   case "${ARCH}" in
>> ++    custom)
>> ++      ARCH=$RPM_CUSTOM_ARCH
>> ++      ISANAME=$RPM_CUSTOM_ISANAME
>> ++      ISABITS=$RPM_CUSTOM_ISABITS
>> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
>> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
>> ++    ;;
>> +     sparc64*)
>> +       ISANAME=sparc
>> +       ISABITS=64
>> +--
>> +2.41.0
>> +
>> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>> index 95a9e92f96..bc036fc843 100644
>> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>> @@ -40,6 +40,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
>>              file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
>>              file://fix-declaration.patch \
>>              file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
>> +           file://0001-Allow-setting-plaform-macro-settings-externally.patch \
>>              "
>>
>>   PE = "1"
>> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
>>      ${libdir}/rpm/rpmdeps \
>>   "
>>
>> +def rpm_isaname(d):
>> +    import re
>> +    arch = d.getVar('TARGET_ARCH')
>> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
>> +        return "x86"
>> +    # Add more platform tweaks for ISANAME as needed
>> +    return arch
>> +
>> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
>> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
>> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
>> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
>> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
>> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib', '3', '0', d)}"
>> +
>>   do_configure:prepend() {
>>           mkdir -p ${S}/build-aux
>>   }
>> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
>>   do_install:append:class-target() {
>>       rm -rf ${D}/var
>>   }
>> +
>>   do_install:append:class-nativesdk() {
>>       rm -rf ${D}${SDKPATHNATIVE}/var
>>       # Ensure find-debuginfo is located correctly inside SDK
>> --
>> 2.41.0
>>
Böszörményi Zoltán July 27, 2023, 7:32 a.m. UTC | #4
Patch approved with the requested changes.

I sent a v2 with using the approved patch and adding
the exports only to do_install:class-target because
that's where it's needed.

2023. 07. 26. 15:05 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 07. 25. 18:30 keltezéssel, Alexander Kanavin írta:
>> I would want to hold this until we have a reaction from upstream.
>
> Now we have reaction. Both PRs were closed because they were not
> against master, my bad. Now reopened against master as
> https://github.com/rpm-software-management/rpm/pull/2585
>
> But there was some real comment here:
> https://github.com/rpm-software-management/rpm/pull/2580#issuecomment-1651647277
>
> The discussion may/should be taken to the issue at
> https://github.com/rpm-software-management/rpm/issues/2578
>
>> RPM_CUSTOM_* exports should go to specific tasks where they are needed.
>>
>> Alex
>>
>> On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
>>> Feed platform settings to installplatform externally. Based on the patch
>>> submitted under https://github.com/rpm-software-management/rpm/pull/2579
>>>
>>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>>> ---
>>>   ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
>>>   meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
>>>   2 files changed, 73 insertions(+)
>>>   create mode 100644 
>>> meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>
>>> diff --git 
>>> a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch 
>>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch 
>>>
>>> new file mode 100644
>>> index 0000000000..8b3220f114
>>> --- /dev/null
>>> +++ 
>>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>> @@ -0,0 +1,56 @@
>>> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
>>> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
>>> + <zboszor@gmail.com>
>>> +Date: Tue, 25 Jul 2023 10:56:44 +0200
>>> +Subject: [PATCH] Allow setting plaform macro settings externally
>>> +MIME-Version: 1.0
>>> +Content-Type: text/plain; charset=UTF-8
>>> +Content-Transfer-Encoding: 8bit
>>> +
>>> +Yocto has their own way to set the platform names via BSPs
>>> +(Board Support Packages). These names are more specific than
>>> +basic CPU architectures, and such a platform name ends up in
>>> +/etc/rpm/platform but the corresponding subdirectory under
>>> +/usr/lib/rpm/platform does not exist.
>>> +
>>> +Allow creating such custom platform subdirectory with feeding
>>> +the necessary data using external variables: RPM_CUSTOM_ARCH,
>>> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
>>> +and RPM_CUSTOM_CANONCOLOR
>>> +
>>> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>>> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
>>> +---
>>> + installplatform | 9 ++++++++-
>>> + 1 file changed, 8 insertions(+), 1 deletion(-)
>>> +
>>> +diff --git a/installplatform b/installplatform
>>> +index a5ad7c5b8..59f57697b 100755
>>> +--- a/installplatform
>>> ++++ b/installplatform
>>> +@@ -11,7 +11,7 @@ VENDOR="${4}"
>>> + OS="${5}"
>>> + RPMRC_GNU="${6}"
>>> +
>>> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>>> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2` 
>>> ${RPM_CUSTOM_ARCH:+custom}; do
>>> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
>>> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
>>> +   case $RPMRC_OPTFLAGS in
>>> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>>> +   CANONCOLOR=
>>> +   FILTER=cat
>>> +   case "${ARCH}" in
>>> ++    custom)
>>> ++      ARCH=$RPM_CUSTOM_ARCH
>>> ++      ISANAME=$RPM_CUSTOM_ISANAME
>>> ++      ISABITS=$RPM_CUSTOM_ISABITS
>>> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
>>> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
>>> ++    ;;
>>> +     sparc64*)
>>> +       ISANAME=sparc
>>> +       ISABITS=64
>>> +--
>>> +2.41.0
>>> +
>>> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb 
>>> b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>> index 95a9e92f96..bc036fc843 100644
>>> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>> @@ -40,6 +40,7 @@ SRC_URI = 
>>> "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
>>> file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
>>>              file://fix-declaration.patch \
>>> file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
>>> + file://0001-Allow-setting-plaform-macro-settings-externally.patch \
>>>              "
>>>
>>>   PE = "1"
>>> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
>>>      ${libdir}/rpm/rpmdeps \
>>>   "
>>>
>>> +def rpm_isaname(d):
>>> +    import re
>>> +    arch = d.getVar('TARGET_ARCH')
>>> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
>>> +        return "x86"
>>> +    # Add more platform tweaks for ISANAME as needed
>>> +    return arch
>>> +
>>> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
>>> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
>>> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
>>> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
>>> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
>>> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib', 
>>> '3', '0', d)}"
>>> +
>>>   do_configure:prepend() {
>>>           mkdir -p ${S}/build-aux
>>>   }
>>> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
>>>   do_install:append:class-target() {
>>>       rm -rf ${D}/var
>>>   }
>>> +
>>>   do_install:append:class-nativesdk() {
>>>       rm -rf ${D}${SDKPATHNATIVE}/var
>>>       # Ensure find-debuginfo is located correctly inside SDK
>>> -- 
>>> 2.41.0
>>>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#184883): https://lists.openembedded.org/g/openembedded-core/message/184883
> Mute This Topic: https://lists.openembedded.org/mt/100350661/3617728
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin July 27, 2023, 8:30 a.m. UTC | #5
I was hoping to get a reaction from Panu (who's the maintainer; Neal
is a contributor), but then I remembered he's a Finn, and this time of
the year all Finns disappear into summer cabins - temperatures above
+20 are still rare in that country, and actual sun in the sky is even
more precious :)

So I'm slightly torn: I don't have anything against the patch, I just
don't want to carry (and maintain) something that upstream rejected.
We've had plenty of such incidents with rpm in the past.

Alex

On Thu, 27 Jul 2023 at 09:32, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>
> Patch approved with the requested changes.
>
> I sent a v2 with using the approved patch and adding
> the exports only to do_install:class-target because
> that's where it's needed.
>
> 2023. 07. 26. 15:05 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> > 2023. 07. 25. 18:30 keltezéssel, Alexander Kanavin írta:
> >> I would want to hold this until we have a reaction from upstream.
> >
> > Now we have reaction. Both PRs were closed because they were not
> > against master, my bad. Now reopened against master as
> > https://github.com/rpm-software-management/rpm/pull/2585
> >
> > But there was some real comment here:
> > https://github.com/rpm-software-management/rpm/pull/2580#issuecomment-1651647277
> >
> > The discussion may/should be taken to the issue at
> > https://github.com/rpm-software-management/rpm/issues/2578
> >
> >> RPM_CUSTOM_* exports should go to specific tasks where they are needed.
> >>
> >> Alex
> >>
> >> On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
> >>> Feed platform settings to installplatform externally. Based on the patch
> >>> submitted under https://github.com/rpm-software-management/rpm/pull/2579
> >>>
> >>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
> >>> ---
> >>>   ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
> >>>   meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
> >>>   2 files changed, 73 insertions(+)
> >>>   create mode 100644
> >>> meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
> >>>
> >>> diff --git
> >>> a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
> >>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
> >>>
> >>> new file mode 100644
> >>> index 0000000000..8b3220f114
> >>> --- /dev/null
> >>> +++
> >>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
> >>> @@ -0,0 +1,56 @@
> >>> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
> >>> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
> >>> + <zboszor@gmail.com>
> >>> +Date: Tue, 25 Jul 2023 10:56:44 +0200
> >>> +Subject: [PATCH] Allow setting plaform macro settings externally
> >>> +MIME-Version: 1.0
> >>> +Content-Type: text/plain; charset=UTF-8
> >>> +Content-Transfer-Encoding: 8bit
> >>> +
> >>> +Yocto has their own way to set the platform names via BSPs
> >>> +(Board Support Packages). These names are more specific than
> >>> +basic CPU architectures, and such a platform name ends up in
> >>> +/etc/rpm/platform but the corresponding subdirectory under
> >>> +/usr/lib/rpm/platform does not exist.
> >>> +
> >>> +Allow creating such custom platform subdirectory with feeding
> >>> +the necessary data using external variables: RPM_CUSTOM_ARCH,
> >>> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
> >>> +and RPM_CUSTOM_CANONCOLOR
> >>> +
> >>> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
> >>> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
> >>> +---
> >>> + installplatform | 9 ++++++++-
> >>> + 1 file changed, 8 insertions(+), 1 deletion(-)
> >>> +
> >>> +diff --git a/installplatform b/installplatform
> >>> +index a5ad7c5b8..59f57697b 100755
> >>> +--- a/installplatform
> >>> ++++ b/installplatform
> >>> +@@ -11,7 +11,7 @@ VENDOR="${4}"
> >>> + OS="${5}"
> >>> + RPMRC_GNU="${6}"
> >>> +
> >>> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
> >>> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`
> >>> ${RPM_CUSTOM_ARCH:+custom}; do
> >>> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
> >>> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
> >>> +   case $RPMRC_OPTFLAGS in
> >>> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
> >>> +   CANONCOLOR=
> >>> +   FILTER=cat
> >>> +   case "${ARCH}" in
> >>> ++    custom)
> >>> ++      ARCH=$RPM_CUSTOM_ARCH
> >>> ++      ISANAME=$RPM_CUSTOM_ISANAME
> >>> ++      ISABITS=$RPM_CUSTOM_ISABITS
> >>> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
> >>> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
> >>> ++    ;;
> >>> +     sparc64*)
> >>> +       ISANAME=sparc
> >>> +       ISABITS=64
> >>> +--
> >>> +2.41.0
> >>> +
> >>> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> >>> b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> >>> index 95a9e92f96..bc036fc843 100644
> >>> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> >>> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
> >>> @@ -40,6 +40,7 @@ SRC_URI =
> >>> "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
> >>> file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
> >>>              file://fix-declaration.patch \
> >>> file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
> >>> + file://0001-Allow-setting-plaform-macro-settings-externally.patch \
> >>>              "
> >>>
> >>>   PE = "1"
> >>> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
> >>>      ${libdir}/rpm/rpmdeps \
> >>>   "
> >>>
> >>> +def rpm_isaname(d):
> >>> +    import re
> >>> +    arch = d.getVar('TARGET_ARCH')
> >>> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
> >>> +        return "x86"
> >>> +    # Add more platform tweaks for ISANAME as needed
> >>> +    return arch
> >>> +
> >>> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
> >>> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
> >>> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
> >>> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
> >>> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
> >>> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib',
> >>> '3', '0', d)}"
> >>> +
> >>>   do_configure:prepend() {
> >>>           mkdir -p ${S}/build-aux
> >>>   }
> >>> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
> >>>   do_install:append:class-target() {
> >>>       rm -rf ${D}/var
> >>>   }
> >>> +
> >>>   do_install:append:class-nativesdk() {
> >>>       rm -rf ${D}${SDKPATHNATIVE}/var
> >>>       # Ensure find-debuginfo is located correctly inside SDK
> >>> --
> >>> 2.41.0
> >>>
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#184883): https://lists.openembedded.org/g/openembedded-core/message/184883
> > Mute This Topic: https://lists.openembedded.org/mt/100350661/3617728
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
>
Böszörményi Zoltán July 27, 2023, 8:39 a.m. UTC | #6
2023. 07. 27. 10:30 keltezéssel, Alexander Kanavin írta:
> I was hoping to get a reaction from Panu (who's the maintainer; Neal
> is a contributor), but then I remembered he's a Finn, and this time of
> the year all Finns disappear into summer cabins - temperatures above
> +20 are still rare in that country, and actual sun in the sky is even
> more precious :)

:-)

> So I'm slightly torn: I don't have anything against the patch, I just
> don't want to carry (and maintain) something that upstream rejected.
> We've had plenty of such incidents with rpm in the past.

No problem. I can carry the patch and recipe change internally in
bbappend form until it's decided. Apparently, it's only me where
the use case to need rpmbuild on a target machine ever occurred.

Thanks.

>
> Alex
>
> On Thu, 27 Jul 2023 at 09:32, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>> Patch approved with the requested changes.
>>
>> I sent a v2 with using the approved patch and adding
>> the exports only to do_install:class-target because
>> that's where it's needed.
>>
>> 2023. 07. 26. 15:05 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
>>> 2023. 07. 25. 18:30 keltezéssel, Alexander Kanavin írta:
>>>> I would want to hold this until we have a reaction from upstream.
>>> Now we have reaction. Both PRs were closed because they were not
>>> against master, my bad. Now reopened against master as
>>> https://github.com/rpm-software-management/rpm/pull/2585
>>>
>>> But there was some real comment here:
>>> https://github.com/rpm-software-management/rpm/pull/2580#issuecomment-1651647277
>>>
>>> The discussion may/should be taken to the issue at
>>> https://github.com/rpm-software-management/rpm/issues/2578
>>>
>>>> RPM_CUSTOM_* exports should go to specific tasks where they are needed.
>>>>
>>>> Alex
>>>>
>>>> On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
>>>>> Feed platform settings to installplatform externally. Based on the patch
>>>>> submitted under https://github.com/rpm-software-management/rpm/pull/2579
>>>>>
>>>>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>>>>> ---
>>>>>    ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
>>>>>    meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
>>>>>    2 files changed, 73 insertions(+)
>>>>>    create mode 100644
>>>>> meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>>
>>>>> diff --git
>>>>> a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>>
>>>>> new file mode 100644
>>>>> index 0000000000..8b3220f114
>>>>> --- /dev/null
>>>>> +++
>>>>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>> @@ -0,0 +1,56 @@
>>>>> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
>>>>> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
>>>>> + <zboszor@gmail.com>
>>>>> +Date: Tue, 25 Jul 2023 10:56:44 +0200
>>>>> +Subject: [PATCH] Allow setting plaform macro settings externally
>>>>> +MIME-Version: 1.0
>>>>> +Content-Type: text/plain; charset=UTF-8
>>>>> +Content-Transfer-Encoding: 8bit
>>>>> +
>>>>> +Yocto has their own way to set the platform names via BSPs
>>>>> +(Board Support Packages). These names are more specific than
>>>>> +basic CPU architectures, and such a platform name ends up in
>>>>> +/etc/rpm/platform but the corresponding subdirectory under
>>>>> +/usr/lib/rpm/platform does not exist.
>>>>> +
>>>>> +Allow creating such custom platform subdirectory with feeding
>>>>> +the necessary data using external variables: RPM_CUSTOM_ARCH,
>>>>> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
>>>>> +and RPM_CUSTOM_CANONCOLOR
>>>>> +
>>>>> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>>>>> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
>>>>> +---
>>>>> + installplatform | 9 ++++++++-
>>>>> + 1 file changed, 8 insertions(+), 1 deletion(-)
>>>>> +
>>>>> +diff --git a/installplatform b/installplatform
>>>>> +index a5ad7c5b8..59f57697b 100755
>>>>> +--- a/installplatform
>>>>> ++++ b/installplatform
>>>>> +@@ -11,7 +11,7 @@ VENDOR="${4}"
>>>>> + OS="${5}"
>>>>> + RPMRC_GNU="${6}"
>>>>> +
>>>>> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>>>>> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`
>>>>> ${RPM_CUSTOM_ARCH:+custom}; do
>>>>> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
>>>>> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
>>>>> +   case $RPMRC_OPTFLAGS in
>>>>> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>>>>> +   CANONCOLOR=
>>>>> +   FILTER=cat
>>>>> +   case "${ARCH}" in
>>>>> ++    custom)
>>>>> ++      ARCH=$RPM_CUSTOM_ARCH
>>>>> ++      ISANAME=$RPM_CUSTOM_ISANAME
>>>>> ++      ISABITS=$RPM_CUSTOM_ISABITS
>>>>> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
>>>>> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
>>>>> ++    ;;
>>>>> +     sparc64*)
>>>>> +       ISANAME=sparc
>>>>> +       ISABITS=64
>>>>> +--
>>>>> +2.41.0
>>>>> +
>>>>> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> index 95a9e92f96..bc036fc843 100644
>>>>> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> @@ -40,6 +40,7 @@ SRC_URI =
>>>>> "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
>>>>> file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
>>>>>               file://fix-declaration.patch \
>>>>> file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
>>>>> + file://0001-Allow-setting-plaform-macro-settings-externally.patch \
>>>>>               "
>>>>>
>>>>>    PE = "1"
>>>>> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
>>>>>       ${libdir}/rpm/rpmdeps \
>>>>>    "
>>>>>
>>>>> +def rpm_isaname(d):
>>>>> +    import re
>>>>> +    arch = d.getVar('TARGET_ARCH')
>>>>> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
>>>>> +        return "x86"
>>>>> +    # Add more platform tweaks for ISANAME as needed
>>>>> +    return arch
>>>>> +
>>>>> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
>>>>> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
>>>>> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
>>>>> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
>>>>> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
>>>>> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib',
>>>>> '3', '0', d)}"
>>>>> +
>>>>>    do_configure:prepend() {
>>>>>            mkdir -p ${S}/build-aux
>>>>>    }
>>>>> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
>>>>>    do_install:append:class-target() {
>>>>>        rm -rf ${D}/var
>>>>>    }
>>>>> +
>>>>>    do_install:append:class-nativesdk() {
>>>>>        rm -rf ${D}${SDKPATHNATIVE}/var
>>>>>        # Ensure find-debuginfo is located correctly inside SDK
>>>>> --
>>>>> 2.41.0
>>>>>
>>>
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>> Links: You receive all messages sent to this group.
>>> View/Reply Online (#184883): https://lists.openembedded.org/g/openembedded-core/message/184883
>>> Mute This Topic: https://lists.openembedded.org/mt/100350661/3617728
>>> Group Owner: openembedded-core+owner@lists.openembedded.org
>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>
Böszörményi Zoltán July 28, 2023, 12:12 p.m. UTC | #7
2023. 07. 27. 10:30 keltezéssel, Alexander Kanavin írta:
> I was hoping to get a reaction from Panu (who's the maintainer; Neal
> is a contributor), but then I remembered he's a Finn, and this time of
> the year all Finns disappear into summer cabins - temperatures above
> +20 are still rare in that country, and actual sun in the sky is even
> more precious :)
>
> So I'm slightly torn: I don't have anything against the patch, I just
> don't want to carry (and maintain) something that upstream rejected.
> We've had plenty of such incidents with rpm in the past.

Fanfare... my RPM PR was merged.
https://github.com/rpm-software-management/rpm/pull/2585

Neal slightly modified the INSTALL text, though.
Should I send an update after v3, or you can work with that?

Thanks.

>
> Alex
>
> On Thu, 27 Jul 2023 at 09:32, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>> Patch approved with the requested changes.
>>
>> I sent a v2 with using the approved patch and adding
>> the exports only to do_install:class-target because
>> that's where it's needed.
>>
>> 2023. 07. 26. 15:05 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
>>> 2023. 07. 25. 18:30 keltezéssel, Alexander Kanavin írta:
>>>> I would want to hold this until we have a reaction from upstream.
>>> Now we have reaction. Both PRs were closed because they were not
>>> against master, my bad. Now reopened against master as
>>> https://github.com/rpm-software-management/rpm/pull/2585
>>>
>>> But there was some real comment here:
>>> https://github.com/rpm-software-management/rpm/pull/2580#issuecomment-1651647277
>>>
>>> The discussion may/should be taken to the issue at
>>> https://github.com/rpm-software-management/rpm/issues/2578
>>>
>>>> RPM_CUSTOM_* exports should go to specific tasks where they are needed.
>>>>
>>>> Alex
>>>>
>>>> On Tue, 25 Jul 2023 at 15:57, Zoltán Böszörményi <zboszor@gmail.com> wrote:
>>>>> Feed platform settings to installplatform externally. Based on the patch
>>>>> submitted under https://github.com/rpm-software-management/rpm/pull/2579
>>>>>
>>>>> Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>>>>> ---
>>>>>    ...ng-plaform-macro-settings-externally.patch | 56 +++++++++++++++++++
>>>>>    meta/recipes-devtools/rpm/rpm_4.18.1.bb       | 17 ++++++
>>>>>    2 files changed, 73 insertions(+)
>>>>>    create mode 100644
>>>>> meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>>
>>>>> diff --git
>>>>> a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>>
>>>>> new file mode 100644
>>>>> index 0000000000..8b3220f114
>>>>> --- /dev/null
>>>>> +++
>>>>> b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
>>>>> @@ -0,0 +1,56 @@
>>>>> +From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
>>>>> +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
>>>>> + <zboszor@gmail.com>
>>>>> +Date: Tue, 25 Jul 2023 10:56:44 +0200
>>>>> +Subject: [PATCH] Allow setting plaform macro settings externally
>>>>> +MIME-Version: 1.0
>>>>> +Content-Type: text/plain; charset=UTF-8
>>>>> +Content-Transfer-Encoding: 8bit
>>>>> +
>>>>> +Yocto has their own way to set the platform names via BSPs
>>>>> +(Board Support Packages). These names are more specific than
>>>>> +basic CPU architectures, and such a platform name ends up in
>>>>> +/etc/rpm/platform but the corresponding subdirectory under
>>>>> +/usr/lib/rpm/platform does not exist.
>>>>> +
>>>>> +Allow creating such custom platform subdirectory with feeding
>>>>> +the necessary data using external variables: RPM_CUSTOM_ARCH,
>>>>> +RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
>>>>> +and RPM_CUSTOM_CANONCOLOR
>>>>> +
>>>>> +Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
>>>>> +Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
>>>>> +---
>>>>> + installplatform | 9 ++++++++-
>>>>> + 1 file changed, 8 insertions(+), 1 deletion(-)
>>>>> +
>>>>> +diff --git a/installplatform b/installplatform
>>>>> +index a5ad7c5b8..59f57697b 100755
>>>>> +--- a/installplatform
>>>>> ++++ b/installplatform
>>>>> +@@ -11,7 +11,7 @@ VENDOR="${4}"
>>>>> + OS="${5}"
>>>>> + RPMRC_GNU="${6}"
>>>>> +
>>>>> +-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>>>>> ++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`
>>>>> ${RPM_CUSTOM_ARCH:+custom}; do
>>>>> +   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
>>>>> +   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
>>>>> +   case $RPMRC_OPTFLAGS in
>>>>> +@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
>>>>> +   CANONCOLOR=
>>>>> +   FILTER=cat
>>>>> +   case "${ARCH}" in
>>>>> ++    custom)
>>>>> ++      ARCH=$RPM_CUSTOM_ARCH
>>>>> ++      ISANAME=$RPM_CUSTOM_ISANAME
>>>>> ++      ISABITS=$RPM_CUSTOM_ISABITS
>>>>> ++      CANONARCH=$RPM_CUSTOM_CANONARCH
>>>>> ++      CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
>>>>> ++    ;;
>>>>> +     sparc64*)
>>>>> +       ISANAME=sparc
>>>>> +       ISABITS=64
>>>>> +--
>>>>> +2.41.0
>>>>> +
>>>>> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> index 95a9e92f96..bc036fc843 100644
>>>>> --- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> +++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
>>>>> @@ -40,6 +40,7 @@ SRC_URI =
>>>>> "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
>>>>> file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
>>>>>               file://fix-declaration.patch \
>>>>> file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
>>>>> + file://0001-Allow-setting-plaform-macro-settings-externally.patch \
>>>>>               "
>>>>>
>>>>>    PE = "1"
>>>>> @@ -103,6 +104,21 @@ WRAPPER_TOOLS = " \
>>>>>       ${libdir}/rpm/rpmdeps \
>>>>>    "
>>>>>
>>>>> +def rpm_isaname(d):
>>>>> +    import re
>>>>> +    arch = d.getVar('TARGET_ARCH')
>>>>> +    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
>>>>> +        return "x86"
>>>>> +    # Add more platform tweaks for ISANAME as needed
>>>>> +    return arch
>>>>> +
>>>>> +export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
>>>>> +export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
>>>>> +export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
>>>>> +export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
>>>>> +# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
>>>>> +export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib',
>>>>> '3', '0', d)}"
>>>>> +
>>>>>    do_configure:prepend() {
>>>>>            mkdir -p ${S}/build-aux
>>>>>    }
>>>>> @@ -132,6 +148,7 @@ do_install:append:class-nativesdk() {
>>>>>    do_install:append:class-target() {
>>>>>        rm -rf ${D}/var
>>>>>    }
>>>>> +
>>>>>    do_install:append:class-nativesdk() {
>>>>>        rm -rf ${D}${SDKPATHNATIVE}/var
>>>>>        # Ensure find-debuginfo is located correctly inside SDK
>>>>> --
>>>>> 2.41.0
>>>>>
>>>
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>> Links: You receive all messages sent to this group.
>>> View/Reply Online (#184883): https://lists.openembedded.org/g/openembedded-core/message/184883
>>> Mute This Topic: https://lists.openembedded.org/mt/100350661/3617728
>>> Group Owner: openembedded-core+owner@lists.openembedded.org
>>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [zboszor@gmail.com]
>>> -=-=-=-=-=-=-=-=-=-=-=-
>>>
Alexander Kanavin July 28, 2023, 1:01 p.m. UTC | #8
On Fri, 28 Jul 2023 at 14:12, Böszörményi Zoltán <zboszor@gmail.com> wrote:
> Fanfare... my RPM PR was merged.
> https://github.com/rpm-software-management/rpm/pull/2585
>
> Neal slightly modified the INSTALL text, though.
> Should I send an update after v3, or you can work with that?

You can do a partial backport, trimming out the INSTALL modifications.
It's best to otherwise submit the patch exactly as merged, so that it
can be dropped by git rebase in automated version updates (or at least
there's a higher chance of avoiding rebase conflicts that need manual
intervention).

Alex
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
new file mode 100644
index 0000000000..8b3220f114
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0001-Allow-setting-plaform-macro-settings-externally.patch
@@ -0,0 +1,56 @@ 
+From 320f4f3861dad70342f065004311eac143d6522d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?=
+ <zboszor@gmail.com>
+Date: Tue, 25 Jul 2023 10:56:44 +0200
+Subject: [PATCH] Allow setting plaform macro settings externally
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Yocto has their own way to set the platform names via BSPs
+(Board Support Packages). These names are more specific than
+basic CPU architectures, and such a platform name ends up in
+/etc/rpm/platform but the corresponding subdirectory under
+/usr/lib/rpm/platform does not exist.
+
+Allow creating such custom platform subdirectory with feeding
+the necessary data using external variables: RPM_CUSTOM_ARCH,
+RPM_CUSTOM_ISANAME, RPM_CUSTOM_ISABITS, RPM_CUSTOM_CANONARCH
+and RPM_CUSTOM_CANONCOLOR
+
+Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
+Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/2579]
+---
+ installplatform | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/installplatform b/installplatform
+index a5ad7c5b8..59f57697b 100755
+--- a/installplatform
++++ b/installplatform
+@@ -11,7 +11,7 @@ VENDOR="${4}"
+ OS="${5}"
+ RPMRC_GNU="${6}"
+ 
+-for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
++for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2` ${RPM_CUSTOM_ARCH:+custom}; do
+   RPMRC_OPTFLAGS="`sed -n 's/^optflags: '$ARCH' //p' $RPMRC`"
+   RPMRC_OPTFLAGS="`echo $RPMRC_OPTFLAGS | sed -e 's, ,\ ,g'`"
+   case $RPMRC_OPTFLAGS in
+@@ -30,6 +30,13 @@ for ARCH in noarch `grep ^arch_canon $RPMRC | cut -d: -f2`; do
+   CANONCOLOR=
+   FILTER=cat
+   case "${ARCH}" in
++    custom)
++	ARCH=$RPM_CUSTOM_ARCH
++	ISANAME=$RPM_CUSTOM_ISANAME
++	ISABITS=$RPM_CUSTOM_ISABITS
++	CANONARCH=$RPM_CUSTOM_CANONARCH
++	CANONCOLOR=$RPM_CUSTOM_CANONCOLOR
++    ;;
+     sparc64*) 
+ 	ISANAME=sparc
+ 	ISABITS=64
+-- 
+2.41.0
+
diff --git a/meta/recipes-devtools/rpm/rpm_4.18.1.bb b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
index 95a9e92f96..bc036fc843 100644
--- a/meta/recipes-devtools/rpm/rpm_4.18.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.18.1.bb
@@ -40,6 +40,7 @@  SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protoc
            file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
            file://fix-declaration.patch \
            file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
+           file://0001-Allow-setting-plaform-macro-settings-externally.patch \
            "
 
 PE = "1"
@@ -103,6 +104,21 @@  WRAPPER_TOOLS = " \
    ${libdir}/rpm/rpmdeps \
 "
 
+def rpm_isaname(d):
+    import re
+    arch = d.getVar('TARGET_ARCH')
+    if re.match("^i.86$", arch) or re.match("^x86.*64$", arch):
+        return "x86"
+    # Add more platform tweaks for ISANAME as needed
+    return arch
+
+export RPM_CUSTOM_ARCH = "${MACHINE_ARCH}"
+export RPM_CUSTOM_ISANAME = "${@rpm_isaname(d)}"
+export RPM_CUSTOM_ISABITS = "${SITEINFO_BITS}"
+export RPM_CUSTOM_CANONARCH = "${TARGET_ARCH}"
+# CANONCOLOR determines whether /usr/lib or /usr/lib64 is used for a 64-bit platform
+export RPM_CUSTOM_CANONCOLOR = "${@bb.utils.contains('DISTRO_FEATURES', 'multilib', '3', '0', d)}"
+
 do_configure:prepend() {
         mkdir -p ${S}/build-aux
 }
@@ -132,6 +148,7 @@  do_install:append:class-nativesdk() {
 do_install:append:class-target() {
     rm -rf ${D}/var
 }
+
 do_install:append:class-nativesdk() {
     rm -rf ${D}${SDKPATHNATIVE}/var
     # Ensure find-debuginfo is located correctly inside SDK