blob: 93821093582a798dab61ea150ce4b4fb0c6a089a (
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
|
<?xml version="1.0"?>
<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 apply patches 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 && epatch "${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-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
inherit eutils versionator rpm
MY_PV=$(replace_version_separator 3 '-')
MY_P=fetchmail-${MY_PV}
SRC_URI="http://suse.osuosl.org/suse/i386/9.2/suse/src/${MY_P}.src.rpm"
DESCRIPTION="SuSE 9.2 Fetchmail Source Package"
HOMEPAGE="http://www.suse.com"
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:
#DEPEND="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
S=${WORKDIR}/fetchmail-$(get_version_component_range 1-3)
src_unpack () {
rpm_src_unpack ${A}
cd "${S}"
EPATCH_SOURCE="${WORKDIR}" EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" epatch
}
</codesample>
</body>
</section>
</chapter>
</guide>
|