Gentoo Archives: gentoo-commits

From: Brian Evans <grknight@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/devmanual:master commit in: ebuild-writing/variables/
Date: Wed, 24 Oct 2018 13:01:13
Message-Id: 1540385795.f7b0e2c7b3fae81bcbfb69f16be8942be3564880.grknight@gentoo
1 commit: f7b0e2c7b3fae81bcbfb69f16be8942be3564880
2 Author: Brian Evans <grknight <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 14 19:02:19 2018 +0000
4 Commit: Brian Evans <grknight <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 24 12:56:35 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=f7b0e2c7
7
8 variables: Prefer eapi7-ver functions to versionator
9
10 Signed-off-by: Brian Evans <grknight <AT> gentoo.org>
11
12 ebuild-writing/variables/text.xml | 38 +++++++++++++++++++-------------------
13 1 file changed, 19 insertions(+), 19 deletions(-)
14
15 diff --git a/ebuild-writing/variables/text.xml b/ebuild-writing/variables/text.xml
16 index 4829ea8..39aeb76 100644
17 --- a/ebuild-writing/variables/text.xml
18 +++ b/ebuild-writing/variables/text.xml
19 @@ -483,14 +483,18 @@ conventions. Using capital letters in names or differences in how underscores an
20 are used in versions are particularly common. For example, what Gentoo calls <c>foo-1.2.3b</c> may be
21 expecting a tarball named <c>Foo-1.2-3b.tar.bz2</c>. Rather than hard coding the package string,
22 it is preferable to make <c>MY_PN</c>, <c>MY_PV</c> and <c>MY_P</c> variables and use those to define the
23 -upstream naming. The easy way of redefining the version, which should be used unless you are sure
24 -you know what you are doing, is to use the <c>versionator</c> eclass:
25 +upstream naming.
26 +EAPI=7 debuted a new set of functions, ver_cut, ver_rs and ver_test.
27 +These were backported into older EAPIs with the <c>eapi7-ver</c> eclass.
28 +The easy way of redefining the version, which should be used unless you are sure
29 +you know what you are doing, is to use these functions:
30 </p>
31
32 <codesample lang="ebuild">
33 -inherit versionator
34 +inherit eapi7-ver
35 MY_PN="Foo"
36 -MY_PV=$(replace_version_separator 2 '-')
37 +# Replace the second period separator in PV with -
38 +MY_PV=$(ver_rs 2 '-')
39 MY_P="${MY_PN}-${MY_PV}"
40 </codesample>
41
42 @@ -501,7 +505,7 @@ switches to a format like <c>Foo-1.3-4.5.tar.bz2</c> (yes, this really happens).
43
44 <p>
45 It is also possible to use bash substitution to achieve the same effect (this is
46 -how versionator works internally), but this is complicated, error prone and hard
47 +how eapi7-ver works internally), but this is complicated, error prone and hard
48 to read.
49 </p>
50
51 @@ -513,8 +517,8 @@ highly discouraged.
52 </p>
53
54 <p>
55 -The <c>versionator</c> eclass can also be used to extract particular components
56 -from a version string. See <c>man versionator.eclass</c> and the eclass source code
57 +The ver_ functions are used extract particular components
58 +from a version string. See <c>man eapi7-ver.eclass</c> and the eclass source code
59 for further documentation and examples. A brief summary of the functions
60 follows.
61 </p>
62 @@ -525,39 +529,35 @@ follows.
63 <th>Purpose</th>
64 </tr>
65 <tr>
66 - <ti><c>get_all_version_components</c></ti>
67 - <ti>Split up a version string into its component parts.</ti>
68 - </tr>
69 - <tr>
70 - <ti><c>get_version_components</c></ti>
71 + <ti><c>ver_rs [range] ' '</c></ti>
72 <ti>Get important version components, excluding '.', '-' and '_'.</ti>
73 </tr>
74 <tr>
75 - <ti><c>get_major_version</c></ti>
76 + <ti><c>ver_cut 1</c></ti>
77 <ti>Get the major version.</ti>
78 </tr>
79 <tr>
80 - <ti><c>get_version_component_range</c></ti>
81 + <ti><c>ver_cut [range]</c></ti>
82 <ti>Extract a range of subparts from a version string.</ti>
83 </tr>
84 <tr>
85 - <ti><c>get_after_major_version</c></ti>
86 + <ti><c>ver_cut 2-</c></ti>
87 <ti>Get everything after the major version.</ti>
88 </tr>
89 <tr>
90 - <ti><c>replace_version_separator</c></ti>
91 + <ti><c>ver_rs [range] [char]</c></ti>
92 <ti>Replace a particular version separator.</ti>
93 </tr>
94 <tr>
95 - <ti><c>replace_all_version_separators</c></ti>
96 + <ti><c>ver_rs 1- [char]</c></ti>
97 <ti>Replace all version separators.</ti>
98 </tr>
99 <tr>
100 - <ti><c>delete_version_separator</c></ti>
101 + <ti><c>ver_rs [range] ''</c></ti>
102 <ti>Delete a version separator.</ti>
103 </tr>
104 <tr>
105 - <ti><c>delete_all_version_separators</c></ti>
106 + <ti><c>ver_rs 1- ''</c></ti>
107 <ti>Delete all version separators.</ti>
108 </tr>
109 </table>