public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH 1/2] econf: Replace unnecessary 'case' statements with 'if's
@ 2014-08-17 18:00 Michał Górny
  2014-08-17 18:00 ` [gentoo-portage-dev] [PATCH 2/2] econf: Add EAPI-conditional arguments via array Michał Górny
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2014-08-17 18:00 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Replace the 'case' statements used to match 'configure' output with
simpler pattern-matching 'if's.
---
 bin/phase-helpers.sh | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 47bd843..6a5ce85 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -525,19 +525,15 @@ econf() {
 			local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
 
 			if ___eapi_econf_passes_--disable-dependency-tracking; then
-				case "${conf_help}" in
-					*--disable-dependency-tracking*)
-						set -- --disable-dependency-tracking "$@"
-						;;
-				esac
+				if [[ ${conf_help} == *--disable-dependency-tracking* ]]; then
+					set -- --disable-dependency-tracking "$@"
+				fi
 			fi
 
 			if ___eapi_econf_passes_--disable-silent-rules; then
-				case "${conf_help}" in
-					*--disable-silent-rules*)
-						set -- --disable-silent-rules "$@"
-						;;
-				esac
+				if [[ ${conf_help} == *--disable-silent-rules* ]]; then
+					set -- --disable-silent-rules "$@"
+				fi
 			fi
 		fi
 
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-portage-dev] [PATCH 2/2] econf: Add EAPI-conditional arguments via array
  2014-08-17 18:00 [gentoo-portage-dev] [PATCH 1/2] econf: Replace unnecessary 'case' statements with 'if's Michał Górny
@ 2014-08-17 18:00 ` Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2014-08-17 18:00 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Michał Górny

Use a dedicated array variable to add EAPI-conditional arguments to
the configure script instead of prepending them to the command
parameters.
---
 bin/phase-helpers.sh | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 6a5ce85..b96c3f5 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -521,18 +521,19 @@ econf() {
 			done
 		fi
 
+		local conf_args=()
 		if ___eapi_econf_passes_--disable-dependency-tracking || ___eapi_econf_passes_--disable-silent-rules; then
 			local conf_help=$("${ECONF_SOURCE}/configure" --help 2>/dev/null)
 
 			if ___eapi_econf_passes_--disable-dependency-tracking; then
 				if [[ ${conf_help} == *--disable-dependency-tracking* ]]; then
-					set -- --disable-dependency-tracking "$@"
+					conf_args+=( --disable-dependency-tracking )
 				fi
 			fi
 
 			if ___eapi_econf_passes_--disable-silent-rules; then
 				if [[ ${conf_help} == *--disable-silent-rules* ]]; then
-					set -- --disable-silent-rules "$@"
+					conf_args+=( --disable-silent-rules )
 				fi
 			fi
 		fi
@@ -550,7 +551,9 @@ econf() {
 			CONF_PREFIX=${CONF_PREFIX#*=}
 			[[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}"
 			[[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}"
-			set -- --libdir="$(__strip_duplicate_slashes "${CONF_PREFIX}${CONF_LIBDIR}")" "$@"
+			conf_args+=(
+				--libdir="$(__strip_duplicate_slashes "${CONF_PREFIX}${CONF_LIBDIR}")"
+			)
 		fi
 
 		# Handle arguments containing quoted whitespace (see bug #457136).
@@ -566,6 +569,7 @@ econf() {
 			--datadir="${EPREFIX}"/usr/share \
 			--sysconfdir="${EPREFIX}"/etc \
 			--localstatedir="${EPREFIX}"/var/lib \
+			"${conf_args[@]}" \
 			"$@" \
 			"${EXTRA_ECONF[@]}"
 		__vecho "${ECONF_SOURCE}/configure" "$@"
-- 
2.0.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-17 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-17 18:00 [gentoo-portage-dev] [PATCH 1/2] econf: Replace unnecessary 'case' statements with 'if's Michał Górny
2014-08-17 18:00 ` [gentoo-portage-dev] [PATCH 2/2] econf: Add EAPI-conditional arguments via array 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