RPM sources

If a package is supplied as an .rpm file, you should:

inherit rpm

If you don't need to do anything in the unpack phase, then you are finished as the rpm.eclass exports a default src_unpack that will unpack the RPM files.

If you do need to call additional unpack functions then override src_unpack in a manner such as:

src_unpack() {
	rpm_src_unpack ${A}
	cd "${S}"

	use ssl && eapply "${FILESDIR}/${PV}/${P}-ssl.patch"

Example RPM handling

Here is an ebuild snippet that is based upon the fetchmail source RPM from SuSE 9.2. The ebuild snippet is complete enough to work with the ebuild unpack command. The ebuild will download the source file from the OSU SuSE mirror, unpack the file and apply the included patches. The filename should be suse-fetchmail-

# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2


inherit rpm

MY_PV=$(ver_rs 3 '-')

DESCRIPTION="SuSE 9.2 Fetchmail Source Package"
S=${WORKDIR}/fetchmail-$(ver_cut 1-3)

LICENSE="GPL-2 public-domain"


# Need to test if the file can be unpacked with rpmoffset and cpio
# If it can't then set:


# To force the use of rpmoffset and cpio instead of rpm2cpio from
# app-arch/rpm, then set the following:


src_unpack() {
    rpm_src_unpack ${A}

src_prepare() {
    for i in "${WORKDIR}"/*.patch ; do
        eapply "${i}"