public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michael Orlitzky" <mjo@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/eselect-php:master commit in: src/
Date: Fri, 22 Jan 2016 03:15:43 +0000 (UTC)	[thread overview]
Message-ID: <1453427236.71d449ab84cacc518b6a11c891feed86367c8244.mjo@gentoo> (raw)

commit:     71d449ab84cacc518b6a11c891feed86367c8244
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 01:47:16 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 01:47:16 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=71d449ab

Replace get_libdirs() and get_active_libdir() with autotools magic.

The get_libdirs() function is a heuristic to determine which libdirs
are available on the system. The get_active_libdir() function then
chose the first one as the "active" libdir. In a few places we either
chose the "active" libdir, or looped through all of them to find some
other thing of interest (like the valid targets).

Now that we compute @libdir@ at build time, we can replace all of that
with the one correct value of @libdir@. The functions get_libdirs()
and get_active_libdir() are removed entirely.

 src/php.eselect.in.in | 47 +++++++++++++----------------------------------
 1 file changed, 13 insertions(+), 34 deletions(-)

diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 689b1db..0c83de7 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -88,7 +88,7 @@ sapi_active_link_target_dir() {
 	local sapi="${1}"
 	local target="${2}"
 
-	local link_target_dir="${EROOT}$(get_active_libdir)/${target}/bin"
+	local link_target_dir="@libdir@/${target}/bin"
 	if [[ "${sapi}" == "apache2" ]] ; then
 		link_target_dir+="/../apache2"
 	fi
@@ -116,7 +116,7 @@ sapi_active_link_dir() {
 	local sapi="${1}"
 
 	case "${sapi}" in
-		apache2) echo "${EROOT}$(get_active_libdir)/apache2/modules" ;;
+		apache2) echo "@libdir@/apache2/modules" ;;
 		cli)     echo "@bindir@" ;;
 		fpm)     echo "@bindir@" ;;
 		cgi)     echo "@bindir@" ;;
@@ -198,7 +198,7 @@ cleanup_sapi() {
 	fi
 
 	if [[ "${sapi}" == "apache2" ]] ; then
-		rm -f "${EROOT}$(get_active_libdir)"/apache2/modules/libphp[57].so \
+		rm -f "@libdir@"/apache2/modules/libphp[57].so \
 		   || die "failed to remove old libphp.so symlink"
 	fi
 
@@ -214,35 +214,15 @@ update_sapi() {
 	set_$sapi $target
 }
 
-get_libdirs() {
-	local dir libdirs
-	for dir in $(list_libdirs); do
-		[[ -L ${EROOT}/usr/${dir} ]] && continue
-		ls "${EROOT}"/usr/${dir}/php*.* > /dev/null 2>&1 || continue
-
-		libdirs+=' '/usr/${dir}
-	done
-	echo ${libdirs:-/usr/lib}
-}
+find_targets() {
+	local dirs
 
-get_active_libdir() {
-	local dir
-	for dir in $(get_libdirs); do
-		echo ${dir}
-		return
+	for dir in "@libdir@"/php*.*; do
+		t=$(basename $dir)
+		has $t $dirs || dirs="${dirs} $t"
 	done
-	echo /usr/lib
-}
 
-find_targets() {
-	local dir dirs libdir
-	for libdir in $(get_libdirs); do
-		for dir in "${EROOT}"${libdir}/php*.*; do
-			t=$(basename $dir)
-			has $t $dirs || dirs="${dirs} $t"
-		done
-	done
-  echo $dirs
+	echo $dirs
 }
 
 # List all valid targets for the given SAPI. The list is obtained by
@@ -276,11 +256,10 @@ find_sapi_targets() {
 	esac
 
 	for target in $(find_targets); do
-		for libdir in $(get_libdirs); do
-			local pattern="${EROOT}${libdir}/${target}/${pattern_suffix}"
-			for file in $pattern; do
-				[[ -f "${file}" ]] && echo "${target}"
-			done
+		local pattern="@libdir@/${target}/${pattern_suffix}"
+
+		for file in $pattern; do
+			[[ -f "${file}" ]] && echo "${target}"
 		done
 	done | @SORT@ | @UNIQ@
 }


             reply	other threads:[~2016-01-22  3:15 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22  3:15 Michael Orlitzky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-12-08  2:24 [gentoo-commits] proj/eselect-php:master commit in: src/ Brian Evans
2020-03-01 12:59 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-29 22:16 Michael Orlitzky
2020-02-12 22:30 Michael Orlitzky
2018-04-12  2:24 Michael Orlitzky
2016-01-22 20:53 Michael Orlitzky
2016-01-22 19:42 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22 19:14 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-22  3:15 Michael Orlitzky
2016-01-20 14:42 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09 17:20 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-09  2:24 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2016-01-08 21:50 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-20  0:17 Michael Orlitzky
2015-12-18  2:27 Brian Evans
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky
2015-12-11  0:40 Michael Orlitzky

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=1453427236.71d449ab84cacc518b6a11c891feed86367c8244.mjo@gentoo \
    --to=mjo@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