Skip to contentSkip to conversation

rpm: make nativesdk-rpm rdepend on nativesdk-file

PATCH In review Chen Qi 4 participants 10 messages Jan 16, 2023 1 message not in the archive

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

PATCH 1/1 rpm: make nativesdk-rpm rdepend on nativesdk-file

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -0
index 8eb0ab207e..3b7d4d640a 100644
@@ -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"
 
Signature · 1 line
2.17.1
#1 lore raw

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

Quoted 37 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -1
index 8eb0ab207e..3b7d4d640a 100644
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

author
#2 lore raw

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 <[email protected]>
Sent: Monday, January 16, 2023 5:18 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
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

Quoted 39 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -1
index 8eb0ab207e..3b7d4d640a 100644
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Thanks, it's fine then.

Alex

Quoted 65 lines · Qi

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 <[email protected]>
Sent: Monday, January 16, 2023 5:18 PM
To: Chen, Qi <[email protected]>
Cc: [email protected]
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

Quoted 39 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -1
index 8eb0ab207e..3b7d4d640a 100644
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Acked-by on v1 1/1
#4 lore raw
In reply to Chen Qi
Quoted 40 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -1
index 8eb0ab207e..3b7d4d640a 100644
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
In reply to Chen Qi
Quoted 17 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -0
index 8eb0ab207e..3b7d4d640a 100644

meta/recipes-devtools/rpm/rpm_4.18.0.bb PROVIDES += "python3-rpm" · line 191

Quoted 4 lines
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -0
@@ -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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#7 lore raw
Quoted 20 lines · Richard Purdie via lists.openembedded.org
Quoted 19 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -0
index 8eb0ab207e..3b7d4d640a 100644
@@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
 FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
 
Quoted 5 lines

meta/recipes-devtools/rpm/rpm_4.18.0.bb PROVIDES += "python3-rpm" · line 191

Quoted 2 lines
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -0
 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

author
#8 lore raw

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 <[email protected]>
Sent: Monday, January 16, 2023 7:14 PM
To: Chen, Qi <[email protected]>; [email protected]
Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file

Quoted 20 lines · Richard Purdie via lists.openembedded.org
Quoted 19 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -0
index 8eb0ab207e..3b7d4d640a 100644
@@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
 FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
 
Quoted 5 lines

meta/recipes-devtools/rpm/rpm_4.18.0.bb PROVIDES += "python3-rpm" · line 191

Quoted 2 lines
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -0
 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

#9 lore raw

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,

Quoted 72 lines · Qi

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 <[email protected]>
Sent: Monday, January 16, 2023 7:14 PM
To: Chen, Qi <[email protected]>; [email protected]
Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file

Quoted 20 lines · Richard Purdie via lists.openembedded.org
Quoted 19 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -0
index 8eb0ab207e..3b7d4d640a 100644
@@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
 FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
 
Quoted 5 lines

meta/recipes-devtools/rpm/rpm_4.18.0.bb PROVIDES += "python3-rpm" · line 191

Quoted 2 lines
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -0
 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

#10 lore raw

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

Quoted 83 lines · Martin Jansa

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,

Quoted 52 lines · Qi

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 <[email protected]>
Sent: Monday, January 16, 2023 7:14 PM
To: Chen, Qi <[email protected]>; [email protected]
Subject: Re: [OE-core][PATCH] rpm: make nativesdk-rpm rdepend on nativesdk-file

Quoted 20 lines · Richard Purdie via lists.openembedded.org
Quoted 19 lines · Chen Qi

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.

---
 meta/recipes-devtools/rpm/rpm_4.18.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -0
index 8eb0ab207e..3b7d4d640a 100644
@@ -188,6 +188,7 @@ PROVIDES += "python3-rpm"
 FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
 
Quoted 5 lines

meta/recipes-devtools/rpm/rpm_4.18.0.bb PROVIDES += "python3-rpm" · line 191

Quoted 2 lines
meta/recipes-devtools/rpm/rpm_4.18.0.bb +1 -0
 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

Quoted 10 lines

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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-