Commit Graph

309 Commits

Author SHA1 Message Date
Hongxu Jia
5c8ceb35b4 rpm: keep leading `/' from sed operation
For /usr/lib/rpm/macros, Yocto explicitly set OECMAKE_FIND_ROOT_PATH_MODE_PROGRAM
= "ONLY" [1][2] to search tools from CMAKE_FIND_ROOT_PATH [5] which locates in
native recipe sysroot or HOSTTOOLS_DIR. If found in native recipe sysroot or
HOSTTOOLS_DIR, the sed operation removed leading `/'

root@qemux86-64:~# vi /usr/lib/rpm/macros
...
%__xz                   usr/bin/xz
%__make                 usr/bin/make
%__zstd                 usr/bin/zstd
%__quilt                usr/bin/quilt
%__patch                usr/bin/patch
...

root@qemux86-64:~# rpm --eval "%{__xz} %{__make} %{__zstd} %{__quilt} %{__patch}"
usr/bin/xz usr/bin/make usr/bin/zstd usr/bin/quilt usr/bin/patch

This commit keeps leading `/' from sed operation, and similar reason for
/usr/lib/cmake/rpm/rpm-targets.cmake

After applying this commit:
root@qemux86-64:~# rpm --eval "%{__xz} %{__make} %{__zstd} %{__quilt} %{__patch}"
/usr/bin/xz /usr/bin/make /usr/bin/zstd /usr/bin/quilt /usr/bin/patch

[1] https://git.openembedded.org/openembedded-core/commit/?id=f4ea12f6635125ee793f4dd801c538c0186f9dc3
[2] https://cmake.org/cmake/help/latest/variable/CMAKE_FIND_ROOT_PATH_MODE_PROGRAM.html

(From OE-Core rev: cab720b5508411f9a63025e2765d4d46914a1404)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0d0773879ab9520c475c4a8c930b2e663de0e032)
Signed-off-by: Deepak Rathore <deeratho@cisco.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2025-09-09 09:08:09 -07:00
Yi Zhao
9bbf3a7362 rpm: fix expansion of %_libdir in macros
There is a patch in oe-core[1] to avoid hardcoded paths in macros. It
tries to use libdir to expand %_libdir in macros.in. However, in
upstream commit[2], libdir for macros in CMakeLists.txt is set to
${prefix}/=LIB=, which causes %_libdir to expand to ${prefix}/=LIB=
instead of the correct path in the final macros.

On target:
$ rpm --showrc | grep _libdir
[snip]
-13: _libdir    ${prefix}/=LIB=
[snip]

This also causes %__pkgconfig_path in fileattrs/pkgconfig.attr to become
an invalid regular expression when building rpm packages. This results a
warning in log.do_package_write_rpm in all packages:

Warning: Ignoring invalid regular expression ^((${prefix}/=LIB=|usr/share)/pkgconfig/.*.pc|usr/bin/pkg-config)$

Set libdir to ${CMAKE_INSTALL_FULL_LIBDIR} instead of ${prefix}/=LIB= to
make sure it is expanded to the correct path in macros.

After the patch:
On target:
$ rpm --showrc | grep _libdir
[snip]
-13: _libdir    /usr/lib
[snip]

[1] https://git.openembedded.org/openembedded-core/tree/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
[2] d2abb7a487

(From OE-Core rev: 7c7f95668d270a825c7d3d235ec2b8d4e7eb0b9f)

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit ae0e217145f45d065124aeb0a7d72a0c25f621ef)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-10-02 06:15:15 -07:00
Alexander Kanavin
5d33880b9d rpm: update 4.19.1 -> 4.19.1.1
Summary of changes from RPM 4.19.1
Fixes
Packaging: Don’t warn about missing user/group on skipped files [Regression] (#2814)
Packaging: Make user/group lookup caching thread-safe [Regression] (#2843)
Lua interface: Fix regression in Lua scriptlet runaway child detection [Regression] (#2818)
Build: CMakeLists.txt: restore readline support as an explicit option [Regression] (#2852)
Build: Fix unconditional uses of Linux-specific extensions [Regression] (#2812)
Build: Add missing include for check_symbol_exists (#2831)
Build: Don’t use _nl_msg_cat_cntr if it’s not available (#2856)

Drop patches:
files/0002-docs-CMakeLists.txt-do-not-install-non-existent-docs.patch
(upstream resolved the issue)

files/0001-CMakeLists.txt-restore-readline-support-as-an-explic.patch
files/0001-Fix-unconditional-dependency-on-non-POSIX-GLOB_ONLYD.patch
(backports)

(From OE-Core rev: d05416b6d6ec197b42f20652ed53ada1eb697d67)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit d233e33a5ca12f95878c3ee9e34d9d9c61e49f68)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-05-03 06:12:21 -07:00
Lei Maohui
930450926c rpm: Fix the following error when run nativesdk-rpm in nativesdk environment.
package busybox-inittab-1.36.1-r0.ubinux_x86_64 is intended for a different architecture
  package busybox-udhcpc-1.36.1-r0.core2_64 is intended for a different architecture
  package ldconfig-2.39+git0+312e159626-r0.core2_64 is intended for a different architecture
  ......

CMAKE_INSTALL_SYSCONFDIR is necessary. If not set
CMAKE_INSTALL_SYSCONFDIR, nativesdk-rpm will use the default setting:
/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-ubinuxsdk-linux/etc to find rpmrc file.

(From OE-Core rev: c9cb2eb2e662e19d68d27f2eec791986715c3abe)

Signed-off-by: Lei Maohui <leimaohui@fujitsu.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-29 10:26:13 +00:00
Yi Zhao
b73804429c rpm: add missing dependencies for packageconfig
Add depenency libselinux for PACKAGECONFIG[selinux].
Add depenency audit for PACKAGECONFIG[audit].

(From OE-Core rev: 97b5d0c85af0b667854eea90ace0a8c2f51ecefe)

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-03 22:08:26 +00:00
Kai Kang
b3d8881edd rpm: fix dependency for package config imaevm
The dependency `ima-evm-utils` of package config `imaevm` has been
removed during rpm upgrade. Add it back, otherwise it fails to run
do_configure when the package config `imaevm` enabled.

(From OE-Core rev: 15df110b79bfa2428f70453aa6aabe7239f8e25a)

Signed-off-by: Kai Kang <kai.kang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-03 21:43:35 +00:00
Alexander Kanavin
8e841dbcc3 rpm: override curl executable search with just 'curl'
rpm is searching for curl executable at do_configure time
and result is non-deterministic, depending on whether curl
is in native sysroot or not:
https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20240201-8dcic6ea/packages/diff-html/

(From OE-Core rev: 785c39701ea17e6a539709b9ae905f7b0667bceb)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-02-03 21:43:35 +00:00
Alexander Kanavin
05d0b9eafb rpm: update 4.18.1 -> 4.19.1
Upstream has replaced autoconf with cmake, which necessitates a rewrite of the
recipe and available options, and a rebase to cmake of
0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch

Correct a mistake in 0001-Do-not-read-config-files-from-HOME.patch :
the patch was removing the NULL marker at the end of function arguments,
and 0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch
was restoring it (in addition to the actual change the patch was making).
Now both patches preserve the NULL terminator.

(From OE-Core rev: 38549d462b399e3a63335f60a44c8bbced98639a)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-27 08:20:02 +00:00
Khem Raj
f99f55259d rpm: Fix build with musl
(From OE-Core rev: cd610101dc8fcb0cabe351085d36823c5bd7eb19)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-01-07 12:24:57 +00:00
Anuj Mittal
817937f57e rpm: backport fix to prevent crashes with latest sqlite
SQLite 3.42.0 causes crashes when installing RPM packages at rootfs
creation time. Backport an upstream fix to resolve the issue.

(From OE-Core rev: f6e4227efb29ed9b1680a1c516e4487804f6e64c)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-07-10 11:36:34 +01:00
Chen Qi
f669fe7ead rpm: write macros under libdir
If we create a macros file under etc/, the populate_sdk task would
fail if 'package-management' is in SDKIMAGE_FEATURES and nativesdk-rpm-build
is installed.. The error message is like below:

  unable to place /.../sdk/image/etc/rpm in final SDK location

This is because it's trying to move the etc/rpm dictory into the
host sysroot but the <host_sysroot>/etc/rpm has already exists.

To solve this problem, avoid creating /etc/rpm/macros for nativesdk-rpm-build,
use ${libdir}/macros instead. In this way, the macros file is hold
in nativesdk-rpm. As nativesdk-rpm-build depends on nativesdk-rpm,
the 'rpmbuild' command inside SDK can still correctly find find-debuginfo
binary.

(From OE-Core rev: 5fde0eadf16d34d88a599009013913fe55d89283)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-06-20 23:24:26 +01:00
Martin Jansa
4ed6dc5602 rpm: drop unused 0001-Rip-out-partial-support-for-unused-MD2-and-RIPEMD160.patch
* it was removed from SRC_URI in oe-core commit:
  commit 67257ca87c6fa8e6050a20ecea50daf834c7e869
  Author: Alexander Kanavin <alex.kanavin@gmail.com>
  Date:   Sat Apr 25 19:28:00 2020 +0200
  Subject: rpm: upgrade to 4.15.1

  and it's unused since then

(From OE-Core rev: c801a215fb2d53bdec7f4c9a20ff7969e8071e5c)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-05-25 10:29:09 +01:00
Alexander Kanavin
d1c2e5a929 rpm: update 4.18.0 -> 4.18.1
Drop:
0001-docs-do-not-build-manpages-requires-pandoc.patch
(pandoc is now detected from $PATH)
fifofix.patch
(upstream fixed the issue)

(From OE-Core rev: d8d673b2dc86e04cc278dc111b36d52d60bc25f7)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-05-22 10:53:47 +01:00
Chen Qi
00c9f39fcb rpm: add back find-debuginfo support
RPM upstream removed find-debuginfo and switched to use debugedit
since the following commit.

  04b0805a75

According to https://github.com/rpm-software-management/rpm/blob/master/INSTALL,
debugedit is needed by rpm. More specifically it's needed by rpmbuild
to supporting generating debuginfo package when %debug_package is enabled.

(From OE-Core rev: d06c7c0d288cafa75f14a841f9cb31dcd0714644)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-27 15:44:02 +01:00
Chen Qi
23212c8c44 rpm: fix RPM_ETCCONFIGDIR value in SDK
The RPM_ETCCONFIGDIR should be some root directory instead of the
etc directory as in patch 0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch
RPM_ETCCONFIGDIR is used to prefix /etc.

The regression was introduced in the following patch.
"""
nativesdk-rpm: export RPM_ETCCONFIGDIR and MAGIC in environment like RPM_CONFIGDIR
"""
The patch incorrectly set RPM_ETCCONFIGDIR, maybe because this variable's
name is a little misleading.

Note that this patch modifies both RPM_ETCCONFIGDIR and RPM_CONFIGDIR.
The RPM_CONFIGDIR's value happened to be correct because of the ${libdir},
not $OECORE_NATIVE_SYSROOT. In fact, due to the substitution mechanism,
the $OECORE_NATIVE_SYSROOT is empty.

(From OE-Core rev: 2c6388e5bbf45a71891aa90047eef980d8a27c9d)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-22 23:17:27 +00:00
Khem Raj
91275dd75b rpm: Fix hdr_hash function prototype
(From OE-Core rev: 0e812b4c22ac077f2defd6842f82b5c993db24c2)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-03-06 09:52:16 +00:00
Chen Qi
8321a268af rpm: do not export MAGIC in SDK
This MAGIC variable is used by libmagic (file), and should
be exported by the file recipe.

As the rpm recipe has 'file' in its DEPENDS, its sub-packages
which links to libmagic will be automatically added the 'file'
runtime dependency. More specifically, it's the rpm-build package.
So in case components in nativesdk-rpm-build package uses libmagic,
the nativesdk-file package will be installed and the MAGIC var
will be exported.

(From OE-Core rev: 6e2147ab1d0f3aad2dfe8180a3896c9c9bcfdac8)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2023-01-18 16:42:28 +00:00
Martin Jansa
08152ea9ea 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

(From OE-Core rev: 34f1121ba9684b1ab978438db2b16c1e42ea5973)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-12-31 17:08:29 +00:00
Martin Jansa
0174379afc 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 <ovidiu.panait@windriver.com>
  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 <hongxu.jia@windriver.com>
  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.

(From OE-Core rev: f40a2658f5be6739c5dddab7f9f11e1f85a17102)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-12-31 17:08:29 +00:00
Alexander Kanavin
adefc671ef rpm: update 4.18.0-rc1 -> 4.18.0-release
(From OE-Core rev: 0e9594bdd95a70580e5c10d5b362eb149876ed34)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-09-29 21:15:50 +01:00
Richard Purdie
31565c258d rpm: Upgrade 4.17.1 -> 4.18rc1
rpm is close to release and give our release timings, update to the
rc1 of 4.18.

Includes fixes for CVE-2021-35937, CVE-2021-35938 and CVE-2021-35939
which can't be easily backported.

Add a PACKAGECONFIG option for a new readline dependency and disable
it by default since it pulls in GPLv3 and that breaks a number of
our test configurations as things stand.

Refresh patches and drop the error.h patch as error() no longer used.

(From OE-Core rev: 4b31e4f2aea490bd5056c97742b5e25a8dcc8b36)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-09-20 23:17:53 +01:00
Khem Raj
79f85d85ca rpm: Remove -Wimplicit-function-declaration warnings
(From OE-Core rev: 9f2dbfc51ef2faf1b6154856adb69ca9f764573b)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-21 22:51:41 +01:00
Alexander Kanavin
600a05afae rpm: update 4.17.0 -> 4.17.1
(From OE-Core rev: 826eb17fe741d38be24d31f3bba35074e404a414)

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-08-10 08:25:28 +01:00
Richard Purdie
b0130fcf91 meta/meta-selftest/meta-skeleton: Update LICENSE variable to use SPDX license identifiers
An automated conversion using scripts/contrib/convert-spdx-licenses.py to
convert to use the standard SPDX license identifiers. Two recipes in meta-selftest
were not converted as they're that way specifically for testing. A change in
linux-firmware was also skipped and may need a more manual tweak.

(From OE-Core rev: ceda3238cdbf1beb216ae9ddb242470d5dfc25e0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-02-20 16:45:25 +00:00
Samuli Piippo
bf07396051 rpm: remove tmp folder created during install
nativesdk-rpm build is also affected by the stray /var/tmp
created during the rpm install. Remove it to fix QA Issue:
nativesdk-rpm installs files in /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/var/volatile, but it is expected to be empty [empty-dirs]

(From OE-Core rev: 28dd1e1a0965646c5736e3de91aad830311a797b)

Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-01-04 23:14:05 +00:00
Changqing Li
b7263ed534 rpm: fix CVE-2021-3521
(From OE-Core rev: 938dd031bc2577417266f032e53490909654220c)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-01-04 23:14:05 +00:00
Richard Purdie
ba2f6c64a1 recipes: Update github.com urls to use https
Github has announced there will be no more git:// fetching from their servers:

https://github.blog/2021-09-01-improving-git-protocol-security-github/#no-more-unauthenticated-git

and they're about to start having brownout periods to encourage people
to update. This runs the conversion script over OE-Core to update our
urls to use https instead of git.

(From OE-Core rev: b37b61e9a1e448a34957db9ae39285d21352552e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-11-03 10:12:42 +00:00
Alexander Kanavin
c3189b9efe rpm: update 4.16.1.3 -> 4.17.0
The flagship features are migration from bdb to sqlite and zstd support,
both are enabled and taken into use. The relationship and upstream preference
between sqlite and ndb formats isn't quite clear.

Lua is now a hard dependency.

Added packageconfig option for r/o support for bdb (that doesn't need bdb
itself), but not enabled it as upstream marks it EXPERIMENTAL in capital
letters.

Drop sed adjustment for a file that is not anymore installed.

Adjust oeqa test to check for sqlite database instead of bdb.

Drop
0001-Fix-build-with-musl-C-library.patch (nss support removed upstream)
0001-rpm-rpmio.c-restrict-virtual-memory-usage-if-limit-s.patch
(difficult to undersand and rebase; obsolete with the move to zstd)
0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch
(upstream made the same change)

Portions of 0001-tools-Add-error.h-for-non-glibc-case.patch dropped
(upstream moved the files to a separate component).

Added 0001-docs-do-not-build-manpages-requires-pandoc.patch to avoid
pandoc dependency.

Added 0001-build-pack.c-do-not-insert-payloadflags-into-.rpm-me.patch
to restore reproducibility when compression thread amount varies between hosts.

(From OE-Core rev: 6080fcf7e4f64faedd98ed26b65a3bc29ef08238)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-11 18:41:37 +01:00
Richard Purdie
d441b484eb rpm: Deterministically set vendor macro entry
On an aarch64 build host, vendor is found to be "unknown", on x86 systems
it is "pc". This filters through to the PLATFORM tag in target rpms.

We saw reproducibility test failures where the PLATFORM tags in noarch
rpms were changing depending upon which host built them. Forcing the
vendor value to a consistent one makes things deterministic.

(From OE-Core rev: f6434075b2bdfc23c683d22281b674b1e6abde77)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-08 16:43:59 +01:00
Richard Purdie
86c7d3e031 sstatesig: Add processing for full build paths in sysroot files
Some files in the populate_sysroot tasks have hardcoded paths in them,
particularly if they are postinst-useradd- files or crossscripts.

Add some filtering logic to remove these paths.

This means that the hashequiv "outhash" matches correcting in more
cases allowing for better build artefact reuse.

To make this work a new variable is added SSTATE_HASHEQUIV_FILEMAP
which maps file globbing to replacement patterns (paths or regex)
on a per sstate task basis. It is hoped this shouldn't be needed
in many cases. We are in the process to developing QA tests which
will better detect issues in this area to allow optimal sstate
reuse.

(From OE-Core rev: d9852ffbbe728dac33dc081538a08af98f52fd4a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-04 15:03:53 +01:00
Richard Purdie
b6e74ba64e rpm: Ensure compression parallelism isn't coded into rpms
We don't want the compression thread numbers to be encoded into the rpm
since this results in the rpm not being deterministic. Add a patch
from Alex Kanavin which addresses this issue (was queued for rpm 4.17
but we need to fix this with 4.16 too).

(From OE-Core rev: 1ba0bf50c72f2506dfa507559c49a70e16cd5124)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-10-02 23:09:22 +01:00
Ranjitsinh Rathod
9886ef691a rpm: Handle proper return value to avoid major issues
0001-rpm-rpmio.c-restrict-virtual-memory-usage-if-limit-s.patch changed
to avoid critical issues
Handled return values of getrlimit() and lzma_cputhreads() functions
to avoid unexpected behaviours like devide by zero and potential read
of uninitialized variable 'virtual_memory'
Upstream-Status: Pending [merge of multithreading patches to upstream]

(From OE-Core rev: 5aae9c2cb464350bc443a0f60fd6602942e61f46)

Signed-off-by: Ranjitsinh Rathod <ranjitsinh.rathod@kpit.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-09-11 22:39:19 +01:00
Alexander Kanavin
ab407efcb0 rpm: do not RRECOMMEND rpm-build
This avoids pulling in perl, python and (especially) bash;
rpm building functionality should be neither hard nor soft
dependency of rpm package management.

(From OE-Core rev: ff0e05241a3b61415dc24a8bc2104b4be04b8fc7)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-02 15:44:11 +01:00
Richard Purdie
bb6ddc3691 Convert to new override syntax
This is the result of automated script conversion:

scripts/contrib/convert-overrides.py <oe-core directory>

converting the metadata to use ":" as the override character instead of "_".

(From OE-Core rev: 42344347be29f0997cc2f7636d9603b1fe1875ae)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-08-02 15:44:10 +01:00
Richard Purdie
4e9513b2c3 rpm: Drop CVE exclusion as database fixed to handle
Didn't think this might make it in but it has, we can drop the exclusion.

(From OE-Core rev: 64456aed7514d611a242c210375c01d7f4048de2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-20 12:32:28 +01:00
Ross Burton
b96c342fbd rpm: turn Berkeley DB hard dependency into PACKAGECONFIG
In the future we hope to switch to sqlite instead of Berkeley DB, so
prepare for this by adding an (enabled by default) PACKAGECONFIG for
Berkeley DB.

(From OE-Core rev: 365f0804a0726fe4be9eb7ef3515fea2dd38bef1)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-18 23:52:53 +01:00
Richard Purdie
b77802fb05 rpm: Exclude CVE-2021-20271 from cve-check
This is included in the release we have, it was the reason for the last rpm
point release.

(From OE-Core rev: 117feb358c81b6b852dee24268eac0a1a47c1701)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-05-13 11:34:14 +01:00
Mingli Yu
ce9e341775 rpm: Upgrade to 4.16.1.3
Fixes some security vulnerabilities such as CVE-2021-3421 and
CVE-2021-20271.

Rebase 0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
to avoid fuzz warnings.

(From OE-Core rev: 5dcd9c673502dab276b4fb4e6b4c7c1d1d9425ef)

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-04-23 10:12:10 +01:00
Diego Santa Cruz
ed253541ee rpm: split build and extra functionality into separate packages
Having all the rpm build related tools in the main package requires
adding runtime dependencies on perl and python3-core, so adding
rpm to a target image can pull quite many unneeded packages to satisfy
the dependencies.

This splits all the build related tools into rpm-build and moves the
bash, perl and python3-core runtime dependencies to that package.

Also, the rpmsign tool is split into rpm-sign and rpm2archive (only
built if archive is in PACKAGECONFIG) into rpm-archive. These are
separate packages since they are not really related to building, so
do not belong in rpm-build, but are not necessarily wanted in
target images when rpm is included.

(From OE-Core rev: 0dea6cccc1c638078846e6eb8e48e8ef69c87618)

Signed-off-by: Diego Santa Cruz <Diego.SantaCruz@spinetix.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2021-03-06 22:39:04 +00:00
Alexander Kanavin
74d0f71173 rpm: update 4.16.0 -> 4.16.1.2
(From OE-Core rev: bf2c7f82f07509424ce25ed5f64a03d7e4723fd1)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-12-30 14:01:07 +00:00
Ross Burton
7661beb222 rpm: use libgcrypt instead of OpenSSL for cryptography
RPM 4.16 uses libgcrypt by default[1], so change our build to follow.

[1] 5c0801a1a3

(From OE-Core rev: 196855101f28aeb8ab44f5ca1e02bfb02a11a256)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-11-03 08:21:10 +00:00
Khem Raj
4f9ef652c4 rpm: Fix error.h handing properly on musl
Ignoring configure fragments when error.h does not exist on system
leaves eflutils half configured, which is seen when gold linker is
enabled because librpm does not have proper dependencies added,
therefore add error.h for non-glibc case and include it when glibc is
not used.

(From OE-Core rev: 0b45dc1d611a7c96b528a5c62a2f18a00651d121)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-11-02 11:35:10 +00:00
Alexander Kanavin
fb55c447ad rpm: adjust MIPS64 N32 support
upstream has switched from libmagic to elfutils to determine
file 'colors', and so this adapts the existing patch accordingly.

(From OE-Core rev: 0d420c8f6a6718b54ef9a1278bfa8fec6709d3bd)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-30 13:22:49 +00:00
Alexander Kanavin
d22a91051e rpm: update 4.15.1 -> 4.16.0
Drop backports.
Drop 0001-rpmfc.c-do-not-run-file-classification-in-parallel.patch as
enabling compression support in libmagic finally allows us to use
parallel file classification.

Add a backported patch that fixes musl builds.

License-Update: formatting
(From OE-Core rev: 36c014428b8088abb024287e9841f72e7368ce5b)

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-10-30 13:22:48 +00:00
Ross Burton
3b545e61db rpm: add PACKAGECONFIG for the systemd inhibit plugin
RPM ships a systemd inhibit plugin, that will tell systemd to inhibit a
reboot or sleep during a package upgrades.

For native RPM this is entirely useless, and for target it's only useful
if you're using systemd+logind+rpm.

This plugin uses DBus which means it depends on expat -> cmake-native ->
libarchive-native curl-native, which is quite a dependency tree to need
in early build (required to build packages via rpm-native).

It was previously forcibly disabled for native packages but the build
dependency on DBus remained.  Add a PACKAGECONFIG for the plugin that is
only enabled for target builds with systemd and explicitly disabled for
native/nativesdk builds, but also keep the explicit disabling of all
plugins as the prioreset plugin also behaves badly inside a build.

(From OE-Core rev: df758ea66fd2f69d591c1fd36b90969796d50bd0)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-30 15:01:51 +01:00
Ross Burton
d734975024 rpm: disable libarchive use
libarchive is only needed for the rpm2archive tool, as this is of
limited use and libarchive is a non-trivial build dependency make this
optional and disabled by default.

(From OE-Core rev: 2eaefac2bb0b999e64a445fdadefb639eb7089a0)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-09-30 15:01:51 +01:00
hongxu
92d9cc304d 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.

(From OE-Core rev: 5f16fd0bf774314c79572daf4ba7e4a8ae209ba1)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-08-01 19:57:49 +01:00
Chen Qi
76826e21ae 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
"""

(From OE-Core rev: 13e17930062cb3f816516ba7dbeb70d6da7174dd)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-07-18 11:06:32 +01:00
Hongxu Jia
7adde4fa40 rpm: fix rpm -Kv xxx.rpm failed if signature header is larger than 64KB
Since commits [Place file signatures into the signature header where they
belong][1] applied, run `rpm -Kv **.rpm' failed if signature header
is larger than 64KB. Here are steps:

1) A unsigned rpm package, the size is 227560 bytes
$ ls -al xz-src-5.2.5-r0.corei7_64.rpm
-rw-------. 1 mockbuild 1000 227560 Jun  3 09:59

2) Sign the rpm package
$ rpmsign --addsign ... xz-src-5.2.5-r0.corei7_64.rpm

3) The size of signed rpm is 312208 bytes
$ ls -al xz-src-5.2.5-r0.corei7_64.rpm
-rw-------. 1 mockbuild 1000 312208 Jun  3 09:48

4) Run `rpm -Kv' failed with signature hdr data out of range
$ rpm -Kv xz-src-5.2.5-r0.corei7_64.rpm
xz-src-5.2.5-r0.corei7_64.rpm:
error: xz-src-5.2.5-r0.corei7_64.rpm: signature hdr data: BAD, no. of
bytes(88864) out of range

>From 1) and 3), the size of signed rpm package increased
312208 - 227560 = 84648, so the check of dl_max (64KB,65536)
is not enough.

As [1] said:

    This also means the signature header can be MUCH bigger than ever
    before,so bump up the limit (to 64MB, arbitrary something for now)

So [1] missed to multiply by 1024.

[1] f558e88605

(From OE-Core rev: 8359bdd60afafd80d354f7f40ed648643d8db292)

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-06-04 13:27:32 +01:00
Changqing Li
07083caab6 rpm: fix file conflicts for MIPS64 N32
The following error occurred when prefer_color set to 2:
Error: Transaction check error:
  file /sbin/ldconfig conflicts between attempted installs of
ldconfig-2.31+git0+71f2b249a2-r0.mips64_n32 and
lib32-ldconfig-2.31+git0+71f2b249a2-r0.mips32r2
  file /usr/bin/gencat conflicts between attempted installs of
lib32-libc6-utils-2.31+git0+71f2b249a2-r0.mips32r2
...

This was because:
transactions_color = 001 (ELF32) & 010 (ELF64) & 100 (ELF32 N32 MIPS64)
FColor = Current file color (001) & transaction_color (111)
oFcolor = Previous file color (100) & transaction_color (111)

when "neither preferred" happened, handled as conflicts. this is too
restrictive for three way conflicts(mips64/mips64 n32/mips(32)).
Fixed by  perform a 'last-in-wins' resolution when "neither is preferred".

refer:
https://github.com/rpm-software-management/rpm/issues/193
https://git.openembedded.org/openembedded-core/commit/meta/recipes-devtools/rpm?id=36c225704daa58b98a4b7f2ef315eb944d8628b5

(From OE-Core rev: f94511fe5c163de8fb34d00ff3ba995437c3922c)

Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2020-05-09 18:57:21 +01:00