Re: [PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file


Martin Jansa
 

The use case I was fixing in:
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@...> 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@...>
Sent: Monday, January 16, 2023 7:14 PM
To: Chen, Qi <Qi.Chen@...>; openembedded-core@...
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@...>
> > ---
> >  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





Join {openembedded-core@lists.openembedded.org to automatically receive all group messages.