Exemplo n.º 1
0
 def _ensure_livefs_is_loaded_nonpreloaded(self, restrict):
     # do a trick to make the resolver now aware of vdb pkgs if needed
     # check for any matches; none, try and insert vdb nodes.
     l = self.state.match_atom(restrict)
     if not l:
         # hmm. ok... no conflicts, so we insert in vdb matches
         # to trigger a replace instead of an install
         for pkg in self.livefs_dbs.itermatch(restrict):
             self._dprint("inserting vdb node for %s %s", (restrict, pkg))
             c = choice_point(restrict, [pkg])
             state.add_op(c, c.current_pkg, force=True).apply(self.state)
Exemplo n.º 2
0
 def _ensure_livefs_is_loaded_nonpreloaded(self, restrict):
     # do a trick to make the resolver now aware of vdb pkgs if needed
     # check for any matches; none, try and insert vdb nodes.
     l = self.state.match_atom(restrict)
     if not l:
         # hmm. ok... no conflicts, so we insert in vdb matches
         # to trigger a replace instead of an install
         for pkg in self.livefs_dbs.itermatch(restrict):
             self._dprint("inserting vdb node for %s %s", (restrict, pkg))
             c = choice_point(restrict, [pkg])
             state.add_op(c, c.current_pkg, force=True).apply(self.state)
Exemplo n.º 3
0
 def insert_providers(self, stack, atom, choices):
     """legacy function to insert old virtual providers into the resolver"""
     for x in choices.provides:
         l = state.add_op(choices, x).apply(self.state)
         if l and l != [x]:
             # slight hack; basically, should be pruning providers as the parent is removed
             # this duplicates it, basically; if it's not a restrict, then it's a pkg.
             # thus poke it.
             if len(l) == 1 and not isinstance(l[0], restriction.base):
                 p = getattr(l[0], 'provider', None)
                 if p is not None and not self.state.match_atom(p):
                     # ok... force it.
                     fail = state.replace_op(choices, x).apply(self.state)
                     if not fail:
                         continue
                     self.notify_choice_failed(
                         stack, atom, choices,
                         "failed forcing provider: %s due to conflict %s",
                         (x, p))
                     return fail
             self.notify_choice_failed(
                 stack, atom, choices,
                 "failed inserting provider: %s due to conflict %s", (x, l))
             return l
     return None
Exemplo n.º 4
0
    def insert_choice(self, atom, stack, choices):
        # first, check for conflicts.
        # lil bit fugly, but works for the moment
        if not choices.current_pkg.repo.livefs:
            self._ensure_livefs_is_loaded(choices.current_pkg.slotted_atom)
        conflicts = state.add_op(choices, choices.current_pkg).apply(self.state)
        if conflicts:
            # this means in this branch of resolution, someone slipped
            # something in already. cycle, basically.
            # hack.  see if what was insert is enough for us.

            # this is tricky... if it's the same node inserted
            # (cycle), then we ignore it; this does *not* perfectly
            # behave though, doesn't discern between repos.

            if (len(conflicts) == 1 and conflicts[0] == choices.current_pkg and
                conflicts[0].repo.livefs == choices.current_pkg.repo.livefs and
                atom.match(conflicts[0])):

                # early exit. means that a cycle came about, but exact
                # same result slipped through.
                return False

            self._dprint("was trying to insert atom '%s' pkg '%s',\n"
                   "but '[%s]' exists already",
                   (atom, choices.current_pkg,
                   ", ".join(map(str, conflicts))))

            try_rematch = False
            if any(True for x in conflicts if isinstance(x, restriction.base)):
                # blocker was caught
                try_rematch = True
            elif not any(True for x in conflicts if not
                self.vdb_restrict.match(x)):
                # vdb entry, replace.
                if self.vdb_restrict.match(choices.current_pkg):
                    # we're replacing a vdb entry with a vdb entry?  wtf.
                    print ("internal weirdness spotted- vdb restrict matches, "
                        "but current doesn't, bailing")
                    raise Exception("internal weirdness- vdb restrict matches, but current doesn't. bailing- run w/ --debug")
                conflicts = state.replace_op(choices, choices.current_pkg).apply(
                    self.state)
                if not conflicts:
                    self._dprint("replacing vdb entry for   '%s' with pkg '%s'",
                        (atom, choices.current_pkg))

            else:
                try_rematch = True
            if try_rematch:
                # XXX: this block looks whacked.  figure out what it's up to.
                l2 = self.state.match_atom(atom)
                if l2 == [choices.current_pkg]:
                    # stop resolution.
                    conflicts = False
                elif l2:
                    # potentially need to do some form of cleanup here.
                    conflicts = False
        else:
            conflicts = None
        return conflicts
Exemplo n.º 5
0
 def insert_providers(self, stack, atom, choices):
     for x in choices.provides:
         l = state.add_op(choices, x).apply(self.state)
         if l and l != [x]:
             # slight hack; basically, should be pruning providers as the parent is removed
             # this duplicates it, basically; if it's not a restrict, then it's a pkg.
             # thus poke it.
             if len(l) == 1 and not isinstance(l[0], restriction.base):
                 p = getattr(l[0], 'provider', None)
                 if p is not None and not self.state.match_atom(p):
                     # ok... force it.
                     fail = state.replace_op(choices, x).apply(self.state)
                     if not fail:
                         continue
                     self.notify_choice_failed(stack, atom, choices,
                         "failed forcing provider: %s due to conflict %s", (x, p))
                     return fail
             self.notify_choice_failed(stack, atom, choices,
                 "failed inserting provider: %s due to conflict %s", (x, l))
             return l
     return None
Exemplo n.º 6
0
    def insert_choice(self, atom, stack, choices):
        # first, check for conflicts.
        # lil bit fugly, but works for the moment
        if not choices.current_pkg.repo.livefs:
            self._ensure_livefs_is_loaded(choices.current_pkg.slotted_atom)
        conflicts = state.add_op(choices,
                                 choices.current_pkg).apply(self.state)
        if conflicts:
            # this means in this branch of resolution, someone slipped
            # something in already. cycle, basically.
            # hack.  see if what was inserted is enough for us.

            # this is tricky... if it's the same node inserted
            # (cycle), then we ignore it; this does *not* perfectly
            # behave though, doesn't discern between repos.

            if (len(conflicts) == 1 and conflicts[0] == choices.current_pkg and
                    conflicts[0].repo.livefs == choices.current_pkg.repo.livefs
                    and atom.match(conflicts[0])):

                # early exit. means that a cycle came about, but exact
                # same result slipped through.
                return False

            self._dprint(
                "was trying to insert atom '%s' pkg '%s',\n"
                "but '[%s]' exists already",
                (atom, choices.current_pkg, ", ".join(map(str, conflicts))))

            try_rematch = False
            if any(True for x in conflicts if isinstance(x, restriction.base)):
                # blocker was caught
                try_rematch = True
            elif not any(True
                         for x in conflicts if not self.vdb_restrict.match(x)):
                # vdb entry, replace.
                if self.vdb_restrict.match(choices.current_pkg):
                    # we're replacing a vdb entry with a vdb entry?  wtf.
                    print("internal weirdness spotted- vdb restrict matches, "
                          "but current doesn't, bailing")
                    raise Exception(
                        "internal weirdness- vdb restrict matches ",
                        "but current doesn't. bailing- run w/ --debug")
                conflicts = state.replace_op(
                    choices, choices.current_pkg).apply(self.state)
                if not conflicts:
                    self._dprint("replacing vdb entry for '%s' with pkg '%s'",
                                 (atom, choices.current_pkg))

            else:
                try_rematch = True
            if try_rematch:
                # XXX: this block looks whacked.  figure out what it's up to.
                l2 = self.state.match_atom(atom)
                if l2 == [choices.current_pkg]:
                    # stop resolution.
                    conflicts = False
                elif l2:
                    # potentially need to do some form of cleanup here.
                    conflicts = False
        else:
            conflicts = None
        return conflicts