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

Bug 294719

Summary: emerge --onlydeps and PDEPEND
Product: Portage Development Reporter: Torsten Veller (RETIRED) <tove>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: esigra, SebastianLuther, wtt6
Priority: High Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=524916
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 155723, 619102    
Attachments: emerge --info
onlydeps=minimal patch
onlydeps=minimal
onlydeps=minimal patch
onlydeps=all patch
onlydeps-with-rdeps patch

Description Torsten Veller (RETIRED) gentoo-dev 2009-11-26 14:47:44 UTC
$ emerge -pq --onlydeps dev-perl/Crypt-SSLeay
[ebuild  N    ] dev-perl/Crypt-SSLeay-0.57 
[ebuild  N    ] dev-perl/libwww-perl-5.831


dev-perl/Crypt-SSLeay: PDEPEND="dev-perl/libwww-perl"
and
dev-perl/libwww-perl:  R/DEPEND="ssl? ( dev-perl/Crypt-SSLeay )"


Is this intended behaviour with --onlydeps?

As PDEPENDS should be emerged after, I didn't expect --depsonly to try to install them.
Comment 1 Torsten Veller (RETIRED) gentoo-dev 2009-11-26 14:49:03 UTC
Created attachment 211251 [details]
emerge --info
Comment 2 Sebastian Luther (few) 2009-11-26 15:12:02 UTC
From PMS: Post dependencies (PDEPEND). These must be installed at some point.
Comment 3 Zac Medico gentoo-dev 2009-11-26 21:38:31 UTC
Yes, PDEPEND atoms are first-class dependencies. I suppose we can add support for something like --onlydeps=minimal which would only pull in DEPEND.
Comment 4 Zac Medico gentoo-dev 2009-11-26 21:45:58 UTC
Or, we might consider making --onlydeps automatically drop PDEPEND and RDEPEND in cases when they have circular deps.
Comment 5 William Throwe 2017-03-12 02:50:19 UTC
Created attachment 466762 [details, diff]
onlydeps=minimal patch

Rather an old bug, but I have a use for it (preparing for --buildpkgonly runs).  Here's a patch to add --onlydeps=minimal to skip REDPEND and PDEPEND (the same logic buildpkgonly uses).

I haven't tested it very thoroughly yet because the portage ebuild makes that hard.  (No epatch_user.)
Comment 6 William Throwe 2017-03-12 03:09:26 UTC
(In reply to William Throwe from comment #5)
> I haven't tested it very thoroughly yet because the portage ebuild makes
> that hard.  (No epatch_user.)

Oops, actually it does have it.  PEBKAC.

Basic tests on a real system seem to work as intended.
Comment 7 Zac Medico gentoo-dev 2017-03-12 03:57:49 UTC
(In reply to William Throwe from comment #5)
> --- a/pym/_emerge/depgraph.py
> +++ b/pym/_emerge/depgraph.py
> @@ -2995,7 +2995,8 @@ class depgraph(object):
>  			use_enabled.add("test")
>  
>  		if not pkg.built and \
> -			"--buildpkgonly" in self._frozen_config.myopts and \
> +			("--buildpkgonly" in self._frozen_config.myopts or \
> +			 pkg.onlydeps == "minimal") and \
>  			"deep" not in self._dynamic_config.myparams:
>  			edepend["RDEPEND"] = ""
>  			edepend["PDEPEND"] = ""

Since onlydeps and buildpkgonly are separate things, I'd prefer to keep their code separate. How about something like this:

		if pkg.onlydeps == "minimal":
			edepend["RDEPEND"] = ""
			edepend["PDEPEND"] = ""
Comment 8 William Throwe 2017-03-12 18:32:55 UTC
Created attachment 466830 [details, diff]
onlydeps=minimal

That makes sense.  And now that you mention that it doesn't really make sense to tie the behavior to pkg.built or --deep, so that seems better too.

Here's an updated patch.
Comment 9 Zac Medico gentoo-dev 2017-03-13 04:00:33 UTC
I'm thinking that this behavior, just installing the build-time dependencies, is what people typically want anyway. We could probably make this the default --onlydeps behavior without upsetting anyone.
Comment 10 Zac Medico gentoo-dev 2017-03-13 04:13:00 UTC
> diff --git a/man/emerge.1 b/man/emerge.1
> index 7db4271..ff43514 100644
> --- a/man/emerge.1
> +++ b/man/emerge.1
> @@ -712,9 +712,10 @@ allowed to be broken when satisfying dependencies of other packages.
>  Broken dependencies of this sort will invalidate assumptions that make
>  it possible for \fB\-\-deep\fR to be disabled by default.
>  .TP
> -.BR "\-\-onlydeps " (\fB\-o\fR)
> +.BR "\-\-onlydeps[=minimal] " (\fB\-o\fR)
>  Only merge (or pretend to merge) the dependencies of the packages
> -specified, not the packages themselves.
> +specified, not the packages themselves.  If the \fBminimal\fR argument
> +is given then do not merge run time dependencies.

Maybe we should express this in a positive sense, like "only merge build time dependencies." A possible point of confusion is that if a binary package gets pulled in for the argument package, then it won't pull in any dependencies unless --with-bdeps=y is enabled, since binary packages don't have any real build time dependencies.
Comment 11 William Throwe 2017-03-18 19:20:55 UTC
Created attachment 467468 [details, diff]
onlydeps=minimal patch

Here's a version with the adjusted documentation...
Comment 12 William Throwe 2017-03-18 19:23:02 UTC
Created attachment 467470 [details, diff]
onlydeps=all patch

... and here's a version where the minimal behavior above is the default and the old behavior has been renamed to --onlydeps=all.  Whichever behavior you prefer seems fine to me.
Comment 13 Zac Medico gentoo-dev 2017-03-20 07:32:43 UTC
If we add a --onlydeps-with-rdeps=<y|n> option, then we don't need --onlydeps=all, and people will be able to adjust the default behavior with a --onlydeps-with-rdeps=<y|n> setting in EMERGE_DEFAULT_OPTS.
Comment 14 William Throwe 2017-04-16 22:32:34 UTC
Created attachment 470200 [details, diff]
onlydeps-with-rdeps patch

Here's a version adding --onlydeps-with-rdeps.  Since the behavior can now be chosen easily in EMERGE_DEFAULT_OPTS I've made the option default on so current --onlydeps behavior is unchanged.
Comment 15 Zac Medico gentoo-dev 2017-04-17 06:08:41 UTC
(In reply to William Throwe from comment #14)
> Created attachment 470200 [details, diff] [details, diff]
> onlydeps-with-rdeps patch

Looks good. Thanks!
Comment 18 Zac Medico gentoo-dev 2017-05-20 18:27:51 UTC
Fixed in portage-2.3.5.
Comment 19 Zac Medico gentoo-dev 2017-05-20 18:48:25 UTC
Actually it's portage-2.3.6.