aboutsummaryrefslogtreecommitdiff
blob: 0029c533f29f92fb9cca35a392ddfb33e0f29ad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0" encoding="UTF-8"?>
<guide self="ebuild-writing/functions/src_unpack/rpm-sources/">
<chapter>
<title>RPM sources</title>

<body>
<p>
If a package is supplied as an .rpm file, you should:
</p>

<codesample lang="ebuild">
inherit rpm
</codesample>

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

<p>
If you do need to call additional unpack functions then override <c>src_unpack</c> in a
manner such as:
</p>

<codesample lang="ebuild">
src_unpack() {
	rpm_src_unpack ${A}
	cd "${S}"

	use ssl &amp;&amp; eapply "${FILESDIR}/${PV}/${P}-ssl.patch"
}
</codesample>

<note>
<c>${A}</c> can contain non-rpm files since the rpm eclass will call
the normal <c>unpack</c> function for files that are not in the RPM
format.
</note>
</body>

<section>
<title>Example RPM handling</title>
<body>

<p>
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
<c>ebuild unpack</c> 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 <c>suse-fetchmail-6.2.5.54.1.ebuild</c>.
</p>

<codesample lang="ebuild">
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit rpm

MY_PV=$(ver_rs 3 '-')
MY_P=fetchmail-${MY_PV}

DESCRIPTION="SuSE 9.2 Fetchmail Source Package"
HOMEPAGE="https://www.suse.com"
SRC_URI="https://suse.osuosl.org/suse/i386/9.2/suse/src/${MY_P}.src.rpm"
S=${WORKDIR}/fetchmail-$(ver_cut 1-3)

LICENSE="GPL-2 public-domain"
SLOT="0"
KEYWORDS="-*"

RESTRICT="mirror"

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

#BDEPEND="app-arch/rpm"

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

#USE_RPMOFFSET_ONLY=1

src_unpack() {
    rpm_src_unpack ${A}
}

src_prepare() {
    for i in "${WORKDIR}"/*.patch ; do
        eapply "${i}"
    done
    eapply_user
}
</codesample>

</body>
</section>

</chapter>
</guide>