diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2021-08-10 16:48:22 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2021-08-10 18:26:06 +0200 |
commit | af7dba769693a706174ea2177ff7fde23eb8a394 (patch) | |
tree | a46d33a7e6318ade048ab639590213de6e96aff5 /dev-db | |
parent | dev-db/mariadb: bump to v10.2.40 (diff) | |
download | gentoo-af7dba769693a706174ea2177ff7fde23eb8a394.tar.gz gentoo-af7dba769693a706174ea2177ff7fde23eb8a394.tar.bz2 gentoo-af7dba769693a706174ea2177ff7fde23eb8a394.zip |
dev-db/mariadb: fix parameter parsing in pkg_config
Bug: https://bugs.gentoo.org/801898
Package-Manager: Portage-3.0.21, Repoman-3.0.3
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/mariadb/mariadb-10.2.40.ebuild | 25 | ||||
-rw-r--r-- | dev-db/mariadb/mariadb-10.3.31.ebuild | 25 | ||||
-rw-r--r-- | dev-db/mariadb/mariadb-10.4.21.ebuild | 25 | ||||
-rw-r--r-- | dev-db/mariadb/mariadb-10.5.12.ebuild | 25 |
4 files changed, 80 insertions, 20 deletions
diff --git a/dev-db/mariadb/mariadb-10.2.40.ebuild b/dev-db/mariadb/mariadb-10.2.40.ebuild index f3462ac3ca61..a5fc6881ea9c 100644 --- a/dev-db/mariadb/mariadb-10.2.40.ebuild +++ b/dev-db/mariadb/mariadb-10.2.40.ebuild @@ -788,18 +788,33 @@ pkg_postinst() { pkg_config() { _getoptval() { local section="${1}" - local flag="--${2}=" + local option="--${2}" local extra_options="${3}" local cmd=( "${my_print_defaults_binary}" "${extra_options}" "${section}" ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" + local values=() + local parameters=( $(eval "${cmd[@]}" 2>/dev/null) ) + for parameter in "${parameters[@]}" + do + # my_print_defaults guarantees output of options, one per line, + # in the form that they would be specified on the command line. + # So checking for --option=* should be safe. + case ${parameter} in + ${option}=*) + values+=( "${parameter#*=}" ) + ;; + esac + done + + if [[ ${#values[@]} -gt 0 ]] ; then + # Option could have been set multiple times + # in which case only the last occurrence + # contains the current value + echo "${values[-1]}" fi } diff --git a/dev-db/mariadb/mariadb-10.3.31.ebuild b/dev-db/mariadb/mariadb-10.3.31.ebuild index d3463517487d..cbbc8dfba20d 100644 --- a/dev-db/mariadb/mariadb-10.3.31.ebuild +++ b/dev-db/mariadb/mariadb-10.3.31.ebuild @@ -779,18 +779,33 @@ pkg_postinst() { pkg_config() { _getoptval() { local section="${1}" - local flag="--${2}=" + local option="--${2}" local extra_options="${3}" local cmd=( "${my_print_defaults_binary}" "${extra_options}" "${section}" ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" + local values=() + local parameters=( $(eval "${cmd[@]}" 2>/dev/null) ) + for parameter in "${parameters[@]}" + do + # my_print_defaults guarantees output of options, one per line, + # in the form that they would be specified on the command line. + # So checking for --option=* should be safe. + case ${parameter} in + ${option}=*) + values+=( "${parameter#*=}" ) + ;; + esac + done + + if [[ ${#values[@]} -gt 0 ]] ; then + # Option could have been set multiple times + # in which case only the last occurrence + # contains the current value + echo "${values[-1]}" fi } diff --git a/dev-db/mariadb/mariadb-10.4.21.ebuild b/dev-db/mariadb/mariadb-10.4.21.ebuild index 2c6e7495a0ff..e41458e1ca60 100644 --- a/dev-db/mariadb/mariadb-10.4.21.ebuild +++ b/dev-db/mariadb/mariadb-10.4.21.ebuild @@ -800,18 +800,33 @@ pkg_postinst() { pkg_config() { _getoptval() { local section="${1}" - local flag="--${2}=" + local option="--${2}" local extra_options="${3}" local cmd=( "${my_print_defaults_binary}" "${extra_options}" "${section}" ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" + local values=() + local parameters=( $(eval "${cmd[@]}" 2>/dev/null) ) + for parameter in "${parameters[@]}" + do + # my_print_defaults guarantees output of options, one per line, + # in the form that they would be specified on the command line. + # So checking for --option=* should be safe. + case ${parameter} in + ${option}=*) + values+=( "${parameter#*=}" ) + ;; + esac + done + + if [[ ${#values[@]} -gt 0 ]] ; then + # Option could have been set multiple times + # in which case only the last occurrence + # contains the current value + echo "${values[-1]}" fi } diff --git a/dev-db/mariadb/mariadb-10.5.12.ebuild b/dev-db/mariadb/mariadb-10.5.12.ebuild index 633f14472c20..845b70ab1fb2 100644 --- a/dev-db/mariadb/mariadb-10.5.12.ebuild +++ b/dev-db/mariadb/mariadb-10.5.12.ebuild @@ -794,18 +794,33 @@ pkg_postinst() { pkg_config() { _getoptval() { local section="${1}" - local flag="--${2}=" + local option="--${2}" local extra_options="${3}" local cmd=( "${my_print_defaults_binary}" "${extra_options}" "${section}" ) - local results=( $(eval "${cmd[@]}" 2>/dev/null | sed -n "/^${flag}/s,${flag},,gp") ) - if [[ ${#results[@]} -gt 0 ]] ; then - # When option is set multiple times only return last value - echo "${results[-1]}" + local values=() + local parameters=( $(eval "${cmd[@]}" 2>/dev/null) ) + for parameter in "${parameters[@]}" + do + # my_print_defaults guarantees output of options, one per line, + # in the form that they would be specified on the command line. + # So checking for --option=* should be safe. + case ${parameter} in + ${option}=*) + values+=( "${parameter#*=}" ) + ;; + esac + done + + if [[ ${#values[@]} -gt 0 ]] ; then + # Option could have been set multiple times + # in which case only the last occurrence + # contains the current value + echo "${values[-1]}" fi } |