1 |
commit: b613790793b46ccc596e1dc28163ea865d508b65 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jun 2 15:16:03 2016 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jun 2 15:16:03 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=b6137907 |
7 |
|
8 |
crossdev: handle multiple repos at same prio level |
9 |
|
10 |
This helps fix an infinite recursion issue when trying to load the |
11 |
multilib eclass environment. |
12 |
|
13 |
URL: https://bugs.gentoo.org/531044 |
14 |
URL: https://bugs.gentoo.org/540586 |
15 |
Reported-by: Ulrar <lemonnier.k <AT> gmail.com> |
16 |
Reported-by: Malte Starostik <bugs <AT> xodtsoq.de> |
17 |
Reported-by: Samuel Loewen <samuellwn <AT> gmail.com> |
18 |
|
19 |
crossdev | 13 ++++++++++--- |
20 |
1 file changed, 10 insertions(+), 3 deletions(-) |
21 |
|
22 |
diff --git a/crossdev b/crossdev |
23 |
index 29bea33..686b906 100755 |
24 |
--- a/crossdev |
25 |
+++ b/crossdev |
26 |
@@ -319,12 +319,18 @@ parse_repo_config() { |
27 |
# priority = 0 |
28 |
local repo_config=$(portageq repositories_configuration "${ROOT}") |
29 |
local flat_config=$(echo "${repo_config}" | gawk ' |
30 |
+ function push(arr, idx, ele) { |
31 |
+ if (idx in arr) |
32 |
+ arr[idx][length(arr) + 1] = ele |
33 |
+ else |
34 |
+ arr[idx][0] = ele |
35 |
+ } |
36 |
{ |
37 |
if ($1 == "main-repo") { |
38 |
main_repo = $NF |
39 |
} else if ($1 ~ /^\[/) { |
40 |
if (repo_name && loc) |
41 |
- repos[prio] = repo_name ":" loc |
42 |
+ push(repos, prio, repo_name ":" loc) |
43 |
repo_name = gensub(/\[([^\]]*)\]/, "\\1", 1, $1) |
44 |
loc = prio = "" |
45 |
} else if ($1 == "priority") { |
46 |
@@ -334,12 +340,13 @@ parse_repo_config() { |
47 |
} |
48 |
} |
49 |
END { |
50 |
- repos[prio] = repo_name ":" loc |
51 |
+ push(repos, prio, repo_name ":" loc) |
52 |
|
53 |
print(main_repo) |
54 |
asorti(repos, prios) |
55 |
for (prio in prios) |
56 |
- print(repos[prios[prio]]) |
57 |
+ for (repo in repos[prios[prio]]) |
58 |
+ print(repos[prios[prio]][repo]) |
59 |
} |
60 |
') |