diff mbox series

rpm: make nativesdk-rpm rdepend on nativesdk-file

Message ID 20230116084809.16470-1-Qi.Chen@windriver.com
State New
Headers show
Series rpm: make nativesdk-rpm rdepend on nativesdk-file | expand

Commit Message

ChenQi Jan. 16, 2023, 8:48 a.m. UTC
For now, running `file' inside SDK errors out.
  file: could not find any valid magic files!

This is because nativesdk-rpm exports MAGIC. So let's
make nativesdk-rpm depend on file for better user
experiences.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)

Comments

Alexander Kanavin Jan. 16, 2023, 9:17 a.m. UTC | #1
I'm not sure I understand the issue. Why isn't file from the host
working properly in the presence of the MAGIC env var?

Alex

On Mon, 16 Jan 2023 at 09:48, Chen Qi <Qi.Chen@windriver.com> wrote:
>
> For now, running `file' inside SDK errors out.
>   file: could not find any valid magic files!
>
> This is because nativesdk-rpm exports MAGIC. So let's
> make nativesdk-rpm depend on file for better user
> experiences.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> index 8eb0ab207e..3b7d4d640a 100644
> --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
>  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
>
>  RDEPENDS:${PN}-build = "bash perl python3-core"
> +RDEPENDS:nativesdk-rpm += "nativesdk-file"
>
>  PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
>
> --
> 2.17.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#175963): https://lists.openembedded.org/g/openembedded-core/message/175963
> Mute This Topic: https://lists.openembedded.org/mt/96303256/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
ChenQi Jan. 16, 2023, 9:26 a.m. UTC | #2
This is because the MAGIC var is pointing a file that does not exist. And the file is provided by nativesdk-file.

Some of the strace output:
openat(AT_FDCWD, "/buildarea2/chenqi/builds/build-poky-sysvinit/sdkinst/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/buildarea2/chenqi/builds/build-poky-sysvinit/sdkinst/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc", 0x7ffcddb11330) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/buildarea2/chenqi/builds/build-poky-sysvinit/sdkinst/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, "file: could not find any valid m"..., 44) = 44
exit_group(1)                           = ?
+++ exited with 1 +++

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <alex.kanavin@gmail.com> 
Sent: Monday, January 16, 2023 5:18 PM
To: Chen, Qi <Qi.Chen@windriver.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file

I'm not sure I understand the issue. Why isn't file from the host working properly in the presence of the MAGIC env var?

Alex

On Mon, 16 Jan 2023 at 09:48, Chen Qi <Qi.Chen@windriver.com> wrote:
>
> For now, running `file' inside SDK errors out.
>   file: could not find any valid magic files!
>
> This is because nativesdk-rpm exports MAGIC. So let's make 
> nativesdk-rpm depend on file for better user experiences.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb 
> b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> index 8eb0ab207e..3b7d4d640a 100644
> --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
>  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
>
>  RDEPENDS:${PN}-build = "bash perl python3-core"
> +RDEPENDS:nativesdk-rpm += "nativesdk-file"
>
>  PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
>
> --
> 2.17.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#175963): 
> https://lists.openembedded.org/g/openembedded-core/message/175963
> Mute This Topic: https://lists.openembedded.org/mt/96303256/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
> [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin Jan. 16, 2023, 9:36 a.m. UTC | #3
Thanks, it's fine then.

Alex

On Mon, 16 Jan 2023 at 10:26, Chen, Qi <Qi.Chen@windriver.com> wrote:
>
> This is because the MAGIC var is pointing a file that does not exist. And the file is provided by nativesdk-file.
>
> Some of the strace output:
> openat(AT_FDCWD, "/buildarea2/chenqi/builds/build-poky-sysvinit/sdkinst/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
> stat("/buildarea2/chenqi/builds/build-poky-sysvinit/sdkinst/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc", 0x7ffcddb11330) = -1 ENOENT (No such file or directory)
> openat(AT_FDCWD, "/buildarea2/chenqi/builds/build-poky-sysvinit/sdkinst/sysroots/x86_64-pokysdk-linux/usr/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
> write(2, "file: could not find any valid m"..., 44) = 44
> exit_group(1)                           = ?
> +++ exited with 1 +++
>
> Regards,
> Qi
>
> -----Original Message-----
> From: Alexander Kanavin <alex.kanavin@gmail.com>
> Sent: Monday, January 16, 2023 5:18 PM
> To: Chen, Qi <Qi.Chen@windriver.com>
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file
>
> I'm not sure I understand the issue. Why isn't file from the host working properly in the presence of the MAGIC env var?
>
> Alex
>
> On Mon, 16 Jan 2023 at 09:48, Chen Qi <Qi.Chen@windriver.com> wrote:
> >
> > For now, running `file' inside SDK errors out.
> >   file: could not find any valid magic files!
> >
> > This is because nativesdk-rpm exports MAGIC. So let's make
> > nativesdk-rpm depend on file for better user experiences.
> >
> > Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> > ---
> >  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > index 8eb0ab207e..3b7d4d640a 100644
> > --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
> >  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
> >
> >  RDEPENDS:${PN}-build = "bash perl python3-core"
> > +RDEPENDS:nativesdk-rpm += "nativesdk-file"
> >
> >  PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
> >
> > --
> > 2.17.1
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#175963):
> > https://lists.openembedded.org/g/openembedded-core/message/175963
> > Mute This Topic: https://lists.openembedded.org/mt/96303256/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> > [alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Martin Jansa Jan. 16, 2023, 10:33 a.m. UTC | #4
Acked-by: Martin Jansa <Martin.Jansa@gmail.com>

On Mon, Jan 16, 2023 at 9:48 AM Chen Qi <Qi.Chen@windriver.com> wrote:

> For now, running `file' inside SDK errors out.
>   file: could not find any valid magic files!
>
> This is because nativesdk-rpm exports MAGIC. So let's
> make nativesdk-rpm depend on file for better user
> experiences.
>
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> index 8eb0ab207e..3b7d4d640a 100644
> --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
>  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
>
>  RDEPENDS:${PN}-build = "bash perl python3-core"
> +RDEPENDS:nativesdk-rpm += "nativesdk-file"
>
>  PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
>
> --
> 2.17.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#175963):
> https://lists.openembedded.org/g/openembedded-core/message/175963
> Mute This Topic: https://lists.openembedded.org/mt/96303256/3617156
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> Martin.Jansa@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Richard Purdie Jan. 16, 2023, 10:39 a.m. UTC | #5
On Mon, 2023-01-16 at 16:48 +0800, Chen Qi wrote:
> For now, running `file' inside SDK errors out.
>   file: could not find any valid magic files!
> 
> This is because nativesdk-rpm exports MAGIC. So let's
> make nativesdk-rpm depend on file for better user
> experiences.
> 
> Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> ---
>  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> index 8eb0ab207e..3b7d4d640a 100644
> --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
>  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
>  
>  RDEPENDS:${PN}-build = "bash perl python3-core"
> +RDEPENDS:nativesdk-rpm += "nativesdk-file"

Should we be adding file to ${PN}-build instead?  Which rpm command was
this with? Does anywhere else in rpm have/need this dependency?

Cheers,

Richard
Richard Purdie Jan. 16, 2023, 11:14 a.m. UTC | #6
On Mon, 2023-01-16 at 10:39 +0000, Richard Purdie via
lists.openembedded.org wrote:
> On Mon, 2023-01-16 at 16:48 +0800, Chen Qi wrote:
> > For now, running `file' inside SDK errors out.
> >   file: could not find any valid magic files!
> > 
> > This is because nativesdk-rpm exports MAGIC. So let's
> > make nativesdk-rpm depend on file for better user
> > experiences.
> > 
> > Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> > ---
> >  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > index 8eb0ab207e..3b7d4d640a 100644
> > --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
> >  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
> >  
> >  RDEPENDS:${PN}-build = "bash perl python3-core"
> > +RDEPENDS:nativesdk-rpm += "nativesdk-file"
> 
> Should we be adding file to ${PN}-build instead?  Which rpm command was
> this with? Does anywhere else in rpm have/need this dependency?

To answer my question, the problem is that as well as the rpm wrappers,
the code also sets MAGIC= from an environment setup file.

At the very least, the RDEPENDS needs a class-nativesdk override in
there as otherwise it is floating around unconditionally.

I don't really like adding workarounds like this since we won't
understand them at some future date.

Other solutions might include:

a) patching RPM to use RPM_FILEMAGIC instead of MAGIC so we can set it
in a more granular way
b) moving the environment setup piece for MAGIC to nativesdk-file so it
is only used if file is installed in the SDK
c) fixing rpm (or file?) to dynamically relocate the paths it is using

Can we see if there is a better solution we can switch to please?

Cheers,

Richard
ChenQi Jan. 16, 2023, 12:47 p.m. UTC | #7
Richard, I'm going to check how rpm uses 'file' and will come up with a better solution.
Martin, could you please tell me your use case, if convenient? I will ensure I don't break it.

Regards,
Qi

-----Original Message-----
From: Richard Purdie <richard.purdie@linuxfoundation.org> 
Sent: Monday, January 16, 2023 7:14 PM
To: Chen, Qi <Qi.Chen@windriver.com>; openembedded-core@lists.openembedded.org
Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file

On Mon, 2023-01-16 at 10:39 +0000, Richard Purdie via lists.openembedded.org wrote:
> On Mon, 2023-01-16 at 16:48 +0800, Chen Qi wrote:
> > For now, running `file' inside SDK errors out.
> >   file: could not find any valid magic files!
> > 
> > This is because nativesdk-rpm exports MAGIC. So let's make 
> > nativesdk-rpm depend on file for better user experiences.
> > 
> > Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> > ---
> >  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb 
> > b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > index 8eb0ab207e..3b7d4d640a 100644
> > --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
> >  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
> >  
> >  RDEPENDS:${PN}-build = "bash perl python3-core"
> > +RDEPENDS:nativesdk-rpm += "nativesdk-file"
> 
> Should we be adding file to ${PN}-build instead?  Which rpm command 
> was this with? Does anywhere else in rpm have/need this dependency?

To answer my question, the problem is that as well as the rpm wrappers, the code also sets MAGIC= from an environment setup file.

At the very least, the RDEPENDS needs a class-nativesdk override in there as otherwise it is floating around unconditionally.

I don't really like adding workarounds like this since we won't understand them at some future date.

Other solutions might include:

a) patching RPM to use RPM_FILEMAGIC instead of MAGIC so we can set it in a more granular way
b) moving the environment setup piece for MAGIC to nativesdk-file so it is only used if file is installed in the SDK
c) fixing rpm (or file?) to dynamically relocate the paths it is using

Can we see if there is a better solution we can switch to please?

Cheers,

Richard
Martin Jansa Jan. 16, 2023, 12:56 p.m. UTC | #8
The use case I was fixing in:
https://git.openembedded.org/openembedded-core/commit/?id=f40a2658f5be6739c5dddab7f9f11e1f85a17102
was just about rpmdeps not being able to find rpmrc due to wrong path in
the wrapper.

MAGIC was moved to environment-setup.d/rpm.sh just to set all variables
(which used to be set in the wrappers) in the same place and to be able to
remove the wrappers completely in the next commit.

It might be cleaner to set MAGIC variable in separate
environment-setup.d/file.sh installed by nativesdk-file to make sure that
it's set only together when corresponding magic.mgc is installed in SDK
(but we'll still need to depend on file where needed). MAGIC variable was
added in
https://git.openembedded.org/openembedded-core/commit/?id=760103cdaed3e820888d8984ec0b76cfc831d534
but commit doesn't say why.

Regards,

On Mon, Jan 16, 2023 at 1:47 PM Chen, Qi <Qi.Chen@windriver.com> wrote:

> Richard, I'm going to check how rpm uses 'file' and will come up with a
> better solution.
> Martin, could you please tell me your use case, if convenient? I will
> ensure I don't break it.
>
> Regards,
> Qi
>
> -----Original Message-----
> From: Richard Purdie <richard.purdie@linuxfoundation.org>
> Sent: Monday, January 16, 2023 7:14 PM
> To: Chen, Qi <Qi.Chen@windriver.com>;
> openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on
> nativesdk-file
>
> On Mon, 2023-01-16 at 10:39 +0000, Richard Purdie via
> lists.openembedded.org wrote:
> > On Mon, 2023-01-16 at 16:48 +0800, Chen Qi wrote:
> > > For now, running `file' inside SDK errors out.
> > >   file: could not find any valid magic files!
> > >
> > > This is because nativesdk-rpm exports MAGIC. So let's make
> > > nativesdk-rpm depend on file for better user experiences.
> > >
> > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
> > > ---
> > >  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > > b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > > index 8eb0ab207e..3b7d4d640a 100644
> > > --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > > +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
> > > @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
> > >  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
> > >
> > >  RDEPENDS:${PN}-build = "bash perl python3-core"
> > > +RDEPENDS:nativesdk-rpm += "nativesdk-file"
> >
> > Should we be adding file to ${PN}-build instead?  Which rpm command
> > was this with? Does anywhere else in rpm have/need this dependency?
>
> To answer my question, the problem is that as well as the rpm wrappers,
> the code also sets MAGIC= from an environment setup file.
>
> At the very least, the RDEPENDS needs a class-nativesdk override in there
> as otherwise it is floating around unconditionally.
>
> I don't really like adding workarounds like this since we won't understand
> them at some future date.
>
> Other solutions might include:
>
> a) patching RPM to use RPM_FILEMAGIC instead of MAGIC so we can set it in
> a more granular way
> b) moving the environment setup piece for MAGIC to nativesdk-file so it is
> only used if file is installed in the SDK
> c) fixing rpm (or file?) to dynamically relocate the paths it is using
>
> Can we see if there is a better solution we can switch to please?
>
> Cheers,
>
> Richard
>
>
>
>
>
>
Alexander Kanavin Jan. 16, 2023, 1:35 p.m. UTC | #9
MAGIC=... was added in the first place to the native rpm 4.x wrapper
by me because rpm links with libmagic (which is a part of file
recipe/component), and libmagic would try to find it in file's
recipe-specific sysroot if not overridden from environment.

I'd say the right fix would be to make libmagic (or whatever else
reads the file) find the needed file relative to its own installation
path.

Alex

On Mon, 16 Jan 2023 at 13:56, Martin Jansa <Martin.Jansa@gmail.com> wrote:
>
> The use case I was fixing in:
> https://git.openembedded.org/openembedded-core/commit/?id=f40a2658f5be6739c5dddab7f9f11e1f85a17102
> was just about rpmdeps not being able to find rpmrc due to wrong path in the wrapper.
>
> MAGIC was moved to environment-setup.d/rpm.sh just to set all variables (which used to be set in the wrappers) in the same place and to be able to remove the wrappers completely in the next commit.
>
> It might be cleaner to set MAGIC variable in separate environment-setup.d/file.sh installed by nativesdk-file to make sure that it's set only together when corresponding magic.mgc is installed in SDK (but we'll still need to depend on file where needed). MAGIC variable was added in https://git.openembedded.org/openembedded-core/commit/?id=760103cdaed3e820888d8984ec0b76cfc831d534 but commit doesn't say why.
>
> Regards,
>
> On Mon, Jan 16, 2023 at 1:47 PM Chen, Qi <Qi.Chen@windriver.com> wrote:
>>
>> Richard, I'm going to check how rpm uses 'file' and will come up with a better solution.
>> Martin, could you please tell me your use case, if convenient? I will ensure I don't break it.
>>
>> Regards,
>> Qi
>>
>> -----Original Message-----
>> From: Richard Purdie <richard.purdie@linuxfoundation.org>
>> Sent: Monday, January 16, 2023 7:14 PM
>> To: Chen, Qi <Qi.Chen@windriver.com>; openembedded-core@lists.openembedded.org
>> Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file
>>
>> On Mon, 2023-01-16 at 10:39 +0000, Richard Purdie via lists.openembedded.org wrote:
>> > On Mon, 2023-01-16 at 16:48 +0800, Chen Qi wrote:
>> > > For now, running `file' inside SDK errors out.
>> > >   file: could not find any valid magic files!
>> > >
>> > > This is because nativesdk-rpm exports MAGIC. So let's make
>> > > nativesdk-rpm depend on file for better user experiences.
>> > >
>> > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
>> > > ---
>> > >  meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
>> > >  1 file changed, 1 insertion(+)
>> > >
>> > > diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
>> > > b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
>> > > index 8eb0ab207e..3b7d4d640a 100644
>> > > --- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
>> > > +++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
>> > > @@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
>> > >  FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
>> > >
>> > >  RDEPENDS:${PN}-build = "bash perl python3-core"
>> > > +RDEPENDS:nativesdk-rpm += "nativesdk-file"
>> >
>> > Should we be adding file to ${PN}-build instead?  Which rpm command
>> > was this with? Does anywhere else in rpm have/need this dependency?
>>
>> To answer my question, the problem is that as well as the rpm wrappers, the code also sets MAGIC= from an environment setup file.
>>
>> At the very least, the RDEPENDS needs a class-nativesdk override in there as otherwise it is floating around unconditionally.
>>
>> I don't really like adding workarounds like this since we won't understand them at some future date.
>>
>> Other solutions might include:
>>
>> a) patching RPM to use RPM_FILEMAGIC instead of MAGIC so we can set it in a more granular way
>> b) moving the environment setup piece for MAGIC to nativesdk-file so it is only used if file is installed in the SDK
>> c) fixing rpm (or file?) to dynamically relocate the paths it is using
>>
>> Can we see if there is a better solution we can switch to please?
>>
>> Cheers,
>>
>> Richard
>>
>>
>>
>>
>>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#175982): https://lists.openembedded.org/g/openembedded-core/message/175982
> Mute This Topic: https://lists.openembedded.org/mt/96303256/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rpm/rpm_4.18.0.bb b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
index 8eb0ab207e..3b7d4d640a 100644
--- a/meta/recipes-devtools/rpm/rpm_4.18.0.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.18.0.bb
@@ -188,6 +188,7 @@  PROVIDES += "python3-rpm"
 FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
 
 RDEPENDS:${PN}-build = "bash perl python3-core"
+RDEPENDS:nativesdk-rpm += "nativesdk-file"
 
 PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"