Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 46223 - portage fails uninstalling ebuilds when eclass is missing
Summary: portage fails uninstalling ebuilds when eclass is missing
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
: 60919 69813 101095 105464 134939 (view as bug list)
Depends on: 56408
Blocks: 200044
  Show dependency tree
 
Reported: 2004-03-30 02:09 UTC by Carsten Lohrke (RETIRED)
Modified: 2007-11-23 04:01 UTC (History)
17 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Lohrke (RETIRED) gentoo-dev 2004-03-30 02:09:51 UTC
I detected this problem when deleting a private eclass from my overlay directory before unmerging the ebuild, which depends on that eclass. Not a big deal for me, I just removed the stuff by hand, but in general having really old ebuilds in use, whose eclasses do not exist anymore or changed in an unexpected way since the ebuild was written, could cause serious trouble.
Comment 1 Carsten Lohrke (RETIRED) gentoo-dev 2004-04-13 09:05:53 UTC
problem sighted "in the wild" (forums.g.o)
Comment 2 Carsten Lohrke (RETIRED) gentoo-dev 2004-04-13 14:33:05 UTC
lowering priority again, it was BreakMyGentoo stuff
Comment 3 Nicholas Jones (RETIRED) gentoo-dev 2004-04-13 17:43:41 UTC
Using what portage?
Comment 4 Carsten Lohrke (RETIRED) gentoo-dev 2004-04-14 09:09:36 UTC
I think it was 2.0.50-r1 or 3. But - as I wrote - it was a local problem in my overlay directory.

The question is, what happens when someone doesn't keep all ebuilds up to date:
1. Does portage check /var/db/pkg/*/*/ before a deprecated eclass gets removed or is there any other update-mechanism?
2. What happens when a particular installed ebuild isn't compatible with a newer version of an eclass? Maybe the ebuild overrides a function, but doesn't calls the inherited function because it's not needed, but in a later version of the eclass, it is!?
Comment 5 Carsten Lohrke (RETIRED) gentoo-dev 2004-04-20 10:32:09 UTC
Didn't realized it first, but here's a "valid" missing_eclass_sample:
http://forums.gentoo.org/viewtopic.php?p=1062142
Comment 6 Carsten Lohrke (RETIRED) gentoo-dev 2004-04-20 15:45:14 UTC
A simple solution for deprecated eclasses would be to put them in e.g. /usr/portage/eclass/deprecated and include these when unmerging an ebuild. Then portage has to check, if the ebuild inherits a deprecated eclass. If yes, portage has to check the whole /var/db tree, if there's another reference. If not, the eclass could be safely deleted from /usr/portage/eclass/deprecated. This will be the most common problem and the advantage is that this will perfectly fit in the way portage works, while trying to update old installed ebuilds could cause more problems. And remerging may be no option in some cases. 

The downside: This won't solve the second problem.
Comment 7 Brian Harring (RETIRED) gentoo-dev 2004-08-02 04:04:25 UTC
A better solution to this is to correctly save and restore the env (instead of resourcing the ebuild *every* single phase).
Marking this blocked by #56408, since w/ the env patches I have there, this type of problem isn't possible.
Comment 8 Carsten Lohrke (RETIRED) gentoo-dev 2004-08-18 18:09:04 UTC
I have a far simpler "method" - at least as long as we have no uninstall stuff to perform, beside grabbing the set of files and removing it. Testing if the eclass exist and if not touching it, satifies portage.
Comment 9 Brian Harring (RETIRED) gentoo-dev 2004-08-19 06:23:27 UTC
Err... No.  No no no no...
:)
Right now I'm not aware of any eclass's that provide prerm/postrm.  There are a few that provide setup.  If portage just basically ignores the missing eclass (as you're proposing), that lets portage get into an even worse unknown state; it thinks things are fine, when they are not.  What if the setup/(pre|post)(rm|inst) calls a function defined by that eclass?  That becomes a bug that ebuild.sh will overlook (specifically all ebuilds overlook it).  You rarely see
pkg_setup() {
    webapp_setup || die "wtf"
}
for example.
The correct solution that is to reuse the saved env.  Sidestepping/hiding the problem only allows the situtation to become worse.
Comment 10 Carsten Lohrke (RETIRED) gentoo-dev 2004-08-19 07:12:37 UTC
I knew I would get this answer. ;) Didn't thought about something like 'webapp_setup || die "wtf"' And indeed, there are eclasses doing rm stuff.
Comment 11 Brian Harring (RETIRED) gentoo-dev 2004-08-19 12:04:38 UTC
*** Bug 60919 has been marked as a duplicate of this bug. ***
Comment 12 Tobias Sager 2004-08-25 13:21:08 UTC
Run into this while upgrading php from 4.3.3-r1 to 4.3.8.
("/usr/sbin/ebuild.sh: line 1102: /usr/portage/eclass/php.eclass: No such file or directory").
Comment 13 Jason Stubbs (RETIRED) gentoo-dev 2004-11-02 05:55:43 UTC
*** Bug 69813 has been marked as a duplicate of this bug. ***
Comment 14 Ville Oikarinen 2004-11-14 12:54:15 UTC
Would this be a reasonable unmerging strategy for Portage:

1 If an ebuild does not override any functionality for unmerging, then the ebuild script won't be run during unmerge. Portage just deletes all merged files.

2 Else if all eclasses (+ other dependencies, are there such? DEPEND, RDEPEND, UDEPEND...) can be found, Portage acts just like it does now.

3 Else it retrieves the needed dependency from CVS. Note that the newest version of the dependency is retrieved, not the one matching the ebuild merge date. This way bug fixes can take effect.

Note that here we assume that eclass APIs and their semantics will always be backwards compatible, and this is always a fair assumption regarding software components.

----

If there is need to change the contract between eclass and ebuilds depending on it - and this seems to be the case, for otherwise this bug hadn't been reported  (the existence of an eclass clearly is part of the contract :-) - the following needs to be done:

The developer creates a new "slot" for the eclass. It might be fairly easy to utilize the current version and slot handling functionality of Portage.

When no current ebuild uses an old eclass or eclass slot anymore, Portage removes it, but to avoid the need for step 3 above (CVS retrieval), Portage checks if any of the merged ebuilds refers to it, in which case it saves it in an attic directory. Step 2 above uses this directory when deciding if there is need for step 3.

Note that the strategy above can be implemented without this slot functionality.
Comment 15 Ville Oikarinen 2004-11-25 00:41:59 UTC
Will portage be able to unmerge the old mod_php soon? Or should I do something manually? (yuck :-)
Comment 16 Brian Harring (RETIRED) gentoo-dev 2005-02-16 04:32:23 UTC
Future portage versions will.  This is in regard to php.eclass, yes?
If so... robbat2, here is an example of the horkage I was talking about.
Comment 17 Jason Stubbs (RETIRED) gentoo-dev 2005-08-02 16:37:00 UTC
*** Bug 101095 has been marked as a duplicate of this bug. ***
Comment 18 Jakub Moc (RETIRED) gentoo-dev 2005-09-10 01:34:37 UTC
*** Bug 105464 has been marked as a duplicate of this bug. ***
Comment 19 Jakub Moc (RETIRED) gentoo-dev 2006-05-30 12:04:59 UTC
*** Bug 134939 has been marked as a duplicate of this bug. ***
Comment 20 kalium 2006-08-07 10:35:25 UTC
Why not just save everything needed to build the package in the /var/db/pkg db? (including the eclass files)
Comment 21 Simon Stelling (RETIRED) gentoo-dev 2006-08-07 10:37:34 UTC
mainly because it's basically already there (environment.bz2) and it'd be a super-redundancy.
Comment 22 Zac Medico gentoo-dev 2007-11-23 03:50:09 UTC
This is fixed in 2.1.4_rc1.