~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/scripts/gina/dominate.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-09-23 10:39:15 UTC
  • mto: This revision was merged to the branch mainline in revision 14026.
  • Revision ID: jeroen.vermeulen@canonical.com-20110923103915-dqvfb55wdsk1a02z
Optimization.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    # packages listed in the Sources file we imported, but also packages
25
25
    # that have been recently deleted.
26
26
    package_counts = dominator.findPublishedSourcePackageNames(series, pocket)
27
 
    for package_name, package_count in package_counts:
 
27
    for package_name, pub_count in package_counts:
28
28
        entries = packages_map.src_map.get(package_name, [])
29
29
        live_versions = [
30
30
            entry['Version'] for entry in entries if 'Version' in entry]
31
31
 
32
 
        dominator.dominateRemovedSourceVersions(
33
 
            series, pocket, package_name, live_versions)
 
32
        # Gina import just ensured that any live version in the Sources
 
33
        # file has a Published publication.  So there should be at least
 
34
        # as many Published publications as live versions.
 
35
        if pub_count < len(live_versions):
 
36
            logger.warn(
 
37
                "Package %s has fewer live source publications (%s) than "
 
38
                "live versions (%s).  The archive may be broken in some "
 
39
                "way.",
 
40
                package_name, pub_count, len(live_versions))
 
41
 
 
42
        # Domination can only turn Published publications into
 
43
        # non-Published ones, and ensures that we end up with one
 
44
        # Published publication per live version.  Thus, if there are as
 
45
        # many Published publications as live versions, there is no
 
46
        # domination to do.  We skip these as an optimization.  Without
 
47
        # it, dominating a single Debian series takes hours.
 
48
        if pub_count != len(live_versions):
 
49
            dominator.dominateRemovedSourceVersions(
 
50
                series, pocket, package_name, live_versions)
34
51
 
35
52
        txn.commit()