* [gentoo-portage-dev] [PATCH 2/4] Switch internal metadata to key=value format
@ 2021-09-03 16:35 99% ` Michał Górny
0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2021-09-03 16:35 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
bin/ebuild.sh | 13 +++++++------
lib/_emerge/EbuildMetadataPhase.py | 15 +++++++++------
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 32995d95b..381bcb5c8 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -754,10 +754,11 @@ if [[ $EBUILD_PHASE = depend ]] ; then
export SANDBOX_ON="0"
set -f
- auxdbkeys="DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
+ metadata_keys=(
+ DEPEND RDEPEND SLOT SRC_URI RESTRICT HOMEPAGE LICENSE
DESCRIPTION KEYWORDS INHERITED IUSE REQUIRED_USE PDEPEND BDEPEND
- EAPI PROPERTIES DEFINED_PHASES IDEPEND UNUSED_04
- UNUSED_03 UNUSED_02 UNUSED_01"
+ EAPI PROPERTIES DEFINED_PHASES IDEPEND
+ )
if ! ___eapi_has_BDEPEND; then
unset BDEPEND
@@ -767,10 +768,10 @@ if [[ $EBUILD_PHASE = depend ]] ; then
fi
# The extra $(echo) commands remove newlines.
- for f in ${auxdbkeys} ; do
- eval "echo \$(echo \${!f}) 1>&${PORTAGE_PIPE_FD}" || exit $?
+ for f in "${metadata_keys[@]}" ; do
+ echo "${f}=$(echo ${!f})" >&${PORTAGE_PIPE_FD} || exit $?
done
- eval "exec ${PORTAGE_PIPE_FD}>&-"
+ exec {PORTAGE_PIPE_FD}>&-
set +f
else
# Note: readonly variables interfere with __preprocess_ebuild_env(), so
diff --git a/lib/_emerge/EbuildMetadataPhase.py b/lib/_emerge/EbuildMetadataPhase.py
index d00f194c2..5fd0e8a4d 100644
--- a/lib/_emerge/EbuildMetadataPhase.py
+++ b/lib/_emerge/EbuildMetadataPhase.py
@@ -151,13 +151,16 @@ class EbuildMetadataPhase(SubProcess):
metadata_lines = _unicode_decode(b''.join(self._raw_metadata),
encoding=_encodings['repo.content'],
errors='replace').splitlines()
+ metadata = {}
metadata_valid = True
- if len(portage.auxdbkeys) != len(metadata_lines):
- # Don't trust bash's returncode if the
- # number of lines is incorrect.
- metadata_valid = False
- else:
- metadata = dict(zip(portage.auxdbkeys, metadata_lines))
+ for l in metadata_lines:
+ if '=' not in l:
+ metadata_valid = False
+ break
+ key, value = l.split('=', 1)
+ metadata[key] = value
+
+ if metadata_valid:
parsed_eapi = self._eapi
if parsed_eapi is None:
parsed_eapi = "0"
--
2.33.0
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-09-03 16:35 [gentoo-portage-dev] [PATCH 0/4] Modernize metadata passing & add INHERIT to md5-cache Michał Górny
2021-09-03 16:35 99% ` [gentoo-portage-dev] [PATCH 2/4] Switch internal metadata to key=value format Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox