OLD | NEW |
1 # Copyright 1999-2011 Gentoo Foundation | 1 # Copyright 1999-2011 Gentoo Foundation |
2 # Distributed under the terms of the GNU General Public License v2 | 2 # Distributed under the terms of the GNU General Public License v2 |
3 | 3 |
4 from __future__ import print_function | 4 from __future__ import print_function |
5 | 5 |
6 import difflib | 6 import difflib |
7 import gc | 7 import gc |
8 import logging | 8 import logging |
9 import re | 9 import re |
10 import sys | 10 import sys |
11 import textwrap | 11 import textwrap |
| 12 from collections import deque |
12 from itertools import chain | 13 from itertools import chain |
13 | 14 |
14 import portage | 15 import portage |
15 from portage import os, OrderedDict | 16 from portage import os, OrderedDict |
16 from portage import _unicode_decode | 17 from portage import _unicode_decode |
17 from portage.const import PORTAGE_PACKAGE_ATOM | 18 from portage.const import PORTAGE_PACKAGE_ATOM |
18 from portage.dbapi import dbapi | 19 from portage.dbapi import dbapi |
19 from portage.dep import Atom, extract_affecting_use, check_required_use, human_r
eadable_required_use, _repo_separator | 20 from portage.dep import Atom, extract_affecting_use, check_required_use, human_r
eadable_required_use, _repo_separator |
20 from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use | 21 from portage.eapi import eapi_has_strong_blocks, eapi_has_required_use |
21 from portage.exception import InvalidAtom, InvalidDependString | 22 from portage.exception import InvalidAtom, InvalidDependString |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 self._required_set_names = set(["world"]) | 121 self._required_set_names = set(["world"]) |
121 | 122 |
122 atoms = ' '.join(myopts.get("--exclude", [])).split() | 123 atoms = ' '.join(myopts.get("--exclude", [])).split() |
123 self.excluded_pkgs = _wildcard_set(atoms) | 124 self.excluded_pkgs = _wildcard_set(atoms) |
124 atoms = ' '.join(myopts.get("--reinstall-atoms", [])).split() | 125 atoms = ' '.join(myopts.get("--reinstall-atoms", [])).split() |
125 self.reinstall_atoms = _wildcard_set(atoms) | 126 self.reinstall_atoms = _wildcard_set(atoms) |
126 atoms = ' '.join(myopts.get("--nousepkg-atoms", [])).split() | 127 atoms = ' '.join(myopts.get("--nousepkg-atoms", [])).split() |
127 self.nousepkg_atoms = _wildcard_set(atoms) | 128 self.nousepkg_atoms = _wildcard_set(atoms) |
128 atoms = ' '.join(myopts.get("--useoldpkg-atoms", [])).split() | 129 atoms = ' '.join(myopts.get("--useoldpkg-atoms", [])).split() |
129 self.useoldpkg_atoms = _wildcard_set(atoms) | 130 self.useoldpkg_atoms = _wildcard_set(atoms) |
| 131 atoms = ' '.join(myopts.get("--norebuild-atoms", [])).split() |
| 132 self.norebuild_atoms = _wildcard_set(atoms) |
| 133 |
| 134 self.rebuild = myopts.get('--rebuild', 'n') != 'n' |
130 | 135 |
131 class _depgraph_sets(object): | 136 class _depgraph_sets(object): |
132 def __init__(self): | 137 def __init__(self): |
133 # contains all sets added to the graph | 138 # contains all sets added to the graph |
134 self.sets = {} | 139 self.sets = {} |
135 # contains non-set atoms given as arguments | 140 # contains non-set atoms given as arguments |
136 self.sets['__non_set_args__'] = InternalPackageSet(allow_repo=Tr
ue) | 141 self.sets['__non_set_args__'] = InternalPackageSet(allow_repo=Tr
ue) |
137 # contains all atoms from all sets added to the graph, including | 142 # contains all atoms from all sets added to the graph, including |
138 # atoms given as arguments | 143 # atoms given as arguments |
139 self.atoms = InternalPackageSet(allow_repo=True) | 144 self.atoms = InternalPackageSet(allow_repo=True) |
140 self.atom_arg_map = {} | 145 self.atom_arg_map = {} |
141 | 146 |
| 147 class _rebuild_config(object): |
| 148 def __init__(self, frozen_config, backtrack_parameters): |
| 149 self._graph = digraph() |
| 150 self._frozen_config = frozen_config |
| 151 self.rebuild_list = backtrack_parameters.rebuild_list.copy() |
| 152 self.orig_rebuild_list = self.rebuild_list.copy() |
| 153 self.reinstall_list = backtrack_parameters.reinstall_list.copy() |
| 154 |
| 155 def add(self, dep_pkg, dep): |
| 156 parent = dep.collapsed_parent |
| 157 priority = dep.collapsed_priority |
| 158 norebuild_atoms = self._frozen_config.norebuild_atoms |
| 159 if (self._frozen_config.rebuild and isinstance(parent, Package)
and |
| 160 parent.built and (priority.buildtime or priority.runtime
) and |
| 161 isinstance(dep_pkg, Package) and |
| 162 not norebuild_atoms.findAtomForPackage(parent)): |
| 163 self._graph.add(dep_pkg, parent, priority) |
| 164 |
| 165 def _trigger_rebuild(self, parent, build_deps, runtime_deps): |
| 166 root_slot = (parent.root, parent.slot_atom) |
| 167 if root_slot in self.rebuild_list: |
| 168 return False |
| 169 trees = self._frozen_config.trees |
| 170 children = set(build_deps).intersection(runtime_deps) |
| 171 reinstall = False |
| 172 for slot_atom in children: |
| 173 kids = set([build_deps[slot_atom], runtime_deps[slot_ato
m]]) |
| 174 for dep_pkg in kids: |
| 175 dep_root_slot = (dep_pkg.root, slot_atom) |
| 176 if (not dep_pkg.built and |
| 177 dep_root_slot not in self.orig_rebuild_l
ist): |
| 178 # There's no binary package for dep_pkg,
so any binary |
| 179 # package for this parent would be inval
id. Force rebuild. |
| 180 self.rebuild_list.add(root_slot) |
| 181 return True |
| 182 elif ("--usepkg" in self._frozen_config.myopts a
nd |
| 183 (dep_root_slot in self.reinstall_list or |
| 184 dep_root_slot in self.rebuild_list or |
| 185 not dep_pkg.installed)): |
| 186 |
| 187 # A direct rebuild dependency is being i
nstalled. We |
| 188 # should update the parent as well to th
e latest binary, |
| 189 # if that binary is valid. |
| 190 # |
| 191 # To validate the binary, we check wheth
er all of the |
| 192 # rebuild dependencies are present on th
e same binhost. |
| 193 # |
| 194 # 1) If parent is present on the binhost
, but one of its |
| 195 # rebuild dependencies is not, then t
he parent should |
| 196 # be rebuilt from source. |
| 197 # 2) Otherwise, the parent binary is ass
umed to be valid, |
| 198 # because all of its rebuild dependen
cies are |
| 199 # consistent. |
| 200 bintree = trees[parent.root]["bintree"] |
| 201 uri = bintree.get_pkgindex_uri(parent.cp
v) |
| 202 dep_uri = bintree.get_pkgindex_uri(dep_p
kg.cpv) |
| 203 bindb = bintree.dbapi |
| 204 |
| 205 if uri and uri != dep_uri: |
| 206 # 1) Remote binary package is in
valid because it was |
| 207 # built without dep_pkg. Forc
e rebuild. |
| 208 self.rebuild_list.add(root_slot) |
| 209 return True |
| 210 elif (parent.installed and |
| 211 root_slot not in self.reinstall_
list): |
| 212 inst_build_time = parent.metadat
a.get("BUILD_TIME") |
| 213 try: |
| 214 bin_build_time, = bindb.
aux_get(parent.cpv, |
| 215 ["BUILD_TIME"]) |
| 216 except KeyError: |
| 217 continue |
| 218 if bin_build_time != inst_build_
time: |
| 219 # 2) Remote binary packa
ge is valid, and local package |
| 220 # is not up to date.
Force reinstall. |
| 221 reinstall = True |
| 222 if reinstall: |
| 223 self.reinstall_list.add(root_slot) |
| 224 return reinstall |
| 225 |
| 226 def trigger_rebuilds(self): |
| 227 """ |
| 228 Trigger rebuilds where necessary. If pkgA has been updated, and
pkgB |
| 229 depends on pkgA at both build-time and run-time, pkgB needs to b
e |
| 230 rebuilt. |
| 231 """ |
| 232 need_restart = False |
| 233 graph = self._graph |
| 234 build_deps = {} |
| 235 runtime_deps = {} |
| 236 leaf_nodes = deque(graph.leaf_nodes()) |
| 237 |
| 238 # Trigger rebuilds bottom-up (starting with the leaves) so that
parents |
| 239 # will always know which children are being rebuilt. |
| 240 while leaf_nodes: |
| 241 node = leaf_nodes.popleft() |
| 242 slot_atom = node.slot_atom |
| 243 |
| 244 # Remove our leaf node from the graph, keeping track of
deps. |
| 245 parents = graph.nodes[node][1].items() |
| 246 graph.remove(node) |
| 247 for parent, priorities in parents: |
| 248 for priority in priorities: |
| 249 if priority.buildtime: |
| 250 build_deps.setdefault(parent, {}
)[slot_atom] = node |
| 251 if priority.runtime: |
| 252 runtime_deps.setdefault(parent,
{})[slot_atom] = node |
| 253 if not graph.child_nodes(parent): |
| 254 leaf_nodes.append(parent) |
| 255 |
| 256 # Trigger rebuilds for our leaf node. Because all of our
children |
| 257 # have been processed, build_deps and runtime_deps will
be |
| 258 # completely filled in, and self.rebuild_list / self.rei
nstall_list |
| 259 # will tell us whether any of our children need to be re
built or |
| 260 # reinstalled. |
| 261 node_build_deps = build_deps.get(node, {}) |
| 262 node_runtime_deps = runtime_deps.get(node, {}) |
| 263 if self._trigger_rebuild(node, node_build_deps, node_run
time_deps): |
| 264 need_restart = True |
| 265 |
| 266 return need_restart |
| 267 |
| 268 |
142 class _dynamic_depgraph_config(object): | 269 class _dynamic_depgraph_config(object): |
143 | 270 |
144 def __init__(self, depgraph, myparams, allow_backtracking, backtrack_par
ameters): | 271 def __init__(self, depgraph, myparams, allow_backtracking, backtrack_par
ameters): |
145 self.myparams = myparams.copy() | 272 self.myparams = myparams.copy() |
146 self._vdb_loaded = False | 273 self._vdb_loaded = False |
147 self._allow_backtracking = allow_backtracking | 274 self._allow_backtracking = allow_backtracking |
148 # Maps slot atom to package for each Package added to the graph. | 275 # Maps slot atom to package for each Package added to the graph. |
149 self._slot_pkg_map = {} | 276 self._slot_pkg_map = {} |
150 # Maps nodes to the reasons they were selected for reinstallatio
n. | 277 # Maps nodes to the reasons they were selected for reinstallatio
n. |
151 self._reinstall_nodes = {} | 278 self._reinstall_nodes = {} |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] | 426 _dep_keys = ["DEPEND", "RDEPEND", "PDEPEND"] |
300 | 427 |
301 def __init__(self, settings, trees, myopts, myparams, spinner, | 428 def __init__(self, settings, trees, myopts, myparams, spinner, |
302 frozen_config=None, backtrack_parameters=BacktrackParameter(), a
llow_backtracking=False): | 429 frozen_config=None, backtrack_parameters=BacktrackParameter(), a
llow_backtracking=False): |
303 if frozen_config is None: | 430 if frozen_config is None: |
304 frozen_config = _frozen_depgraph_config(settings, trees, | 431 frozen_config = _frozen_depgraph_config(settings, trees, |
305 myopts, spinner) | 432 myopts, spinner) |
306 self._frozen_config = frozen_config | 433 self._frozen_config = frozen_config |
307 self._dynamic_config = _dynamic_depgraph_config(self, myparams, | 434 self._dynamic_config = _dynamic_depgraph_config(self, myparams, |
308 allow_backtracking, backtrack_parameters) | 435 allow_backtracking, backtrack_parameters) |
| 436 self._rebuild = _rebuild_config(frozen_config, backtrack_paramet
ers) |
309 | 437 |
310 self._select_atoms = self._select_atoms_highest_available | 438 self._select_atoms = self._select_atoms_highest_available |
311 self._select_package = self._select_pkg_highest_available | 439 self._select_package = self._select_pkg_highest_available |
312 | 440 |
313 def _load_vdb(self): | 441 def _load_vdb(self): |
314 """ | 442 """ |
315 Load installed package metadata if appropriate. This used to be
called | 443 Load installed package metadata if appropriate. This used to be
called |
316 from the constructor, but that wasn't very nice since this proce
dure | 444 from the constructor, but that wasn't very nice since this proce
dure |
317 is slow and it generates spinner output. So, now it's called on-
demand | 445 is slow and it generates spinner output. So, now it's called on-
demand |
318 by various methods when necessary. | 446 by various methods when necessary. |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 792 |
665 def _add_dep(self, dep, allow_unsatisfied=False): | 793 def _add_dep(self, dep, allow_unsatisfied=False): |
666 debug = "--debug" in self._frozen_config.myopts | 794 debug = "--debug" in self._frozen_config.myopts |
667 buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts | 795 buildpkgonly = "--buildpkgonly" in self._frozen_config.myopts |
668 nodeps = "--nodeps" in self._frozen_config.myopts | 796 nodeps = "--nodeps" in self._frozen_config.myopts |
669 deep = self._dynamic_config.myparams.get("deep", 0) | 797 deep = self._dynamic_config.myparams.get("deep", 0) |
670 recurse = deep is True or dep.depth <= deep | 798 recurse = deep is True or dep.depth <= deep |
671 if dep.blocker: | 799 if dep.blocker: |
672 if not buildpkgonly and \ | 800 if not buildpkgonly and \ |
673 not nodeps and \ | 801 not nodeps and \ |
| 802 not dep.collapsed_priority.ignored and \ |
| 803 not dep.collapsed_priority.optional and \ |
674 dep.parent not in self._dynamic_config._slot_col
lision_nodes: | 804 dep.parent not in self._dynamic_config._slot_col
lision_nodes: |
675 if dep.parent.onlydeps: | 805 if dep.parent.onlydeps: |
676 # It's safe to ignore blockers if the | 806 # It's safe to ignore blockers if the |
677 # parent is an --onlydeps node. | 807 # parent is an --onlydeps node. |
678 return 1 | 808 return 1 |
679 # The blocker applies to the root where | 809 # The blocker applies to the root where |
680 # the parent is or will be installed. | 810 # the parent is or will be installed. |
681 blocker = Blocker(atom=dep.atom, | 811 blocker = Blocker(atom=dep.atom, |
682 eapi=dep.parent.metadata["EAPI"], | 812 eapi=dep.parent.metadata["EAPI"], |
683 priority=dep.priority, root=dep.parent.r
oot) | 813 priority=dep.priority, root=dep.parent.r
oot) |
684 self._dynamic_config._blocker_parents.add(blocke
r, dep.parent) | 814 self._dynamic_config._blocker_parents.add(blocke
r, dep.parent) |
685 return 1 | 815 return 1 |
686 | 816 |
687 if dep.child is None: | 817 if dep.child is None: |
688 dep_pkg, existing_node = self._select_package(dep.root,
dep.atom, | 818 dep_pkg, existing_node = self._select_package(dep.root,
dep.atom, |
689 onlydeps=dep.onlydeps) | 819 onlydeps=dep.onlydeps) |
690 else: | 820 else: |
691 # The caller has selected a specific package | 821 # The caller has selected a specific package |
692 # via self._minimize_packages(). | 822 # via self._minimize_packages(). |
693 dep_pkg = dep.child | 823 dep_pkg = dep.child |
694 existing_node = self._dynamic_config._slot_pkg_map[ | 824 existing_node = self._dynamic_config._slot_pkg_map[ |
695 dep.root].get(dep_pkg.slot_atom) | 825 dep.root].get(dep_pkg.slot_atom) |
696 | 826 |
697 if not dep_pkg: | 827 if not dep_pkg: |
698 » » » if dep.priority.optional: | 828 » » » if (dep.collapsed_priority.optional or |
699 » » » » # This could be an unnecessary build-time dep | 829 » » » » dep.collapsed_priority.ignored): |
700 » » » » # pulled in by --with-bdeps=y. | 830 » » » » # This is an unnecessary build-time dep. |
701 return 1 | 831 return 1 |
702 if allow_unsatisfied: | 832 if allow_unsatisfied: |
703 self._dynamic_config._unsatisfied_deps.append(de
p) | 833 self._dynamic_config._unsatisfied_deps.append(de
p) |
704 return 1 | 834 return 1 |
705 self._dynamic_config._unsatisfied_deps_for_display.appen
d( | 835 self._dynamic_config._unsatisfied_deps_for_display.appen
d( |
706 ((dep.root, dep.atom), {"myparent":dep.parent})) | 836 ((dep.root, dep.atom), {"myparent":dep.parent})) |
707 | 837 |
708 # The parent node should not already be in | 838 # The parent node should not already be in |
709 # runtime_pkg_mask, since that would trigger an | 839 # runtime_pkg_mask, since that would trigger an |
710 # infinite backtracking loop. | 840 # infinite backtracking loop. |
(...skipping 22 matching lines...) Expand all Loading... |
733 msg.append(" parent:
%s" % dep.parent) | 863 msg.append(" parent:
%s" % dep.parent) |
734 msg.append(" priority:
%s" % dep.priority) | 864 msg.append(" priority:
%s" % dep.priority) |
735 msg.append(" root:
%s" % dep.root) | 865 msg.append(" root:
%s" % dep.root) |
736 msg.append(" atom:
%s" % dep.atom) | 866 msg.append(" atom:
%s" % dep.atom) |
737 msg.append("") | 867 msg.append("") |
738 writemsg_level("".join("
%s\n" % l for l in msg), | 868 writemsg_level("".join("
%s\n" % l for l in msg), |
739 noiselevel=-1, l
evel=logging.DEBUG) | 869 noiselevel=-1, l
evel=logging.DEBUG) |
740 | 870 |
741 return 0 | 871 return 0 |
742 | 872 |
743 » » if not self._add_pkg(dep_pkg, dep): | 873 » » self._rebuild.add(dep_pkg, dep) |
| 874 |
| 875 » » if (not dep.collapsed_priority.ignored and |
| 876 » » » not self._add_pkg(dep_pkg, dep)): |
744 return 0 | 877 return 0 |
745 return 1 | 878 return 1 |
746 | 879 |
747 def _check_slot_conflict(self, pkg, atom): | 880 def _check_slot_conflict(self, pkg, atom): |
748 existing_node = self._dynamic_config._slot_pkg_map[pkg.root].get
(pkg.slot_atom) | 881 existing_node = self._dynamic_config._slot_pkg_map[pkg.root].get
(pkg.slot_atom) |
749 matches = None | 882 matches = None |
750 if existing_node: | 883 if existing_node: |
751 matches = pkg.cpv == existing_node.cpv | 884 matches = pkg.cpv == existing_node.cpv |
752 if pkg != existing_node and \ | 885 if pkg != existing_node and \ |
753 atom is not None: | 886 atom is not None: |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 depkeys = ["DEPEND","RDEPEND","PDEPEND"] | 1236 depkeys = ["DEPEND","RDEPEND","PDEPEND"] |
1104 for k in depkeys: | 1237 for k in depkeys: |
1105 edepend[k] = metadata[k] | 1238 edepend[k] = metadata[k] |
1106 | 1239 |
1107 if not pkg.built and \ | 1240 if not pkg.built and \ |
1108 "--buildpkgonly" in self._frozen_config.myopts and \ | 1241 "--buildpkgonly" in self._frozen_config.myopts and \ |
1109 "deep" not in self._dynamic_config.myparams: | 1242 "deep" not in self._dynamic_config.myparams: |
1110 edepend["RDEPEND"] = "" | 1243 edepend["RDEPEND"] = "" |
1111 edepend["PDEPEND"] = "" | 1244 edepend["PDEPEND"] = "" |
1112 | 1245 |
| 1246 ignore_build_time_deps = False |
1113 if pkg.built and not removal_action: | 1247 if pkg.built and not removal_action: |
1114 if self._frozen_config.myopts.get("--with-bdeps", "n") =
= "y": | 1248 if self._frozen_config.myopts.get("--with-bdeps", "n") =
= "y": |
1115 # Pull in build time deps as requested, but mark
ed them as | 1249 # Pull in build time deps as requested, but mark
ed them as |
1116 # "optional" since they are not strictly require
d. This allows | 1250 # "optional" since they are not strictly require
d. This allows |
1117 # more freedom in the merge order calculation fo
r solving | 1251 # more freedom in the merge order calculation fo
r solving |
1118 # circular dependencies. Don't convert to PDEPEN
D since that | 1252 # circular dependencies. Don't convert to PDEPEN
D since that |
1119 # could make --with-bdeps=y less effective if it
is used to | 1253 # could make --with-bdeps=y less effective if it
is used to |
1120 # adjust merge order to prevent built_with_use()
calls from | 1254 # adjust merge order to prevent built_with_use()
calls from |
1121 # failing. | 1255 # failing. |
1122 pass | 1256 pass |
1123 else: | 1257 else: |
1124 » » » » # built packages do not have build time dependen
cies. | 1258 » » » » ignore_build_time_deps = True |
1125 » » » » edepend["DEPEND"] = "" | |
1126 | 1259 |
1127 if removal_action and self._frozen_config.myopts.get("--with-bde
ps", "y") == "n": | 1260 if removal_action and self._frozen_config.myopts.get("--with-bde
ps", "y") == "n": |
1128 » » » edepend["DEPEND"] = "" | 1261 » » » ignore_build_time_deps = True |
1129 | 1262 |
1130 if removal_action: | 1263 if removal_action: |
1131 depend_root = myroot | 1264 depend_root = myroot |
1132 else: | 1265 else: |
1133 depend_root = "/" | 1266 depend_root = "/" |
1134 root_deps = self._frozen_config.myopts.get("--root-deps"
) | 1267 root_deps = self._frozen_config.myopts.get("--root-deps"
) |
1135 if root_deps is not None: | 1268 if root_deps is not None: |
1136 if root_deps is True: | 1269 if root_deps is True: |
1137 depend_root = myroot | 1270 depend_root = myroot |
1138 elif root_deps == "rdeps": | 1271 elif root_deps == "rdeps": |
1139 » » » » » edepend["DEPEND"] = "" | 1272 » » » » » ignore_build_time_deps = True |
1140 | 1273 |
1141 deps = ( | 1274 deps = ( |
1142 (depend_root, edepend["DEPEND"], | 1275 (depend_root, edepend["DEPEND"], |
1143 » » » » self._priority(buildtime=(not pkg.built), | 1276 » » » » self._priority(buildtime=True, |
1144 » » » » optional=pkg.built), | 1277 » » » » optional=pkg.built, |
1145 » » » » pkg.built), | 1278 » » » » ignored=ignore_build_time_deps), |
| 1279 » » » » pkg.built or ignore_build_time_deps), |
1146 (myroot, edepend["RDEPEND"], | 1280 (myroot, edepend["RDEPEND"], |
1147 self._priority(runtime=True), | 1281 self._priority(runtime=True), |
1148 False), | 1282 False), |
1149 (myroot, edepend["PDEPEND"], | 1283 (myroot, edepend["PDEPEND"], |
1150 self._priority(runtime_post=True), | 1284 self._priority(runtime_post=True), |
1151 False) | 1285 False) |
1152 ) | 1286 ) |
1153 | 1287 |
1154 debug = "--debug" in self._frozen_config.myopts | 1288 debug = "--debug" in self._frozen_config.myopts |
1155 strict = mytype != "installed" | 1289 strict = mytype != "installed" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 is_virt = hasattr(atom, '_orig_atom') | 1393 is_virt = hasattr(atom, '_orig_atom') |
1260 atom = getattr(atom, '_orig_atom', atom) | 1394 atom = getattr(atom, '_orig_atom', atom) |
1261 | 1395 |
1262 if ignore_blockers and atom.blocker: | 1396 if ignore_blockers and atom.blocker: |
1263 # For --with-bdeps, ignore build-time only block
ers | 1397 # For --with-bdeps, ignore build-time only block
ers |
1264 # that originate from built packages. | 1398 # that originate from built packages. |
1265 continue | 1399 continue |
1266 | 1400 |
1267 mypriority = dep_priority.copy() | 1401 mypriority = dep_priority.copy() |
1268 if not atom.blocker: | 1402 if not atom.blocker: |
| 1403 root_slot = (pkg.root, pkg.slot_atom) |
1269 inst_pkgs = [inst_pkg for inst_pkg in vardb.matc
h_pkgs(atom) | 1404 inst_pkgs = [inst_pkg for inst_pkg in vardb.matc
h_pkgs(atom) |
1270 if not reinstall_atoms.findAtomForPackag
e(inst_pkg, | 1405 if not reinstall_atoms.findAtomForPackag
e(inst_pkg, |
1271 modified_use=self._pkg_u
se_enabled(inst_pkg))] | 1406 modified_use=self._pkg_u
se_enabled(inst_pkg))] |
1272 if inst_pkgs: | 1407 if inst_pkgs: |
1273 for inst_pkg in inst_pkgs: | 1408 for inst_pkg in inst_pkgs: |
1274 if self._pkg_visibility_check(in
st_pkg): | 1409 if self._pkg_visibility_check(in
st_pkg): |
1275 # highest visible | 1410 # highest visible |
1276 mypriority.satisfied = i
nst_pkg | 1411 mypriority.satisfied = i
nst_pkg |
1277 break | 1412 break |
1278 if not mypriority.satisfied: | 1413 if not mypriority.satisfied: |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 mypriority.satis
fied = inst_pkg | 1503 mypriority.satis
fied = inst_pkg |
1369 break | 1504 break |
1370 if not mypriority.satisfied: | 1505 if not mypriority.satisfied: |
1371 # none visible, so use h
ighest | 1506 # none visible, so use h
ighest |
1372 mypriority.satisfied = i
nst_pkgs[0] | 1507 mypriority.satisfied = i
nst_pkgs[0] |
1373 | 1508 |
1374 # Dependencies of virtuals are considered to hav
e the | 1509 # Dependencies of virtuals are considered to hav
e the |
1375 # same depth as the virtual itself. | 1510 # same depth as the virtual itself. |
1376 dep = Dependency(atom=atom, | 1511 dep = Dependency(atom=atom, |
1377 blocker=atom.blocker, child=child, depth
=virt_dep.depth, | 1512 blocker=atom.blocker, child=child, depth
=virt_dep.depth, |
1378 » » » » » parent=virt_pkg, priority=mypriority, ro
ot=dep_root) | 1513 » » » » » parent=virt_pkg, priority=mypriority, ro
ot=dep_root, |
| 1514 » » » » » collapsed_parent=pkg, collapsed_priority
=dep_priority) |
1379 | 1515 |
1380 ignored = False | 1516 ignored = False |
1381 if not atom.blocker and \ | 1517 if not atom.blocker and \ |
1382 not recurse_satisfied and \ | 1518 not recurse_satisfied and \ |
1383 mypriority.satisfied and \ | 1519 mypriority.satisfied and \ |
1384 mypriority.satisfied.visible and \ | 1520 mypriority.satisfied.visible and \ |
1385 dep.child is not None and \ | 1521 dep.child is not None and \ |
1386 not dep.child.installed and \ | 1522 not dep.child.installed and \ |
1387 self._dynamic_config._slot_pkg_map[dep.c
hild.root].get( | 1523 self._dynamic_config._slot_pkg_map[dep.c
hild.root].get( |
1388 dep.child.slot_atom) is None: | 1524 dep.child.slot_atom) is None: |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 def _resolve(self, myfavorites): | 2060 def _resolve(self, myfavorites): |
1925 """Given self._dynamic_config._initial_arg_list, pull in the roo
t nodes, | 2061 """Given self._dynamic_config._initial_arg_list, pull in the roo
t nodes, |
1926 call self._creategraph to process theier deps and return | 2062 call self._creategraph to process theier deps and return |
1927 a favorite list.""" | 2063 a favorite list.""" |
1928 debug = "--debug" in self._frozen_config.myopts | 2064 debug = "--debug" in self._frozen_config.myopts |
1929 onlydeps = "--onlydeps" in self._frozen_config.myopts | 2065 onlydeps = "--onlydeps" in self._frozen_config.myopts |
1930 myroot = self._frozen_config.target_root | 2066 myroot = self._frozen_config.target_root |
1931 pkgsettings = self._frozen_config.pkgsettings[myroot] | 2067 pkgsettings = self._frozen_config.pkgsettings[myroot] |
1932 pprovideddict = pkgsettings.pprovideddict | 2068 pprovideddict = pkgsettings.pprovideddict |
1933 virtuals = pkgsettings.getvirtuals() | 2069 virtuals = pkgsettings.getvirtuals() |
1934 » » for arg in self._expand_set_args( | 2070 » » args = self._dynamic_config._initial_arg_list[:] |
1935 » » » self._dynamic_config._initial_arg_list, | 2071 » » for root, atom in chain(self._rebuild.rebuild_list, |
1936 » » » add_to_digraph=True): | 2072 » » » self._rebuild.reinstall_list): |
| 2073 » » » args.append(AtomArg(arg=atom, atom=atom, |
| 2074 » » » » root_config=self._frozen_config.roots[root])) |
| 2075 » » for arg in self._expand_set_args(args, add_to_digraph=True): |
1937 for atom in arg.pset.getAtoms(): | 2076 for atom in arg.pset.getAtoms(): |
1938 self._spinner_update() | 2077 self._spinner_update() |
1939 dep = Dependency(atom=atom, onlydeps=onlydeps, | 2078 dep = Dependency(atom=atom, onlydeps=onlydeps, |
1940 root=myroot, parent=arg) | 2079 root=myroot, parent=arg) |
1941 try: | 2080 try: |
1942 pprovided = pprovideddict.get(atom.cp) | 2081 pprovided = pprovideddict.get(atom.cp) |
1943 if pprovided and portage.match_from_list
(atom, pprovided): | 2082 if pprovided and portage.match_from_list
(atom, pprovided): |
1944 # A provided package has been sp
ecified on the command line. | 2083 # A provided package has been sp
ecified on the command line. |
1945 self._dynamic_config._pprovided_
args.append((arg, atom)) | 2084 self._dynamic_config._pprovided_
args.append((arg, atom)) |
1946 continue | 2085 continue |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 if set(self._dynamic_config.digraph).intersection( \ | 2181 if set(self._dynamic_config.digraph).intersection( \ |
2043 self._dynamic_config._needed_unstable_keywords) or \ | 2182 self._dynamic_config._needed_unstable_keywords) or \ |
2044 set(self._dynamic_config.digraph).intersection( \ | 2183 set(self._dynamic_config.digraph).intersection( \ |
2045 self._dynamic_config._needed_use_config_changes) or \ | 2184 self._dynamic_config._needed_use_config_changes) or \ |
2046 set(self._dynamic_config.digraph).intersection( \ | 2185 set(self._dynamic_config.digraph).intersection( \ |
2047 self._dynamic_config._needed_license_changes) : | 2186 self._dynamic_config._needed_license_changes) : |
2048 #We failed if the user needs to change the configuration | 2187 #We failed if the user needs to change the configuration |
2049 self._dynamic_config._success_without_autounmask = True | 2188 self._dynamic_config._success_without_autounmask = True |
2050 return False, myfavorites | 2189 return False, myfavorites |
2051 | 2190 |
| 2191 if self._rebuild.trigger_rebuilds(): |
| 2192 backtrack_infos = self._dynamic_config._backtrack_infos |
| 2193 config = backtrack_infos.setdefault("config", {}) |
| 2194 config["rebuild_list"] = self._rebuild.rebuild_list |
| 2195 config["reinstall_list"] = self._rebuild.reinstall_list |
| 2196 self._dynamic_config._need_restart = True |
| 2197 return False, myfavorites |
| 2198 |
2052 # We're true here unless we are missing binaries. | 2199 # We're true here unless we are missing binaries. |
2053 return (True, myfavorites) | 2200 return (True, myfavorites) |
2054 | 2201 |
2055 def _set_args(self, args): | 2202 def _set_args(self, args): |
2056 """ | 2203 """ |
2057 Create the "__non_set_args__" package set from atoms and package
s given as | 2204 Create the "__non_set_args__" package set from atoms and package
s given as |
2058 arguments. This method can be called multiple times if necessary
. | 2205 arguments. This method can be called multiple times if necessary
. |
2059 The package selection cache is automatically invalidated, since | 2206 The package selection cache is automatically invalidated, since |
2060 arguments influence package selections. | 2207 arguments influence package selections. |
2061 """ | 2208 """ |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2531 if not mreasons and \ | 2678 if not mreasons and \ |
2532 not pkg.built and \ | 2679 not pkg.built and \ |
2533 pkg.metadata["REQUIRED_U
SE"] and \ | 2680 pkg.metadata["REQUIRED_U
SE"] and \ |
2534 eapi_has_required_use(pk
g.metadata["EAPI"]): | 2681 eapi_has_required_use(pk
g.metadata["EAPI"]): |
2535 if not check_required_us
e( | 2682 if not check_required_us
e( |
2536 pkg.metadata["RE
QUIRED_USE"], | 2683 pkg.metadata["RE
QUIRED_USE"], |
2537 self._pkg_use_en
abled(pkg), | 2684 self._pkg_use_en
abled(pkg), |
2538 pkg.iuse.is_vali
d_flag): | 2685 pkg.iuse.is_vali
d_flag): |
2539 required_use_uns
atisfied.append(pkg) | 2686 required_use_uns
atisfied.append(pkg) |
2540 continue | 2687 continue |
2541 » » » » » » if pkg.built and not mreasons: | 2688 » » » » » » root_slot = (pkg.root, pkg.slot_
atom) |
| 2689 » » » » » » if pkg.built and root_slot in se
lf._rebuild.rebuild_list: |
| 2690 » » » » » » » mreasons = ["need to reb
uild from source"] |
| 2691 » » » » » » elif pkg.installed and root_slot
in self._rebuild.reinstall_list: |
| 2692 » » » » » » » mreasons = ["need to reb
uild from source"] |
| 2693 » » » » » » elif pkg.built and not mreasons: |
2542 mreasons = ["use flag co
nfiguration mismatch"] | 2694 mreasons = ["use flag co
nfiguration mismatch"] |
2543 masked_packages.append( | 2695 masked_packages.append( |
2544 (root_config, pkgsettings, cpv,
repo, metadata, mreasons)) | 2696 (root_config, pkgsettings, cpv,
repo, metadata, mreasons)) |
2545 | 2697 |
2546 if check_backtrack: | 2698 if check_backtrack: |
2547 if backtrack_mask: | 2699 if backtrack_mask: |
2548 raise self._backtrack_mask() | 2700 raise self._backtrack_mask() |
2549 else: | 2701 else: |
2550 return | 2702 return |
2551 | 2703 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3209 continue | 3361 continue |
3210 | 3362 |
3211 # Ignore USE deps for the initial match since we
want to | 3363 # Ignore USE deps for the initial match since we
want to |
3212 # ensure that updates aren't missed solely due t
o the user's | 3364 # ensure that updates aren't missed solely due t
o the user's |
3213 # USE configuration. | 3365 # USE configuration. |
3214 for pkg in self._iter_match_pkgs(root_config, pk
g_type, atom.without_use, | 3366 for pkg in self._iter_match_pkgs(root_config, pk
g_type, atom.without_use, |
3215 onlydeps=onlydeps): | 3367 onlydeps=onlydeps): |
3216 if pkg in self._dynamic_config._runtime_
pkg_mask: | 3368 if pkg in self._dynamic_config._runtime_
pkg_mask: |
3217 # The package has been masked by
the backtracking logic | 3369 # The package has been masked by
the backtracking logic |
3218 continue | 3370 continue |
| 3371 root_slot = (pkg.root, pkg.slot_atom) |
| 3372 if pkg.built and root_slot in self._rebu
ild.rebuild_list: |
| 3373 continue |
| 3374 if (pkg.installed and |
| 3375 root_slot in self._rebuild.reins
tall_list): |
| 3376 continue |
3219 | 3377 |
3220 if not pkg.installed and \ | 3378 if not pkg.installed and \ |
3221 self._frozen_config.excluded_pkg
s.findAtomForPackage(pkg, \ | 3379 self._frozen_config.excluded_pkg
s.findAtomForPackage(pkg, \ |
3222 modified_use=self._pkg_u
se_enabled(pkg)): | 3380 modified_use=self._pkg_u
se_enabled(pkg)): |
3223 continue | 3381 continue |
3224 | 3382 |
3225 if built and not installed and nousepkg_
atoms.findAtomForPackage(pkg, \ | 3383 if built and not installed and nousepkg_
atoms.findAtomForPackage(pkg, \ |
3226 modified_use=self._pkg_use_enabl
ed(pkg)): | 3384 modified_use=self._pkg_use_enabl
ed(pkg)): |
3227 break | 3385 break |
3228 | 3386 |
(...skipping 2953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6182 for msg_type, msgs in pkg.invalid.items(): | 6340 for msg_type, msgs in pkg.invalid.items(): |
6183 for msg in msgs: | 6341 for msg in msgs: |
6184 mreasons.append( | 6342 mreasons.append( |
6185 _MaskReason("invalid", "invalid: %s" % (
msg,))) | 6343 _MaskReason("invalid", "invalid: %s" % (
msg,))) |
6186 | 6344 |
6187 if not pkg.metadata["SLOT"]: | 6345 if not pkg.metadata["SLOT"]: |
6188 mreasons.append( | 6346 mreasons.append( |
6189 _MaskReason("invalid", "SLOT: undefined")) | 6347 _MaskReason("invalid", "SLOT: undefined")) |
6190 | 6348 |
6191 return mreasons | 6349 return mreasons |
OLD | NEW |