1 |
commit: 459be03a011a231ef4c995a234251a3071ceb95f |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 14 17:43:06 2018 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 24 12:59:24 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=459be03a |
7 |
|
8 |
Change src_prepare/epatch document to include eapply as well |
9 |
|
10 |
Signed-off-by: Brian Evans <grknight <AT> gentoo.org> |
11 |
|
12 |
.../functions/src_prepare/epatch/text.xml | 63 ++++++++++++++++++++-- |
13 |
1 file changed, 60 insertions(+), 3 deletions(-) |
14 |
|
15 |
diff --git a/ebuild-writing/functions/src_prepare/epatch/text.xml b/ebuild-writing/functions/src_prepare/epatch/text.xml |
16 |
index 65386dd..eba335b 100644 |
17 |
--- a/ebuild-writing/functions/src_prepare/epatch/text.xml |
18 |
+++ b/ebuild-writing/functions/src_prepare/epatch/text.xml |
19 |
@@ -1,14 +1,37 @@ |
20 |
<?xml version="1.0"?> |
21 |
<guide self="ebuild-writing/functions/src_prepare/epatch/"> |
22 |
<chapter> |
23 |
-<title>Patching with epatch</title> |
24 |
+<title>Patching with epatch and eapply</title> |
25 |
|
26 |
<body> |
27 |
<p> |
28 |
The canonical way of applying patches in ebuilds is to |
29 |
-use <c>epatch</c> (from <c>eutils.eclass</c>, which you must make sure |
30 |
+use <c>epatch</c> (from <c>epatch.eclass</c>, which you must make sure |
31 |
to inherit!) inside <c>src_prepare</c>. This function automatically |
32 |
-handles <c>-p</c> levels, <c>gunzip</c> and so on as necessary. Also note that olds ebuild may still use src_unpack to apply patches. This is because those ebuilds are based in EAPI=1. You are advised to use EAPI=2 and apply your patches in src_prepare function instead. |
33 |
+handles <c>-p</c> levels, <c>gunzip</c> and so on as necessary. |
34 |
+<br> |
35 |
+Also note that olds ebuild may still use src_unpack to apply patches. |
36 |
+This is because those ebuilds are based in EAPI=1. |
37 |
+You are advised to use the latest and apply your patches in src_prepare function instead. |
38 |
+<br> |
39 |
+Starting with EAPI=7, this function is banned and eapply must be used. |
40 |
+</p> |
41 |
+ |
42 |
+<p> |
43 |
+Beginning with EAPI=6, a new function eapply was added to apply patches |
44 |
+without the need for an eclass. |
45 |
+This function differs from epatch in several ways: |
46 |
+<ul> |
47 |
+<li>eapply will not unpack patches for you.</li> |
48 |
+<li> |
49 |
+The default patch level is -p1. |
50 |
+Other patch levels must be specified manually or the command will fail. |
51 |
+</li> |
52 |
+<li> |
53 |
+When specifying a directory, at least file name ending in .patch or .diff |
54 |
+must exist or the command fails. Other files are ignored. |
55 |
+</li> |
56 |
+</ul> |
57 |
</p> |
58 |
|
59 |
<p> |
60 |
@@ -17,6 +40,40 @@ and patches is <e>highly</e> discouraged. |
61 |
</p> |
62 |
</body> |
63 |
|
64 |
+<section> |
65 |
+<title>Basic <c>eapply</c></title> |
66 |
+<body> |
67 |
+<p> |
68 |
+The default src_prepare function will look for a global PATCHES array to apply |
69 |
+a list of patches for you. |
70 |
+</p> |
71 |
+<codesample lang="ebuild"> |
72 |
+PATCHES=( |
73 |
+ "${FILESDIR}/${P}-destdir.patch" |
74 |
+ "${FILESDIR}/${P}-parallel_build.patch" |
75 |
+) |
76 |
+</codesample> |
77 |
+</body> |
78 |
+</section> |
79 |
+ |
80 |
+<section> |
81 |
+<title>Advanced <c>eapply</c></title> |
82 |
+<body> |
83 |
+<p> |
84 |
+This example shows how different patch levels can be applied: |
85 |
+</p> |
86 |
+ |
87 |
+<codesample lang="ebuild"> |
88 |
+src_prepare() { |
89 |
+ eapply -p2 "${WORKDIR}/${P}-suse-update.patch.bz2" |
90 |
+ eapply -p0 "${FILESDIR}/${PV}-no-TIOCGDEV.patch" |
91 |
+ eapply "${FILESDIR}/${PV}-gcc-6.patch" |
92 |
+ eapply_user |
93 |
+} |
94 |
+</codesample> |
95 |
+</body> |
96 |
+</section> |
97 |
+ |
98 |
<section> |
99 |
<title>Basic <c>epatch</c></title> |
100 |
<body> |