aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron W. Swenson <titanofold@gentoo.org>2017-09-05 10:15:07 -0400
committerAaron W. Swenson <titanofold@gentoo.org>2017-09-05 10:15:07 -0400
commit638b7478a001ccde8418c9a2a5d7e253c0df0678 (patch)
treeea4367ce575aa16f1c84819f60417755841d5d7b /postgres.eclass
parentsync with Gentoo repo (diff)
downloadeclass-638b7478a001ccde8418c9a2a5d7e253c0df0678.tar.gz
eclass-638b7478a001ccde8418c9a2a5d7e253c0df0678.tar.bz2
eclass-638b7478a001ccde8418c9a2a5d7e253c0df0678.zip
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
Diffstat (limited to 'postgres.eclass')
-rw-r--r--postgres.eclass25
1 files changed, 21 insertions, 4 deletions
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