1 |
commit: 26a8ea6889190b6a0ec110f76fa49834d53771e9 |
2 |
Author: William Throwe <wtt6 <AT> cornell <DOT> edu> |
3 |
AuthorDate: Sun Mar 12 01:41:59 2017 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun May 14 18:13:10 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=26a8ea68 |
7 |
|
8 |
emerge: add --onlydeps-with-rdeps=<y|n> option (bug 294719) |
9 |
|
10 |
Add --onlydeps-with-rdeps=n option in order to omit pure |
11 |
run-time dependencies with --onlydeps. The dependencies |
12 |
that get pulled in are those that are necessary for the |
13 |
equivalent --buildpkgonly command to succeed. The default |
14 |
--onlydeps behavior remains unchanged. |
15 |
|
16 |
X-Gentoo-bug: 294719 |
17 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=294719 |
18 |
Acked-by: Brian Dolbec <dolsen <AT> gentoo.org> |
19 |
|
20 |
man/emerge.1 | 5 +++ |
21 |
pym/_emerge/depgraph.py | 5 +++ |
22 |
pym/_emerge/main.py | 6 +++ |
23 |
.../tests/resolver/test_onlydeps_minimal.py | 47 ++++++++++++++++++++++ |
24 |
4 files changed, 63 insertions(+) |
25 |
|
26 |
diff --git a/man/emerge.1 b/man/emerge.1 |
27 |
index 240d4de7e..ffb453efb 100644 |
28 |
--- a/man/emerge.1 |
29 |
+++ b/man/emerge.1 |
30 |
@@ -724,6 +724,11 @@ it possible for \fB\-\-deep\fR to be disabled by default. |
31 |
Only merge (or pretend to merge) the dependencies of the packages |
32 |
specified, not the packages themselves. |
33 |
.TP |
34 |
+.BR "\-\-onlydeps\-with\-rdeps < y | n >" |
35 |
+Include run time dependencies when \fB\-\-onlydeps\fR is specified. |
36 |
+When this is disabled only build time dependencies are included. This |
37 |
+option is enabled by default. |
38 |
+.TP |
39 |
.BR "\-\-package\-moves [ y | n ]" |
40 |
Perform package moves when necessary. This option is enabled |
41 |
by default. Package moves are typically applied immediately |
42 |
|
43 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
44 |
index cda497b1d..726835dd4 100644 |
45 |
--- a/pym/_emerge/depgraph.py |
46 |
+++ b/pym/_emerge/depgraph.py |
47 |
@@ -3066,6 +3066,11 @@ class depgraph(object): |
48 |
edepend["RDEPEND"] = "" |
49 |
edepend["PDEPEND"] = "" |
50 |
|
51 |
+ if pkg.onlydeps and \ |
52 |
+ self._frozen_config.myopts.get("--onlydeps-with-rdeps") == 'n': |
53 |
+ edepend["RDEPEND"] = "" |
54 |
+ edepend["PDEPEND"] = "" |
55 |
+ |
56 |
ignore_build_time_deps = False |
57 |
if pkg.built and not removal_action: |
58 |
if self._dynamic_config.myparams.get("bdeps") in ("y", "auto"): |
59 |
|
60 |
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py |
61 |
index 808496722..2132aa63c 100644 |
62 |
--- a/pym/_emerge/main.py |
63 |
+++ b/pym/_emerge/main.py |
64 |
@@ -147,6 +147,7 @@ def insert_optional_args(args): |
65 |
'--jobs' : valid_integers, |
66 |
'--keep-going' : y_or_n, |
67 |
'--load-average' : valid_floats, |
68 |
+ '--onlydeps-with-rdeps' : y_or_n, |
69 |
'--package-moves' : y_or_n, |
70 |
'--quiet' : y_or_n, |
71 |
'--quiet-build' : y_or_n, |
72 |
@@ -565,6 +566,11 @@ def parse_opts(tmpcmdline, silent=False): |
73 |
"action" : "append", |
74 |
}, |
75 |
|
76 |
+ "--onlydeps-with-rdeps": { |
77 |
+ "help" : "modify interpretation of depedencies", |
78 |
+ "choices" : true_y_or_n |
79 |
+ }, |
80 |
+ |
81 |
"--rebuild-exclude": { |
82 |
"help" :"A space separated list of package names or slot atoms. " + \ |
83 |
"Emerge will not rebuild these packages due to the " + \ |
84 |
|
85 |
diff --git a/pym/portage/tests/resolver/test_onlydeps_minimal.py b/pym/portage/tests/resolver/test_onlydeps_minimal.py |
86 |
new file mode 100644 |
87 |
index 000000000..13c79ed55 |
88 |
--- /dev/null |
89 |
+++ b/pym/portage/tests/resolver/test_onlydeps_minimal.py |
90 |
@@ -0,0 +1,47 @@ |
91 |
+# Copyright 2017 Gentoo Foundation |
92 |
+# Distributed under the terms of the GNU General Public License v2 |
93 |
+ |
94 |
+from portage.tests import TestCase |
95 |
+from portage.tests.resolver.ResolverPlayground import ResolverPlayground, ResolverPlaygroundTestCase |
96 |
+ |
97 |
+class OnlydepsMinimalTestCase(TestCase): |
98 |
+ |
99 |
+ def testOnlydepsMinimal(self): |
100 |
+ ebuilds = { |
101 |
+ "dev-libs/A-1": { "DEPEND": "dev-libs/B", |
102 |
+ "RDEPEND": "dev-libs/C", |
103 |
+ "PDEPEND": "dev-libs/D" }, |
104 |
+ "dev-libs/B-1": { }, |
105 |
+ "dev-libs/C-1": { }, |
106 |
+ "dev-libs/D-1": { }, |
107 |
+ } |
108 |
+ installed = { |
109 |
+ } |
110 |
+ |
111 |
+ test_cases = ( |
112 |
+ ResolverPlaygroundTestCase( |
113 |
+ ["dev-libs/A"], |
114 |
+ all_permutations = True, |
115 |
+ success = True, |
116 |
+ options = { "--onlydeps": True, |
117 |
+ "--onlydeps-with-rdeps": "y" }, |
118 |
+ mergelist = ["dev-libs/B-1", |
119 |
+ "dev-libs/C-1", |
120 |
+ "dev-libs/D-1"]), |
121 |
+ ResolverPlaygroundTestCase( |
122 |
+ ["dev-libs/A"], |
123 |
+ all_permutations = True, |
124 |
+ success = True, |
125 |
+ options = { "--onlydeps": True, |
126 |
+ "--onlydeps-with-rdeps": "n" }, |
127 |
+ mergelist = ["dev-libs/B-1"]), |
128 |
+ ) |
129 |
+ |
130 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
131 |
+ installed=installed, debug=False) |
132 |
+ try: |
133 |
+ for test_case in test_cases: |
134 |
+ playground.run_TestCase(test_case) |
135 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
136 |
+ finally: |
137 |
+ playground.cleanup() |