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:
Created attachment 22294 [details, diff] mtimedbdict.patch Patch is against 2.0.50_pre1.
Created attachment 24247 [details, diff] mtimedbdict.patch The same, updated for 2.0.50_pre19.
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...
(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.