Gentoo and upgrading perl core
GENERAL RULE: always back-up and always use maintenance windows.
On a busy server with lots of scripts and programs installed this task might become quite hard since you don’t know from where the problems can appear. If you look on the official documentation you will find that in order to upgrade perl-core you should upgrade the @world.(all packages).
To be honest i never upgraded the @world for the same reason. I prefer to upgrade the packages that i need ( ex: apache, php,etc ) and when the times comes(once in a while) i usually upgrade the @system. It’s easier to keep an eye on what happened with only one application instead on finding yourself in the situation that everything is down(for example you can have both email and web downtime in the same time).
But enough with this story, let’s go to perl.
If you do emerge -pv dev-lang/perl it’s simply not going to work because of the nightmare of dependencies. One package refers to another and that to another and you will a lot have conflicts. As i said before the official way is to upgrade the @world but there is ANOTHER WAY.
echo "=app-admin/gentoo-perl-helpers-0.3.1-r1 ~amd64" >> /etc/portage/package.accept_keywords emerge gentoo-perl-helpers
This is a tool that constructs a list of perl packages that need to be upgraded plus their direct dependencies ( ex: net-snmp if you compiled with perl module, spamassassin, etc) and of-course perl-core.
It’s quite simple to use it. For example if you want to upgrade from perl 5.24 to 5.28 you simply do:
# gentoo-perl gen-upgrade-sets 5.24 5.28
* [gentoo-perl > gen-upgrade-sets] Generating /etc/portage/sets/perl-cleanup
* [...ch-atom-blacklisted > list-blacklisted-for] No blacklist entries for dev-lang/perl:0/5.28
* [gentoo-perl > gen-upgrade-sets] ... Done /etc/portage/sets/perl-cleanup
* [gentoo-perl > gen-upgrade-sets] Generating /etc/portage/sets/perl-upgrade
* [...perl-subslot-rebuild > installed-deps-atom] revdep DEPEND scanning for dev-lang/perl(|-5\.[^: ]+):0/(5\.26|5\.24|5\.22|5\.20|5\.18|5\.16)=
* [...perl-subslot-rebuild > installed-deps-atom] revdep RDEPEND scanning for dev-lang/perl(|-5\.[^: ]+):0/(5\.26|5\.24|5\.22|5\.20|5\.18|5\.16)=
* [...perl-subslot-rebuild > installed-deps-atom] revdep PDEPEND scanning for dev-lang/perl(|-5\.[^: ]+):0/(5\.26|5\.24|5\.22|5\.20|5\.18|5\.16)=
* [...perl-subslot-rebuild > installed-deps-atom] No matches in PDEPEND
* [gentoo-perl > gen-upgrade-sets] ... Done /etc/portage/sets/perl-upgrade
* [gentoo-perl > gen-upgrade-sets] Created set @perl-cleanup in /etc/portage/sets/perl-cleanup
* [gentoo-perl > gen-upgrade-sets] Created set @perl-upgrade in /etc/portage/sets/perl-upgrade
* [gentoo-perl > gen-upgrade-sets]
* [gentoo-perl > gen-upgrade-sets] Assuming both of those were in /etc/portage/sets you can now do
* [gentoo-perl > gen-upgrade-sets] emerge -va1 -k n @perl-upgrade
* [gentoo-perl > gen-upgrade-sets] And if this exhibits confusing blockers that only refer to perl-core
* [gentoo-perl > gen-upgrade-sets] emerge -C -va @perl-cleanup
* [gentoo-perl > gen-upgrade-sets] Should help pave the way forward
* [gentoo-perl > gen-upgrade-sets]
* [gentoo-perl > gen-upgrade-sets] If portage crashes mid-way through an upgrade, after any relevant issues
* [gentoo-perl > gen-upgrade-sets] Re-run this tool to regenerate the sets before proceeding
After that you should run …. but wait a minute and read below the command and not hurry to press YES.
emerge --oneshot --ask @perl-upgrade
Now comes the tricky part. It might be that the packages that you upgrade will not have the same USE definition as before. Pay a lot of attention to this subject because it might break the usability of a certain package. My approach was to look on the packages that will be installed and where necessary to add in /etc/portage/package.use the correct USE elements. For example for net-snmp i have:
# cat /etc/portage/package.use/net-snmp net-analyzer/net-snmp perl tcpd
Once you are sure that all the packages are having the correct USE elements you should do the upgrade.
Once the upgrade is done you should all do :
perl-cleaner -all
You might also need to do emerge -cvap and look for(if) something that you can uninistall in order not to create confusion for the next upgrade. Also emerge revdep-rebuild might be needed after this step but this is totally dependent to your system.