Skip to contentSkip to conversation

rpm: fix nativesdk's default var location

PATCH In review Chen Qi 2 participants 6 messages Jul 16, 2020 – Sep 4, 2020

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/1 rpm: fix nativesdk's default var location

For now, the nativesdk-rpm's %_var in /usr/lib/rpm/macros is '/var'. This is causing error when running `rpm -qplv A.rpm'.

error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

The rpm in SDK should be using its own database. So we should remove this configure option, letting the SDK's native sysroot prefix to be there in %_var. In fact, '%_usr' in macros has already got the prefix. After this change, we have in the macros file lines like below.

"""

%_usr                   /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-linux/usr
%_usrsrc                %{_usr}/src
%_var                   /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-linux/var

"""

---
 meta/recipes-devtools/rpm/rpm_4.15.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/rpm/rpm_4.15.1.bb +1 -1
index cbe1acffe2..b5a0ac9382 100644
@@ -67,7 +67,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls --disable-openmp"
 # Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via session dbus even when plugins support is enabled.
 # Also disable plugins by default for native.
 EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
-EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
+EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --disable-plugins"
 
 BBCLASSEXTEND = "native nativesdk"
 
Signature · 1 line
2.17.1
#1 lore raw

Hi,

I'm sorry but I don't understand this patch.

Quoted 2 lines

error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

I think these two error messages is just because invoking nativesdk-rpm without "--root=":
-------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm
error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/var/lib/rpm
drwxr-xr-x    2 root     root                        0 Jun 19  2018 /etc
-rw-r--r--    1 root     root                      642 Jun 19  2018 /etc/xattr.conf
...

Same as nativesdk-gcc adding "--sysroot=", nativesdk-rpm should be invoked with "--root=":
--------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm --root=/home/leimh/test-rootfs/
drwxr-xr-x    2 root     root                        0 Jun 19  2018 /etc
-rw-r--r--    1 root     root                      642 Jun 19  2018 /etc/xattr.conf
......

But now with this patch, "--root=" doesn't work for nativesdk-rpm. Even I use nativesdk-rpm with "--root=", the database of nativesdk-rpm still is written to ${SDK_INTALL_DIR}/var/lib/rpm/, not the directory that I set by "--root=".

Best regards
Lei

Quoted 54 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Chen Qi
Sent: Thursday, July 16, 2020 2:57 PM
To: [email protected]
Subject: [OE-core][PATCH] rpm: fix nativesdk's default var location

For now, the nativesdk-rpm's %_var in /usr/lib/rpm/macros is '/var'. This is causing error when running `rpm -qplv A.rpm'.

error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

The rpm in SDK should be using its own database. So we should remove this configure option, letting the SDK's native sysroot prefix to be there in %_var. In fact, '%_usr' in macros has already got the prefix.
After this change, we have in the macros file lines like below.

"""
%_usr /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-
linux/usr
%_usrsrc %{_usr}/src
%_var /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-
linux/var
"""

---
 meta/recipes-devtools/rpm/rpm_4.15.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-devtools/rpm/rpm_4.15.1.bb +0 -0

devtools/rpm/rpm_4.15.1.bb
index cbe1acffe2..b5a0ac9382 100644

meta/recipes-devtools/rpm/rpm_4.15.1.bb +0 -0
@@ -67,7 +67,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls --

disable-openmp"
# Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via
session dbus even when plugins support is enabled.
# Also disable plugins by default for native. EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --
localstatedir=/var --disable-plugins" -EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc -- localstatedir=/var --disable-plugins" +EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --disable- plugins"

BBCLASSEXTEND = "native nativesdk"

--
2.17.1

author
#2 lore raw

Hi Lei,

The rpm in SDK uses a wrapper, and looking at the settings I don't think it's supposed to be used with '--root'.

export RPM_CONFIGDIR=dirname $realpath/../lib/rpm RPM_ETCCONFIGDIR=${RPM_ETCCONFIGDIR-dirname $realpath/../../etc/..} MAGIC=dirname $realpath/../share/misc/magic.mgc RPM_NO_CHROOT_FOR_SCRIPTS=1 exec -a "$0" $realdir/rpm.real "$@"

Besides, checking the macros file, it has already set %_usr, %_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

Regards,
Chen Qi

Quoted 89 lines · leimaohui

Hi,

I'm sorry but I don't understand this patch.

Quoted 2 lines

error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

I think these two error messages is just because invoking nativesdk-rpm without "--root=":
-------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm
error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/var/lib/rpm
drwxr-xr-x    2 root     root                        0 Jun 19  2018 /etc
-rw-r--r--    1 root     root                      642 Jun 19  2018 /etc/xattr.conf
...

Same as nativesdk-gcc adding "--sysroot=", nativesdk-rpm should be invoked with "--root=":
--------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm --root=/home/leimh/test-rootfs/
drwxr-xr-x    2 root     root                        0 Jun 19  2018 /etc
-rw-r--r--    1 root     root                      642 Jun 19  2018 /etc/xattr.conf
......

But now with this patch, "--root=" doesn't work for nativesdk-rpm. Even I use nativesdk-rpm with "--root=", the database of nativesdk-rpm still is written to ${SDK_INTALL_DIR}/var/lib/rpm/, not the directory that I set by "--root=".

Best regards
Lei

Quoted 54 lines

-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Chen Qi
Sent: Thursday, July 16, 2020 2:57 PM
To: [email protected]
Subject: [OE-core][PATCH] rpm: fix nativesdk's default var location

For now, the nativesdk-rpm's %_var in /usr/lib/rpm/macros is '/var'. This is causing error when running `rpm -qplv A.rpm'.

error: cannot open Packages index using db5 - Permission denied (13)
error: cannot open Packages database in /var/lib/rpm

The rpm in SDK should be using its own database. So we should remove this configure option, letting the SDK's native sysroot prefix to be there in %_var. In fact, '%_usr' in macros has already got the prefix.
After this change, we have in the macros file lines like below.

"""
%_usr /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-
linux/usr
%_usrsrc %{_usr}/src
%_var /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-
linux/var
"""

---
  meta/recipes-devtools/rpm/rpm_4.15.1.bb | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-devtools/rpm/rpm_4.15.1.bb +0 -0

devtools/rpm/rpm_4.15.1.bb
index cbe1acffe2..b5a0ac9382 100644

meta/recipes-devtools/rpm/rpm_4.15.1.bb +0 -0
@@ -67,7 +67,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls --

disable-openmp"
# Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via
session dbus even when plugins support is enabled.
# Also disable plugins by default for native. EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --
localstatedir=/var --disable-plugins" -EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc -- localstatedir=/var --disable-plugins" +EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --disable- plugins"

BBCLASSEXTEND = "native nativesdk"

--
2.17.1

#3 lore raw

Hi, Chen

Quoted 1 line

Besides, checking the macros file, it has already set %_usr, %_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

“it has already set %_usr, %_prefix, %_libdir to point to locations under SDK” is just because %_usr and %_libdir are not necessary for rpm, so they are not set in EXTRA_OECONF_append_class-nativesdk and EXTRA_OECONF_append_class-native. After all, nobody likes to do unnecessary works. And the same as native-rpm, nativesdk-rpm only sets %s_etc and %_var, just because they are necessary config.

Besides, with nativesdk-rpm –help, you can get “--root” option, but users can’t use it. I think it doesn't make sense.

Best regards
Lei

From: [email protected] <[email protected]> On Behalf Of Chen Qi
Sent: Thursday, September 3, 2020 2:52 PM
To: Lei, Maohui <[email protected]>; Richard Purdie ([email protected]) <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH] rpm: fix nativesdk's default var location

Hi Lei,

The rpm in SDK uses a wrapper, and looking at the settings I don't think it's supposed to be used with '--root'.

export RPM_CONFIGDIR=dirname $realpath/../lib/rpm RPM_ETCCONFIGDIR=${RPM_ETCCONFIGDIR-dirname $realpath/../../etc/..} MAGIC=dirname $realpath/../share/misc/magic.mgc RPM_NO_CHROOT_FOR_SCRIPTS=1 exec -a "$0" $realdir/rpm.real "$@"

Besides, checking the macros file, it has already set %_usr, %_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

Regards,
Chen Qi

On 09/03/2020 01:40 PM, leimaohui wrote:

Hi,

I'm sorry but I don't understand this patch.

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /var/lib/rpm

I think these two error messages is just because invoking nativesdk-rpm without "--root=":

-------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/var/lib/rpm

drwxr-xr-x 2 root root 0 Jun 19 2018 /etc

-rw-r--r-- 1 root root 642 Jun 19 2018 /etc/xattr.conf

...

Same as nativesdk-gcc adding "--sysroot=", nativesdk-rpm should be invoked with "--root=":

--------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm --root=/home/leimh/test-rootfs/

drwxr-xr-x 2 root root 0 Jun 19 2018 /etc

-rw-r--r-- 1 root root 642 Jun 19 2018 /etc/xattr.conf

......

But now with this patch, "--root=" doesn't work for nativesdk-rpm. Even I use nativesdk-rpm with "--root=", the database of nativesdk-rpm still is written to ${SDK_INTALL_DIR}/var/lib/rpm/, not the directory that I set by "--root=".

Best regards

Lei

-----Original Message-----

From: [email protected]<mailto:[email protected]> <openembedded-

[email protected]<mailto:[email protected]>> On Behalf Of Chen Qi

Sent: Thursday, July 16, 2020 2:57 PM

To: [email protected]<mailto:[email protected]>

Subject: [OE-core][PATCH] rpm: fix nativesdk's default var location

For now, the nativesdk-rpm's %_var in /usr/lib/rpm/macros is '/var'. This is

causing error when running `rpm -qplv A.rpm'.

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /var/lib/rpm

The rpm in SDK should be using its own database. So we should remove this

configure option, letting the SDK's native sysroot prefix to be there in %_var. In

fact, '%_usr' in macros has already got the prefix.

After this change, we have in the macros file lines like below.

"""

%_usr /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-

linux/usr

%_usrsrc %{_usr}/src

%_var /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-

linux/var

"""

---

 meta/recipes-devtools/rpm/rpm_4.15.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-devtools/rpm/rpm_4.15.1.bb +0 -0

devtools/rpm/rpm_4.15.1.bb

index cbe1acffe2..b5a0ac9382 100644

--- a/meta/recipes-devtools/rpm/rpm_4.15.1.bb

+++ b/meta/recipes-devtools/rpm/rpm_4.15.1.bb

@@ -67,7 +67,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls --

disable-openmp"

# Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via

session dbus even when plugins support is enabled.

# Also disable plugins by default for native.

EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --

localstatedir=/var --disable-plugins"

-EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --

localstatedir=/var --disable-plugins"

+EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --disable-

plugins"

BBCLASSEXTEND = "native nativesdk"

--

2.17.1

author
#4 lore raw
Quoted 8 lines · Maohui

Hi, Chen

Quoted 1 line

Besides, checking the macros file, it has already set %_usr,

%_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

“it has already set %_usr, %_prefix, %_libdir to point to locations under SDK” is just because %_usr and %_libdir are not necessary for rpm,

Hmm... I really doubt this. If they are unnecessary, why rpm gives user choice to configure them? I suspect they should have effect on at least rpmbuild.

Quoted 4 lines

so they are not set in EXTRA_OECONF_append_class-nativesdk and EXTRA_OECONF_append_class-native. After all, nobody likes to do unnecessary works. And the same as native-rpm, nativesdk-rpm only sets %s_etc and %_var, just because they are necessary config.

Besides, with nativesdk-rpm –help, you can get “--root” option, but users can’t use it. I think it doesn't make sense.

From your description, I guess the problem you met is that you want to use nativesdk-rpm to do package management or generate a rootfs. You can add in ROOTFS/etc/rpm/macros "%_var /var", so that the default value of nativesdk-rpm is overridden.

Regards,
Chen Qi

Quoted 159 lines

Best regards

Lei

*From:*[email protected] <[email protected]> *On Behalf Of *Chen Qi *Sent:* Thursday, September 3, 2020 2:52 PM
*To:* Lei, Maohui <[email protected]>; Richard Purdie ([email protected]) <[email protected]> *Cc:* [email protected]
*Subject:* Re: [OE-core][PATCH] rpm: fix nativesdk's default var location

Hi Lei,

The rpm in SDK uses a wrapper, and looking at the settings I don't think it's supposed to be used with '--root'.

export RPM_CONFIGDIR=dirname $realpath/../lib/rpm RPM_ETCCONFIGDIR=${RPM_ETCCONFIGDIR-dirname $realpath/../../etc/..} MAGIC=dirname $realpath/../share/misc/magic.mgc RPM_NO_CHROOT_FOR_SCRIPTS=1 exec -a "$0" $realdir/rpm.real "$@"

Besides, checking the macros file, it has already set %_usr, %_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

Regards,
Chen Qi

On 09/03/2020 01:40 PM, leimaohui wrote:

Hi,

I'm sorry but I don't understand this patch.

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /var/lib/rpm

I think these two error messages is just because invoking nativesdk-rpm without "--root=":

-------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/var/lib/rpm

drwxr-xr-x 2 root root 0 Jun 19 2018 /etc

-rw-r--r-- 1 root root 642 Jun 19 2018 /etc/xattr.conf

...

Same as nativesdk-gcc adding "--sysroot=", nativesdk-rpm should be invoked with "--root=":

--------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm --root=/home/leimh/test-rootfs/

drwxr-xr-x 2 root root 0 Jun 19 2018 /etc

-rw-r--r-- 1 root root 642 Jun 19 2018 /etc/xattr.conf

......

But now with this patch, "--root=" doesn't work for nativesdk-rpm. Even I use nativesdk-rpm with "--root=", the database of nativesdk-rpm still is written to ${SDK_INTALL_DIR}/var/lib/rpm/, not the directory that I set by "--root=".

Best regards

Lei

-----Original Message-----

From:[email protected] <mailto:[email protected]> <openembedded-

[email protected] <mailto:[email protected]>> On Behalf Of Chen Qi

Sent: Thursday, July 16, 2020 2:57 PM

To:[email protected] <mailto:[email protected]>

Subject: [OE-core][PATCH] rpm: fix nativesdk's default var location

For now, the nativesdk-rpm's %_var in /usr/lib/rpm/macros is '/var'. This is

causing error when running `rpm -qplv A.rpm'.

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /var/lib/rpm

The rpm in SDK should be using its own database. So we should remove this

configure option, letting the SDK's native sysroot prefix to be there in %_var. In

fact, '%_usr' in macros has already got the prefix.

After this change, we have in the macros file lines like below.

"""

%_usr /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-

linux/usr

%_usrsrc %{_usr}/src

%_var /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-

linux/var

"""

---

meta/recipes-devtools/rpm/rpm_4.15.1.bb | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/rpm/rpm_4.15.1.bb b/meta/recipes-

devtools/rpm/rpm_4.15.1.bb

index cbe1acffe2..b5a0ac9382 100644

--- a/meta/recipes-devtools/rpm/rpm_4.15.1.bb

+++ b/meta/recipes-devtools/rpm/rpm_4.15.1.bb

@@ -67,7 +67,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls --

disable-openmp"

# Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via

session dbus even when plugins support is enabled.

# Also disable plugins by default for native.

EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --

localstatedir=/var --disable-plugins"

-EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --

localstatedir=/var --disable-plugins"

+EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --disable-

plugins"

BBCLASSEXTEND = "native nativesdk"

--

2.17.1

#5 lore raw

Hi, Chen

Quoted 2 lines

Hmm... I really doubt this. If they are unnecessary, why rpm gives user choice to configure them? I suspect they should have effect on at least rpmbuild.

I’m sorry, I mean these configurations are no necessary just for native-rpm and nativesdk-rpm.

Quoted 1 line

From your description, I guess the problem you met is that you want to use nativesdk-rpm to do package management or generate a rootfs.

Yes, I want to make nativesdk-rpm can work for rootfs.

Quoted 1 line

You can add in ROOTFS/etc/rpm/macros "%_var /var", so that the default value of nativesdk-rpm is overridden.

Ok, It seems a way without adding a .bbapend of rpm.

Thank you for your reply!

Best regards
Lei

From: ChenQi <[email protected]>
Sent: Thursday, September 3, 2020 5:38 PM
To: Lei, Maohui <[email protected]>; Richard Purdie ([email protected]) <[email protected]>
Cc: [email protected]
Subject: Re: [OE-core][PATCH] rpm: fix nativesdk's default var location

On 09/03/2020 04:53 PM, Lei, Maohui wrote:
Hi, Chen

Quoted 1 line

Besides, checking the macros file, it has already set %_usr, %_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

“it has already set %_usr, %_prefix, %_libdir to point to locations under SDK” is just because %_usr and %_libdir are not necessary for rpm,

Hmm... I really doubt this. If they are unnecessary, why rpm gives user choice to configure them? I suspect they should have effect on at least rpmbuild.

so they are not set in EXTRA_OECONF_append_class-nativesdk and EXTRA_OECONF_append_class-native. After all, nobody likes to do unnecessary works. And the same as native-rpm, nativesdk-rpm only sets %s_etc and %_var, just because they are necessary config.

Besides, with nativesdk-rpm –help, you can get “--root” option, but users can’t use it. I think it doesn't make sense.

From your description, I guess the problem you met is that you want to use nativesdk-rpm to do package management or generate a rootfs. You can add in ROOTFS/etc/rpm/macros "%_var /var", so that the default value of nativesdk-rpm is overridden.

Regards,
Chen Qi

Best regards
Lei

From: [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]> On Behalf Of Chen Qi
Sent: Thursday, September 3, 2020 2:52 PM
To: Lei, Maohui <[email protected]><mailto:[email protected]>; Richard Purdie ([email protected]<mailto:[email protected]>) <[email protected]><mailto:[email protected]>
Cc: [email protected]<mailto:[email protected]>
Subject: Re: [OE-core][PATCH] rpm: fix nativesdk's default var location

Hi Lei,

The rpm in SDK uses a wrapper, and looking at the settings I don't think it's supposed to be used with '--root'.

export RPM_CONFIGDIR=dirname $realpath/../lib/rpm RPM_ETCCONFIGDIR=${RPM_ETCCONFIGDIR-dirname $realpath/../../etc/..} MAGIC=dirname $realpath/../share/misc/magic.mgc RPM_NO_CHROOT_FOR_SCRIPTS=1 exec -a "$0" $realdir/rpm.real "$@"

Besides, checking the macros file, it has already set %_usr, %_prefix, %_libdir to point to locations under SDK. I think that also implies that it's not supposed to be used with '--root'. And that's we should do the same for %_var.

Regards,
Chen Qi

On 09/03/2020 01:40 PM, leimaohui wrote:

Hi,

I'm sorry but I don't understand this patch.

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /var/lib/rpm

I think these two error messages is just because invoking nativesdk-rpm without "--root=":

-------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/var/lib/rpm

drwxr-xr-x 2 root root 0 Jun 19 2018 /etc

-rw-r--r-- 1 root root 642 Jun 19 2018 /etc/xattr.conf

...

Same as nativesdk-gcc adding "--sysroot=", nativesdk-rpm should be invoked with "--root=":

--------------------------------------------------

$ /opt/poky/3.1+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/rpm -qplv attr-2.4.48-r0.core2_64.rpm --root=/home/leimh/test-rootfs/

drwxr-xr-x 2 root root 0 Jun 19 2018 /etc

-rw-r--r-- 1 root root 642 Jun 19 2018 /etc/xattr.conf

......

But now with this patch, "--root=" doesn't work for nativesdk-rpm. Even I use nativesdk-rpm with "--root=", the database of nativesdk-rpm still is written to ${SDK_INTALL_DIR}/var/lib/rpm/, not the directory that I set by "--root=".

Best regards

Lei

-----Original Message-----

From: [email protected]<mailto:[email protected]> <openembedded-

[email protected]<mailto:[email protected]>> On Behalf Of Chen Qi

Sent: Thursday, July 16, 2020 2:57 PM

To: [email protected]<mailto:[email protected]>

Subject: [OE-core][PATCH] rpm: fix nativesdk's default var location

For now, the nativesdk-rpm's %_var in /usr/lib/rpm/macros is '/var'. This is

causing error when running `rpm -qplv A.rpm'.

error: cannot open Packages index using db5 - Permission denied (13)

error: cannot open Packages database in /var/lib/rpm

The rpm in SDK should be using its own database. So we should remove this

configure option, letting the SDK's native sysroot prefix to be there in %_var. In

fact, '%_usr' in macros has already got the prefix.

After this change, we have in the macros file lines like below.

"""

%_usr /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-

linux/usr

%_usrsrc %{_usr}/src

%_var /opt/windriver/wrlinux/20.29/sysroots/x86_64-wrlinuxsdk-

linux/var

"""

---

 meta/recipes-devtools/rpm/rpm_4.15.1.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes- renamed from meta/recipes-devtools/rpm/rpm_4.15.1.bb +0 -0

devtools/rpm/rpm_4.15.1.bb

index cbe1acffe2..b5a0ac9382 100644

--- a/meta/recipes-devtools/rpm/rpm_4.15.1.bb

+++ b/meta/recipes-devtools/rpm/rpm_4.15.1.bb

@@ -67,7 +67,7 @@ EXTRA_OECONF_append_libc-musl = " --disable-nls --

disable-openmp"

# Disable dbus for native, so that rpm doesn't attempt to inhibit shutdown via

session dbus even when plugins support is enabled.

# Also disable plugins by default for native.

EXTRA_OECONF_append_class-native = " --sysconfdir=/etc --

localstatedir=/var --disable-plugins"

-EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --

localstatedir=/var --disable-plugins"

+EXTRA_OECONF_append_class-nativesdk = " --sysconfdir=/etc --disable-

plugins"

BBCLASSEXTEND = "native nativesdk"

--

2.17.1