Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9645 - main/trunk/pym/_emerge
Date: Mon, 31 Mar 2008 18:02:34
Message-Id: E1JgOJF-0000Hf-Gv@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-03-31 18:00:40 +0000 (Mon, 31 Mar 2008)
3 New Revision: 9645
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Make depgraph creation more tolerant of missing or masked packages when
9 the relevant deps are satisfied by installed packages. This kind of
10 friendliness is especially desired in cases such as --emptytree where
11 it might not be possible to reinstall every single package. Also, it
12 allows multislot atoms from the world file (that are necessary to prevent
13 them from being removed by depclean) trigger warning messages while
14 still allowing a --emptytree to proceed.
15
16
17 Modified: main/trunk/pym/_emerge/__init__.py
18 ===================================================================
19 --- main/trunk/pym/_emerge/__init__.py 2008-03-31 17:11:47 UTC (rev 9644)
20 +++ main/trunk/pym/_emerge/__init__.py 2008-03-31 18:00:40 UTC (rev 9645)
21 @@ -2291,9 +2291,12 @@
22 self._missing_args.append((arg, atom))
23 continue
24 if pkg.installed and "selective" not in self.myparams:
25 + # Previous behavior was to bail out in this case, but
26 + # since the dep is satisfied by the installed package,
27 + # it's more friendly to continue building the graph
28 + # and just show a warning message.
29 self._unsatisfied_deps_for_display.append(
30 ((myroot, atom), {}))
31 - return 0, myfavorites
32
33 self._dep_stack.append(
34 Dependency(atom=atom, onlydeps=onlydeps, root=myroot, parent=arg))
35 @@ -2572,7 +2575,6 @@
36 empty = "empty" in self.myparams
37 selective = "selective" in self.myparams
38 noreplace = "--noreplace" in self.myopts
39 - reinstall = False
40 # Behavior of the "selective" parameter depends on
41 # whether or not a package matches an argument atom.
42 # If an installed package provides an old-style
43 @@ -2592,12 +2594,12 @@
44 if existing_node:
45 break
46 if installed and not find_existing_node and \
47 - (reinstall or not selective) and \
48 - (matched_packages or empty):
49 + matched_packages:
50 # We only need to select an installed package in the
51 # following cases:
52 - # 1) there is no other choice
53 - # 2) selective is True
54 + # 1) no available packages
55 + # 2) available packages rejected for some reason
56 + # such as --newuse
57 continue
58 if hasattr(db, "xmatch"):
59 cpv_list = db.xmatch("match-all", atom)
60 @@ -2691,7 +2693,7 @@
61 if not installed and \
62 ("--newuse" in self.myopts or \
63 "--reinstall" in self.myopts) and \
64 - vardb.cpv_exists(cpv):
65 + cpv in vardb.match(atom):
66 pkgsettings.setcpv(cpv, mydb=metadata)
67 forced_flags = set()
68 forced_flags.update(pkgsettings.useforce)
69 @@ -2706,8 +2708,6 @@
70 self._reinstall_for_flags(
71 forced_flags, old_use, old_iuse,
72 cur_use, cur_iuse)
73 - if reinstall_for_flags:
74 - reinstall = True
75 if not installed:
76 must_reinstall = empty or \
77 (myarg and not selective)
78 @@ -2715,11 +2715,6 @@
79 not must_reinstall and \
80 cpv in vardb.match(atom):
81 break
82 - if installed:
83 - must_reinstall = empty or \
84 - (found_available_arg and not selective)
85 - if must_reinstall:
86 - break
87 # Metadata accessed above is cached internally by
88 # each db in order to optimize visibility checks.
89 # Now that all possible checks visibility checks
90 @@ -2732,13 +2727,20 @@
91 pkgsettings.setcpv(cpv, mydb=metadata)
92 metadata["USE"] = pkgsettings["PORTAGE_USE"]
93 myeb = cpv
94 - matched_packages.append(
95 - Package(type_name=pkg_type, root=root,
96 - cpv=cpv, metadata=metadata,
97 - built=built, installed=installed,
98 - onlydeps=onlydeps))
99 + want_reinstall = False
100 + if installed:
101 + want_reinstall = empty or \
102 + (found_available_arg and not selective)
103 + pkg = Package(type_name=pkg_type, root=root,
104 + cpv=cpv, metadata=metadata,
105 + built=built, installed=installed,
106 + onlydeps=onlydeps)
107 + if installed and want_reinstall:
108 + matched_packages.insert(0, pkg)
109 + else:
110 + matched_packages.append(pkg)
111 if reinstall_for_flags:
112 - self._reinstall_nodes[matched_packages[-1]] = \
113 + self._reinstall_nodes[pkg] = \
114 reinstall_for_flags
115 break
116
117 @@ -2753,7 +2755,7 @@
118 bestmatch = portage.best(
119 [pkg.cpv for pkg in matched_packages])
120 matched_packages = [pkg for pkg in matched_packages \
121 - if pkg.cpv == bestmatch]
122 + if portage.dep.cpvequal(pkg.cpv, bestmatch)]
123
124 # ordered by type preference ("ebuild" type is the last resort)
125 return matched_packages[-1], existing_node
126 @@ -4045,6 +4047,7 @@
127 print bold('*'+revision)
128 sys.stdout.write(text)
129
130 + sys.stdout.flush()
131 self.display_problems()
132 return os.EX_OK
133
134
135 --
136 gentoo-commits@l.g.o mailing list