1SUMMARY = "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
27SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.20.x;protocol=https \
28           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://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \
36           file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \
37           file://0001-build-pack.c-do-not-insert-payloadflags-into-.rpm-me.patch \
38           file://0001-CMakeLists.txt-look-for-lua-with-pkg-config-rather-t.patch \
39           file://0002-rpmio-rpmglob.c-avoid-using-GLOB_BRACE-if-undefined-.patch \
40           file://0001-CMakeLists.txt-set-libdir-to-CMAKE_INSTALL_FULL_LIBD.patch \
41           "
42
43PE = "1"
44SRCREV = "b3323786668cf99bc9aed7e60ccdab0bc25e19da"
45
46S = "${WORKDIR}/git"
47
48DEPENDS = "lua libgcrypt file popt xz bzip2 elfutils python3 sqlite3 zstd"
49DEPENDS:append:class-native = " file-replacement-native bzip2-replacement-native"
50
51EXTRA_OECMAKE:append = " -D__CURL:FILEPATH=curl"
52EXTRA_OECMAKE:append:libc-musl = " -DENABLE_NLS=OFF -DENABLE_OPENMP=OFF"
53
54# --sysconfdir prevents rpm from attempting to access machine-specific configuration in sysroot/etc; we need to have it in rootfs
55# --localstatedir prevents rpm from writing its database to native sysroot when building images
56EXTRA_OECMAKE:append:class-native = " -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DCMAKE_INSTALL_LOCALSTATEDIR:PATH=/var"
57EXTRA_OECMAKE:append:class-nativesdk = " -DCMAKE_INSTALL_SYSCONFDIR:PATH=/etc -DCMAKE_INSTALL_FULL_SYSCONFDIR=/etc"
58
59inherit cmake gettext pkgconfig python3targetconfig
60OECMAKE_GENERATOR = "Unix Makefiles"
61
62BBCLASSEXTEND = "native nativesdk"
63
64PACKAGECONFIG ??= "archive"
65
66PACKAGECONFIG[plugins] = "-DENABLE_PLUGINS=ON,-DENABLE_PLUGINS=OFF"
67PACKAGECONFIG[testsuite] = "-DENABLE_TESTSUITE=ON,-DENABLE_TESTSUITE=OFF"
68
69# has replaced openpgp support and is written in rust: https://fedoraproject.org/wiki/Changes/RpmSequoia
70PACKAGECONFIG[sequoia] = "-DWITH_SEQUOIA=ON,-DWITH_SEQUOIA=OFF,rpm-sequoia"
71
72PACKAGECONFIG[cap] = "-DWITH_CAP=ON,-DWITH_CAP=OFF"
73PACKAGECONFIG[acl] = "-DWITH_ACL=ON,-DWITH_ACL=OFF"
74PACKAGECONFIG[archive] = "-DWITH_ARCHIVE=ON,-DWITH_ARCHIVE=OFF,libarchive"
75PACKAGECONFIG[selinux] = "-DWITH_SELINUX=ON,-DWITH_SELINUX=OFF,libselinux"
76PACKAGECONFIG[dbus] = "-DWITH_DBUS=ON,-DWITH_DBUS=OFF"
77PACKAGECONFIG[audit] = "-DWITH_AUDIT=ON,-DWITH_AUDIT=OFF,audit"
78PACKAGECONFIG[fsverity] = "-DWITH_FSVERITY=ON,-DWITH_FSVERITY=OFF"
79PACKAGECONFIG[imaevm] = "-DWITH_IMAEVM=ON,-DWITH_IMAEVM=OFF,ima-evm-utils"
80PACKAGECONFIG[fapolicyd] = "-DWITH_FAPOLICYD=ON,-DWITH_FAPOLICYD=OFF"
81PACKAGECONFIG[readline] = "-DWITH_READLINE=ON,-DWITH_READLINE=OFF,readline"
82
83# Direct rpm-native to read configuration from our sysroot, not the one it was compiled in
84# libmagic also has sysroot path contamination, so override it
85
86WRAPPER_TOOLS = " \
87   ${bindir}/rpm \
88   ${bindir}/rpm2archive \
89   ${bindir}/rpm2cpio \
90   ${bindir}/rpmbuild \
91   ${bindir}/rpmdb \
92   ${bindir}/rpmgraph \
93   ${bindir}/rpmkeys \
94   ${bindir}/rpmsign \
95   ${bindir}/rpmspec \
96   ${libdir}/rpm/rpmdeps \
97"
98
99do_install:append:class-native() {
100        for tool in ${WRAPPER_TOOLS}; do
101                test -x ${D}$tool && create_wrapper ${D}$tool \
102                        RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
103                        RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \
104                        MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
105                        RPM_NO_CHROOT_FOR_SCRIPTS=1
106        done
107}
108
109do_install:append:class-nativesdk() {
110        rm -rf ${D}/var
111
112	mkdir -p ${D}${SDKPATHNATIVE}/environment-setup.d
113	cat <<- EOF > ${D}${SDKPATHNATIVE}/environment-setup.d/rpm.sh
114		export RPM_CONFIGDIR="${libdir}/rpm"
115		export RPM_ETCCONFIGDIR="${SDKPATHNATIVE}"
116		export RPM_NO_CHROOT_FOR_SCRIPTS=1
117	EOF
118}
119
120# Rpm's make install creates var/tmp which clashes with base-files packaging
121do_install:append:class-target() {
122    rm -rf ${D}/var
123}
124do_install:append:class-nativesdk() {
125    rm -rf ${D}${SDKPATHNATIVE}/var
126    # Ensure find-debuginfo is located correctly inside SDK
127    mkdir -p ${D}${libdir}/rpm
128    echo "%__find_debuginfo   ${SDKPATHNATIVE}/usr/bin/find-debuginfo" >> ${D}${libdir}/rpm/macros
129}
130
131do_install:append () {
132	sed -i -e 's:${HOSTTOOLS_DIR}/::g' \
133            -e 's:${STAGING_DIR_NATIVE}/::g' \
134	    ${D}/${libdir}/rpm/macros
135	sed -i -e 's:${RECIPE_SYSROOT}/::g' \
136	    ${D}/${libdir}/cmake/rpm/rpm-targets.cmake
137
138}
139
140FILES:${PN} += "${libdir}/rpm-plugins/*.so \
141               "
142FILES:${PN}:append:class-nativesdk = " ${SDKPATHNATIVE}/environment-setup.d/rpm.sh"
143
144FILES:${PN}-dev += "${libdir}/rpm-plugins/*.la \
145                    "
146PACKAGE_BEFORE_PN += "${PN}-build ${PN}-sign ${PN}-archive"
147
148RRECOMMENDS:${PN} += "rpm-sign rpm-archive"
149
150FILES:${PN}-build = "\
151    ${bindir}/rpmbuild \
152    ${bindir}/gendiff \
153    ${bindir}/rpmspec \
154    ${libdir}/librpmbuild.so.* \
155    ${libdir}/rpm/brp-* \
156    ${libdir}/rpm/check-* \
157    ${libdir}/rpm/sepdebugcrcfix \
158    ${libdir}/rpm/find-lang.sh \
159    ${libdir}/rpm/sysusers.sh \
160    ${libdir}/rpm/*provides* \
161    ${libdir}/rpm/*requires* \
162    ${libdir}/rpm/*deps* \
163    ${libdir}/rpm/*.prov \
164    ${libdir}/rpm/*.req \
165    ${libdir}/rpm/config.* \
166    ${libdir}/rpm/mkinstalldirs \
167    ${libdir}/rpm/macros.p* \
168    ${libdir}/rpm/fileattrs/* \
169"
170
171FILES:${PN}-sign = "\
172    ${bindir}/rpmsign \
173    ${libdir}/librpmsign.so.* \
174"
175
176FILES:${PN}-archive = "\
177    ${bindir}/rpm2archive \
178"
179
180PACKAGES += "python3-rpm"
181PROVIDES += "python3-rpm"
182FILES:python3-rpm = "${PYTHON_SITEPACKAGES_DIR}/rpm/* ${PYTHON_SITEPACKAGES_DIR}/rpm-*.egg-info"
183
184RDEPENDS:${PN}-build = "bash perl python3-core debugedit"
185
186PACKAGE_PREPROCESS_FUNCS += "rpm_package_preprocess"
187
188# Do not specify a sysroot when compiling on a target.
189rpm_package_preprocess () {
190	sed -i -e 's:--sysroot[^ ]*::g' \
191	    ${PKGD}/${libdir}/rpm/macros
192}
193
194SSTATE_HASHEQUIV_FILEMAP = " \
195    populate_sysroot:*/rpm/macros:${TMPDIR} \
196    populate_sysroot:*/rpm/macros:${COREBASE} \
197    "
198