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 19:14:44 +0000 (UTC)	[thread overview]
Message-ID: <1453486774.d50f77c79f3a7e2ce129ef69ff4cc662d1b95ad6.mjo@gentoo> (raw)

commit:     d50f77c79f3a7e2ce129ef69ff4cc662d1b95ad6
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 22 18:19:34 2016 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:19:34 2016 +0000
URL:        https://gitweb.gentoo.org/proj/eselect-php.git/commit/?id=d50f77c7

Clean up and document the cleanup_sapi() function.

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

diff --git a/src/php.eselect.in.in b/src/php.eselect.in.in
index 7e52f53..63b9d42 100644
--- a/src/php.eselect.in.in
+++ b/src/php.eselect.in.in
@@ -173,23 +173,42 @@ parse_target_major_version() {
 	esac
 }
 
+# Remove dead active symlinks for the given SAPI.
+#
+# If a symlink for an SAPI is dead, then that SAPI is at least
+# partially broken. For example, if the symlink to php-cgi is dead,
+# then CGI just isn't going to work -- the SAPI is broken. It
+# therefore makes sense to run update() after we find and remove any
+# broken links. The update at least has the potential to leave things
+# working.
+#
+# There is one potential caveat to that approach, for SAPIs with more
+# than one active symlink. What if "phpize" is broken but "php" is OK?
+# (Forget for the moment how that might happen...). Do we want to
+# update() the entire SAPI because one of the symlinks is dead?
+# Answer: I guess.
+#
+# INPUT:
+#
+# The name of the SAPI to clean up.
+#
+# OUTPUT:
+#
+# If any symlinks are removed, that fact will be announced. If an
+# update occurs, that will be noted as well
+#
 cleanup_sapi() {
 	local sapi="${1}"
-	local l="${sapi}_link"
-	local link=${!l}
-	if [[ -L $link && ! -e $link ]] ; then
-		echo -n "Broken link for ${sapi}"
-		if update_sapi $1 ; then
-			echo ", updated version to $(get_sapi_active_target "${sapi}")"
-			return
-		else
-			rm $link || die "failed to remove ${link}"
-
-			return
-		fi
-	fi
+	local link_dir=$(sapi_active_link_dir "${sapi}")
 
-	return 1
+	for link_name in $(sapi_active_link_names "${sapi}"); do
+		local link_path="${link_dir}/${link_name}"
+		if [[ -L "${link_path}" && ! -e "${link_path}" ]] ; then
+			rm -f "${link_path}" || die "failed to remove ${link_path}"
+			echo "Removed broken symlink ${link_path}."
+			update_sapi "${sapi}" # Try to fix it.
+		fi
+	done
 }
 
 update_sapi() {


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

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 19:14 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  3:15 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=1453486774.d50f77c79f3a7e2ce129ef69ff4cc662d1b95ad6.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