~launchpad-pqm/launchpad/devel

10637.3.1 by Guilherme Salgado
Use the default python version instead of a hard-coded version
1
#!/usr/bin/python -S
8687.15.22 by Karl Fogel
Add the copyright header block to the remaining .py files.
2
#
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
5
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
6
# This module uses relative imports.
5855.5.1 by Curtis Hovey
Migrate db configuration to lazr.config.
7
# pylint: disable-msg=W0403
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
8
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
9
"""
10
Gina launcher script. Handles commandline options and makes the proper
11
calls to the other classes and instances.
12
13
The callstack is essentially:
10303.1.1 by Gary Poster
use newest version of zc.buildout
14
    main -> run_gina
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
15
                -> import_sourcepackages -> do_one_sourcepackage
16
                -> import_binarypackages -> do_one_binarypackage
17
"""
18
5855.5.1 by Curtis Hovey
Migrate db configuration to lazr.config.
19
20
__metaclass__ = type
21
22
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
23
# Set to non-zero if you'd like to be warned every so often
24
COUNTDOWN = 0
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
25
26
import _pythonpath
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
27
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
28
from optparse import OptionParser
2670 by Canonical.com Patch Queue Manager
[trivial] Gina love
29
import os
5821.10.4 by Celso Providelo
fixing gina tests.
30
import psycopg2
2670 by Canonical.com Patch Queue Manager
[trivial] Gina love
31
import sys
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
32
import time
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
33
4753.4.1 by Julian Edwards
Allow gina to override the component (and thus the archive) when importing
34
from zope.component import getUtility
35
3691.348.2 by kiko
Only catch LockAlreadyAcquired, which is really what we are checking for in scripts.
36
from contrib.glock import GlobalLock, LockAlreadyAcquired
3691.348.1 by kiko
Remove the original lockfile class and use our contributed GlobalLock everywhere to avoid stale locks making our scripts stop to run. Update a bunch of scripts to use it. Hopefully backwards-compatible enough to survive tests.
37
6555.7.35 by Stuart Bishop
Fix gina tests
38
from canonical import lp
5028.1.6 by David Murphy
Removed PackagePublishingPriority, PackagePublishingStatus, PackagePublishingPocket, PackageUploadStatus, & PackageUploadCustomFormat from canonical.lp.dbschema.
39
from canonical.lp import initZopeless
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
40
from canonical.config import config
8294.6.8 by Julian Edwards
Section and component are now moved, and gina imports fixed.
41
from lp.soyuz.interfaces.component import IComponentSet
3691.164.16 by Guilherme Salgado
Lots of fixes and tests suggested by Bjorn
42
from canonical.launchpad.scripts import (
43
    execute_zcml_for_scripts, logger_options, log)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
44
8294.6.8 by Julian Edwards
Section and component are now moved, and gina imports fixed.
45
from lp.soyuz.scripts.gina import ExecutionError
46
from lp.soyuz.scripts.gina.katie import Katie
47
from lp.soyuz.scripts.gina.archive import (ArchiveComponentItems,
1716.1.223 by Christian Reis
Checkpoint gina: the sourcepackage side is implemented and well-tested, over two releases, and over two runs of gina
48
    PackagesMap, MangledArchiveError)
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
49
8294.6.8 by Julian Edwards
Section and component are now moved, and gina imports fixed.
50
from lp.soyuz.scripts.gina.handlers import (ImporterHandler,
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
51
    MultiplePackageReleaseError, NoSourcePackageError, DataSetupError)
8294.6.8 by Julian Edwards
Section and component are now moved, and gina imports fixed.
52
from lp.soyuz.scripts.gina.packages import (SourcePackageData,
1716.1.229 by Christian Reis
Move encoding of person's displayname into packages. Add tests for version numbers for gcc-defaults, clean up code slightly. What remains: validating ensureBuild and _getBinary, and testing with multiple components, pockets and architectures
53
    BinaryPackageData, MissingRequiredArguments, DisplayNameDecodingError,
1716.1.239 by Christian Reis
Really fix get_dsc_path to properly grok archive paths (and sanitize callsites and a certain place where we were generating a filename without the string pool attached to it). Remove PackageFileProcessError, which was dead anyway, and update for it. Rename anything that was an archive_root to the right term. All tests now pass
54
    PoolFileNotFound, InvalidVersionError)
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
55
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
56
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
57
def _get_keyring(keyrings_root):
4664.1.1 by Curtis Hovey
Normalized comments for bug 3732.
58
    # XXX kiko 2005-10-23: untested
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
59
    keyrings = ""
60
    for keyring in os.listdir(keyrings_root):
61
        path = os.path.join(keyrings_root, keyring)
62
        keyrings += " --keyring=%s" % path
63
    if not keyrings:
64
        raise AttributeError("Keyrings not found in ./keyrings/")
65
    return keyrings
66
67
68
def main():
3691.164.16 by Guilherme Salgado
Lots of fixes and tests suggested by Bjorn
69
    execute_zcml_for_scripts()
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
70
    parser = OptionParser("Usage: %prog [OPTIONS] [target ...]")
71
    logger_options(parser)
72
73
    parser.add_option("-n", "--dry-run", action="store_true",
74
            help="Don't commit changes to the database",
75
            dest="dry_run", default=False)
76
77
    parser.add_option("-a", "--all", action="store_true",
78
            help="Run all sections defined in launchpad.conf (in order)",
79
            dest="all", default=False)
80
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
81
    parser.add_option( "-l", "--lockfile",
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
82
            default="/var/lock/launchpad-gina.lock",
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
83
            help="Ensure only one process is running that locks LOCKFILE",
84
            metavar="LOCKFILE"
85
            )
86
87
    (options, targets) = parser.parse_args()
88
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
89
    possible_targets = [target.category_and_section_names[1]
90
                        for target in config.getByCategory('gina_target')]
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
91
92
    if options.all:
93
        targets = possible_targets[:]
94
    else:
95
        if not targets:
96
            parser.error("Must specify at least one target to run, or --all")
97
98
        for target in targets:
99
            if target not in possible_targets:
100
                parser.error("No Gina target %s in config file" % target)
101
3691.348.1 by kiko
Remove the original lockfile class and use our contributed GlobalLock everywhere to avoid stale locks making our scripts stop to run. Update a bunch of scripts to use it. Hopefully backwards-compatible enough to survive tests.
102
    lockfile = GlobalLock(options.lockfile, logger=log)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
103
    try:
104
        lockfile.acquire()
3691.348.2 by kiko
Only catch LockAlreadyAcquired, which is really what we are checking for in scripts.
105
    except LockAlreadyAcquired:
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
106
        log.info('Lockfile %s already locked. Exiting.', options.lockfile)
107
        sys.exit(1)
108
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
109
    ztm = initZopeless(dbuser=config.gina.dbuser)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
110
    try:
111
        for target in targets:
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
112
            target_section = config['gina_target.%s' % target]
113
            run_gina(options, ztm, target_section)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
114
    finally:
115
        lockfile.release()
116
117
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
118
def run_gina(options, ztm, target_section):
8294.6.8 by Julian Edwards
Section and component are now moved, and gina imports fixed.
119
    # Avoid circular imports.
9113.7.4 by Jonathan Lange
Update many imports of pocket.
120
    from lp.registry.interfaces.pocket import PackagePublishingPocket
8294.6.8 by Julian Edwards
Section and component are now moved, and gina imports fixed.
121
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
122
    package_root = target_section.root
123
    keyrings_root = target_section.keyrings
124
    distro = target_section.distro
5121.2.7 by Stuart Bishop
More required code changes
125
    # XXX kiko 2005-10-23: I honestly think having a separate distroseries
126
    # bit silly. Can't we construct this based on `distroseries-pocket`?
127
    pocket_distroseries = target_section.pocketrelease
128
    distroseries = target_section.distroseries
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
129
    components = [c.strip() for c in target_section.components.split(",")]
130
    archs = [a.strip() for a in target_section.architectures.split(",")]
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
131
    pocket = target_section.pocket
4753.4.1 by Julian Edwards
Allow gina to override the component (and thus the archive) when importing
132
    component_override = target_section.componentoverride
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
133
    source_only = target_section.source_only
10512.5.4 by Steve Kowalik
And re-add parsing for sourcepackagenames_only.
134
    spnames_only = target_section.sourcepackagenames_only
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
135
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
136
    dry_run = options.dry_run
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
137
6555.7.35 by Stuart Bishop
Fix gina tests
138
    LPDB = lp.dbname
139
    LPDB_HOST = lp.dbhost
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
140
    LPDB_USER = config.gina.dbuser
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
141
    KTDB = target_section.katie_dbname
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
142
143
    LIBRHOST = config.librarian.upload_host
144
    LIBRPORT = config.librarian.upload_port
1716.1.211 by Christian Reis
De-lintify and add better exceptions to gina.py
145
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
146
    log.info("")
5121.2.7 by Stuart Bishop
More required code changes
147
    log.info("=== Processing %s/%s/%s ===" % (distro, distroseries, pocket))
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
148
    log.debug("Packages read from: %s" % package_root)
149
    log.debug("Keyrings read from: %s" % keyrings_root)
150
    log.info("Components to import: %s" % ", ".join(components))
4753.4.1 by Julian Edwards
Allow gina to override the component (and thus the archive) when importing
151
    if component_override is not None:
152
        log.info("Override components to: %s" % component_override)
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
153
    log.info("Architectures to import: %s" % ", ".join(archs))
154
    log.debug("Launchpad database: %s" % LPDB)
155
    log.debug("Launchpad database host: %s" % LPDB_HOST)
156
    log.debug("Launchpad database user: %s" % LPDB_USER)
157
    log.info("Katie database: %s" % KTDB)
1716.1.211 by Christian Reis
De-lintify and add better exceptions to gina.py
158
    log.info("SourcePackage Only: %s" % source_only)
10512.5.4 by Steve Kowalik
And re-add parsing for sourcepackagenames_only.
159
    log.info("SourcePackageName Only: %s" % spnames_only)
1716.1.211 by Christian Reis
De-lintify and add better exceptions to gina.py
160
    log.debug("Librarian: %s:%s" % (LIBRHOST, LIBRPORT))
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
161
    log.info("Dry run: %s" % (dry_run))
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
162
    log.info("")
1716.1.211 by Christian Reis
De-lintify and add better exceptions to gina.py
163
5028.1.6 by David Murphy
Removed PackagePublishingPriority, PackagePublishingStatus, PackagePublishingPocket, PackageUploadStatus, & PackageUploadCustomFormat from canonical.lp.dbschema.
164
    if hasattr(PackagePublishingPocket, pocket.upper()):
165
        pocket = getattr(PackagePublishingPocket, pocket.upper())
1716.1.232 by Christian Reis
Set up an initial (empty) multiple-arch-component-pocket run, with a basic test. Also fix up my librarian query to not use selectOneBy. But I had to comment out the check, because staging and production are already polluted :-(
166
    else:
167
        log.error("Could not find a pocket schema for %s" % pocket)
168
        sys.exit(1)
169
4753.4.1 by Julian Edwards
Allow gina to override the component (and thus the archive) when importing
170
    if component_override:
4753.4.2 by Julian Edwards
PEP-8 drives me NUTS.
171
        valid_components = [
172
            component.name for component in getUtility(IComponentSet)]
4753.4.1 by Julian Edwards
Allow gina to override the component (and thus the archive) when importing
173
        if component_override not in valid_components:
174
            log.error("Could not find component %s" % component_override)
175
            sys.exit(1)
176
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
177
    kdb = None
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
178
    keyrings = None
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
179
    if KTDB:
5121.2.7 by Stuart Bishop
More required code changes
180
        kdb = Katie(KTDB, distroseries, dry_run)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
181
        keyrings = _get_keyring(keyrings_root)
182
183
    try:
6527.11.1 by Celso Providelo
go, gina, go ...
184
        arch_component_items = ArchiveComponentItems(
185
            package_root, pocket_distroseries, components, archs,
186
            source_only)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
187
    except MangledArchiveError:
5855.5.1 by Curtis Hovey
Migrate db configuration to lazr.config.
188
        log.exception(
189
            "Failed to analyze archive for %s" % pocket_distroseries)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
190
        sys.exit(1)
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
191
192
    packages_map = PackagesMap(arch_component_items)
5121.2.7 by Stuart Bishop
More required code changes
193
    importer_handler = ImporterHandler(ztm, distro, distroseries,
2501 by Canonical.com Patch Queue Manager
Bring failed binary imports down from 472 to 6 by finding sources more aggressively. r=spiv
194
                                       dry_run, kdb, package_root, keyrings,
4753.4.1 by Julian Edwards
Allow gina to override the component (and thus the archive) when importing
195
                                       pocket, component_override)
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
196
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
197
    import_sourcepackages(packages_map, kdb, package_root, keyrings,
198
                          importer_handler)
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
199
    importer_handler.commit()
200
201
    if source_only:
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
202
        log.info('Source only mode... done')
7224.3.1 by Celso Providelo
fixing gina batching mode.
203
        return
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
204
6527.11.1 by Celso Providelo
go, gina, go ...
205
    for archtag in archs:
206
        try:
207
            importer_handler.ensure_archinfo(archtag)
208
        except DataSetupError:
209
            log.exception("Database setup required for run on %s" % archtag)
210
            sys.exit(1)
211
1716.1.223 by Christian Reis
Checkpoint gina: the sourcepackage side is implemented and well-tested, over two releases, and over two runs of gina
212
    import_binarypackages(packages_map, kdb, package_root, keyrings,
213
                          importer_handler)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
214
    importer_handler.commit()
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
215
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
216
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
217
def import_sourcepackages(packages_map, kdb, package_root,
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
218
                          keyrings, importer_handler):
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
219
    # Goes over src_map importing the sourcepackages packages.
220
    count = 0
221
    npacks = len(packages_map.src_map)
1716.1.217 by Christian Reis
Fix up remaining SQL issues (manually tested by hacking up gina.py, improve gina.py logging and error output, some added language consistency
222
    log.info('%i Source Packages to be imported' % npacks)
1716.1.211 by Christian Reis
De-lintify and add better exceptions to gina.py
223
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
224
    for list_source in sorted(
225
        packages_map.src_map.values(), key=lambda x: x[0].get("Package")):
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
226
        for source in list_source:
227
            count += 1
228
            package_name = source.get("Package", "unknown")
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
229
            try:
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
230
                try:
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
231
                    do_one_sourcepackage(
232
                        source, kdb, package_root, keyrings, importer_handler)
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
233
                except psycopg2.Error:
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
234
                    log.exception(
235
                        "Database error: unable to create SourcePackage "
236
                        "for %s. Retrying once.." % package_name)
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
237
                    importer_handler.abort()
238
                    time.sleep(15)
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
239
                    do_one_sourcepackage(
240
                        source, kdb, package_root, keyrings, importer_handler)
241
            except (
242
                InvalidVersionError, MissingRequiredArguments,
1716.1.229 by Christian Reis
Move encoding of person's displayname into packages. Add tests for version numbers for gcc-defaults, clean up code slightly. What remains: validating ensureBuild and _getBinary, and testing with multiple components, pockets and architectures
243
                DisplayNameDecodingError):
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
244
                log.exception(
245
                    "Unable to create SourcePackageData for %s" %
246
                    package_name)
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
247
                continue
248
            except (PoolFileNotFound, ExecutionError):
249
                # Problems with katie db stuff of opening files
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
250
                log.exception(
251
                    "Error processing package files for %s" % package_name)
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
252
                continue
253
            except psycopg2.Error:
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
254
                log.exception(
255
                    "Database errors made me give up: unable to create "
256
                    "SourcePackage for %s" % package_name)
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
257
                importer_handler.abort()
258
                continue
259
            except MultiplePackageReleaseError:
10512.5.2 by Steve Kowalik
Slightly refactor to use defaultdict.
260
                log.exception(
261
                    "Database duplication processing %s" % package_name)
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
262
                continue
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
263
10512.5.1 by Steve Kowalik
Brutally hack gina to process multiple sources of the same name.
264
            if COUNTDOWN and count % COUNTDOWN == 0:
265
                log.warn('%i/%i sourcepackages processed' % (count, npacks))
1716.1.217 by Christian Reis
Fix up remaining SQL issues (manually tested by hacking up gina.py, improve gina.py logging and error output, some added language consistency
266
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
267
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
268
def do_one_sourcepackage(source, kdb, package_root, keyrings,
269
                         importer_handler):
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
270
    source_data = SourcePackageData(**source)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
271
    if importer_handler.preimport_sourcecheck(source_data):
272
        # Don't bother reading package information if the source package
273
        # already exists in the database
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
274
        log.info('%s already exists in the archive' % source_data.package)
275
        return
276
    source_data.process_package(kdb, package_root, keyrings)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
277
    source_data.ensure_complete(kdb)
278
    importer_handler.import_sourcepackage(source_data)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
279
    importer_handler.commit()
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
280
281
1716.1.223 by Christian Reis
Checkpoint gina: the sourcepackage side is implemented and well-tested, over two releases, and over two runs of gina
282
def import_binarypackages(packages_map, kdb, package_root, keyrings,
283
                          importer_handler):
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
284
    nosource = []
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
285
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
286
    # Run over all the architectures we have
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
287
    for archtag in packages_map.bin_map.keys():
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
288
        count = 0
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
289
        npacks = len(packages_map.bin_map[archtag])
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
290
        log.info('%i Binary Packages to be imported for %s' %
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
291
                 (npacks, archtag))
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
292
        # Go over binarypackages importing them for this architecture
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
293
        for binary in sorted(packages_map.bin_map[archtag].values(),
1716.1.227 by Christian Reis
Order packages by name when processing them, to obtain stable test output. Add a host of binary packages to hoary to ensure I have enough to test with. Check before importing binary packages that they already exist (as we do for source packages) to optimize processing time and output. Reorganize tests to be a bit more self-contained.
294
                             key=lambda x: x.get("Package")):
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
295
            count += 1
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
296
            package_name = binary.get("Package", "unknown")
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
297
            try:
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
298
                try:
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
299
                    do_one_binarypackage(binary, archtag, kdb, package_root,
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
300
                                         keyrings, importer_handler)
5821.10.4 by Celso Providelo
fixing gina tests.
301
                except psycopg2.Error:
1716.2.14 by Christian Reis
Cope better with source packages whose DSC refers to files not in the pool
302
                    log.exception("Database errors when importing a "
303
                                  "BinaryPackage for %s. Retrying once.."
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
304
                                  % package_name)
305
                    importer_handler.abort()
306
                    time.sleep(15)
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
307
                    do_one_binarypackage(binary, archtag, kdb, package_root,
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
308
                                         keyrings, importer_handler)
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
309
            except (InvalidVersionError, MissingRequiredArguments):
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
310
                log.exception("Unable to create BinaryPackageData for %s" %
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
311
                              package_name)
312
                continue
1716.2.14 by Christian Reis
Cope better with source packages whose DSC refers to files not in the pool
313
            except (PoolFileNotFound, ExecutionError):
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
314
                # Problems with katie db stuff of opening files
315
                log.exception("Error processing package files for %s" %
316
                              package_name)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
317
                continue
1716.1.226 by Christian Reis
Moving verification and parsing code over to packages.py, simplifying handlers.py. Also improved the way check_not_in_librarian communicates failures. Added some important XXXs that are a consequence of the use of Teri on the archive. All tests still pass
318
            except MultiplePackageReleaseError:
319
                log.exception("Database duplication processing %s" %
320
                              package_name)
321
                continue
5821.10.4 by Celso Providelo
fixing gina tests.
322
            except psycopg2.Error:
1716.1.255 by Christian Reis
Cope with intermittent postgres isolation errors when importing packages (caused one package to fail in breezy, growl). Also stop lowercasing package and version numbers, since they should be compared case-sensitively (right?)
323
                log.exception("Database errors made me give up: unable to "
1716.2.14 by Christian Reis
Cope better with source packages whose DSC refers to files not in the pool
324
                              "create BinaryPackage for %s" % package_name)
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
325
                importer_handler.abort()
326
                continue
327
            except NoSourcePackageError:
5883.1.1 by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema.
328
                log.exception("Failed to create Binary Package for %s" %
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
329
                              package_name)
330
                nosource.append(binary)
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
331
                continue
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
332
333
            if COUNTDOWN and count % COUNTDOWN == 0:
4664.1.1 by Curtis Hovey
Normalized comments for bug 3732.
334
                # XXX kiko 2005-10-23: untested
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
335
                log.warn('%i/%i binary packages processed' % (count, npacks))
336
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
337
        if nosource:
4664.1.1 by Curtis Hovey
Normalized comments for bug 3732.
338
            # XXX kiko 2005-10-23: untested
1716.1.241 by Christian Reis
Add support for locating license files that are prefixed with the binary package name (and add a package to test the feature with). Clean up changelog handling of package and version. Deal with the fact that selectOne* can raise an exception when encountering database corruption. Explicitly set SourcePackageRelease.format, and reorder the SPR attributes to check we are indeed sending in everything we should. Added a test for an invalid version. Refactor dsc and license handling so we don't do any more than we should in each of the calls to read_*.
339
            log.warn('%i source packages not found' % len(nosource))
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
340
            for pkg in nosource:
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
341
                log.warn(pkg)
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
342
343
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
344
def do_one_binarypackage(binary, archtag, kdb, package_root, keyrings,
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
345
                         importer_handler):
1716.1.219 by Christian Reis
One more step in the direction of gina testing: test the processing of a second distro release. Verify that no duplicate source packages are added. Check for mangled tagfile stanzas. Reorder classes in handlers.py to be more naturally sequenced. Centralize error checking in gina.py so that do_one_*package is what's tested for error raising. Add support files for testing Breezy. More test clauses. I'd estimate I'm 30% done
346
    binary_data = BinaryPackageData(**binary)
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
347
    if importer_handler.preimport_binarycheck(archtag, binary_data):
1716.1.227 by Christian Reis
Order packages by name when processing them, to obtain stable test output. Add a host of binary packages to hoary to ensure I have enough to test with. Check before importing binary packages that they already exist (as we do for source packages) to optimize processing time and output. Reorganize tests to be a bit more self-contained.
348
        log.info('%s already exists in the archive' % binary_data.package)
349
        return
1716.1.225 by Christian Reis
First part of really testing binary packages. Add 14 binary package entries for hoary main. Change the librarian check to be a function so it can be unified between sources and binaries. Bulletproof the test to run under weird filesystem conditions. Make the config a bit less daft. Deal better with corrupt packages files (and entries). Fetch the licence for binary packages properly (the hard way). Clean up the creation of BinaryPackageData. Removed the catch-all except:s which only make my life harder (for now, at least).
350
    binary_data.process_package(kdb, package_root, keyrings)
1716.2.6 by Christian Reis
Move the check for processor to the start of run_gina so we ensure that all processors required are already preseeded in the database before doing /anything/. Clarifies issue in production where a processor for ia64 was missing
351
    importer_handler.import_binarypackage(archtag, binary_data)
1964 by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor
352
    importer_handler.commit()
353
354
355
if __name__ == "__main__":
1716.1.218 by Christian Reis
Add more package data and update the gina doctest. Seriously whack packages.py and gina.py, with some trickle into handlers.py. The creation of source packages for Hoary is now minimally tested, with most important codepaths and error conditions being checked. Did work on validation and ensuring the source and binary package data we have is consistent. Added a ton of packages to the gina test archive so we can use them in our tests -- welcome them into rocketfuel :-)
356
    main()
2168 by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements.
357