Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-10 Thread Alexander Kanavin
On Tue, 10 Sep 2019 at 13:56, Zheng, Ruoqin 
wrote:

> 3. Actually, my first plan  is to write ${MACHINE_ARCH} in toolchain, but
> it was rejected
>
> +++ b/meta/classes/toolchain-scripts.bbclass
>
> @@ -101,6 +101,7 @@ toolchain_shared_env_script () {
>
> echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script
>
> echo 'export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"' >> $script
>
> echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
>
> +   echo 'export MACHINE_ARCH=${MACHINE_ARCH}' >> $script
>
> echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script
>
>
>
> I guess if it can work, maybe post-relocate-setup.d/ facility will be
> usefull.
>

What I would like to avoid is placing rpm-specific things into SDK recipes
that have nothing to do with rpm. So please investigate
post-relocate-setup.d/, and if it is not good enough, we can perhaps extend
it.

Alex
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-10 Thread Zheng, Ruoqin
Hi Alex

->You probably need to use the post-relocate-setup.d/ facility, like the 
nativesdk-meson recipe does. I am not sure if ->PACKAGE_ARCHS is accessible 
from it, but it does seem like the right mechanism for tweaking settings that 
are ->specific to nativesdk packages.


1.   About ${PACKAGE_ARCHS}
Well, for nativesdk packages ${PACKAGE_ARCHS} is accessible from 
nativesdk.bbclass, and it equals
PACKAGE_ARCHS = "${SDK_PACKAGE_ARCHS}"
SDK_PACKAGE_ARCHS = "all any noarch ${SDK_ARCH}-${SDKPKGSUFFIX}"
Which will not be changed for different ARCH.

While target packages ${PACKAGE_ARCHS} is accessible from base.bbclass, and the 
value is suitable for different ARCH.

2. About post-relocate-setup.d

And  usually, tweaking settings are specific to nativesdk packages. But Even if 
I use the post-relocate-setup.d/ facility, as the value of ${MACHINE_ARCH} is 
not provided in SDK, so it will not work for target packages.

To skip it, I have to write arch info in config file explicitly for different 
target ARCH as only meta-environment has a similar implementation.

3. Actually, my first plan  is to write ${MACHINE_ARCH} in toolchain, but it 
was rejected
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -101,6 +101,7 @@ toolchain_shared_env_script () {
echo 'export CPPFLAGS="${TARGET_CPPFLAGS}"' >> $script
echo 'export KCFLAGS="--sysroot=$SDKTARGETSYSROOT"' >> $script
echo 'export OECORE_DISTRO_VERSION="${DISTRO_VERSION}"' >> $script
+   echo 'export MACHINE_ARCH=${MACHINE_ARCH}' >> $script
echo 'export OECORE_SDK_VERSION="${SDK_VERSION}"' >> $script

I guess if it can work, maybe post-relocate-setup.d/ facility will be usefull.

--
Zheng Ruoqin
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
   Nanjing, 210012, China
MAIL : zhengrq.f...@cn.fujistu.com

From: Alexander Kanavin [mailto:alex.kana...@gmail.com]
Sent: Tuesday, September 10, 2019 6:53 PM
To: Zheng, Ruoqin/郑 若钦 
Cc: OE-core 
Subject: Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

On Tue, 10 Sep 2019 at 10:07, Zheng, Ruoqin 
mailto:zhengrq.f...@cn.fujitsu.com>> wrote:
In last patch, I put the config file in meta-environment as its do_install task 
is in the target environment which means the value of ${PACKAGE_ARCHS} is right.
And it finally produce a nativesdk package.

If I put the config file in nativesdk-rpm, the value of ${PACKAGE_ARCHS} will 
always be “all any noarch x86_64-nativesdk” which is not suitable for x86, arm 
and other ARCHS.

So I’d like to put config file in the rpm of meta-environment. Did you have any 
good Suggestions?

You probably need to use the post-relocate-setup.d/ facility, like the 
nativesdk-meson recipe does. I am not sure if PACKAGE_ARCHS is accessible from 
it, but it does seem like the right mechanism for tweaking settings that are 
specific to nativesdk packages.

Alex




-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-10 Thread Alexander Kanavin
On Tue, 10 Sep 2019 at 10:07, Zheng, Ruoqin 
wrote:

> In last patch, I put the config file in meta-environment as its do_install
> task is in the target environment which means the value of ${PACKAGE_ARCHS}
> is right.
>
> And it finally produce a nativesdk package.
>
>
>
> If I put the config file in nativesdk-rpm, the value of ${PACKAGE_ARCHS}
> will always be “all any noarch x86_64-nativesdk” which is not suitable for
> x86, arm and other ARCHS.
>
>
>
> So I’d like to put config file in the rpm of meta-environment. Did you
> have any good Suggestions?
>

You probably need to use the post-relocate-setup.d/ facility, like the
nativesdk-meson recipe does. I am not sure if PACKAGE_ARCHS is accessible
from it, but it does seem like the right mechanism for tweaking settings
that are specific to nativesdk packages.

Alex
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-10 Thread Zheng, Ruoqin
Hi Alex

Now I have a question after a test.

In last patch, I put the config file in meta-environment as its do_install task 
is in the target environment which means the value of ${PACKAGE_ARCHS} is right.
And it finally produce a nativesdk package.

If I put the config file in nativesdk-rpm, the value of ${PACKAGE_ARCHS} will 
always be “all any noarch x86_64-nativesdk” which is not suitable for x86, arm 
and other ARCHS.

So I’d like to put config file in the rpm of meta-environment. Did you have any 
good Suggestions?

--
Zheng Ruoqin
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
   Nanjing, 210012, China
MAIL : zhengrq.f...@cn.fujistu.com

From: Alexander Kanavin [mailto:alex.kana...@gmail.com]
Sent: Monday, September 09, 2019 9:07 PM
To: Zheng, Ruoqin/郑 若钦 
Cc: OE-core 
Subject: Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

On Mon, 9 Sep 2019 at 13:19, Zheng, Ruoqin 
mailto:zhengrq.f...@cn.fujitsu.com>> wrote:
->What do these two sed commands do? If we create /etc/rpmrc just above, can it 
have the right content from the beginning?

Well, in the environment in Yocto Build system, the value of ${PACKAGE_ARCHS} 
include “–nativesdk” as not needed in SDK environment.
And the ARCH name of core2-64 rpm is core2_64 like rpm-4.14.2.1-r0.core2_64.rpm.
So I modify the ARCH name in etc/rpmrc.

Thanks, can you put a comment in front of the sed commands explaining that? It 
would be useful to anyone who reads the recipe.

Alex


-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Zheng, Ruoqin
Hi Alex:

Ok, I will send a V3 patch.

--
Zheng Ruoqin
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
   Nanjing, 210012, China
MAIL : zhengrq.f...@cn.fujistu.com

From: Alexander Kanavin [mailto:alex.kana...@gmail.com]
Sent: Monday, September 09, 2019 9:07 PM
To: Zheng, Ruoqin/郑 若钦 
Cc: OE-core 
Subject: Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

On Mon, 9 Sep 2019 at 13:19, Zheng, Ruoqin 
mailto:zhengrq.f...@cn.fujitsu.com>> wrote:
->What do these two sed commands do? If we create /etc/rpmrc just above, can it 
have the right content from the beginning?

Well, in the environment in Yocto Build system, the value of ${PACKAGE_ARCHS} 
include “–nativesdk” as not needed in SDK environment.
And the ARCH name of core2-64 rpm is core2_64 like rpm-4.14.2.1-r0.core2_64.rpm.
So I modify the ARCH name in etc/rpmrc.

Thanks, can you put a comment in front of the sed commands explaining that? It 
would be useful to anyone who reads the recipe.

Alex


-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Alexander Kanavin
On Mon, 9 Sep 2019 at 13:19, Zheng, Ruoqin 
wrote:

> ->What do these two sed commands do? If we create /etc/rpmrc just above,
> can it have the right content from the beginning?
>
>
>
> Well, in the environment in Yocto Build system, the value of
> ${PACKAGE_ARCHS} include “–nativesdk” as not needed in SDK environment.
>
> And the ARCH name of core2-64 rpm is core2_64 like
> rpm-4.14.2.1-r0.core2_64.rpm.
>
> So I modify the ARCH name in etc/rpmrc.
>

Thanks, can you put a comment in front of the sed commands explaining that?
It would be useful to anyone who reads the recipe.

Alex
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Zheng, Ruoqin
Hi Alex

I’d like to explain it.

->Why not simply ${D}/etc/rpm?


As you see, ${SDKTARGETSYSROOT} for x86_64 is 
/opt/poky/2.7+snapshot/sysroots/core2-64-pokysdk-linux.



I make it because config file in host-sysroot as 
/opt/poky/2.7+snapshot/sysroots/x86_64-pokysdk-linux  will be covered by 
another ARCH.

For example, first install SDK for x86_64, and next install SDK for x86, as 
host-sysroot is same, the same config file will be covered. In that case config 
settings for x86_64 will be inefficacy.



To resolve that problem, I put config file in target-sysroot like 
/opt/poky/2.7+snapshot/sysroots/core2-64-poky-linux. As each ARCH has its own 
target-sysroot, config file will not be covered.


That was also why I put config file in meta-environment in last patch.

->What do these two sed commands do? If we create /etc/rpmrc just above, can it 
have the right content from the beginning?

Well, in the environment in Yocto Build system, the value of ${PACKAGE_ARCHS} 
include “–nativesdk” as not needed in SDK environment.
And the ARCH name of core2-64 rpm is core2_64 like rpm-4.14.2.1-r0.core2_64.rpm.
So I modify the ARCH name in etc/rpmrc.

--
Zheng Ruoqin
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
   Nanjing, 210012, China
MAIL : zhengrq.f...@cn.fujistu.com

From: Alexander Kanavin [mailto:alex.kana...@gmail.com]
Sent: Monday, September 09, 2019 7:07 PM
To: Zheng, Ruoqin/郑 若钦 
Cc: OE-core 
Subject: Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

On Mon, 9 Sep 2019 at 12:58, Zheng Ruoqin 
mailto:zhengrq.f...@cn.fujitsu.com>> wrote:
 rm -rf ${D}/var
+install -d ${D}/${SDKTARGETSYSROOT}/etc/rpm

Why not simply ${D}/etc/rpm?

+sed -i 's/-nativesdk//g' ${D}/${SDKTARGETSYSROOT}/etc/rpmrc
+sed -i 's/-/_/' ${D}/${SDKTARGETSYSROOT}/etc/rpmrc

What do these two sed commands do? If we create /etc/rpmrc just above, can it 
have the right content from the beginning?
  "
+FILES_${PN}_append_class-nativesdk += "${SDKTARGETSYSROOT}"

Same question: why is ${SDKTARGETSYSROOT} needed? The configuration files 
should be in /etc, and rpm should be instructed to pick them up from there, 
same way as it is done for -native variant when building an image.

Alex


-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Alexander Kanavin
On Mon, 9 Sep 2019 at 13:08, Zheng, Ruoqin 
wrote:

> I'd like to explain the path ${SDKTARGETSYSROOT} in this patch.
>
> As you see, ${SDKTARGETSYSROOT} for x86_64 is
> /opt/poky/2.7+snapshot/sysroots/core2-64-pokysdk-linux.
>
> I make it because config file in host-sysroot as
> /opt/poky/2.7+snapshot/sysroots/x86_64-pokysdk-linux  will be covered by
> another ARCH.
> For example, first install SDK for x86_64, and next install SDK for x86,
> as host-sysroot is same, the same config file will be covered. In that case
> config settings for x86_64 will be inefficacy.
>
> To resolve that problem, I put config file in target-sysroot like
> /opt/poky/2.7+snapshot/sysroots/core2-64-poky-linux. As each ARCH has its
> own target-sysroot, config file will not be covered.
>

I see, thanks. Can you add this information to the patch please?

Alex
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Zheng, Ruoqin
Hi Alex

I'd like to explain the path ${SDKTARGETSYSROOT} in this patch.

As you see, ${SDKTARGETSYSROOT} for x86_64 is 
/opt/poky/2.7+snapshot/sysroots/core2-64-pokysdk-linux.

I make it because config file in host-sysroot as 
/opt/poky/2.7+snapshot/sysroots/x86_64-pokysdk-linux  will be covered by 
another ARCH.
For example, first install SDK for x86_64, and next install SDK for x86, as 
host-sysroot is same, the same config file will be covered. In that case config 
settings for x86_64 will be inefficacy.

To resolve that problem, I put config file in target-sysroot like 
/opt/poky/2.7+snapshot/sysroots/core2-64-poky-linux. As each ARCH has its own 
target-sysroot, config file will not be covered.

--
--
Zheng Ruoqin
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)
ADDR.: No.6 Wenzhu Road, Software Avenue,
   Nanjing, 210012, China
MAIL : zhengrq.f...@cn.fujistu.com


> -Original Message-
> From: Zheng, Ruoqin/郑 若钦
> Sent: Monday, September 09, 2019 6:57 PM
> To: openembedded-core@lists.openembedded.org
> Cc: Zheng, Ruoqin/郑 若钦 
> Subject: [OE-core][PATCH] rpm: make rpm work in toolchain.
> 
> We need to configure rpm to use package architecture from yocto build system.
> 
> Signed-off-by: Zheng Ruoqin 
> ---
>  meta/recipes-devtools/rpm/rpm_4.14.2.1.bb | 15 +++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb b/meta/recipes-
> devtools/rpm/rpm_4.14.2.1.bb
> index 063f4269a5..af8e144f96 100644
> --- a/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb
> +++ b/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb
> @@ -102,6 +102,9 @@ do_install_append_class-native() {
>  done
>  }
> 
> +REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-
> ${TARGET_OS}"
> +SDKTARGETSYSROOT =
> "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
> +
>  do_install_append_class-nativesdk() {
>  for tool in ${WRAPPER_TOOLS}; do
>  create_wrapper ${D}$tool \ @@ -112,6 +115,16 @@
> do_install_append_class-nativesdk() {
>  done
> 
>  rm -rf ${D}/var
> +install -d ${D}/${SDKTARGETSYSROOT}/etc/rpm
> +
> +cat >${D}/${SDKTARGETSYSROOT}/etc/rpmrc < +arch_compat: ${MACHINE_ARCH}: ${PACKAGE_ARCHS} EOF
> +sed -i 's/-nativesdk//g' ${D}/${SDKTARGETSYSROOT}/etc/rpmrc
> +sed -i 's/-/_/' ${D}/${SDKTARGETSYSROOT}/etc/rpmrc
> +cat >${D}/${SDKTARGETSYSROOT}/etc/rpm/platform < +${MACHINE_ARCH}-pc-linux EOF
>  }
> 
>  # Rpm's make install creates var/tmp which clashes with base-files packaging
> @@ -133,6 +146,8 @@ FILES_${PN} += "${libdir}/rpm-plugins/*.so \
> 
>  FILES_${PN}-dev += "${libdir}/rpm-plugins/*.la \
>  "
> +FILES_${PN}_append_class-nativesdk += "${SDKTARGETSYSROOT}"
> +
> 
>  PACKAGES += "python3-rpm"
>  PROVIDES += "python3-rpm"
> --
> 2.17.1



-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Alexander Kanavin
On Mon, 9 Sep 2019 at 12:58, Zheng Ruoqin 
wrote:

>  rm -rf ${D}/var
> +install -d ${D}/${SDKTARGETSYSROOT}/etc/rpm
>

Why not simply ${D}/etc/rpm?


> +sed -i 's/-nativesdk//g' ${D}/${SDKTARGETSYSROOT}/etc/rpmrc
> +sed -i 's/-/_/' ${D}/${SDKTARGETSYSROOT}/etc/rpmrc
>

What do these two sed commands do? If we create /etc/rpmrc just above, can
it have the right content from the beginning?
  "

> +FILES_${PN}_append_class-nativesdk += "${SDKTARGETSYSROOT}"
>

Same question: why is ${SDKTARGETSYSROOT} needed? The configuration files
should be in /etc, and rpm should be instructed to pick them up from there,
same way as it is done for -native variant when building an image.

Alex
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [PATCH] rpm: make rpm work in toolchain.

2019-09-09 Thread Zheng Ruoqin
We need to configure rpm to use package architecture from yocto build
system.

Signed-off-by: Zheng Ruoqin 
---
 meta/recipes-devtools/rpm/rpm_4.14.2.1.bb | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb 
b/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb
index 063f4269a5..af8e144f96 100644
--- a/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.14.2.1.bb
@@ -102,6 +102,9 @@ do_install_append_class-native() {
 done
 }
 
+REAL_MULTIMACH_TARGET_SYS = "${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
+SDKTARGETSYSROOT = "${SDKPATH}/sysroots/${REAL_MULTIMACH_TARGET_SYS}"
+
 do_install_append_class-nativesdk() {
 for tool in ${WRAPPER_TOOLS}; do
 create_wrapper ${D}$tool \
@@ -112,6 +115,16 @@ do_install_append_class-nativesdk() {
 done
 
 rm -rf ${D}/var
+install -d ${D}/${SDKTARGETSYSROOT}/etc/rpm
+
+cat >${D}/${SDKTARGETSYSROOT}/etc/rpmrc <${D}/${SDKTARGETSYSROOT}/etc/rpm/platform