Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/zorry:master commit in: gobs/pym/
Date: Thu, 27 Dec 2012 23:09:25
Message-Id: 1356649737.e0d1cde78bca88822acfbf665c7fb9f7907df4fa.zorry@gentoo
1 commit: e0d1cde78bca88822acfbf665c7fb9f7907df4fa
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 27 23:08:57 2012 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 27 23:08:57 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/zorry.git;a=commit;h=e0d1cde7
7
8 Move build_mydepgraph to a new file
9
10 ---
11 gobs/pym/actions.py | 67 +-------------------------------------------
12 gobs/pym/build_depgraph.py | 64 ++++++++++++++++++++++++++++++++++++++++++
13 2 files changed, 65 insertions(+), 66 deletions(-)
14
15 diff --git a/gobs/pym/actions.py b/gobs/pym/actions.py
16 index e5cbd65..2b3a6de 100644
17 --- a/gobs/pym/actions.py
18 +++ b/gobs/pym/actions.py
19 @@ -81,8 +81,7 @@ from _emerge.UnmergeDepPriority import UnmergeDepPriority
20 from _emerge.UseFlagDisplay import pkg_use_display
21 from _emerge.userquery import userquery
22
23 -from gobs.build_log import log_fail_queru
24 -from gobs.ConnectionManager import connectionManager
25 +from gobs.build_depgraph import build_mydepgraph
26
27 if sys.hexversion >= 0x3000000:
28 long = int
29 @@ -90,64 +89,9 @@ if sys.hexversion >= 0x3000000:
30 else:
31 _unicode = unicode
32
33 -def build_mydepgraph(settings, trees, mtimedb, myopts, myparams, myaction, myfiles, spinner, build_dict):
34 - try:
35 - success, mydepgraph, favorites = backtrack_depgraph(
36 - settings, trees, myopts, myparams, myaction, myfiles, spinner)
37 - except portage.exception.PackageSetNotFound as e:
38 - root_config = trees[settings["ROOT"]]["root_config"]
39 - display_missing_pkg_set(root_config, e.value)
40 - build_dict['type_fail'] = "depgraph fail"
41 - build_dict['check_fail'] = True
42 - else:
43 - if not success:
44 - if mydepgraph._dynamic_config._needed_p_mask_changes:
45 - build_dict['type_fail'] = "Mask packages"
46 - build_dict['check_fail'] = True
47 - mydepgraph.display_problems()
48 - if mydepgraph._dynamic_config._needed_use_config_changes:
49 - repeat = True
50 - repeat_times = 0
51 - while repeat:
52 - mydepgraph._display_autounmask()
53 - settings, trees, mtimedb = load_emerge_config()
54 - myparams = create_depgraph_params(myopts, myaction)
55 - try:
56 - success, mydepgraph, favorites = backtrack_depgraph(
57 - settings, trees, myopts, myparams, myaction, myfiles, spinner)
58 - except portage.exception.PackageSetNotFound as e:
59 - root_config = trees[settings["ROOT"]]["root_config"]
60 - display_missing_pkg_set(root_config, e.value)
61 - if not success and mydepgraph._dynamic_config._needed_use_config_changes:
62 - print("repaet_times:", repeat_times)
63 - if repeat_times is 2:
64 - build_dict['type_fail'] = "Need use change"
65 - build_dict['check_fail'] = True
66 - mydepgraph.display_problems()
67 - repeat = False
68 - else:
69 - repeat_times = repeat_times + 1
70 - else:
71 - repeat = False
72 -
73 - if mydepgraph._dynamic_config._unsolvable_blockers:
74 - mydepgraph.display_problems()
75 - build_dict['type_fail'] = "Blocking packages"
76 - build_dict['check_fail'] = True
77 -
78 - if mydepgraph._dynamic_config._slot_collision_info:
79 - mydepgraph.display_problems()
80 - build_dict['type_fail'] = "Slot blocking"
81 - build_dict['check_fail'] = True
82 -
83 - return build_dict, success, settings, trees, mtimedb, mydepgraph
84 -
85 def action_build(settings, trees, mtimedb,
86 myopts, myaction, myfiles, spinner, build_dict):
87
88 - CM2=connectionManager()
89 - conn2 = CM2.newConnection()
90 -
91 if '--usepkgonly' not in myopts:
92 old_tree_timestamp_warn(settings['PORTDIR'], settings)
93
94 @@ -366,15 +310,6 @@ def action_build(settings, trees, mtimedb,
95 trees, mtimedb, myopts, myparams, myaction, myfiles, spinner, build_dict)
96
97 if not success:
98 - build_dict['type_fail'] = "Dep calc fail"
99 - build_dict['check_fail'] = True
100 - mydepgraph.display_problems()
101 -
102 - if build_dict['check_fail'] is True:
103 - if not conn2.is_connected() is True:
104 - conn2.reconnect(attempts=2, delay=1)
105 - log_fail_queru(conn2, build_dict, settings)
106 - conn2.close
107 return 1
108
109 if "--pretend" not in myopts and \
110
111 diff --git a/gobs/pym/build_depgraph.py b/gobs/pym/build_depgraph.py
112 new file mode 100644
113 index 0000000..ebff21b
114 --- /dev/null
115 +++ b/gobs/pym/build_depgraph.py
116 @@ -0,0 +1,64 @@
117 +from __future__ import print_function
118 +from _emerge.depgraph import backtrack_depgraph, create_depgraph_params
119 +import portage
120 +portage.proxy.lazyimport.lazyimport(globals(),
121 + 'gobs.actions:load_emerge_config',
122 +)
123 +from portage.exception import PackageSetNotFound
124 +
125 +from gobs.ConnectionManager import connectionManager
126 +from gobs.build_log import log_fail_queru
127 +
128 +def build_mydepgraph(settings, trees, mtimedb, myopts, myparams, myaction, myfiles, spinner, build_dict):
129 + CM2=connectionManager()
130 + conn2 = CM2.newConnection()
131 + try:
132 + success, mydepgraph, favorites = backtrack_depgraph(
133 + settings, trees, myopts, myparams, myaction, myfiles, spinner)
134 + except portage.exception.PackageSetNotFound as e:
135 + root_config = trees[settings["ROOT"]]["root_config"]
136 + display_missing_pkg_set(root_config, e.value)
137 + build_dict['type_fail'] = "depgraph fail"
138 + build_dict['check_fail'] = True
139 + else:
140 + if not success:
141 + repeat = True
142 + repeat_times = 0
143 + while repeat:
144 + if mydepgraph._dynamic_config._needed_p_mask_changes:
145 + build_dict['type_fail'] = "Mask packages"
146 + build_dict['check_fail'] = True
147 + elif mydepgraph._dynamic_config._needed_use_config_changes:
148 + mydepgraph._display_autounmask()
149 + build_dict['type_fail'] = "Need use change"
150 + build_dict['check_fail'] = True
151 + elif mydepgraph._dynamic_config._unsolvable_blockers:
152 + build_dict['type_fail'] = "Blocking packages"
153 + build_dict['check_fail'] = True
154 + elif mydepgraph._dynamic_config._slot_collision_info:
155 + build_dict['type_fail'] = "Slot blocking"
156 + build_dict['check_fail'] = True
157 + else:
158 + build_dict['type_fail'] = "Dep calc fail"
159 + build_dict['check_fail'] = True
160 + mydepgraph.display_problems()
161 + if repeat_times is 2:
162 + repeat = False
163 + if not conn2.is_connected() is True:
164 + conn2.reconnect(attempts=2, delay=1)
165 + log_fail_queru(conn2, build_dict, settings)
166 + conn.close
167 + else:
168 + repeat_times = repeat_times + 1
169 + settings, trees, mtimedb = load_emerge_config()
170 + myparams = create_depgraph_params(myopts, myaction)
171 + try:
172 + success, mydepgraph, favorites = backtrack_depgraph(
173 + settings, trees, myopts, myparams, myaction, myfiles, spinner)
174 + except portage.exception.PackageSetNotFound as e:
175 + root_config = trees[settings["ROOT"]]["root_config"]
176 + display_missing_pkg_set(root_config, e.value)
177 + if success:
178 + repeat = False
179 +
180 + return build_dict, success, settings, trees, mtimedb, mydepgraph