Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 388259 - When using --ask, print fetch instructions for packages with fetch restrictions
Summary: When using --ask, print fetch instructions for packages with fetch restrictions
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 377365 388093 409383
  Show dependency tree
 
Reported: 2011-10-23 19:15 UTC by Martin von Gagern
Modified: 2012-03-23 01:24 UTC (History)
1 user (show)

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


Attachments
Portage patch v1 (bug388259a.patch,1.45 KB, patch)
2012-03-12 10:48 UTC, Martin von Gagern
Details | Diff
Portage patch v2 (bug388259b.patch,2.63 KB, patch)
2012-03-12 20:50 UTC, Martin von Gagern
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin von Gagern 2011-10-23 19:15:55 UTC
I regularly update my system using something like "emerge -uaND @world". This prints a list of packages and asks me whether to proceed. If some of the packages are using fetch restrictions, those packages will be marked with a red F accordingly, but resolving them is still a number of steps: for every such package, I'll have to "emerge -f =category/package-version", read the text and proceed accordingly.

As it can be expected that I want to manually fetch files before proceeding, it would be great if "emerge --ask" could print all those fetch instructions when it prints the list of packages to emerge. Personally I'd prefer the instructions after the package list, but I'll be happy the other way round, too.

In such a scenario, I could read and follow all those instructions, without having to manually run emerge for every affected package.
Comment 1 Zac Medico gentoo-dev 2011-10-23 19:25:24 UTC
This is similar to bug 388093, but I hadn't thought of calling pkg_nofetch before the --ask prompt. That's a good idea.
Comment 2 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2011-10-31 08:40:49 UTC
Yeah this would be great.
Comment 3 Martin von Gagern 2011-12-21 07:25:05 UTC
Ping?
Comment 4 Martin von Gagern 2012-03-12 10:48:17 UTC
Created attachment 304975 [details, diff]
Portage patch v1

OK, to get some traction here: how about the attached patch?

I tried to adjust the code used by the Display class to print either a green "f" or a red "F". The thing I'm most uncertain about is whether I'm using the correct portdb object there. And the use of the underscored method _pkg_use_enabled from the depgraph object might warrant closer inspection as well.

I also thought about collecting the list of packages to fetch inside the Display class, in order to avoid both code duplication and repeated computation. But that kind of mixing computation and presentation feels rather ugly, so I decided against it.
Comment 5 Zac Medico gentoo-dev 2012-03-12 18:38:02 UTC
(In reply to comment #4)
> I also thought about collecting the list of packages to fetch inside the
> Display class, in order to avoid both code duplication and repeated
> computation. But that kind of mixing computation and presentation feels
> rather ugly, so I decided against it.

The fetch instructions can be considered display code. So, they have to go either in the Display class or in depgraph._display_problems(). Maybe the Display class makes more sense, since the fetch instructions may not be considered a "problem", depending on how you look at it.
Comment 6 Zac Medico gentoo-dev 2012-03-12 18:40:44 UTC
(In reply to comment #4)
> Created attachment 304975 [details, diff] [details, diff]
> Portage patch v1
> 
> OK, to get some traction here: how about the attached patch?

action_build is just the wrong place for it, because it really needs to be into the depgraphs' display, not wrapped around it.
Comment 7 Zac Medico gentoo-dev 2012-03-12 18:45:02 UTC
(In reply to comment #4)
> The thing I'm most uncertain about is whether I'm using
> the correct portdb object there.

There's a different portdb for each $ROOT, so you have to get the instance that belongs to the given package. You can git it like this:

   portdb = pkg.root_config.trees['porttree'].dbapi
Comment 8 Martin von Gagern 2012-03-12 20:50:20 UTC
Created attachment 305033 [details, diff]
Portage patch v2


(In reply to comment #5)
> Maybe the Display class makes more sense,

OK, moved stuff there. I changed the API of set_pkg_info, but don't expect anyone else to be using that. No part of the portage source code uses it, except for the call I changed to match.

(In reply to comment #7)
> There's a different portdb for each $ROOT, so you have to get the instance
> that belongs to the given package. You can git it like this:
> 
>    portdb = pkg.root_config.trees['porttree'].dbapi

I've used a slightly different form, to keep all such phrases in the class the same. Display does it like this:

  portdb = self.conf.trees[pkg.root]["porttree"].dbapi

If there is any benefit to the former method, it should be changed consistently.
Comment 10 Zac Medico gentoo-dev 2012-03-18 00:19:52 UTC
This is in 2.2.0_alpha91, but I'll leave this bug open until it's in an unmasked release.
Comment 11 Zac Medico gentoo-dev 2012-03-23 01:24:23 UTC
This is fixed in 2.1.10.50.