blob: 0e852d04e013fa7d9dd1fdeb3f946192e95b1b2e [file] [log] [blame]
Andrew Geisslereff27472021-10-29 15:35:00 -05001SUMMARY = "The RPM package management system"
2DESCRIPTION = "The RPM Package Manager (RPM) is a powerful command line driven \
3package management system capable of installing, uninstalling, \
4verifying, querying, and updating software packages. Each software \
5package consists of an archive of files along with information about \
6the package like its version, a description, etc."
7
8SUMMARY:${PN}-dev = "Development files for manipulating RPM packages"
9DESCRIPTION:${PN}-dev = "This package contains the RPM C library and header files. These \
10development files will simplify the process of writing programs that \
11manipulate RPM packages and databases. These files are intended to \
12simplify the process of creating graphical package managers or any \
13other tools that need an intimate knowledge of RPM packages in order \
14to function."
15
16SUMMARY:python3-rpm = "Python bindings for apps which will manupulate RPM packages"
17DESCRIPTION:python3-rpm = "The python3-rpm package contains a module that permits applications \
18written in the Python programming language to use the interface \
19supplied by the RPM Package Manager libraries."
20
21HOMEPAGE = "http://www.rpm.org"
22
23# libraries are also LGPL - how to express this?
24LICENSE = "GPL-2.0"
25LIC_FILES_CHKSUM = "file://COPYING;md5=c4eec0c20c6034b9407a09945b48a43f"
26
Andrew Geissler595f6302022-01-24 19:11:47 +000027SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.17.x;protocol=https \
Andrew Geisslereff27472021-10-29 15:35:00 -050028 file://environment.d-rpm.sh \
29 file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \
30 file://0001-Do-not-read-config-files-from-HOME.patch \
31 file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \
32 file://0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch \
33 file://0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch \
34 file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \
35 file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \
36 file://0001-perl-disable-auto-reqs.patch \
37 file://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \
38 file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \
39 file://0001-tools-Add-error.h-for-non-glibc-case.patch \
40 file://0001-docs-do-not-build-manpages-requires-pandoc.patch \
41 file://0001-build-pack.c-do-not-insert-payloadflags-into-.rpm-me.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000042 file://0001-CVE-2021-3521.patch \
43 file://0002-CVE-2021-3521.patch \
44 file://0003-CVE-2021-3521.patch \
Andrew Geisslereff27472021-10-29 15:35:00 -050045 "
46
47PE = "1"
48SRCREV = "3e74e8ba2dd5e76a5353d238dc7fc38651ce27b3"
49
50S = "${WORKDIR}/git"
51
52DEPENDS = "lua libgcrypt file popt xz bzip2 elfutils python3"
53DEPENDS:append:class-native = " file-replacement-native bzip2-replacement-native"
54
55inherit autotools gettext pkgconfig python3native
56export PYTHON_ABI
57
58AUTOTOOLS_AUXDIR = "${S}/build-aux"
59
60# OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe
61EXTRA_AUTORECONF:append = " --exclude=gnu-configize"
62
63# Vendor is detected differently on x86 and aarch64 hosts and can feed into target packages
64EXTRA_OECONF:append = " --enable-python --with-crypto=libgcrypt --with-vendor=pc"
65EXTRA_OECONF:append:libc-musl = " --disable-nls --disable-openmp"
66
67# --sysconfdir prevents rpm from attempting to access machine-specific configuration in sysroot/etc; we need to have it in rootfs
68# --localstatedir prevents rpm from writing its database to native sysroot when building images
69# Forcibly disable plugins for native/nativesdk, as the inhibit and prioreset
70# plugins both behave badly inside builds.
71EXTRA_OECONF:append:class-native = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
72EXTRA_OECONF:append:class-nativesdk = " --sysconfdir=/etc --disable-plugins"
73
74BBCLASSEXTEND = "native nativesdk"
75
76PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'inhibit', '', d)} sqlite zstd"
77# The inhibit plugin serves no purpose outside of the target
78PACKAGECONFIG:remove:class-native = "inhibit"
79PACKAGECONFIG:remove:class-nativesdk = "inhibit"
80
81PACKAGECONFIG[imaevm] = "--with-imaevm,,ima-evm-utils"
82PACKAGECONFIG[inhibit] = "--enable-inhibit-plugin,--disable-inhibit-plugin,dbus"
83PACKAGECONFIG[rpm2archive] = "--with-archive,--without-archive,libarchive"
84PACKAGECONFIG[sqlite] = "--enable-sqlite=yes,--enable-sqlite=no,sqlite3"
85PACKAGECONFIG[ndb] = "--enable-ndb,--disable-ndb"
86PACKAGECONFIG[bdb-ro] = "--enable-bdb-ro,--disable-bdb-ro"
87PACKAGECONFIG[zstd] = "--enable-zstd=yes,--enable-zstd=no,zstd"
88
89ASNEEDED = ""
90
91# Direct rpm-native to read configuration from our sysroot, not the one it was compiled in
92# libmagic also has sysroot path contamination, so override it
93
94WRAPPER_TOOLS = " \
95 ${bindir}/rpm \
96 ${bindir}/rpm2archive \
97 ${bindir}/rpm2cpio \
98 ${bindir}/rpmbuild \
99 ${bindir}/rpmdb \
100 ${bindir}/rpmgraph \
101 ${bindir}/rpmkeys \
102 ${bindir}/rpmsign \
103 ${bindir}/rpmspec \
104 ${libdir}/rpm/rpmdeps \
105"
106
107do_configure:prepend() {
108 mkdir -p ${S}/build-aux
109}
110
111do_install:append:class-native() {
112 for tool in ${WRAPPER_TOOLS}; do
113 test -x ${D}$tool && create_wrapper ${D}$tool \
114 RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
115 RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \
116 MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
117 RPM_NO_CHROOT_FOR_SCRIPTS=1
118 done
119}
120
121do_install:append:class-nativesdk() {
122 for tool in ${WRAPPER_TOOLS}; do
123 test -x ${D}$tool && create_wrapper ${D}$tool \
124 RPM_CONFIGDIR='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir'), d.getVar('bindir'))}/rpm \
125 RPM_ETCCONFIGDIR='$'{RPM_ETCCONFIGDIR-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir'), d.getVar('bindir'))}/..} \
126 MAGIC='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir'), d.getVar('bindir'))}/misc/magic.mgc \
127 RPM_NO_CHROOT_FOR_SCRIPTS=1
128 done
129
130 rm -rf ${D}/var
131
132 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
133 install -m 644 ${WORKDIR}/environment.d-rpm.sh ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh
134}
135
136# Rpm's make install creates var/tmp which clashes with base-files packaging
137do_install:append:class-target() {
138 rm -rf ${D}/var
139}
Andrew Geissler595f6302022-01-24 19:11:47 +0000140do_install:append:class-nativesdk() {
141 rm -rf ${D}${SDKPATHNATIVE}/var
142}
Andrew Geisslereff27472021-10-29 15:35:00 -0500143
144do_install:append () {
145 sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
146 ${D}/${libdir}/rpm/macros
147
148}
149
150FILES:${PN} += "${libdir}/rpm-plugins/*.so \
151 "
152FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/rpm.sh"
153
154FILES:${PN}-dev += "${libdir}/rpm-plugins/*.la \
155 "
156PACKAGE_BEFORE_PN += "${PN}-build ${PN}-sign ${PN}-archive"
157
158RRECOMMENDS:${PN} += "rpm-sign rpm-archive"
159
160FILES:${PN}-build = "\
161 ${bindir}/rpmbuild \
162 ${bindir}/gendiff \
163 ${bindir}/rpmspec \
164 ${libdir}/librpmbuild.so.* \
165 ${libdir}/rpm/brp-* \
166 ${libdir}/rpm/check-* \
167 ${libdir}/rpm/debugedit \
168 ${libdir}/rpm/sepdebugcrcfix \
169 ${libdir}/rpm/find-debuginfo.sh \
170 ${libdir}/rpm/find-lang.sh \
171 ${libdir}/rpm/*provides* \
172 ${libdir}/rpm/*requires* \
173 ${libdir}/rpm/*deps* \
174 ${libdir}/rpm/*.prov \
175 ${libdir}/rpm/*.req \
176 ${libdir}/rpm/config.* \
177 ${libdir}/rpm/mkinstalldirs \
178 ${libdir}/rpm/macros.p* \
179 ${libdir}/rpm/fileattrs/* \
180"
181
182FILES:${PN}-sign = "\
183 ${bindir}/rpmsign \
184 ${libdir}/librpmsign.so.* \
185"
186
187FILES:${PN}-archive = "\
188 ${bindir}/rpm2archive \
189"
190
191PACKAGES += "python3-rpm"
192PROVIDES += "python3-rpm"
193FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/*"
194
195RDEPENDS:${PN}-build = "bash perl python3-core"
196
197PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
198
199# Do not specify a sysroot when compiling on a target.
200rpm_package_preprocess () {
201 sed -i -e 's:--sysroot[^ ]*::g' \
202 ${PKGD}/${libdir}/rpm/macros
203}
204
205SSTATE_HASHEQUIV_FILEMAP = " \
206 populate_sysroot:*/rpm/macros:${TMPDIR} \
207 populate_sysroot:*/rpm/macros:${COREBASE} \
208 "