commit: b613790793b46ccc596e1dc28163ea865d508b65 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Thu Jun 2 15:16:03 2016 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Thu Jun 2 15:16:03 2016 +0000 URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=b6137907
crossdev: handle multiple repos at same prio level This helps fix an infinite recursion issue when trying to load the multilib eclass environment. URL: https://bugs.gentoo.org/531044 URL: https://bugs.gentoo.org/540586 Reported-by: Ulrar <lemonnier.k <AT> gmail.com> Reported-by: Malte Starostik <bugs <AT> xodtsoq.de> Reported-by: Samuel Loewen <samuellwn <AT> gmail.com> crossdev | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crossdev b/crossdev index 29bea33..686b906 100755 --- a/crossdev +++ b/crossdev @@ -319,12 +319,18 @@ parse_repo_config() { # priority = 0 local repo_config=$(portageq repositories_configuration "${ROOT}") local flat_config=$(echo "${repo_config}" | gawk ' + function push(arr, idx, ele) { + if (idx in arr) + arr[idx][length(arr) + 1] = ele + else + arr[idx][0] = ele + } { if ($1 == "main-repo") { main_repo = $NF } else if ($1 ~ /^\[/) { if (repo_name && loc) - repos[prio] = repo_name ":" loc + push(repos, prio, repo_name ":" loc) repo_name = gensub(/\[([^\]]*)\]/, "\\1", 1, $1) loc = prio = "" } else if ($1 == "priority") { @@ -334,12 +340,13 @@ parse_repo_config() { } } END { - repos[prio] = repo_name ":" loc + push(repos, prio, repo_name ":" loc) print(main_repo) asorti(repos, prios) for (prio in prios) - print(repos[prios[prio]]) + for (repo in repos[prios[prio]]) + print(repos[prios[prio]][repo]) } ')
