All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nativesdk-rpm: Add wrappers for nativesdk support
@ 2018-02-27 13:45 Ovidiu Panait
  2018-02-27 14:09 ` Alexander Kanavin
  0 siblings, 1 reply; 3+ messages in thread
From: Ovidiu Panait @ 2018-02-27 13:45 UTC (permalink / raw)
  To: openembedded-core

When installing the SDK to a non-default path, running "rpm --showrc" from the
sdk will produce the following error:
error: Unable to open /opt/poky/2.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/lib/rpm/rpmrc for reading: No such file or directory. 

Fix this by adding wrappers that dynamically export the RPM_CONFIGDIR,
RPM_ETCCONFIGDIR and MAGIC environment variables, pointing to the proper
sdk locations.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 meta/recipes-devtools/rpm/rpm_4.14.1.bb | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/meta/recipes-devtools/rpm/rpm_4.14.1.bb b/meta/recipes-devtools/rpm/rpm_4.14.1.bb
index 7b8ea46a75..daaf4637a3 100644
--- a/meta/recipes-devtools/rpm/rpm_4.14.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.14.1.bb
@@ -65,6 +65,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls"
 #
 # Also disable plugins, so that rpm doesn't attempt to inhibit shutdown via session dbus
 EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
+EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -96,6 +97,31 @@ do_install_append_class-native() {
         done
 }
 
+do_install_append_class-nativesdk() {
+        tools="\
+                ${bindir}/rpm \
+                ${bindir}/rpm2archive \
+                ${bindir}/rpm2cpio \
+                ${bindir}/rpmbuild \
+                ${bindir}/rpmdb \
+                ${bindir}/rpmgraph \
+                ${bindir}/rpmkeys \
+                ${bindir}/rpmsign \
+                ${bindir}/rpmspec \
+                ${libdir}/rpm/rpmdeps \
+        "
+
+        for tool in $tools; do
+                create_wrapper ${D}$tool \
+                        RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
+                        RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/..} \
+                        MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/misc/magic.mgc \
+                        RPM_NO_CHROOT_FOR_SCRIPTS=1
+        done
+
+        rm -rf ${D}/var
+}
+
 # Rpm's make install creates var/tmp which clashes with base-files packaging
 do_install_append_class-target() {
     rm -rf ${D}/var
-- 
2.16.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nativesdk-rpm: Add wrappers for nativesdk support
  2018-02-27 13:45 [PATCH] nativesdk-rpm: Add wrappers for nativesdk support Ovidiu Panait
@ 2018-02-27 14:09 ` Alexander Kanavin
  2018-02-27 14:46   ` Mark Hatle
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kanavin @ 2018-02-27 14:09 UTC (permalink / raw)
  To: Ovidiu Panait, openembedded-core

On 02/27/2018 03:45 PM, Ovidiu Panait wrote:
> +do_install_append_class-nativesdk() {
> +        tools="\
> +                ${bindir}/rpm \
> +                ${bindir}/rpm2archive \
> +                ${bindir}/rpm2cpio \
> +                ${bindir}/rpmbuild \
> +                ${bindir}/rpmdb \
> +                ${bindir}/rpmgraph \
> +                ${bindir}/rpmkeys \
> +                ${bindir}/rpmsign \
> +                ${bindir}/rpmspec \
> +                ${libdir}/rpm/rpmdeps \
> +        "
> +
> +        for tool in $tools; do
> +                create_wrapper ${D}$tool \
> +                        RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
> +                        RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/..} \
> +                        MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/misc/magic.mgc \
> +                        RPM_NO_CHROOT_FOR_SCRIPTS=1
> +        done
> +
> +        rm -rf ${D}/var
> +}

Can this be done without copy-pasting an existing function please?

Alex


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nativesdk-rpm: Add wrappers for nativesdk support
  2018-02-27 14:09 ` Alexander Kanavin
@ 2018-02-27 14:46   ` Mark Hatle
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Hatle @ 2018-02-27 14:46 UTC (permalink / raw)
  To: Alexander Kanavin, Ovidiu Panait, openembedded-core

On 2/27/18 8:09 AM, Alexander Kanavin wrote:
> On 02/27/2018 03:45 PM, Ovidiu Panait wrote:
>> +do_install_append_class-nativesdk() {
>> +        tools="\
>> +                ${bindir}/rpm \
>> +                ${bindir}/rpm2archive \
>> +                ${bindir}/rpm2cpio \
>> +                ${bindir}/rpmbuild \
>> +                ${bindir}/rpmdb \
>> +                ${bindir}/rpmgraph \
>> +                ${bindir}/rpmkeys \
>> +                ${bindir}/rpmsign \
>> +                ${bindir}/rpmspec \
>> +                ${libdir}/rpm/rpmdeps \
>> +        "
>> +
>> +        for tool in $tools; do
>> +                create_wrapper ${D}$tool \
>> +                        RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
>> +                        RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/..} \
>> +                        MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/misc/magic.mgc \
>> +                        RPM_NO_CHROOT_FOR_SCRIPTS=1
>> +        done
>> +
>> +        rm -rf ${D}/var
>> +}
> 
> Can this be done without copy-pasting an existing function please?

The code can't run in class-target, this would screw up the target.
The code in class-native has a different set of arguments to the create_wrapper.
The rm -rf ${D}/var is not done on class-native, but is done on class-target.

So no.  We need two copies, as they are different.

--Mark

> Alex
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-27 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 13:45 [PATCH] nativesdk-rpm: Add wrappers for nativesdk support Ovidiu Panait
2018-02-27 14:09 ` Alexander Kanavin
2018-02-27 14:46   ` Mark Hatle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.