HOWTO: Fix what portage breaks (minimize portage use by moving packges back to entropy).

From Sabayon Wiki
Jump to: navigation, search


Excessively mixing entropy ( equo or spritz) with portage (gentoo's emerge command) can lead to problems. Some of the installed packages can become incompatible and can break your system or at least cause bugs. That said there are times when you may want to get a package from portage either because you can a get more recent version, different use flags, or because the package just isn't in entropy. In these cases, you can emerge the package, but you may have better luck if you try keep the number of emerged packages to a minimum.

Emerge can pull in many dependencies that may exist in entropy and where it's even possible that the entropy versions will satisfy your portage package. In this case it may be better to get the dependencies from entropy. Since emerge knows nothing about entropy, this won't happen unless those dependencies were already installed when you do the emerge

The Easy Way

So the easy way to make sure that you keep the most entropy packages possible is to install the entropy version first before installing or updating the portage version. Then when you do the emerge there is a good chance several of the dependencies can be met with entropy packages that are now already installed. So long as you don't use --deep (-D) with your emerge, you should essentially be using the least amount of portage needed to get it done. To really make sure, you should probably even try emerging with --nodeps, especially if using -u (--update), which always tries to update direct (first level) dependencies even if it's not required. The emerge could fail with --nodeps, in which case you'll need to remove that option. There is still no guarantee that emerging things now won't break entropy packages. This, and the method below, just minimize the interferance.

Harder cases

There are a couple of problems with the technique above. 1) The package may not have an entropy version. 2) It may have one, but you already emerged it before using "the easy way" and now you have already pulled in all the portage versions of the dependencies. 3) Maybe you did "the easy way" once, but you waited a very long time and did a portage update before doing an entropy update and the old entropy dependencies couldn't satisfy the new portage package so portage replaced them. 4) Even if you make the best efforts to minimize mixing package managers, if you've mixed them at all, you can still break things. In which case you may just want to get your system back to 100% entropy packages.

The Fix

In these harder cases, the following command gives a way to find all the installed gentoo packages for which there is an entropy replacement.

# equo upgrade --replay --pretend | grep "spm-db->" | cut -d ' ' -f 6 | cut -d '|' -f 1

Puting it in a very simple script allows to convert all these packages back to entropy versions:

<syntaxhighlight lang="'"`UNIQ--pre-00000001-QINU`"'" enclose="none">g2s</syntaxhighlight>

Note you can pass a --pretend to this script, or whatever else, but if you just want a list, probably better to just use the one line version.

Getting Pure Entropy:

So if you've installed some portage stuff this should get you back to 100% entropy (except of course for the stuff entropy doesn't have), and of course it may break some of the portage stuff that wasn't in Sabayon. If you are just trying to get back to a consistent pure entropy system, then you're done (aside from possibly removing unwanted packages), and much faster than if you re-installed every package on your system.

Still want some portage?

If however you still want some portage stuff, you probably want to re-emerge some things. What's the point then you wonder? Well it's just like for "the easy way" above. The first time you installed your portage package, it may have pulled in many dependencies from portage even though they could have been satisfied from entropy. This time when you install them, you have already installed the entropy version of the dependencies. The same disclaimers apply.

Again, this is just to clean up stuff already installed. Ideally one could use a script that installs portage ebuilds in the first place by first doing a pretend, grabbing information about the dependencies that must be installed, installing all those first with Sabayon, and then doing the emerge. This should produce the same result, but without compiling a lot of unneeded stuff in the first place. But that script doesn't exist yet unless you already wrote it yourself.

Don't forget to use:

# equo rescue spmsync --ask

after your emerging, to make Entropy aware of what you have done via Portage.

Using hacks like this takes some thought and usually generates many corner cases. You should know what you are doing (what the script is doing), use pretend and don't blame the author if it goes drastically wrong.