commit:     a5e7622671faf8e8ee6211e5d9099fc294479992
Author:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 17 05:35:06 2016 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Sat Sep 17 18:57:26 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a5e76226

dev-lang/perl: use REPLACING_VERSIONS instead of has_version where possible

Package-Manager: portage-2.3.0

 dev-lang/perl/perl-5.24.0-r1.ebuild | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/dev-lang/perl/perl-5.24.0-r1.ebuild 
b/dev-lang/perl/perl-5.24.0-r1.ebuild
index f984f96..e4d7ab2 100644
--- a/dev-lang/perl/perl-5.24.0-r1.ebuild
+++ b/dev-lang/perl/perl-5.24.0-r1.ebuild
@@ -68,7 +68,13 @@ dual_scripts() {
 }
 
 check_rebuild() {
-       if has_version "<dev-lang/perl-${SHORT_PV}" ; then
+       # Fresh install
+       if [[ -z "${REPLACING_VERSIONS}" ]]; then
+               return 0;
+       # Major Upgrade
+       # doesn't matter if there's multiple copies, it still needs a rebuild
+       # if the string is anything other than "5.CURRENTMAJOR"
+       elif [[ "${REPLACING_VERSIONS%.*}" != "${PV%.*}" ]]; then
                echo ""
                ewarn "UPDATE THE PERL MODULES:"
                ewarn "After updating dev-lang/perl the installed Perl modules"
@@ -84,17 +90,18 @@ check_rebuild() {
                ewarn "You should then call perl-cleaner to clean up any old 
files and trigger any"
                ewarn "remaining rebuilds portage may have missed."
                ewarn "Use: perl-cleaner --all"
-       elif has_version dev-lang/perl ; then
-               if (   use ithreads && ! has_version dev-lang/perl[ithreads] ) 
|| \
-                  ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) 
|| \
-                  (   use debug    && ! has_version dev-lang/perl[debug]    ) 
|| \
-                  ( ! use debug    &&   has_version dev-lang/perl[debug]    ) 
; then
-                       echo ""
-                       ewarn "TOGGLED USE-FLAGS WARNING:"
-                       ewarn "You changed one of the use-flags ithreads or 
debug."
-                       ewarn "You must rebuild all perl-modules installed."
-                       ewarn "Use: perl-cleaner --modules ; perl-cleaner 
--force --libperl"
-               fi
+               return 0;
+
+       # Reinstall w/ USE Change
+       elif (   use ithreads && ! has_version dev-lang/perl[ithreads] ) || \
+            ( ! use ithreads &&   has_version dev-lang/perl[ithreads] ) || \
+            (   use debug    && ! has_version dev-lang/perl[debug]    ) || \
+            ( ! use debug    &&   has_version dev-lang/perl[debug]    ) ; then
+               echo ""
+               ewarn "TOGGLED USE-FLAGS WARNING:"
+               ewarn "You changed one of the use-flags ithreads or debug."
+               ewarn "You must rebuild all perl-modules installed."
+               ewarn "Use: perl-cleaner --modules ; perl-cleaner --force 
--libperl"
        fi
 }
 

Reply via email to