Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/tests/resolver/, bin/
Date: Sun, 13 Jan 2019 23:38:28
Message-Id: 1547421452.8463281f6a6daec64a976693447c240f0d669f08.zmedico@gentoo
1 commit: 8463281f6a6daec64a976693447c240f0d669f08
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 13 23:11:40 2019 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 13 23:17:32 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8463281f
7
8 misc-functions.sh: restore canonicalize func (bug 675284)
9
10 The canonicalize function is required by install-qa-check.d/05prefix.
11
12 Fixes: aa0a94198794 ("ecompress: Replace with implementation from portage[mgorny]")
13 Bug: https://bugs.gentoo.org/670484
14 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
15
16 bin/misc-functions.sh | 34 ++++++++++++++++++++++++
17 lib/portage/tests/resolver/ResolverPlayground.py | 1 +
18 2 files changed, 35 insertions(+)
19
20 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
21 index 5de26b44d..4f8a4112d 100755
22 --- a/bin/misc-functions.sh
23 +++ b/bin/misc-functions.sh
24 @@ -43,6 +43,40 @@ install_symlink_html_docs() {
25 fi
26 }
27
28 +# replacement for "readlink -f" or "realpath"
29 +READLINK_F_WORKS=""
30 +canonicalize() {
31 + if [[ -z ${READLINK_F_WORKS} ]] ; then
32 + if [[ $(readlink -f -- /../ 2>/dev/null) == "/" ]] ; then
33 + READLINK_F_WORKS=true
34 + else
35 + READLINK_F_WORKS=false
36 + fi
37 + fi
38 + if ${READLINK_F_WORKS} ; then
39 + readlink -f -- "$@"
40 + return
41 + fi
42 +
43 + local f=$1 b n=10 wd=$(pwd)
44 + while (( n-- > 0 )); do
45 + while [[ ${f: -1} = / && ${#f} -gt 1 ]]; do
46 + f=${f%/}
47 + done
48 + b=${f##*/}
49 + cd "${f%"${b}"}" 2>/dev/null || break
50 + if [[ ! -L ${b} ]]; then
51 + f=$(pwd -P)
52 + echo "${f%/}/${b}"
53 + cd "${wd}"
54 + return 0
55 + fi
56 + f=$(readlink "${b}")
57 + done
58 + cd "${wd}"
59 + return 1
60 +}
61 +
62 install_qa_check() {
63 local d f i qa_var x paths qa_checks=() checks_run=()
64 if ! ___eapi_has_prefix_variables; then
65
66 diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py
67 index 626a1f064..0d6340dc0 100644
68 --- a/lib/portage/tests/resolver/ResolverPlayground.py
69 +++ b/lib/portage/tests/resolver/ResolverPlayground.py
70 @@ -99,6 +99,7 @@ class ResolverPlayground(object):
71 "mkdir",
72 "mktemp",
73 "mv",
74 + "readlink",
75 "rm",
76 "sed",
77 "sort",