A recent change to _emerge/actions.py added a check if $PKGDIR was writable before emerge would proceed. It has a few exceptions that will skip that test, like if --pretend was used. I propose/request that --usepkgonly also be an exception.
The commit in question:
Posted & briefly discussed at: https://marc.info/?l=gentoo-portage-dev&m=141648797703113&w=2
The part relevant to my interests is:
need_write_vardb = not Scheduler. \
need_write_bindb = not any(x in myopts for x in
("--fetchonly", "--fetch-all-uri", "--pretend")) and \
(any("buildpkg" in trees[eroot]["root_config"].
settings.features for eroot in trees) or
any("buildsyspkg" in trees[eroot]["root_config"].
settings.features for eroot in trees))
if need_write_bindb or need_write_vardb:
This broke a setup that has worked for me for many years: building new systems by untarring stage3, copying preconfigured files into /etc/portage/ over from a build system, bind-mounting /usr/portage/packages (ro, from an .iso), and emerge ... --usepkgonly world
Note, I don't have a problem if I strip out 'buildpkg' from my FEATURES=, which I'm now doing to avoid hitting this. But I think it'd be reasonable for --usepkgonly to be an exception, because that means "we're not going to create new packages or update /usr/portage/packages/Packages" ... right?
Steps to Reproduce:
1. add buildpkg to FEATURES
2. mount /usr/portage/packages readonly
3. emerge --usepkgonly something
emerge aborts with a read-only error.
Incidentally, the error message is messed up, I get a python Traceback ending in:
_("Read-only file system: %s") %
NameError: global name '_' is not defined
(Perhaps that is an odd artifact of my hand-constructing a chroot setup to reproduce this, unknown.)
since --usepkgonly should not require write access to /usr/portage/packages/ (right?) then there should be no reason for emerge not to complete successfully.
(In reply to Hank Leininger from comment #0)
> A recent change to _emerge/actions.py added a check if $PKGDIR was writable
> before emerge would proceed. It has a few exceptions that will skip that
> test, like if --pretend was used. I propose/request that --usepkgonly also
> be an exception.
Thanks for the followup on bug #490732 (mine, triggering this change in the first place) letting me know about this. Yes, --usepkgonly/-K is another corner case obviously nobody thought of, but that doesn't mean people (like you) aren't running it somewhere.
With the new larger group of devs working on portage now, and with your mention of the commit and specific code, it should be an easy fix, and therefore hopefully a fast fix. =:^)
There's a patch in the following branch:
I've posted it for review here:
This is in the master branch:
Released in portage-2.2.18