Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 35934

Summary: [PATCH] Using $ROOT, package moves are unnecessarily reapplied
Product: Portage Development Reporter: TGL <tom.gl>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: radek
Priority: High Keywords: Inclusion
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=379749
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 137867    
Attachments: mtimedbdict.patch
mtimedbdict.patch

Description TGL 2003-12-16 05:29:16 UTC
When you use portage in a non-standard root (`ROOT=/some/path emerge ...`), it uses an mtimedb located in $ROOT/var/cache/edb/. This is good. But it also makes it re-apply all portage upgrades (the /usr/portage/profiles/updates stuff) to /var/db/pkg and binary packages. This is useless and time consuming. Also, it will never apply any upgrade to $ROOT/var/db/pkg (and neither to $ROOT/var/cache/edb/{virtuals,world}). 

I've patched portage.py so that it is able to use several mtimedbs:
 - the "/" mtimedb, which is needed in all case, at least to apply upgrades to /var/db/pkg and binary packages only when really needed.
 - if root!="/", another mtimedb is needed, for upgrading root/var/db/pkg, resuming emerges, etc.
 - this two db are grouped in a dictionnary (mtimedbdict["/"] and mtimedbdict[root])
 - I've also modified do_upgrade so that it takes a root in arguments, do the upgrades in this root, and also only upgrade binaries when this root is "/" (btw, why are binaries always put in this root?). 
 - I've also kept the "mtimedb" global variable as a reference on mtimedbdict[root], to preserve compatibility with emerge. I've reviewed all the  code related to mtimedb, and convinced myself this reference would never get broken. That said, it would be better to modify emerge so that it uses "portage.mtimedbdict[portage.root]" instead of "portage.mtimedb". 
 - Finally, I've modified the exit function so that it saves both mtimedb files.

Reproducible: Always
Steps to Reproduce:
Comment 1 TGL 2003-12-16 05:30:26 UTC
Created attachment 22294 [details, diff]
mtimedbdict.patch

Patch is against 2.0.50_pre1.
Comment 2 TGL 2004-01-22 10:14:03 UTC
Created attachment 24247 [details, diff]
mtimedbdict.patch

The same, updated for 2.0.50_pre19.
Comment 3 Radek Podgorny 2005-10-13 05:00:04 UTC
The "not updating $ROOT/var/db/pkg" is a serious flaw IMHO, can someone review
the patches and/or verify it's true/false? I'm about to manage a complete
$ROOTed system from outside and this would make it impossible...
Comment 4 Zac Medico gentoo-dev 2013-02-15 23:22:15 UTC
(In reply to comment #0)
> When you use portage in a non-standard root (`ROOT=/some/path emerge ...`),
> it uses an mtimedb located in $ROOT/var/cache/edb/. This is good. But it
> also makes it re-apply all portage upgrades (the
> /usr/portage/profiles/updates stuff) to /var/db/pkg and binary packages.
> This is useless and time consuming.

That's been fixed for awhile now:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0f436b2b66f58b3504be6cf5e75a5d6f1f99e799

> Also, it will never apply any upgrade to
> $ROOT/var/db/pkg (and neither to $ROOT/var/cache/edb/{virtuals,world}). 

You can use emaint --fix movebin and/or moveinst for this.