commit:     b0023c0225317857adaaa1a79b05408ed8248c29
Author:     Maciej Barć <xgqt <AT> riseup <DOT> net>
AuthorDate: Mon Nov 22 15:22:06 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  3 00:03:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0023c02

dev-scheme/racket: use has_version instead of REPLACING_VERSIONS

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Maciej Barć <xgqt <AT> riseup.net>
Closes: https://github.com/gentoo/gentoo/pull/23041
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-scheme/racket/racket-8.2-r1.ebuild | 39 +++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/dev-scheme/racket/racket-8.2-r1.ebuild 
b/dev-scheme/racket/racket-8.2-r1.ebuild
index e4cd39eca5fd..ebb87fe339c6 100644
--- a/dev-scheme/racket/racket-8.2-r1.ebuild
+++ b/dev-scheme/racket/racket-8.2-r1.ebuild
@@ -19,7 +19,10 @@ LICENSE="
        chez? ( Apache-2.0 )
        !chez? ( LGPL-3 )
 "
-# Bytecode generated by Racket is not compatible between versions
+# Bytecode generated by Racket is not compatible between versions.
+# The bytecode version should be denoted by SLOT, in most cases
+# PV == SLOT but this has to be checked carefully and in cases
+# where we use _p, _pre, etc it will have to be set manually.
 SLOT="0/${PV}"
 KEYWORDS="amd64 ~arm ~ppc ~ppc64 x86"
 IUSE="X +chez +doc +futures +jit minimal +places +threads"
@@ -134,25 +137,21 @@ src_install() {
 }
 
 pkg_preinst() {
-       # If we are merging the same version (NOT revision!)
-       # check if pkg database files exist and do not overwrite them
-       local pvr rel
-       for pvr in ${REPLACING_VERSIONS}; do
-               rel="${pvr%-r*}"
-               if [[ "${rel}" == "${PV}" ]]; then
-                       echo "We are installing the same version: ${rel}"
-                       local rktd
-                       for rktd in "${PKGDB[@]}"; do
-                               if [[ -f "${EROOT}/${rktd}" ]]; then
-                                       einfo "Keeping old file: ${rktd}"
-                                       mv "${ED}"/${rktd} "${ED}"/${rktd}.bak 
||
-                                               die "failed to create a backup 
of ${rktd}"
-                                       cp "${EROOT}"/${rktd} "${ED}"/${rktd} ||
-                                               die "failed to create a copy of 
${rktd}"
-                               fi
-                       done
-               fi
-       done
+       # If we are merging the same SLOT check if package
+       # database files exist and do not overwrite them
+       if has_version "${CATEGORY}/${PN}:${SLOT}"; then
+               echo "We are installing the same SLOT: ${SLOT}"
+               local rktd
+               for rktd in "${PKGDB[@]}"; do
+                       if [[ -f "${EROOT}/${rktd}" ]]; then
+                               einfo "Keeping old file: ${rktd}"
+                               mv "${ED}"/${rktd} "${ED}"/${rktd}.bak ||
+                                       die "failed to create a backup of 
${rktd}"
+                               cp "${EROOT}"/${rktd} "${ED}"/${rktd} ||
+                                       die "failed to create a copy of ${rktd}"
+                       fi
+               done
+       fi
 }
 
 pkg_postinst() {

Reply via email to