nativesdk-rpm: export RPM_ETCCONFIGDIR and MAGIC in environment like RPM_CONFIGDIR
PATCH 1/2 nativesdk-rpm: export RPM_ETCCONFIGDIR and MAGIC in environment like RPM_CONFIGDIR
* the paths in wrapper don't work for rpmdeps which is installed in ${libdir}/rpm unlike other wrapped bins from ${bindir} these relative paths don't work there
* replace environment.d-rpm.sh with here-doc so that we can use OE variables
* in the end it might be better to just get rid of the wrappers at this point and depend on environment.d to always set right values
* the wrappers were added in:
commit 760103cdaed3e820888d8984ec0b76cfc831d534
Author: Ovidiu Panait <[email protected]>
Date: Fri May 25 10:48:29 2018 +0800
nativesdk-rpm: Add wrappers for nativesdk support
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/windriver/wrlinux-small/10.17.41/sysroots/x86_64-wrlinuxsdk-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.
* the rpm.sh in environment.d a bit later:
commit 5f16fd0bf774314c79572daf4ba7e4a8ae209ba1
Author: hongxu <[email protected]>
Date: Wed Jul 29 01:22:06 2020 -0700
nativesdk-rpm: adjust RPM_CONFIGDIR paths dynamically
While installing/extracting SDK to a non-default dir(not /opt), run rpm failed:
$ python3 -c "import rpm"
|error: Unable to open /opt/windriver/wrlinux-graphics/20.31/sysroots/ x86_64-wrlinuxsdk-linux/usr/lib/rpm/rpmrc for reading: No such file or directory.
This patch adds a flexible way to configure RPM_CONFIGDIR in SDK.
--- .../rpm/files/environment.d-rpm.sh | 1 - meta/recipes-devtools/rpm/rpm_4.18.0.bb | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 meta/recipes-devtools/rpm/files/environment.d-rpm.sh
meta/recipes-devtools/rpm/files/environment.d-rpm.sh deleted +0 -1
@@ -1 +0,0 @@ -export RPM_CONFIGDIR="$OECORE_NATIVE_SYSROOT/usr/lib/rpm"
meta/recipes-devtools/rpm/rpm_4.18.0.bb +9 -5
@@ -25,7 +25,6 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=c4eec0c20c6034b9407a09945b48a43f" SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protocol=https \ - file://environment.d-rpm.sh \ file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \ file://0001-Do-not-read-config-files-from-HOME.patch \ file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \
@@ -120,16 +119,21 @@ do_install:append:class-native() { do_install:append:class-nativesdk() { for tool in ${WRAPPER_TOOLS}; do test -x ${D}$tool && create_wrapper ${D}$tool \ - RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm \ + RPM_CONFIGDIR='$'{RPM_CONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm} \ RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir'), d.getVar('bindir'))}/..} \ - MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc \ + MAGIC=''{MAGIC-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc} \ RPM_NO_CHROOT_FOR_SCRIPTS=1 done rm -rf ${D}/var - mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d - install -m 644 ${WORKDIR}/environment.d-rpm.sh ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh + mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d + cat <<- EOF > ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh + export RPM_CONFIGDIR="$OECORE_NATIVE_SYSROOT${libdir}/rpm" + export RPM_ETCCONFIGDIR="$OECORE_NATIVE_SYSROOT${sysconfdir}" + export MAGIC="$OECORE_NATIVE_SYSROOT${datadir}/misc/magic.mgc" + export RPM_NO_CHROOT_FOR_SCRIPTS=1 + EOF } # Rpm's make install creates var/tmp which clashes with base-files packaging
Signature · 1 line
2.39.0
PATCH 2/2 nativesdk-rpm: don't create wrappers for WRAPPER_TOOLS
* environment.d/rpm.sh sets the right environment in SDK and we don't need to use them
--- meta/recipes-devtools/rpm/rpm_4.18.0.bb | 8 -------- 1 file changed, 8 deletions(-)
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -8
@@ -117,14 +117,6 @@ do_install:append:class-native() { } do_install:append:class-nativesdk() { - for tool in ${WRAPPER_TOOLS}; do - test -x ${D}$tool && create_wrapper ${D}$tool \ - RPM_CONFIGDIR='$'{RPM_CONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm} \ - RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir'), d.getVar('bindir'))}/..} \ - MAGIC=''{MAGIC-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc} \ - RPM_NO_CHROOT_FOR_SCRIPTS=1 - done - rm -rf ${D}/var mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
Signature · 1 line
2.39.0
Hi Martin,
This patch is causing a regression: running `file xxx' inside SDK errors out. e.g.,
sdkinst [3][0] $ file environment-setup-core2-64-poky-linux
file: could not find any valid magic files!
sdkinst [3][0] $ which file/usr/bin/file
I've sent out a patch to fix the issue: rpm: make nativesdk-rpm rdepend on nativesdk-file. Not sure if there's a better solution. Could you please help review it?
Regards,
Qi
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Martin Jansa
Sent: Friday, December 30, 2022 12:22 AM
To: [email protected]
Cc: Martin Jansa <[email protected]>
Subject: [OE-core] [PATCH 1/2] nativesdk-rpm: export RPM_ETCCONFIGDIR and MAGIC in environment like RPM_CONFIGDIR
* the paths in wrapper don't work for rpmdeps which is installed in ${libdir}/rpm unlike other wrapped bins from ${bindir} these relative paths don't work there
* replace environment.d-rpm.sh with here-doc so that we can use OE variables
* in the end it might be better to just get rid of the wrappers at this point and depend on environment.d to always set right values
* the wrappers were added in:
commit 760103cdaed3e820888d8984ec0b76cfc831d534
Author: Ovidiu Panait <[email protected]>
Date: Fri May 25 10:48:29 2018 +0800
nativesdk-rpm: Add wrappers for nativesdk support
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/windriver/wrlinux-small/10.17.41/sysroots/x86_64-wrlinuxsdk-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.
* the rpm.sh in environment.d a bit later:
commit 5f16fd0bf774314c79572daf4ba7e4a8ae209ba1
Author: hongxu <[email protected]>
Date: Wed Jul 29 01:22:06 2020 -0700
nativesdk-rpm: adjust RPM_CONFIGDIR paths dynamically
While installing/extracting SDK to a non-default dir(not /opt), run rpm failed:
$ python3 -c "import rpm"
|error: Unable to open /opt/windriver/wrlinux-graphics/20.31/sysroots/ x86_64-wrlinuxsdk-linux/usr/lib/rpm/rpmrc for reading: No such file or directory.
This patch adds a flexible way to configure RPM_CONFIGDIR in SDK.
--- .../rpm/files/environment.d-rpm.sh | 1 - meta/recipes-devtools/rpm/rpm_4.18.0.bb | 14 +++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 meta/recipes-devtools/rpm/files/environment.d-rpm.sh
meta/recipes-devtools/rpm/files/environment.d-rpm.sh deleted +0 -1
@@ -1 +0,0 @@ -export RPM_CONFIGDIR="$OECORE_NATIVE_SYSROOT/usr/lib/rpm"
meta/recipes-devtools/rpm/rpm_4.18.0.bb +0 -1
@@ -25,7 +25,6 @@ LICENSE = "GPL-2.0-only" LIC_FILES_CHKSUM = "file://COPYING;md5=c4eec0c20c6034b9407a09945b48a43f" SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protocol=https \ - file://environment.d-rpm.sh \ file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \ file://0001-Do-not-read-config-files-from-HOME.patch \ file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \ @@ -120,16 +119,21 @@ do_install:append:class-native() {
do_install:append:class-nativesdk() {
for tool in ${WRAPPER_TOOLS}; do
test -x ${D}$tool && create_wrapper ${D}$tool \
- RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm \
+ RPM_CONFIGDIR='$'{RPM_CONFIGDIR-'`dirname
+ $''realpath`'/${@os.path.relpath(d.getVar('libdir'),
+ d.getVar('bindir'))}/rpm} \
RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir'), d.getVar('bindir'))}/..} \
- MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc \
+ MAGIC=''{MAGIC-'`dirname
+ $''realpath`'/${@os.path.relpath(d.getVar('datadir'),
+ d.getVar('bindir'))}/misc/magic.mgc} \
RPM_NO_CHROOT_FOR_SCRIPTS=1
done
rm -rf ${D}/var- mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
- install -m 644 ${WORKDIR}/environment.d-rpm.sh ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh
+ mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
+ cat <<- EOF > ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh
+ export RPM_CONFIGDIR="$OECORE_NATIVE_SYSROOT${libdir}/rpm"
+ export RPM_ETCCONFIGDIR="$OECORE_NATIVE_SYSROOT${sysconfdir}"
+ export MAGIC="$OECORE_NATIVE_SYSROOT${datadir}/misc/magic.mgc"
+ export RPM_NO_CHROOT_FOR_SCRIPTS=1
+ EOF
}
# Rpm's make install creates var/tmp which clashes with base-files packaging
--
2.39.0