commit:     2551d80560ef06307944b0c04ae9677db9ff1d32
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 12 16:31:09 2024 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Fri Jan 12 16:31:48 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2551d805

sys-process/runit: remove duplicate pkg_preinst definition

Closes: https://bugs.gentoo.org/862615
Signed-off-by: William Hubbs <williamh <AT> gentoo.org>

 sys-process/runit/runit-2.1.2-r1.ebuild |  17 +----
 sys-process/runit/z                     | 124 ++++++++++++++++++++++++++++++++
 2 files changed, 125 insertions(+), 16 deletions(-)

diff --git a/sys-process/runit/runit-2.1.2-r1.ebuild 
b/sys-process/runit/runit-2.1.2-r1.ebuild
index 3dcf174b65dc..2250a85f21de 100644
--- a/sys-process/runit/runit-2.1.2-r1.ebuild
+++ b/sys-process/runit/runit-2.1.2-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=6
@@ -73,21 +73,6 @@ src_install() {
        EOF
 }
 
-pkg_preinst() {
-       if has_version 'sys-process/runit' &&
-               has_version '<sys-process/runit-2.1.2' &&
-               [ -d "${EROOT}"etc/runit/runsvdir/all ]; then
-               if [ -e "${EROOT}"etc/sv ]; then
-                       mv -f "${EROOT}"etc/sv "${EROOT}"etc/sv.bak || die
-                       ewarn "${EROOT}etc/sv was moved to ${EROOT}etc/sv.bak"
-               fi
-               mv "${EROOT}"etc/runit/runsvdir/all "${EROOT}"etc/sv|| die
-               ln -sf "${EROOT}"etc/sv "${EROOT}"etc/runit/runsvdir/all || die
-               cp -a "${EROOT}"etc/runit/runsvdir "${T}" || die
-               touch "${T}"/make_var_service || die
-       fi
-}
-
 default_config() {
        local sv="${EROOT}"etc/sv
        local service="${EROOT}"etc/service

diff --git a/sys-process/runit/z b/sys-process/runit/z
new file mode 100644
index 000000000000..94ec0c233b7e
--- /dev/null
+++ b/sys-process/runit/z
@@ -0,0 +1,124 @@
+ * Info: Using [Gentoo] (https://bugs.gentoo.org/xmlrpc.cgi)
+ * Info: Getting bug 862615 ..
+cf_runtime_testing_required: ---
+remaining_time: 0.0
+Blocks      : 610764
+Component   : Current packages
+OpSystem    : Linux
+AssignedTo  : [email protected]
+Updated     : 20220911T22:19:38
+Hardware    : All
+actual_time : 0.0
+classification: Unclassified
+Priority    : Normal
+Version     : unspecified
+Title       : sys-process/runit: duplicate pkg_preinst definition
+Severity    : normal
+Reporter    : [email protected]
+estimated_time: 0.0
+TargetMilestone: ---
+Status      : CONFIRMED
+CC          : [email protected]
+Reported    : 20220801T02:32:59
+Product     : Gentoo Linux
+Attachments : 0
+
+Comments    : 3
+
+[Comment #0] [email protected] : 20220801T02:32:59
+-------------------------------------------------------------------------------
+runit-2.1.2-r1.ebuild has two definitions of pkg_preinst:
+
+1) This one comes first (so is NOT used):
+```
+pkg_preinst() {
+        if has_version 'sys-process/runit' &&
+                has_version '<sys-process/runit-2.1.2' &&
+                [ -d "${EROOT}"etc/runit/runsvdir/all ]; then
+                if [ -e "${EROOT}"etc/sv ]; then
+                        mv -f "${EROOT}"etc/sv "${EROOT}"etc/sv.bak || die
+                        ewarn "${EROOT}etc/sv was moved to ${EROOT}etc/sv.bak"
+                fi
+                mv "${EROOT}"etc/runit/runsvdir/all "${EROOT}"etc/sv|| die
+                ln -sf "${EROOT}"etc/sv "${EROOT}"etc/runit/runsvdir/all || die
+                cp -a "${EROOT}"etc/runit/runsvdir "${T}" || die
+                touch "${T}"/make_var_service || die
+        fi
+}
+```
+
+2) This one comes last (so is the one used):
+```
+pkg_postinst() {
+        if [[ -z $REPLACING_VERSIONS ]]; then
+                default_config
+        elif [[ -n $pre_212 ]]; then
+                migrate_from_211
+        fi
+
+        ewarn "To make sure sv works correctly in your currently open"
+        ewarn "shells, please run the following command:"
+        ewarn
+        ewarn "source /etc/profile"
+        ewarn
+
+        if [ -L "${EROOT}"var/service ]; then
+                ewarn "Once this version of runit is active, please remove the"
+                ewarn "compatibility symbolic link at ${EROOT}var/service"
+                ewarn "The correct path now is ${EROOT}etc/service"
+                ewarn
+        fi
+
+        if [ -L "${EROOT}"etc/runit/runsvdir/all ]; then
+                ewarn "${EROOT}etc/runit/runsvdir/all has moved to"
+                iewarn "${EROOT}etc/sv."
+                ewarn "Any symbolic links under ${EROOT}etc/runit/runsvdir"
+                ewarn "which point to services through ../all should be updated
+to"
+                ewarn "point to them through ${EROOT}etc/sv."
+                ewarn "Once that is done, ${EROOT}etc/runit/runsvdir/all should
+be"
+                ewarn "removed."
+                ewarn
+        fi
+}
+```
+
+Which one is supposed to be used?
+
+[Comment #1] [email protected] : 20220801T02:35:24
+-------------------------------------------------------------------------------
+(Recommenting as first comment had wrong paste of second definition.)
+
+runit-2.1.2-r1.ebuild has two definitions of pkg_preinst:
+
+1) This one comes first (so is NOT used):
+```
+pkg_preinst() {
+        if has_version 'sys-process/runit' &&
+                has_version '<sys-process/runit-2.1.2' &&
+                [ -d "${EROOT}"etc/runit/runsvdir/all ]; then
+                if [ -e "${EROOT}"etc/sv ]; then
+                        mv -f "${EROOT}"etc/sv "${EROOT}"etc/sv.bak || die
+                        ewarn "${EROOT}etc/sv was moved to ${EROOT}etc/sv.bak"
+                fi
+                mv "${EROOT}"etc/runit/runsvdir/all "${EROOT}"etc/sv|| die
+                ln -sf "${EROOT}"etc/sv "${EROOT}"etc/runit/runsvdir/all || die
+                cp -a "${EROOT}"etc/runit/runsvdir "${T}" || die
+                touch "${T}"/make_var_service || die
+        fi
+}
+```
+
+2) This one comes last (so is the one used):
+```
+pkg_preinst() {
+        if  has_version '<sys-process/runit-2.1.2'; then
+                pre_212=yes
+        fi
+}
+```
+
+[Comment #2] [email protected] : 20220911T22:19:38
+-------------------------------------------------------------------------------
+ping

Reply via email to