1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_6 )
8 inherit autotools flag-o-matic perl-module python-single-r1 eapi7-ver
10 DESCRIPTION="Red Hat Package Management Utils"
11 HOMEPAGE="https://rpm.org
12 https://github.com/rpm-software-management/rpm"
13 SRC_URI="http://ftp.rpm.org/releases/rpm-$(ver_cut 1-2).x/${P}.tar.bz2"
15 LICENSE="GPL-2 LGPL-2"
17 KEYWORDS="~alpha amd64 arm arm64 ~hppa ia64 ~mips ppc ppc64 s390 ~sh ~sparc x86 ~amd64-linux ~x86-linux"
19 # Tests are broken. See bug 657500
22 IUSE="acl caps doc lua nls python selinux test"
23 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
25 CDEPEND="!app-arch/rpm5
28 >=sys-libs/zlib-1.2.3-r1
29 >=app-arch/bzip2-1.0.1
36 python? ( ${PYTHON_DEPS} )
37 nls? ( virtual/libintl )
38 lua? ( >=dev-lang/lua-5.1.0:*[deprecated] )
40 caps? ( >=sys-libs/libcap-2.0 )
43 nls? ( sys-devel/gettext )
44 doc? ( app-doc/doxygen )
46 test? ( sys-apps/fakechroot )
49 selinux? ( sec-policy/selinux-rpm )
53 eapply "${FILESDIR}"/${PN}-4.11.0-autotools.patch
54 eapply "${FILESDIR}"/${PN}-4.8.1-db-path.patch
55 eapply "${FILESDIR}"/${PN}-4.9.1.2-libdir.patch
58 sed -i 's:%{_var}/tmp:/var/tmp:' macros.in || die "Fixing tmppath failed"
60 sed -i "s:@__PYTHON@:${PYTHON}:" macros.in || die "Fixing %__python failed"
66 # Prevent automake maintainer mode from kicking in (#450448).
67 touch -r Makefile.am preinstall.am
71 append-cppflags -I"${EPREFIX}/usr/include/nss" -I"${EPREFIX}/usr/include/nspr"
76 $(use_enable python) \
77 $(use_with doc hackingdocs) \
80 $(use_with caps cap) \
88 find "${ED}" -name '*.la' -delete || die
90 # fix symlinks to /bin/rpm (#349840)
91 for binary in rpmquery rpmverify;do
92 ln -sf rpm "${ED}"/usr/bin/${binary} || die
96 rm -rf "${ED}"/usr/share/man/?? || die
99 keepdir /usr/src/rpm/{SRPMS,SPECS,SOURCES,RPMS,BUILD}
101 dodoc CREDITS README*
103 for docname in hacking librpm; do
104 docinto "html/${docname}"
105 dodoc -r "doc/${docname}/html/."
109 # Fix perllocal.pod file collision
114 # Known to fail with FEATURES=usersandbox (bug #657500):
115 if has usersandbox $FEATURES ; then
116 ewarn "You are emerging ${P} with 'usersandbox' enabled." \
117 "Expect some test failures or emerge with 'FEATURES=-usersandbox'!"
124 if [[ -f "${EROOT}"/var/lib/rpm/Packages ]] ; then
125 einfo "RPM database found... Rebuilding database (may take a while)..."
126 "${EROOT}"/usr/bin/rpmdb --rebuilddb --root="${EROOT}" || die
128 einfo "No RPM database found... Creating database..."
129 "${EROOT}"/usr/bin/rpmdb --initdb --root="${EROOT}" || die