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 apply patches then override src_unpack in a manner such as:

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

    use ssl && epatch "${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-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils versionator rpm

MY_PV=$(replace_version_separator 3 '-')

DESCRIPTION="SuSE 9.2 Fetchmail Source Package"

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:


S=${WORKDIR}/fetchmail-$(get_version_component_range 1-3)

src_unpack () {
    rpm_src_unpack ${A}
    cd "${S}"
        EPATCH_FORCE="yes" epatch