blob: 95a9e92f96b24cab4b60a247dc69b393502833d1 [file] [log] [blame]
Patrick Williams92b42cb2022-09-03 06:53:57 -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-only"
25LIC_FILES_CHKSUM = "file://COPYING;md5=c4eec0c20c6034b9407a09945b48a43f"
26
Andrew Geissler87f5cff2022-09-30 13:13:31 -050027SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.18.x;protocol=https \
Patrick Williams92b42cb2022-09-03 06:53:57 -050028 file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \
29 file://0001-Do-not-read-config-files-from-HOME.patch \
30 file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \
31 file://0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch \
32 file://0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch \
33 file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \
34 file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \
35 file://0001-perl-disable-auto-reqs.patch \
36 file://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \
37 file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050038 file://0001-build-pack.c-do-not-insert-payloadflags-into-.rpm-me.patch \
39 file://0001-configure.ac-add-linux-gnux32-variant-to-triplet-han.patch \
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050040 file://0001-python-Use-Py_hash_t-instead-of-long-in-hdr_hash.patch \
Patrick Williamse760df82023-05-26 11:10:49 -050041 file://fix-declaration.patch \
Andrew Geissler8f840682023-07-21 09:09:43 -050042 file://ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.patch \
Patrick Williams92b42cb2022-09-03 06:53:57 -050043 "
44
45PE = "1"
Patrick Williamse760df82023-05-26 11:10:49 -050046SRCREV = "4588bc3f994338502d2770ad24cbfcdaa6c335ec"
Patrick Williams92b42cb2022-09-03 06:53:57 -050047
48S = "${WORKDIR}/git"
49
50DEPENDS = "lua libgcrypt file popt xz bzip2 elfutils python3"
51DEPENDS:append:class-native = " file-replacement-native bzip2-replacement-native"
52
53inherit autotools gettext pkgconfig python3native
54export PYTHON_ABI
55
56AUTOTOOLS_AUXDIR = "${S}/build-aux"
57
58# OE-core patches autoreconf to additionally run gnu-configize, which fails with this recipe
59EXTRA_AUTORECONF:append = " --exclude=gnu-configize"
60
61# Vendor is detected differently on x86 and aarch64 hosts and can feed into target packages
62EXTRA_OECONF:append = " --enable-python --with-crypto=libgcrypt --with-vendor=pc"
63EXTRA_OECONF:append:libc-musl = " --disable-nls --disable-openmp"
64
65# --sysconfdir prevents rpm from attempting to access machine-specific configuration in sysroot/etc; we need to have it in rootfs
66# --localstatedir prevents rpm from writing its database to native sysroot when building images
67# Forcibly disable plugins for native/nativesdk, as the inhibit and prioreset
68# plugins both behave badly inside builds.
69EXTRA_OECONF:append:class-native = " --sysconfdir=/etc --localstatedir=/var --disable-plugins"
70EXTRA_OECONF:append:class-nativesdk = " --sysconfdir=/etc --disable-plugins"
71
72BBCLASSEXTEND = "native nativesdk"
73
74PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'inhibit', '', d)} sqlite zstd"
75# The inhibit plugin serves no purpose outside of the target
76PACKAGECONFIG:remove:class-native = "inhibit"
77PACKAGECONFIG:remove:class-nativesdk = "inhibit"
78
79PACKAGECONFIG[imaevm] = "--with-imaevm,,ima-evm-utils"
80PACKAGECONFIG[inhibit] = "--enable-inhibit-plugin,--disable-inhibit-plugin,dbus"
81PACKAGECONFIG[rpm2archive] = "--with-archive,--without-archive,libarchive"
82PACKAGECONFIG[sqlite] = "--enable-sqlite=yes,--enable-sqlite=no,sqlite3"
Andrew Geissler87f5cff2022-09-30 13:13:31 -050083PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
Patrick Williams92b42cb2022-09-03 06:53:57 -050084PACKAGECONFIG[ndb] = "--enable-ndb,--disable-ndb"
85PACKAGECONFIG[bdb-ro] = "--enable-bdb-ro,--disable-bdb-ro"
86PACKAGECONFIG[zstd] = "--enable-zstd=yes,--enable-zstd=no,zstd"
87
88ASNEEDED = ""
89
90# Direct rpm-native to read configuration from our sysroot, not the one it was compiled in
91# libmagic also has sysroot path contamination, so override it
92
93WRAPPER_TOOLS = " \
94 ${bindir}/rpm \
95 ${bindir}/rpm2archive \
96 ${bindir}/rpm2cpio \
97 ${bindir}/rpmbuild \
98 ${bindir}/rpmdb \
99 ${bindir}/rpmgraph \
100 ${bindir}/rpmkeys \
101 ${bindir}/rpmsign \
102 ${bindir}/rpmspec \
103 ${libdir}/rpm/rpmdeps \
104"
105
106do_configure:prepend() {
107 mkdir -p ${S}/build-aux
108}
109
110do_install:append:class-native() {
111 for tool in ${WRAPPER_TOOLS}; do
112 test -x ${D}$tool && create_wrapper ${D}$tool \
113 RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
114 RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \
115 MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
116 RPM_NO_CHROOT_FOR_SCRIPTS=1
117 done
118}
119
120do_install:append:class-nativesdk() {
Patrick Williams92b42cb2022-09-03 06:53:57 -0500121 rm -rf ${D}/var
122
Andrew Geissler517393d2023-01-13 08:55:19 -0600123 mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
124 cat <<- EOF > ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500125 export RPM_CONFIGDIR="${libdir}/rpm"
126 export RPM_ETCCONFIGDIR="${SDKPATHNATIVE}"
Andrew Geissler517393d2023-01-13 08:55:19 -0600127 export RPM_NO_CHROOT_FOR_SCRIPTS=1
128 EOF
Patrick Williams92b42cb2022-09-03 06:53:57 -0500129}
130
131# Rpm's make install creates var/tmp which clashes with base-files packaging
132do_install:append:class-target() {
133 rm -rf ${D}/var
134}
135do_install:append:class-nativesdk() {
136 rm -rf ${D}${SDKPATHNATIVE}/var
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500137 # Ensure find-debuginfo is located correctly inside SDK
Patrick Williams520786c2023-06-25 16:20:36 -0500138 mkdir -p ${D}${libdir}/rpm
139 echo "%__find_debuginfo ${SDKPATHNATIVE}/usr/bin/find-debuginfo" >> ${D}${libdir}/rpm/macros
Patrick Williams92b42cb2022-09-03 06:53:57 -0500140}
141
142do_install:append () {
143 sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
144 ${D}/${libdir}/rpm/macros
145
146}
147
148FILES:${PN} += "${libdir}/rpm-plugins/*.so \
149 "
150FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/rpm.sh"
151
152FILES:${PN}-dev += "${libdir}/rpm-plugins/*.la \
153 "
154PACKAGE_BEFORE_PN += "${PN}-build ${PN}-sign ${PN}-archive"
155
156RRECOMMENDS:${PN} += "rpm-sign rpm-archive"
157
158FILES:${PN}-build = "\
159 ${bindir}/rpmbuild \
160 ${bindir}/gendiff \
161 ${bindir}/rpmspec \
162 ${libdir}/librpmbuild.so.* \
163 ${libdir}/rpm/brp-* \
164 ${libdir}/rpm/check-* \
Patrick Williams92b42cb2022-09-03 06:53:57 -0500165 ${libdir}/rpm/sepdebugcrcfix \
Patrick Williams92b42cb2022-09-03 06:53:57 -0500166 ${libdir}/rpm/find-lang.sh \
167 ${libdir}/rpm/*provides* \
168 ${libdir}/rpm/*requires* \
169 ${libdir}/rpm/*deps* \
170 ${libdir}/rpm/*.prov \
171 ${libdir}/rpm/*.req \
172 ${libdir}/rpm/config.* \
173 ${libdir}/rpm/mkinstalldirs \
174 ${libdir}/rpm/macros.p* \
175 ${libdir}/rpm/fileattrs/* \
176"
177
178FILES:${PN}-sign = "\
179 ${bindir}/rpmsign \
180 ${libdir}/librpmsign.so.* \
181"
182
183FILES:${PN}-archive = "\
184 ${bindir}/rpm2archive \
185"
186
187PACKAGES += "python3-rpm"
188PROVIDES += "python3-rpm"
Patrick Williamse760df82023-05-26 11:10:49 -0500189FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/* ${PYTHON_SITEPACKAGES_DIR}/rpm-*.egg-info"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500190
Andrew Geisslerfc113ea2023-03-31 09:59:46 -0500191RDEPENDS:${PN}-build = "bash perl python3-core debugedit"
Patrick Williams92b42cb2022-09-03 06:53:57 -0500192
193PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
194
195# Do not specify a sysroot when compiling on a target.
196rpm_package_preprocess () {
197 sed -i -e 's:--sysroot[^ ]*::g' \
198 ${PKGD}/${libdir}/rpm/macros
199}
200
201SSTATE_HASHEQUIV_FILEMAP = " \
202 populate_sysroot:*/rpm/macros:${TMPDIR} \
203 populate_sysroot:*/rpm/macros:${COREBASE} \
204 "