postgres.eclass: readarray -t POSTGRES_COMPAT < <(printf '%s\n' "${POSTGRES_COMPAT[@]}" | sort -nr) Calling external commands during metadata regen is forbidden by PMS, and breaks new secure cache regen, e.g.: * ERROR: dev-db/pgpool2-3.6.4 failed (depend phase): * External commands disallowed during metadata regen: sort -nr * * Call stack: * isolated-functions.lib, line 345: Called source '/home/mgorny/tmp/gentoo/dev-db/pgpool2/pgpool2-3.6.4.ebuild' * pgpool2-3.6.4.ebuild, line 8: Called inherit 'postgres-multi' * ebuild-default-functions.lib, line 209: Called __internal_inherit 'postgres-multi' * ebuild-daemon.lib, line 29: Called __qa_invoke 'source' '/home/mgorny/tmp/gentoo/eclass/postgres-multi.eclass' * isolated-functions.lib, line 345: Called source '/home/mgorny/tmp/gentoo/eclass/postgres-multi.eclass' * postgres-multi.eclass, line 4: Called inherit 'multibuild' 'postgres' * ebuild-default-functions.lib, line 209: Called __internal_inherit 'postgres' * ebuild-daemon.lib, line 29: Called __qa_invoke 'source' '/home/mgorny/tmp/gentoo/eclass/postgres.eclass' * isolated-functions.lib, line 345: Called source '/home/mgorny/tmp/gentoo/eclass/postgres.eclass' * postgres.eclass, line 54: Called command_not_found_handle 'sort' '-nr' * ebuild-daemon.bash, line 383: Called die
Created attachment 491104 [details, diff] postgres.eclass Bash sort patch Would something like the attached be okay?
If it works, I suppose it's fine for now. However, I'm not sure we want to keep version_sort long-term. Wouldn't it be better to just hardcode the order in the eclass? i.e. do something like: _POSTGRES_ALL_VERSIONS=( ... ) and then: for x in "${_POSTGRES_ALL_VERSIONS[@]}"; do if has "${x}" "${POSTGRES_COMPAT[@]}"; then ... fi done Having the list also makes it easier to validate for invalid POSTGRES_COMPAT or disable the old versions via eclass. See how python*-r1 handle that. As a side note, editing user-specified variables is a bad idea. You have no guarantee that Portage won't source the ebuild again, resetting your altered POSTGRES_COMPAT.
Created attachment 492138 [details, diff] postgres.eclass Simple sort patch I'm not particularly fond of hard coding, but how about this.
I don't see why it wouldn't work, so feel free to commit.
commit 2345402051e4b0c12cbc7b3a16fd20decbd0d4b3 Author: Aaron W. Swenson <titanofold@gentoo.org> Date: Tue Sep 5 12:59:44 2017 -0400 postgres{,-multi}.eclass: Improvements and bug fix Improve documentation comments to eliminate warnings and make the resulting man pages look better. Use a simple sort instead of the external sort program because calling external commands during metadata regen is forbidden by PMS and breaks new secure cache regen. Gentoo-Bug: 629226 commit 9e0ba9394f263cb8201c48d4a52157b00fe5a795 (HEAD -> master, origin/master, origin/HEAD) Author: Aaron W. Swenson <titanofold@gentoo.org> Date: Tue Sep 5 13:15:18 2017 -0400 app-portage/eclass-manpages: Snapshot bump 20170905 New snapshot bump (20170905) including the most recent change in postres{,-multi}.eclass doc changes. Package-Manager: Portage-2.3.6, Repoman-2.3.1