commit:     0ae592744da6c4b5cd96f1b92d4f92cc23f9dbcc
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 16 20:12:33 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Jan 16 20:28:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ae59274

net-proxy/squid: add workaround for 4.x to 5.x upgrade

Move /usr/share/squid/errors out of the way to avoid triggering an
error from Portage when replacing symlinks with directories.

We must do this in pkg_setup because the Portage safety check runs
before pkg_preinst.

Closes: https://bugs.gentoo.org/834503
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 net-proxy/squid/squid-5.7.ebuild | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/net-proxy/squid/squid-5.7.ebuild b/net-proxy/squid/squid-5.7.ebuild
index 92400122c91f..60bc862ec71f 100644
--- a/net-proxy/squid/squid-5.7.ebuild
+++ b/net-proxy/squid/squid-5.7.ebuild
@@ -59,7 +59,6 @@ DEPEND="
        systemd? ( sys-apps/systemd:= )
 "
 RDEPEND="
-       !!<net-proxy/squid-5
        ${DEPEND}
        mysql? ( dev-perl/DBD-mysql )
        postgres? ( dev-perl/DBD-Pg )
@@ -86,6 +85,19 @@ pkg_pretend() {
        fi
 }
 
+pkg_setup() {
+       if [[ -n ${REPLACING_VERSIONS} ]]; then
+               local v
+               for v in ${REPLACING_VERSIONS}; do
+                       if ver_test "${v}" -lt 5; then
+                               ewarn "Moving ${EROOT}/usr/share/squid/errors 
out of the way (bug 834503)"
+                               mv -v "${EROOT}"/usr/share/squid/errors{,.bak}
+                               break
+                       fi
+               done
+       fi
+}
+
 src_prepare() {
        default
 
@@ -359,6 +371,10 @@ src_install() {
 }
 
 pkg_postinst() {
+       if [[ -e ${EROOT}/usr/share/squid/errors.bak ]]; then
+               rm -rv "${EROOT}"/usr/share/squid/errors.bak
+       fi
+
        elog "A good starting point to debug Squid issues is to use 
'squidclient mgr:' commands such as 'squidclient mgr:info'."
 
        if [[ ${#r} -gt 0 ]]; then

Reply via email to