Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r14476 - main/trunk/pym/_emerge
Date: Sat, 03 Oct 2009 04:03:19
Message-Id: E1Mtvq1-0003O9-AG@stork.gentoo.org
1 Author: zmedico
2 Date: 2009-10-03 04:03:16 +0000 (Sat, 03 Oct 2009)
3 New Revision: 14476
4
5 Modified:
6 main/trunk/pym/_emerge/depgraph.py
7 Log:
8 Bug #285832 - When updates are missed due to dependencies that have been
9 masked by backtracking, abbreviate output in order to avoid terminal
10 flooding.
11
12
13 Modified: main/trunk/pym/_emerge/depgraph.py
14 ===================================================================
15 --- main/trunk/pym/_emerge/depgraph.py 2009-10-02 20:58:01 UTC (rev 14475)
16 +++ main/trunk/pym/_emerge/depgraph.py 2009-10-03 04:03:16 UTC (rev 14476)
17 @@ -318,9 +318,19 @@
18 return
19
20 write = sys.stderr.write
21 + backtrack_masked = []
22
23 for pkg, parent_atoms in missed_updates:
24
25 + try:
26 + for parent, root, atom in parent_atoms:
27 + self._show_unsatisfied_dep(root, atom, myparent=parent,
28 + check_backtrack=True)
29 + except self._backtrack_mask:
30 + # This is displayed below in abbreviated form.
31 + backtrack_masked.append((pkg, parent_atoms))
32 + continue
33 +
34 write("\n!!! The following update has been skipped " + \
35 "due to unsatisfied dependencies:\n\n")
36
37 @@ -333,6 +343,18 @@
38 self._show_unsatisfied_dep(root, atom, myparent=parent)
39 write("\n")
40
41 + if backtrack_masked:
42 + # These are shown in abbreviated form, in order to avoid terminal
43 + # flooding from mask messages as reported in bug #285832.
44 + write("\n!!! The following update(s) have been skipped " + \
45 + "due to unsatisfied dependencies\n" + \
46 + "!!! triggered by backtracking:\n\n")
47 + for pkg, parent_atoms in backtrack_masked:
48 + write(str(pkg.slot_atom))
49 + if pkg.root != '/':
50 + write(" for %s" % (pkg.root,))
51 + write("\n")
52 +
53 sys.stderr.flush()
54
55 def _show_missed_update_slot_conflicts(self, missed_updates):
56 @@ -1993,7 +2015,14 @@
57
58 return selected_atoms
59
60 - def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None):
61 + def _show_unsatisfied_dep(self, root, atom, myparent=None, arg=None,
62 + check_backtrack=False):
63 + """
64 + When check_backtrack=True, no output is produced and
65 + the method either returns or raises _backtrack_mask if
66 + a matching package has been masked by backtracking.
67 + """
68 + backtrack_mask = False
69 atom_set = InternalPackageSet(initial_atoms=(atom,))
70 xinfo = '"%s"' % atom
71 if arg:
72 @@ -2038,6 +2067,7 @@
73 self._dynamic_config._runtime_pkg_mask[pkg]
74 mreasons.append('backtracking: %s' % \
75 ', '.join(sorted(backtrack_reasons)))
76 + backtrack_mask = True
77 if mreasons:
78 masked_pkg_instances.add(pkg)
79 if atom.use:
80 @@ -2047,6 +2077,12 @@
81 masked_packages.append(
82 (root_config, pkgsettings, cpv, metadata, mreasons))
83
84 + if check_backtrack:
85 + if backtrack_mask:
86 + raise self._backtrack_mask()
87 + else:
88 + return
89 +
90 missing_use_reasons = []
91 missing_iuse_reasons = []
92 for pkg in missing_use:
93 @@ -4933,6 +4969,13 @@
94 graph in order to avoid making a potentially unsafe decision.
95 """
96
97 + class _backtrack_mask(_internal_exception):
98 + """
99 + This is raised by _show_unsatisfied_dep() when it's called with
100 + check_backtrack=True and a matching package has been masked by
101 + backtracking.
102 + """
103 +
104 def need_restart(self):
105 return self._dynamic_config._need_restart