Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 541302 - sys-apps/portage need_write_bindb check breaks --usepkgonly for ro /usr/portage/packages
Summary: sys-apps/portage need_write_bindb check breaks --usepkgonly for ro /usr/porta...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: .tbz2 support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2015-02-25 03:45 UTC by Hank Leininger
Modified: 2015-03-04 21:48 UTC (History)
2 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 Hank Leininger 2015-02-25 03:45:28 UTC
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: 

https://github.com/gentoo/portage/commit/206efe5f6341bce99a5e9994a0458c304513b2c3

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. \
        _opts_no_self_update.intersection(myopts)

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?


Reproducible: Always

Steps to Reproduce:
1. add buildpkg to FEATURES
2. mount /usr/portage/packages readonly
3. emerge --usepkgonly something
Actual Results:  
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.)

Expected Results:  
since --usepkgonly should not require write access to /usr/portage/packages/ (right?) then there should be no reason for emerge not to complete successfully.
Comment 1 Duncan 2015-02-25 05:44:06 UTC
(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.

Makes sense.

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. =:^)

Duncan
Comment 2 Zac Medico gentoo-dev 2015-02-25 06:34:43 UTC
There's a patch in the following branch:

	https://github.com/zmedico/portage/tree/bug_541302

I've posted it for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/5274
Comment 3 Zac Medico gentoo-dev 2015-02-25 08:35:27 UTC
This is in the master branch:

https://github.com/gentoo/portage/commit/0b453300f4da44a8a32e05f6d75da18847806739
Comment 4 Brian Dolbec gentoo-dev 2015-03-04 21:48:07 UTC
Released in portage-2.2.18