Fix cycle detector for new packages.

This commit is contained in:
Alberto Planas 2015-02-19 14:14:49 +01:00
parent c9d1e06ca8
commit 6aad8caeb2
2 changed files with 4 additions and 2 deletions

View File

@ -27,6 +27,7 @@ from osc.core import http_DELETE
from osc.core import http_GET
from osc.core import http_POST
from osc.core import makeurl
from osclib.conf import Config
from osclib.stagingapi import StagingAPI
from osclib.memoize import memoize
from osclib.pkgcache import PkgCache
@ -141,6 +142,7 @@ class CheckRepo(object):
"""CheckRepo constructor."""
self.apiurl = apiurl
self.project = 'openSUSE:%s' % project
Config(self.project)
self.staging = StagingAPI(apiurl, self.project)
self.pkgcache = PkgCache(BINCACHE, force_clean=force_clean)

View File

@ -295,7 +295,7 @@ class CycleDetector(object):
# project (i.e Factory) cycles as a set of packages, so we can
# check in the new cycle (also as a set of package) is
# included here.
project_cycles_pkgs = {frozenset(cycle) for cycle in project_cycles}
project_cycles_pkgs = [set(cycle) for cycle in project_cycles]
for cycle in current_graph.cycles():
if cycle not in project_cycles:
project_edges = set((u, v) for u in cycle for v in project_graph.edges(u) if v in cycle)
@ -303,4 +303,4 @@ class CycleDetector(object):
current_pkgs = set(cycle)
yield (cycle,
sorted(current_edges - project_edges),
current_pkgs in project_cycles_pkgs)
not any(current_pkgs.issubset(cpkgs) for cpkgs in project_cycles_pkgs))