summaryrefslogtreecommitdiff
path: root/app-arch/rpm
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-11-24 03:02:55 +0000
committerV3n3RiX <venerix@koprulu.sector>2024-11-24 03:02:55 +0000
commit530a5a826feeb71085fb8a01927f4d775a0b131b (patch)
treeb7669c45ea3f2a3a37b2437817a370226bb1c819 /app-arch/rpm
parent71dd9d29cdaf7cc0ecdb9ea37d128726a941c630 (diff)
gentoo auto-resync : 24:11:2024 - 03:02:54
Diffstat (limited to 'app-arch/rpm')
-rw-r--r--app-arch/rpm/Manifest9
-rw-r--r--app-arch/rpm/files/rpm-4.17.0-libdir.patch32
-rw-r--r--app-arch/rpm/files/rpm-4.18.1-musl-nls.patch42
-rw-r--r--app-arch/rpm/files/rpm-4.20.0-libdir.patch11
-rw-r--r--app-arch/rpm/files/rpm-4.8.1-clang.patch52
-rw-r--r--app-arch/rpm/files/rpm-4.8.1-db-path.patch26
-rw-r--r--app-arch/rpm/rpm-4.18.1.ebuild172
-rw-r--r--app-arch/rpm/rpm-4.20.0.ebuild145
8 files changed, 159 insertions, 330 deletions
diff --git a/app-arch/rpm/Manifest b/app-arch/rpm/Manifest
index 7c2413af5d30..4473c8dfe48e 100644
--- a/app-arch/rpm/Manifest
+++ b/app-arch/rpm/Manifest
@@ -1,11 +1,8 @@
-AUX rpm-4.17.0-libdir.patch 855 BLAKE2B 81a2daf0577c8dc3feac190764125da7a616e24ccdd38c3715c3c68f7fc831cf2662e629f23ed88f7d133961a40ac7f63acd6c7f52e99f17abe53442b2a5f14e SHA512 68d884cf9d57d89138ee7d6882869b0560aa9cd3dc82b837c47732f2d0248b42fbdafbbcc1f3f04322cd750744d97e4512491fb0591eb0622b2a5d1918391c46
-AUX rpm-4.18.1-musl-nls.patch 1605 BLAKE2B 6a1cf248e7c464795edf630aa367b55c8026bdbdcd43cb192f4c96dd96f119720d4f3a59fd019841d45b6e2bf54fce59e64e10e3e320a8b9cddff6e7cf864a50 SHA512 fb1071ba5db5d1b9ac631c2977ceebfaa3421655202cda8c088bcc0561f4d89216eca5e10e3c53787d9e160ee2358c588fc2459b128bf74cf576883fe739d06c
AUX rpm-4.19.0-libdir.patch 578 BLAKE2B 643e4869b5770e98814a4787c66c3de516c0675648598164c4fe6e076e5a5c497ba897353260e5fb780af2d8b9b31693b4189704a145245cc0ee22ae3a6759a7 SHA512 b241e014c642ea70fdec4e12b3af512a00b5c408d9ecdd1c5bcd4aca9bd60f9af49ec8a599fbeb9f4d5a66c24450e082a0f199c27c15554855f3195d394de228
AUX rpm-4.19.1.1-musl-compat.patch 401 BLAKE2B f1d77f167d0270602394cc145c288cc5c622892044c5f38df803649f9ca300f5dab7e0850e239362652142818c152f54e4de5f718ed42d51928329b0599abe34 SHA512 325d2b417619fd26ed9a2e2036854da5ed0118420640ef843e31add082d4ab3527fe3a6a7ee2d35c5939c75a7b5e17318973cd242e8ba008c54b8a1ad7ede0b8
-AUX rpm-4.8.1-clang.patch 1519 BLAKE2B 7338b739782296e8be1d4a0ce9cdbeae558831897585d9b0d3fee935a82ed68e4066e7bbb1e722f212277dd3ede8be2ebad65f4a3f1286911c64263034c8b766 SHA512 7e6400f1782d536a26f322338be798c675ca69e755df0cacb3af1c56b3dc6487ae1c813f3579cba007cefa5b62c5e474576a4b8fd9230bb29536d246db860795
-AUX rpm-4.8.1-db-path.patch 628 BLAKE2B 69ac0d4541c4d6e74fd716529c4cfd482432d400f84f39775bd585931e786acf45ab7a1da617f0214dcba90c78511ca22fc556896ae1963ec9160787fdaab902 SHA512 12539bbeda99d261890d50304945c7f022681ca0a283c70f17a6b1f188e9e24e9ce05b71d541ed6d951f94576b5183c49c4db784d5016d075a859c1e4dcb9005
-DIST rpm-4.18.1.tar.bz2 6396363 BLAKE2B 4bc582bdc34a89d83346a8e18133c4f1846f2e8741c85ae2d0fd3398166e5a5d81ed86869e34700d3ea414fbf8ccf6c918692e865b956b1e6b70830b64cd323e SHA512 0ede2138b9b4c3b50d7e914cf82655507fcc207ba67804c749ea17560002976cb26b95801e9138a51589b60459494a991213a1131dbef5af2eca9b5050a4f29c
+AUX rpm-4.20.0-libdir.patch 437 BLAKE2B a1d0d59027fb2e551647be03a6d4eab9fdac544028e7cd8bd4d8d77ce2b30e7b1334bc88ba1c990f23aa0779fc3d426a5576ef275f50daaed768965e148a93c5 SHA512 65fa4a5e653c6620064ef72db37dc21e40874bf21d68274f66fa26dd015f20d329e55bbf58f24a6aeb58a90946ffab3ff6f2ed4df4299066060d718476ddc2ae
DIST rpm-4.19.1.1.tar.bz2 5849649 BLAKE2B 66ed845007f3767fd92e2384962927b93cef7b825b8ea60f81f0a4b51b9d6a09d1cbec1668226fa85de675347d52635cb25c4d11204ada0eed6c898425b21536 SHA512 3364c453c29903c144a3680ceca7a17426eb085c288b6313fb7e857a42a5e0a965f623882e0f58e633f8b8770e839d9df9f7653d99c73759af5c89d0a981908d
-EBUILD rpm-4.18.1.ebuild 4157 BLAKE2B 8f896909cd5b2ec982bde12fc94d09d9ffb67fee3784aeb6b2e75cef2e39044ce17fe9daf2debf149fb2e0371a72e736252371a6db5869bc58ce83e65052d698 SHA512 69f8fed5ade49586ed2f9c053ec4ade374608670ac7a9f5257dd393e25b2211fa4602fea29b3a9d8e49aa51cfe4f16c2d7c03002d1fda6e76121a4e11cba9978
+DIST rpm-4.20.0.tar.bz2 5984513 BLAKE2B c809e933cf7eb9ab63fa7693e634f7fcf744f94130199f674c5e76e77ead4de25b583daefdf651bbf0475012d262d1bdca605f19a520e160e90e3deb68c74f18 SHA512 b340c66cfda3abed38e81f91c4a789f2c6c0d3ce408de71d861fef27e180b607ae698e046b6925c7781a7177cde9df4075943714ed2aad7c62645eca348f5544
EBUILD rpm-4.19.1.1.ebuild 3285 BLAKE2B dc2241a7fa07e0a07f40c40285fe394361a5930aca7a7aec6ee98f683dec1079f907a03f33470d0ee19cc65597fafd72e3e7fbf3980bd8c48457795fb9c648dc SHA512 af29f466e66aab4017b88c0ca7d08ccc35980ce5a23cd07540cee796d79e0760344d77680edd57a5a226c8281c054ab1c06a830fe9b4380144b16d7190f799dd
+EBUILD rpm-4.20.0.ebuild 3511 BLAKE2B be665295eab82ef8110d9006a5d0ef4663dd2dd2052a7e6c2e1212196bc23bd71a7d7a42b7511876a2441be74fee55368c53a295c63e2d3fab3bdef3ac50d265 SHA512 34e8a092a3e92f45082dae89684b4a44418ce72bf996cf9d0ec2867c199f92dfebfe439d842cc25e635c2c338110d780aeb7f88244834680263030b26b93adf5
MISC metadata.xml 616 BLAKE2B f0df64810f4eaf6b3fa7cdb09a892677404fa2d6d3bd36abb9c5f638be56200d1c83dfec4b6a3bd18ad9ae9b56eeaabdbce243eafad366f366c9157ddfb00ad8 SHA512 792c6c2476c7e928b1e1515b56e19ec83e3855aaaebd17aa66407f6a232f4680ba5d90da54c0a5af7d3db829124fa062015070a1ab82ebe91f5f8f2d1ebaff29
diff --git a/app-arch/rpm/files/rpm-4.17.0-libdir.patch b/app-arch/rpm/files/rpm-4.17.0-libdir.patch
deleted file mode 100644
index 5bff26b71290..000000000000
--- a/app-arch/rpm/files/rpm-4.17.0-libdir.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/configure.ac
-+++ b/configure.ac
-@@ -865,13 +865,7 @@ AC_ARG_WITH([rundir],
- AC_DEFINE_UNQUOTED([RUNDIR],["${RUNDIR}"],[run-time variable directory])
- AC_SUBST(RUNDIR)
-
--if test X"$prefix" = XNONE ; then
-- usrprefix="$ac_default_prefix"
--else
-- usrprefix=$prefix
--fi
--
--RPMCONFIGDIR="`echo ${usrprefix}/lib/rpm`"
-+RPMCONFIGDIR="`echo ${libexecdir}/rpm/`"
- AC_SUBST(RPMCONFIGDIR)
-
- AC_SUBST(OBJDUMP)
---- a/rpm.am
-+++ b/rpm.am
-@@ -1,10 +1,10 @@
- # Internal binaries
- ## HACK: It probably should be $(libexecdir)/rpm or $(libdir)/rpm
--rpmlibexecdir = $(prefix)/lib/rpm
-+rpmlibexecdir = $(pkglibexecdir)
-
- # Host independent config files
- ## HACK: it probably should be $(datadir)/rpm
--rpmconfigdir = $(prefix)/lib/rpm
-+rpmconfigdir = $(pkglibexecdir)
-
- # Libtool version (current-revision-age) for all our libraries
- rpm_version_info = 11:0:2
diff --git a/app-arch/rpm/files/rpm-4.18.1-musl-nls.patch b/app-arch/rpm/files/rpm-4.18.1-musl-nls.patch
deleted file mode 100644
index 7d1fde28bacf..000000000000
--- a/app-arch/rpm/files/rpm-4.18.1-musl-nls.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-https://bugs.gentoo.org/888954
-https://github.com/rpm-software-management/rpm/commit/f401979a4c4829d68e9614860644bdb74b6dda66
-
-From da222f0d82721d17e57d491d2749a4bc44754b9d Mon Sep 17 00:00:00 2001
-From: Takuya Wakazono <pastalian46@gmail.com>
-Date: Thu, 18 Jan 2024 18:41:11 +0900
-Subject: [PATCH] Don't use _nl_msg_cat_cntr if __GLIC__ is not defined
-
-musl doesn't need to use libintl from GNU gettext because it has its
-own NLS implementation. Assuming _nl_msg_cat_cntr exists breaks the
-build against the musl system.
---- a/lib/tagexts.c
-+++ b/lib/tagexts.c
-@@ -532,7 +532,7 @@ static int filerequireTag(Header h, rpmtd td, headerGetFlags hgflags)
-
- /* I18N look aside diversions */
-
--#if defined(ENABLE_NLS)
-+#if defined(ENABLE_NLS) && (defined(__GLIBC__) || !defined(__linux__))
- extern int _nl_msg_cat_cntr; /* XXX GNU gettext voodoo */
- #endif
- static const char * const language = "LANGUAGE";
-@@ -569,7 +569,9 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
- /* change to en_US for msgkey -> msgid resolution */
- langval = getenv(language);
- (void) setenv(language, "en_US", 1);
-+#if defined(__GLIBC__) || !defined(__linux__)
- ++_nl_msg_cat_cntr;
-+#endif
-
- msgid = NULL;
- for (domain = dstring; domain != NULL; domain = de) {
-@@ -584,7 +586,9 @@ static int i18nTag(Header h, rpmTag tag, rpmtd td, headerGetFlags hgflags)
- (void) setenv(language, langval, 1);
- else
- unsetenv(language);
-+#if defined(__GLIBC__) || !defined(__linux__)
- ++_nl_msg_cat_cntr;
-+#endif
-
- if (domain && msgid) {
- td->data = dgettext(domain, msgid);
diff --git a/app-arch/rpm/files/rpm-4.20.0-libdir.patch b/app-arch/rpm/files/rpm-4.20.0-libdir.patch
new file mode 100644
index 000000000000..cc482015f5a4
--- /dev/null
+++ b/app-arch/rpm/files/rpm-4.20.0-libdir.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -41,7 +41,7 @@
+ option(WITH_LIBLZMA "Build with liblzma support" ON)
+ option(WITH_DOXYGEN "Build API docs with doxygen" OFF)
+
+-set(RPM_CONFIGDIR "${CMAKE_INSTALL_PREFIX}/lib/rpm" CACHE PATH "rpm home")
++set(RPM_CONFIGDIR "${CMAKE_INSTALL_PREFIX}/libexec/rpm" CACHE PATH "rpm home")
+ set(RPM_MACROSDIR "${RPM_CONFIGDIR}/macros.d")
+ set(RPM_VENDOR "vendor" CACHE STRING "rpm vendor string")
+
diff --git a/app-arch/rpm/files/rpm-4.8.1-clang.patch b/app-arch/rpm/files/rpm-4.8.1-clang.patch
deleted file mode 100644
index 714fbc09b534..000000000000
--- a/app-arch/rpm/files/rpm-4.8.1-clang.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-https://github.com/rpm-software-management/rpm/commit/6ad8a71407b173b6c50d389f01edd8a4aecd6807
---- a/lib/fsm.c
-+++ b/lib/fsm.c
-@@ -1015,27 +1015,28 @@
- }
-
- setmeta:
-- /* Special files require path-based ops */
-- int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
-- if (!rc && fd == -1 && mayopen) {
-- int flags = O_RDONLY;
-- /* Only follow safe symlinks, and never on temporary files */
-- if (fp->suffix)
-- flags |= AT_SYMLINK_NOFOLLOW;
-- fd = fsmOpenat(di.dirfd, fp->fpath, flags,
-- S_ISDIR(fp->sb.st_mode));
-- if (fd < 0)
-- rc = RPMERR_OPEN_FAILED;
-- }
-+ {
-+ /* Special files require path-based ops */
-+ int mayopen = S_ISREG(fp->sb.st_mode) || S_ISDIR(fp->sb.st_mode);
-+ if (!rc && fd == -1 && mayopen) {
-+ int flags = O_RDONLY;
-+ /* Only follow safe symlinks, and never on temporary files */
-+ if (fp->suffix)
-+ flags |= AT_SYMLINK_NOFOLLOW;
-+ fd = fsmOpenat(di.dirfd, fp->fpath, flags,
-+ S_ISDIR(fp->sb.st_mode));
-+ if (fd < 0)
-+ rc = RPMERR_OPEN_FAILED;
-+ }
-+ if (!rc && fp->setmeta) {
-+ rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
-+ fi, plugins, fp->action,
-+ &fp->sb, nofcaps);
-+ }
-
-- if (!rc && fp->setmeta) {
-- rc = fsmSetmeta(fd, di.dirfd, fp->fpath,
-- fi, plugins, fp->action,
-- &fp->sb, nofcaps);
-- }
--
-- if (fd != firstlinkfile)
-- fsmClose(&fd);
-+ if (fd != firstlinkfile)
-+ fsmClose(&fd);
-+ }
- }
-
- /* Notify on success. */
diff --git a/app-arch/rpm/files/rpm-4.8.1-db-path.patch b/app-arch/rpm/files/rpm-4.8.1-db-path.patch
deleted file mode 100644
index 634dd2373ab8..000000000000
--- a/app-arch/rpm/files/rpm-4.8.1-db-path.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/Makefile.am b/Makefile.am
-index 587cfa7..498abfb 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -177,7 +177,7 @@ EXTRA_DIST += rpmpopt.in
-
- usrsrcdir = $(prefix)/src
-
--rpmvardir = $(localstatedir)/lib/rpm
-+rpmvardir = $(localstatedir)/rpm
- rpmvar_DATA =
-
- install-exec-hook:
-diff --git a/macros.in b/macros.in
-index ae46fcb..213b53c 100644
---- a/macros.in
-+++ b/macros.in
-@@ -155,7 +155,7 @@
- %_bzip2bin %{__bzip2}
-
- # The location of the rpm database file(s).
--%_dbpath %{_var}/lib/rpm
-+%_dbpath %{_var}/rpm
-
- # The location of the rpm database file(s) after "rpm --rebuilddb".
- %_dbpath_rebuild %{_dbpath}
diff --git a/app-arch/rpm/rpm-4.18.1.ebuild b/app-arch/rpm/rpm-4.18.1.ebuild
deleted file mode 100644
index 99b425069dfb..000000000000
--- a/app-arch/rpm/rpm-4.18.1.ebuild
+++ /dev/null
@@ -1,172 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-LUA_COMPAT=( lua5-{3,4} )
-PYTHON_COMPAT=( python3_{10..11} )
-
-inherit autotools lua-single perl-module python-single-r1 toolchain-funcs
-
-DESCRIPTION="Red Hat Package Management Utils"
-HOMEPAGE="https://rpm.org/ https://github.com/rpm-software-management/rpm"
-SRC_URI="
- https://ftp.osuosl.org/pub/rpm/releases/rpm-$(ver_cut 1-2).x/${P}.tar.bz2
- http://ftp.rpm.org/releases/rpm-$(ver_cut 1-2).x/${P}.tar.bz2
-"
-
-LICENSE="GPL-2 LGPL-2"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux"
-IUSE="acl audit caps +berkdb doc dbus nls openmp python readline selinux +sqlite test +zstd"
-REQUIRED_USE="
- ${LUA_REQUIRED_USE}
- python? ( ${PYTHON_REQUIRED_USE} )
-"
-# Tests are broken. See bug #657500
-RESTRICT="test"
-
-DEPEND="
- ${LUA_DEPS}
- !app-arch/rpm5
- app-arch/libarchive:=
- >=app-arch/bzip2-1.0.1
- app-arch/xz-utils
- >=app-crypt/gnupg-1.2
- >=dev-lang/perl-5.8.8
- dev-libs/elfutils
- dev-libs/libgcrypt:=
- >=dev-libs/popt-1.7
- sys-apps/file
- >=sys-libs/zlib-1.2.3-r1
- virtual/libintl
- acl? ( virtual/acl )
- audit? ( sys-process/audit )
- caps? ( >=sys-libs/libcap-2.0 )
- dbus? ( sys-apps/dbus )
- readline? ( sys-libs/readline:= )
- sqlite? ( dev-db/sqlite:3 )
- python? ( ${PYTHON_DEPS} )
- nls? ( virtual/libintl )
- zstd? ( app-arch/zstd:= )
-"
-BDEPEND="
- virtual/pkgconfig
- doc? ( app-text/doxygen )
- nls? ( sys-devel/gettext )
- test? ( sys-apps/fakechroot )
-"
-RDEPEND="
- ${DEPEND}
- selinux? ( sec-policy/selinux-rpm )
-"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-4.8.1-db-path.patch
- "${FILESDIR}"/${PN}-4.8.1-clang.patch
- "${FILESDIR}"/${PN}-4.17.0-libdir.patch
- "${FILESDIR}"/${PN}-4.18.1-musl-nls.patch
-)
-
-pkg_pretend() {
- [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
-}
-
-pkg_setup() {
- lua-single_pkg_setup
-
- use python && python-single-r1_pkg_setup
-
- # bug #779769
- [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
-}
-
-src_prepare() {
- default
-
- # bug #356769
- sed -i 's:%{_var}/tmp:/var/tmp:' macros.in || die "Fixing tmppath failed"
- # bug #492642
- sed -i "s:@__PYTHON@:${PYTHON}:" macros.in || die "Fixing %__python failed"
-
- # Prevent automake maintainer mode from kicking in (bug #450448).
- #touch -r Makefile.am preinstall.am || die
-
- eautoreconf
-}
-
-src_configure() {
- # rpm no longer supports berkdb, but has readonly support.
- # https://github.com/rpm-software-management/rpm/commit/4290300e24c5ab17c615b6108f38438e31eeb1d0
- local myeconfargs=(
- --enable-libelf
- --without-selinux
- --disable-inhibit-plugin
- --with-crypto=libgcrypt
- $(use_enable berkdb bdb-ro)
- $(use_enable python)
- $(use_enable nls)
- $(use_enable openmp)
- $(use_enable dbus inhibit-plugin)
- $(use_enable sqlite)
- $(use_with caps cap)
- $(use_with acl)
- $(use_with audit)
- $(use_with readline)
- $(use_enable zstd zstd $(usex zstd yes no))
- )
-
- econf "${myeconfargs[@]}"
-}
-
-src_test() {
- # Known to fail with FEATURES=usersandbox (bug #657500)
- if has usersandbox ${FEATURES} ; then
- ewarn "You are emerging ${P} with 'usersandbox' enabled." \
- "Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
- fi
-
- emake check
-}
-
-src_install() {
- default
-
- # Remove la files
- find "${ED}" -name '*.la' -delete || die
-
- # Fix symlinks to /bin/rpm (bug #349840)
- for binary in rpmquery rpmverify; do
- ln -sf rpm "${ED}"/usr/bin/${binary} || die
- done
-
- if ! use nls; then
- rm -rf "${ED}"/usr/share/man/?? || die
- fi
-
- keepdir /usr/src/rpm/{SRPMS,SPECS,SOURCES,RPMS,BUILD}
-
- dodoc CREDITS README*
- if use doc; then
- local docname
- for docname in librpm; do
- docinto "html/${docname}"
- dodoc -r "docs/${docname}/html/."
- done
- fi
-
- # Fix perllocal.pod file collision
- perl_delete_localpod
-
- use python && python_optimize
-}
-
-pkg_postinst() {
- if [[ -f "${EROOT}"/var/lib/rpm/Packages ]] ; then
- einfo "RPM database found... Rebuilding database (may take a while)..."
- "${EROOT}"/usr/bin/rpmdb --rebuilddb --root="${EROOT}/" || die
- else
- einfo "No RPM database found... Creating database..."
- "${EROOT}"/usr/bin/rpmdb --initdb --root="${EROOT}/" || die
- fi
-}
diff --git a/app-arch/rpm/rpm-4.20.0.ebuild b/app-arch/rpm/rpm-4.20.0.ebuild
new file mode 100644
index 000000000000..a076561bbe6f
--- /dev/null
+++ b/app-arch/rpm/rpm-4.20.0.ebuild
@@ -0,0 +1,145 @@
+# Copyright 2023-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_MAKEFILE_GENERATOR=emake
+LUA_COMPAT=( lua5-{3,4} )
+PYTHON_COMPAT=( python3_{10..13} )
+
+inherit cmake flag-o-matic lua-single python-single-r1 toolchain-funcs
+
+DESCRIPTION="The RPM Package Manager"
+HOMEPAGE="https://rpm.org/ https://github.com/rpm-software-management/rpm"
+SRC_URI="https://ftp.osuosl.org/pub/rpm/releases/rpm-$(ver_cut 1-2).x/${P}.tar.bz2"
+
+LICENSE="GPL-2 LGPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="acl audit bzip2 caps berkdb doc dbus iconv lzma nls openmp python
+ readline selinux +sequoia +sqlite +zstd"
+REQUIRED_USE="
+ ${LUA_REQUIRED_USE}
+ python? ( ${PYTHON_REQUIRED_USE} )
+"
+# Tests run against a Fedora container.
+RESTRICT="test"
+
+DEPEND="
+ ${LUA_DEPS}
+ app-arch/libarchive:=
+ >=app-crypt/gnupg-1.2
+ >=dev-lang/perl-5.8.8
+ dev-libs/elfutils
+ >=dev-libs/popt-1.7
+ sys-apps/file
+ >=sys-libs/zlib-1.2.3-r1
+ acl? ( virtual/acl )
+ audit? ( sys-process/audit )
+ bzip2? ( >=app-arch/bzip2-1.0.1 )
+ caps? ( >=sys-libs/libcap-2.0 )
+ dbus? ( sys-apps/dbus )
+ iconv? ( virtual/libiconv )
+ lzma? ( app-arch/xz-utils )
+ nls? ( virtual/libintl )
+ python? ( ${PYTHON_DEPS} )
+ readline? ( sys-libs/readline:= )
+ selinux? ( sys-libs/libselinux )
+ sequoia? ( app-crypt/rpm-sequoia )
+ !sequoia? ( dev-libs/libgcrypt:= )
+ sqlite? ( dev-db/sqlite:3 )
+ zstd? ( app-arch/zstd:= )
+"
+BDEPEND="
+ virtual/pkgconfig
+ doc? ( app-text/doxygen )
+ nls? ( sys-devel/gettext )
+"
+RDEPEND="
+ ${DEPEND}
+ selinux? ( sec-policy/selinux-rpm )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.19.1.1-musl-compat.patch
+ "${FILESDIR}"/${P}-libdir.patch
+)
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+ lua-single_pkg_setup
+
+ use python && python-single-r1_pkg_setup
+
+ # bug #779769
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DENABLE_NDB=ON
+ -DENABLE_TESTSUITE=OFF
+ -DWITH_ARCHIVE=ON
+ -DWITH_FSVERITY=OFF
+ -DWITH_IMAEVM=OFF
+ -DWITH_FAPOLICYD=OFF
+ -DWITH_OPENSSL=OFF
+ -DWITH_LIBDW=ON
+ -DWITH_LIBELF=ON
+ -DENABLE_BDB_RO=$(usex berkdb)
+ -DENABLE_NLS=$(usex nls)
+ -DENABLE_OPENMP=$(usex openmp)
+ -DENABLE_PYTHON=$(usex python)
+ -DENABLE_SQLITE=$(usex sqlite)
+ -DWITH_CAP=$(usex caps)
+ -DWITH_ACL=$(usex acl)
+ -DWITH_SELINUX=$(usex selinux)
+ -DWITH_DBUS=$(usex dbus)
+ -DWITH_AUDIT=$(usex audit)
+ -DWITH_SEQUOIA=$(usex sequoia)
+ -DWITH_READLINE=$(usex readline)
+ -DWITH_BZIP2=$(usex bzip2)
+ -DWITH_ICONV=$(usex iconv)
+ -DWITH_ZSTD=$(usex zstd)
+ -DWITH_LIBLZMA=$(usex lzma)
+ -DWITH_DOXYGEN=$(usex doc)
+ )
+
+ # special handling for ASAN
+ # https://github.com/rpm-software-management/rpm/commit/ca8d1cf3f401d89ad3507aed8d7a70ad37026ca7
+ if is-flagq -fsanitize=address; then
+ mycmakeargs+=( -DENABLE_ASAN=ON )
+ fi
+
+ cmake_src_configure
+}
+
+src_test() {
+ emake -C "${BUILD_DIR}" check
+}
+
+src_install() {
+ cmake_src_install
+
+ if ! use doc; then
+ # Remove pre-built API docs.
+ rm -r "${ED}/usr/share/doc/${PF}" || die
+ fi
+
+ dodoc CREDITS README
+
+ use python && python_optimize
+}
+
+pkg_postinst() {
+ if [[ -f "${EROOT}"/var/lib/rpm/rpmdb.sqlite ]] ; then
+ einfo "RPM database found... Rebuilding database (may take a while)..."
+ "${EROOT}"/usr/bin/rpmdb --rebuilddb --root="${EROOT}/" || die
+ else
+ einfo "No RPM database found... Creating database..."
+ "${EROOT}"/usr/bin/rpmdb --initdb --root="${EROOT}/" || die
+ fi
+}