public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Aaron Swenson" <titanofold@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/postgresql/eclass:master commit in: /
Date: Tue,  5 Sep 2017 14:16:29 +0000 (UTC)	[thread overview]
Message-ID: <1504620907.638b7478a001ccde8418c9a2a5d7e253c0df0678.titanofold@gentoo> (raw)

commit:     638b7478a001ccde8418c9a2a5d7e253c0df0678
Author:     Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
AuthorDate: Tue Sep  5 14:15:07 2017 +0000
Commit:     Aaron Swenson <titanofold <AT> gentoo <DOT> org>
CommitDate: Tue Sep  5 14:15:07 2017 +0000
URL:        https://gitweb.gentoo.org/proj/postgresql/eclass.git/commit/?id=638b7478

Use Simple Sort

Calling external commands during metadata regen is forbidden by PMS
and breaks new secure cache regen.

Use a simple sort instead.

Gentoo-Bug: 629226

 postgres-multi.eclass |  3 ++-
 postgres.eclass       | 25 +++++++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/postgres-multi.eclass b/postgres-multi.eclass
index 5d40a0e..9eb7ca2 100644
--- a/postgres-multi.eclass
+++ b/postgres-multi.eclass
@@ -105,7 +105,8 @@ postgres-multi_forbest() {
 postgres-multi_pkg_setup() {
 	local user_slot
 
-	for user_slot in "${POSTGRES_COMPAT[@]}"; do
+	# _POSTGRES_COMPAT is created in postgres.eclass
+	for user_slot in "${_POSTGRES_COMPAT[@]}"; do
 		use "postgres_targets_postgres${user_slot/\./_}" && \
 			_POSTGRES_INTERSECT_SLOTS+=( "${user_slot}" )
 	done

diff --git a/postgres.eclass b/postgres.eclass
index 13483a9..e5a9b6f 100644
--- a/postgres.eclass
+++ b/postgres.eclass
@@ -21,6 +21,14 @@ case ${EAPI:-0} in
 	*) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
 esac
 
+# @ECLASS-VARIABLE: _POSTGRES_ALL_VERSIONS
+# @INTERNAL
+# @DESCRIPTION:
+# List of versions to reverse sort POSTGRES_COMPAT slots
+
+_POSTGRES_ALL_VERSIONS=( 11 10 9.6 9.5 9.4 9.3 9.2 )
+
+
 
 # @ECLASS-VARIABLE: POSTGRES_COMPAT
 # @DEFAULT_UNSET
@@ -47,15 +55,24 @@ esac
 # required if the package must build against one of the PostgreSQL slots
 # declared in POSTGRES_COMPAT.
 
+# @ECLASS-VARIABLE: _POSTGRES_COMPAT
+# @INTERNAL
+# @DESCRIPTION:
+# Copy of POSTGRES_COMPAT, reverse sorted
+_POSTGRES_COMPAT=()
+
+
 if declare -p POSTGRES_COMPAT &> /dev/null ; then
 	# Reverse sort the given POSTGRES_COMPAT so that the most recent
 	# slot is preferred over an older slot.
 	# -- do we care if dependencies are deterministic by USE flags?
-	readarray -t POSTGRES_COMPAT < <(printf '%s\n' "${POSTGRES_COMPAT[@]}" | sort -nr)
+	for i in ${_POSTGRES_ALL_VERSIONS[@]} ; do
+		has ${i} ${POSTGRES_COMPAT[@]} && _POSTGRES_COMPAT+=( ${i} )
+	done
 
 	POSTGRES_DEP=""
 	POSTGRES_REQ_USE=" || ("
-	for slot in "${POSTGRES_COMPAT[@]}" ; do
+	for slot in "${_POSTGRES_COMPAT[@]}" ; do
 		POSTGRES_DEP+=" postgres_targets_postgres${slot/\./_}? ( dev-db/postgresql:${slot}="
 		declare -p POSTGRES_USEDEP &>/dev/null && \
 			POSTGRES_DEP+="[${POSTGRES_USEDEP}]"
@@ -127,7 +144,7 @@ postgres_pkg_setup() {
 
 	local compat_slot
 	local best_slot
-	for compat_slot in "${POSTGRES_COMPAT[@]}"; do
+	for compat_slot in "${_POSTGRES_COMPAT[@]}"; do
 		if use "postgres_targets_postgres${compat_slot/\./_}"; then
 			best_slot="${compat_slot}"
 			break
@@ -136,7 +153,7 @@ postgres_pkg_setup() {
 
 	if [[ -z "${best_slot}" ]]; then
 		local flags f
-		for f in "${POSTGRES_COMPAT[@]}"; do
+		for f in "${_POSTGRES_COMPAT[@]}"; do
 			flags+=" postgres${f/./_}"
 		done
 


             reply	other threads:[~2017-09-05 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-05 14:16 Aaron Swenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-05 15:36 [gentoo-commits] proj/postgresql/eclass:master commit in: / Aaron Swenson
2017-09-03 14:39 Aaron Swenson
2017-09-03 14:39 Aaron Swenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504620907.638b7478a001ccde8418c9a2a5d7e253c0df0678.titanofold@gentoo \
    --to=titanofold@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox