1 |
commit: 1e28ffdc2e9e9afd233b1908c065eed54d4f7759 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 3 13:00:08 2021 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 10 07:16:39 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1e28ffdc |
7 |
|
8 |
Switch internal metadata to key=value format |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
bin/ebuild.sh | 13 +++++++------ |
13 |
lib/_emerge/EbuildMetadataPhase.py | 15 +++++++++------ |
14 |
2 files changed, 16 insertions(+), 12 deletions(-) |
15 |
|
16 |
diff --git a/bin/ebuild.sh b/bin/ebuild.sh |
17 |
index 32995d95b..381bcb5c8 100755 |
18 |
--- a/bin/ebuild.sh |
19 |
+++ b/bin/ebuild.sh |
20 |
@@ -754,10 +754,11 @@ if [[ $EBUILD_PHASE = depend ]] ; then |
21 |
export SANDBOX_ON="0" |
22 |
set -f |
23 |
|
24 |
- auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE |
25 |
+ metadata_keys=( |
26 |
+ DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE |
27 |
DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND BDEPEND |
28 |
- EAPI PROPERTIES DEFINED_PHASES IDEPEND UNUSED_04 |
29 |
- UNUSED_03 UNUSED_02 UNUSED_01" |
30 |
+ EAPI PROPERTIES DEFINED_PHASES IDEPEND |
31 |
+ ) |
32 |
|
33 |
if ! ___eapi_has_BDEPEND; then |
34 |
unset BDEPEND |
35 |
@@ -767,10 +768,10 @@ if [[ $EBUILD_PHASE = depend ]] ; then |
36 |
fi |
37 |
|
38 |
# The extra $(echo) commands remove newlines. |
39 |
- for f in ${auxdbkeys} ; do |
40 |
- eval "echo \$(echo \${!f}) 1>&${PORTAGE_PIPE_FD}" || exit $? |
41 |
+ for f in "${metadata_keys[@]}" ; do |
42 |
+ echo "${f}=$(echo ${!f})" >&${PORTAGE_PIPE_FD} || exit $? |
43 |
done |
44 |
- eval "exec ${PORTAGE_PIPE_FD}>&-" |
45 |
+ exec {PORTAGE_PIPE_FD}>&- |
46 |
set +f |
47 |
else |
48 |
# Note: readonly variables interfere with __preprocess_ebuild_env(), so |
49 |
|
50 |
diff --git a/lib/_emerge/EbuildMetadataPhase.py b/lib/_emerge/EbuildMetadataPhase.py |
51 |
index d00f194c2..5fd0e8a4d 100644 |
52 |
--- a/lib/_emerge/EbuildMetadataPhase.py |
53 |
+++ b/lib/_emerge/EbuildMetadataPhase.py |
54 |
@@ -151,13 +151,16 @@ class EbuildMetadataPhase(SubProcess): |
55 |
metadata_lines = _unicode_decode(b''.join(self._raw_metadata), |
56 |
encoding=_encodings['repo.content'], |
57 |
errors='replace').splitlines() |
58 |
+ metadata = {} |
59 |
metadata_valid = True |
60 |
- if len(portage.auxdbkeys) != len(metadata_lines): |
61 |
- # Don't trust bash's returncode if the |
62 |
- # number of lines is incorrect. |
63 |
- metadata_valid = False |
64 |
- else: |
65 |
- metadata = dict(zip(portage.auxdbkeys, metadata_lines)) |
66 |
+ for l in metadata_lines: |
67 |
+ if '=' not in l: |
68 |
+ metadata_valid = False |
69 |
+ break |
70 |
+ key, value = l.split('=', 1) |
71 |
+ metadata[key] = value |
72 |
+ |
73 |
+ if metadata_valid: |
74 |
parsed_eapi = self._eapi |
75 |
if parsed_eapi is None: |
76 |
parsed_eapi = "0" |