1 |
Signed-off-by: David Seifert <soap@g.o> |
2 |
--- |
3 |
eclass/git-r3.eclass | 97 +++++++++++++++++++++----------------------- |
4 |
1 file changed, 47 insertions(+), 50 deletions(-) |
5 |
|
6 |
diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass |
7 |
index bdb28565e2f9..5c7dc29627cb 100644 |
8 |
--- a/eclass/git-r3.eclass |
9 |
+++ b/eclass/git-r3.eclass |
10 |
@@ -1,27 +1,26 @@ |
11 |
-# Copyright 1999-2021 Gentoo Authors |
12 |
+# Copyright 1999-2023 Gentoo Authors |
13 |
# Distributed under the terms of the GNU General Public License v2 |
14 |
|
15 |
# @ECLASS: git-r3.eclass |
16 |
# @MAINTAINER: |
17 |
# Michał Górny <mgorny@g.o> |
18 |
-# @SUPPORTED_EAPIS: 5 6 7 8 |
19 |
+# @SUPPORTED_EAPIS: 6 7 8 |
20 |
# @BLURB: Eclass for fetching and unpacking git repositories. |
21 |
# @DESCRIPTION: |
22 |
# Third generation eclass for easing maintenance of live ebuilds using |
23 |
# git as remote repository. |
24 |
|
25 |
-case ${EAPI:-0} in |
26 |
- 5|6|7|8) ;; |
27 |
+case ${EAPI} in |
28 |
+ 6|7|8) ;; |
29 |
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
30 |
esac |
31 |
|
32 |
-EXPORT_FUNCTIONS src_unpack |
33 |
- |
34 |
-if [[ ! ${_GIT_R3} ]]; then |
35 |
+if [[ -z ${_GIT_R3_ECLASS} ]]; then |
36 |
+_GIT_R3_ECLASS=1 |
37 |
|
38 |
PROPERTIES+=" live" |
39 |
|
40 |
-if [[ ${EAPI} != [56] ]]; then |
41 |
+if [[ ${EAPI} != 6 ]]; then |
42 |
BDEPEND=">=dev-vcs/git-1.8.2.1[curl]" |
43 |
else |
44 |
DEPEND=">=dev-vcs/git-1.8.2.1[curl]" |
45 |
@@ -559,49 +558,46 @@ git-r3_fetch() { |
46 |
local commit_id=${2:-${EGIT_COMMIT}} |
47 |
local commit_date=${4:-${EGIT_COMMIT_DATE}} |
48 |
|
49 |
- # support new override API for EAPI 6+ |
50 |
- if [[ ${EAPI} != 5 ]]; then |
51 |
- # get the name and do some more processing: |
52 |
- # 1) kill .git suffix, |
53 |
- # 2) underscore (remaining) non-variable characters, |
54 |
- # 3) add preceding underscore if it starts with a digit, |
55 |
- # 4) uppercase. |
56 |
- local override_name=${GIT_DIR##*/} |
57 |
- override_name=${override_name%.git} |
58 |
- override_name=${override_name//[^a-zA-Z0-9_]/_} |
59 |
- override_name=${override_name^^} |
60 |
- |
61 |
- local varmap=( |
62 |
- REPO:repos |
63 |
- BRANCH:branch_name |
64 |
- COMMIT:commit_id |
65 |
- COMMIT_DATE:commit_date |
66 |
- ) |
67 |
- |
68 |
- local localvar livevar live_warn= override_vars=() |
69 |
- for localvar in "${varmap[@]}"; do |
70 |
- livevar=EGIT_OVERRIDE_${localvar%:*}_${override_name} |
71 |
- localvar=${localvar#*:} |
72 |
- override_vars+=( "${livevar}" ) |
73 |
- |
74 |
- if [[ -n ${!livevar} ]]; then |
75 |
- [[ ${localvar} == repos ]] && repos=() |
76 |
- live_warn=1 |
77 |
- ewarn "Using ${livevar}=${!livevar}" |
78 |
- declare "${localvar}=${!livevar}" |
79 |
- fi |
80 |
- done |
81 |
+ # get the name and do some more processing: |
82 |
+ # 1) kill .git suffix, |
83 |
+ # 2) underscore (remaining) non-variable characters, |
84 |
+ # 3) add preceding underscore if it starts with a digit, |
85 |
+ # 4) uppercase. |
86 |
+ local override_name=${GIT_DIR##*/} |
87 |
+ override_name=${override_name%.git} |
88 |
+ override_name=${override_name//[^a-zA-Z0-9_]/_} |
89 |
+ override_name=${override_name^^} |
90 |
+ |
91 |
+ local varmap=( |
92 |
+ REPO:repos |
93 |
+ BRANCH:branch_name |
94 |
+ COMMIT:commit_id |
95 |
+ COMMIT_DATE:commit_date |
96 |
+ ) |
97 |
|
98 |
- if [[ ${live_warn} ]]; then |
99 |
- ewarn "No support will be provided." |
100 |
- else |
101 |
- einfo "To override fetched repository properties, use:" |
102 |
- local x |
103 |
- for x in "${override_vars[@]}"; do |
104 |
- einfo " ${x}" |
105 |
- done |
106 |
- einfo |
107 |
+ local localvar livevar live_warn= override_vars=() |
108 |
+ for localvar in "${varmap[@]}"; do |
109 |
+ livevar=EGIT_OVERRIDE_${localvar%:*}_${override_name} |
110 |
+ localvar=${localvar#*:} |
111 |
+ override_vars+=( "${livevar}" ) |
112 |
+ |
113 |
+ if [[ -n ${!livevar} ]]; then |
114 |
+ [[ ${localvar} == repos ]] && repos=() |
115 |
+ live_warn=1 |
116 |
+ ewarn "Using ${livevar}=${!livevar}" |
117 |
+ declare "${localvar}=${!livevar}" |
118 |
fi |
119 |
+ done |
120 |
+ |
121 |
+ if [[ ${live_warn} ]]; then |
122 |
+ ewarn "No support will be provided." |
123 |
+ else |
124 |
+ einfo "To override fetched repository properties, use:" |
125 |
+ local x |
126 |
+ for x in "${override_vars[@]}"; do |
127 |
+ einfo " ${x}" |
128 |
+ done |
129 |
+ einfo |
130 |
fi |
131 |
|
132 |
# set final variables after applying overrides |
133 |
@@ -1079,5 +1075,6 @@ git-r3_pkg_needrebuild() { |
134 |
# 'export' locally until this gets into EAPI |
135 |
pkg_needrebuild() { git-r3_pkg_needrebuild; } |
136 |
|
137 |
-_GIT_R3=1 |
138 |
fi |
139 |
+ |
140 |
+EXPORT_FUNCTIONS src_unpack |
141 |
-- |
142 |
2.40.0 |