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 |
#
|
11416.2.1
by Steve Kowalik
* Brutally hack at gina again, this time making it use LaunchpadCronScript. |
3 |
# Copyright 2009,2010 Canonical Ltd. This software is licensed under the
|
8687.15.22
by Karl Fogel
Add the copyright header block to the remaining .py files. |
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 |
||
11411.6.19
by Julian Edwards
relocate a pythonpath import |
22 |
import _pythonpath |
23 |
||
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 :-) |
24 |
# Set to non-zero if you'd like to be warned every so often
|
25 |
COUNTDOWN = 0 |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
26 |
|
2670
by Canonical.com Patch Queue Manager
[trivial] Gina love |
27 |
import os |
5821.10.4
by Celso Providelo
fixing gina tests. |
28 |
import psycopg2 |
2670
by Canonical.com Patch Queue Manager
[trivial] Gina love |
29 |
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?) |
30 |
import time |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
31 |
|
4753.4.1
by Julian Edwards
Allow gina to override the component (and thus the archive) when importing |
32 |
from zope.component import getUtility |
33 |
||
6555.7.35
by Stuart Bishop
Fix gina tests |
34 |
from canonical import lp |
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 |
35 |
from canonical.config import config |
11416.2.1
by Steve Kowalik
* Brutally hack at gina again, this time making it use LaunchpadCronScript. |
36 |
from canonical.launchpad.scripts import log |
37 |
||
38 |
from lp.services.scripts.base import LaunchpadCronScript |
|
8294.6.8
by Julian Edwards
Section and component are now moved, and gina imports fixed. |
39 |
from lp.soyuz.interfaces.component import IComponentSet |
40 |
from lp.soyuz.scripts.gina import ExecutionError |
|
41 |
from lp.soyuz.scripts.gina.katie import Katie |
|
42 |
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 |
43 |
PackagesMap, MangledArchiveError) |
8294.6.8
by Julian Edwards
Section and component are now moved, and gina imports fixed. |
44 |
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 |
45 |
MultiplePackageReleaseError, NoSourcePackageError, DataSetupError) |
8294.6.8
by Julian Edwards
Section and component are now moved, and gina imports fixed. |
46 |
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 |
47 |
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 |
48 |
PoolFileNotFound, InvalidVersionError) |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
49 |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
50 |
|
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 :-) |
51 |
def _get_keyring(keyrings_root): |
4664.1.1
by Curtis Hovey
Normalized comments for bug 3732. |
52 |
# 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 :-) |
53 |
keyrings = "" |
54 |
for keyring in os.listdir(keyrings_root): |
|
55 |
path = os.path.join(keyrings_root, keyring) |
|
56 |
keyrings += " --keyring=%s" % path |
|
57 |
if not keyrings: |
|
58 |
raise AttributeError("Keyrings not found in ./keyrings/") |
|
59 |
return keyrings |
|
60 |
||
61 |
||
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 |
62 |
def run_gina(options, ztm, target_section): |
8294.6.8
by Julian Edwards
Section and component are now moved, and gina imports fixed. |
63 |
# Avoid circular imports.
|
9113.7.4
by Jonathan Lange
Update many imports of pocket. |
64 |
from lp.registry.interfaces.pocket import PackagePublishingPocket |
8294.6.8
by Julian Edwards
Section and component are now moved, and gina imports fixed. |
65 |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
66 |
package_root = target_section.root |
67 |
keyrings_root = target_section.keyrings |
|
68 |
distro = target_section.distro |
|
5121.2.7
by Stuart Bishop
More required code changes |
69 |
# XXX kiko 2005-10-23: I honestly think having a separate distroseries
|
70 |
# bit silly. Can't we construct this based on `distroseries-pocket`?
|
|
71 |
pocket_distroseries = target_section.pocketrelease |
|
72 |
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). |
73 |
components = [c.strip() for c in target_section.components.split(",")] |
74 |
archs = [a.strip() for a in target_section.architectures.split(",")] |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
75 |
pocket = target_section.pocket |
4753.4.1
by Julian Edwards
Allow gina to override the component (and thus the archive) when importing |
76 |
component_override = target_section.componentoverride |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
77 |
source_only = target_section.source_only |
10512.5.4
by Steve Kowalik
And re-add parsing for sourcepackagenames_only. |
78 |
spnames_only = target_section.sourcepackagenames_only |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
79 |
|
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
80 |
dry_run = options.dry_run |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
81 |
|
11737.2.20
by William Grant
Fix two missed canonical.lp.dbname references. |
82 |
LPDB = lp.get_dbname() |
6555.7.35
by Stuart Bishop
Fix gina tests |
83 |
LPDB_HOST = lp.dbhost |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
84 |
LPDB_USER = config.gina.dbuser |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
85 |
KTDB = target_section.katie_dbname |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
86 |
|
87 |
LIBRHOST = config.librarian.upload_host |
|
88 |
LIBRPORT = config.librarian.upload_port |
|
1716.1.211
by Christian Reis
De-lintify and add better exceptions to gina.py |
89 |
|
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 |
90 |
log.info("") |
5121.2.7
by Stuart Bishop
More required code changes |
91 |
log.info("=== Processing %s/%s/%s ===" % (distro, distroseries, pocket)) |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
92 |
log.debug("Packages read from: %s" % package_root) |
93 |
log.debug("Keyrings read from: %s" % keyrings_root) |
|
94 |
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 |
95 |
if component_override is not None: |
96 |
log.info("Override components to: %s" % component_override) |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
97 |
log.info("Architectures to import: %s" % ", ".join(archs)) |
98 |
log.debug("Launchpad database: %s" % LPDB) |
|
99 |
log.debug("Launchpad database host: %s" % LPDB_HOST) |
|
100 |
log.debug("Launchpad database user: %s" % LPDB_USER) |
|
101 |
log.info("Katie database: %s" % KTDB) |
|
1716.1.211
by Christian Reis
De-lintify and add better exceptions to gina.py |
102 |
log.info("SourcePackage Only: %s" % source_only) |
10512.5.4
by Steve Kowalik
And re-add parsing for sourcepackagenames_only. |
103 |
log.info("SourcePackageName Only: %s" % spnames_only) |
1716.1.211
by Christian Reis
De-lintify and add better exceptions to gina.py |
104 |
log.debug("Librarian: %s:%s" % (LIBRHOST, LIBRPORT)) |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
105 |
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 :-) |
106 |
log.info("") |
1716.1.211
by Christian Reis
De-lintify and add better exceptions to gina.py |
107 |
|
5028.1.6
by David Murphy
Removed PackagePublishingPriority, PackagePublishingStatus, PackagePublishingPocket, PackageUploadStatus, & PackageUploadCustomFormat from canonical.lp.dbschema. |
108 |
if hasattr(PackagePublishingPocket, pocket.upper()): |
109 |
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 :-( |
110 |
else: |
111 |
log.error("Could not find a pocket schema for %s" % pocket) |
|
112 |
sys.exit(1) |
|
113 |
||
4753.4.1
by Julian Edwards
Allow gina to override the component (and thus the archive) when importing |
114 |
if component_override: |
4753.4.2
by Julian Edwards
PEP-8 drives me NUTS. |
115 |
valid_components = [ |
116 |
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 |
117 |
if component_override not in valid_components: |
118 |
log.error("Could not find component %s" % component_override) |
|
119 |
sys.exit(1) |
|
120 |
||
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
121 |
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 |
122 |
keyrings = None |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
123 |
if KTDB: |
5121.2.7
by Stuart Bishop
More required code changes |
124 |
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 |
125 |
keyrings = _get_keyring(keyrings_root) |
126 |
||
127 |
try: |
|
6527.11.1
by Celso Providelo
go, gina, go ... |
128 |
arch_component_items = ArchiveComponentItems( |
129 |
package_root, pocket_distroseries, components, archs, |
|
130 |
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 |
131 |
except MangledArchiveError: |
5855.5.1
by Curtis Hovey
Migrate db configuration to lazr.config. |
132 |
log.exception( |
133 |
"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 |
134 |
sys.exit(1) |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
135 |
|
136 |
packages_map = PackagesMap(arch_component_items) |
|
5121.2.7
by Stuart Bishop
More required code changes |
137 |
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 |
138 |
dry_run, kdb, package_root, keyrings, |
4753.4.1
by Julian Edwards
Allow gina to override the component (and thus the archive) when importing |
139 |
pocket, component_override) |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
140 |
|
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 :-) |
141 |
import_sourcepackages(packages_map, kdb, package_root, keyrings, |
142 |
importer_handler) |
|
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
143 |
importer_handler.commit() |
144 |
||
145 |
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 |
146 |
log.info('Source only mode... done') |
7224.3.1
by Celso Providelo
fixing gina batching mode. |
147 |
return
|
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
148 |
|
6527.11.1
by Celso Providelo
go, gina, go ... |
149 |
for archtag in archs: |
150 |
try: |
|
151 |
importer_handler.ensure_archinfo(archtag) |
|
152 |
except DataSetupError: |
|
153 |
log.exception("Database setup required for run on %s" % archtag) |
|
154 |
sys.exit(1) |
|
155 |
||
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 |
156 |
import_binarypackages(packages_map, kdb, package_root, keyrings, |
157 |
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 :-) |
158 |
importer_handler.commit() |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
159 |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
160 |
|
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
161 |
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 :-) |
162 |
keyrings, importer_handler): |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
163 |
# Goes over src_map importing the sourcepackages packages.
|
164 |
count = 0 |
|
165 |
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 |
166 |
log.info('%i Source Packages to be imported' % npacks) |
1716.1.211
by Christian Reis
De-lintify and add better exceptions to gina.py |
167 |
|
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
168 |
for list_source in sorted( |
169 |
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. |
170 |
for source in list_source: |
171 |
count += 1 |
|
172 |
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?) |
173 |
try: |
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
174 |
try: |
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
175 |
do_one_sourcepackage( |
176 |
source, kdb, package_root, keyrings, importer_handler) |
|
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
177 |
except psycopg2.Error: |
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
178 |
log.exception( |
179 |
"Database error: unable to create SourcePackage "
|
|
180 |
"for %s. Retrying once.." % package_name) |
|
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
181 |
importer_handler.abort() |
182 |
time.sleep(15) |
|
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
183 |
do_one_sourcepackage( |
184 |
source, kdb, package_root, keyrings, importer_handler) |
|
185 |
except ( |
|
186 |
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 |
187 |
DisplayNameDecodingError): |
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
188 |
log.exception( |
189 |
"Unable to create SourcePackageData for %s" % |
|
190 |
package_name) |
|
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
191 |
continue
|
192 |
except (PoolFileNotFound, ExecutionError): |
|
193 |
# Problems with katie db stuff of opening files
|
|
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
194 |
log.exception( |
195 |
"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. |
196 |
continue
|
197 |
except psycopg2.Error: |
|
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
198 |
log.exception( |
199 |
"Database errors made me give up: unable to create "
|
|
200 |
"SourcePackage for %s" % package_name) |
|
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
201 |
importer_handler.abort() |
202 |
continue
|
|
203 |
except MultiplePackageReleaseError: |
|
10512.5.2
by Steve Kowalik
Slightly refactor to use defaultdict. |
204 |
log.exception( |
205 |
"Database duplication processing %s" % package_name) |
|
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
206 |
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 :-) |
207 |
|
10512.5.1
by Steve Kowalik
Brutally hack gina to process multiple sources of the same name. |
208 |
if COUNTDOWN and count % COUNTDOWN == 0: |
209 |
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 |
210 |
|
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
211 |
|
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 :-) |
212 |
def do_one_sourcepackage(source, kdb, package_root, keyrings, |
213 |
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 |
214 |
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 :-) |
215 |
if importer_handler.preimport_sourcecheck(source_data): |
216 |
# Don't bother reading package information if the source package
|
|
217 |
# 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 |
218 |
log.info('%s already exists in the archive' % source_data.package) |
219 |
return
|
|
220 |
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 :-) |
221 |
source_data.ensure_complete(kdb) |
222 |
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 |
223 |
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 :-) |
224 |
|
225 |
||
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 |
226 |
def import_binarypackages(packages_map, kdb, package_root, keyrings, |
227 |
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 :-) |
228 |
nosource = [] |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
229 |
|
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 |
230 |
# 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 |
231 |
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 :-) |
232 |
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 |
233 |
npacks = len(packages_map.bin_map[archtag]) |
5883.1.1
by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema. |
234 |
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 |
235 |
(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 |
236 |
# 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 |
237 |
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. |
238 |
key=lambda x: x.get("Package")): |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
239 |
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). |
240 |
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 |
241 |
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?) |
242 |
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 |
243 |
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?) |
244 |
keyrings, importer_handler) |
5821.10.4
by Celso Providelo
fixing gina tests. |
245 |
except psycopg2.Error: |
1716.2.14
by Christian Reis
Cope better with source packages whose DSC refers to files not in the pool |
246 |
log.exception("Database errors when importing a " |
247 |
"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?) |
248 |
% package_name) |
249 |
importer_handler.abort() |
|
250 |
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 |
251 |
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?) |
252 |
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). |
253 |
except (InvalidVersionError, MissingRequiredArguments): |
5883.1.1
by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema. |
254 |
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). |
255 |
package_name) |
256 |
continue
|
|
1716.2.14
by Christian Reis
Cope better with source packages whose DSC refers to files not in the pool |
257 |
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). |
258 |
# Problems with katie db stuff of opening files
|
259 |
log.exception("Error processing package files for %s" % |
|
260 |
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 |
261 |
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 |
262 |
except MultiplePackageReleaseError: |
263 |
log.exception("Database duplication processing %s" % |
|
264 |
package_name) |
|
265 |
continue
|
|
5821.10.4
by Celso Providelo
fixing gina tests. |
266 |
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?) |
267 |
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 |
268 |
"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). |
269 |
importer_handler.abort() |
270 |
continue
|
|
271 |
except NoSourcePackageError: |
|
5883.1.1
by Curtis Hovey
Added gina_target and buildsequence_job to lazr schema. |
272 |
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). |
273 |
package_name) |
274 |
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 |
275 |
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 :-) |
276 |
|
277 |
if COUNTDOWN and count % COUNTDOWN == 0: |
|
4664.1.1
by Curtis Hovey
Normalized comments for bug 3732. |
278 |
# 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 :-) |
279 |
log.warn('%i/%i binary packages processed' % (count, npacks)) |
280 |
||
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
281 |
if nosource: |
4664.1.1
by Curtis Hovey
Normalized comments for bug 3732. |
282 |
# 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_*. |
283 |
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 :-) |
284 |
for pkg in nosource: |
2168
by Canonical.com Patch Queue Manager
[r=BjornT] More gina improvements. |
285 |
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 :-) |
286 |
|
287 |
||
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 |
288 |
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). |
289 |
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 |
290 |
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 |
291 |
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. |
292 |
log.info('%s already exists in the archive' % binary_data.package) |
293 |
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). |
294 |
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 |
295 |
importer_handler.import_binarypackage(archtag, binary_data) |
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
296 |
importer_handler.commit() |
297 |
||
298 |
||
11416.2.1
by Steve Kowalik
* Brutally hack at gina again, this time making it use LaunchpadCronScript. |
299 |
class Gina(LaunchpadCronScript): |
300 |
||
301 |
def __init__(self): |
|
302 |
super(Gina, self).__init__(name='gina', dbuser=config.gina.dbuser) |
|
303 |
||
304 |
def add_my_options(self): |
|
305 |
self.parser.add_option("-n", "--dry-run", action="store_true", |
|
306 |
help="Don't commit changes to the database", |
|
307 |
dest="dry_run", default=False) |
|
308 |
self.parser.add_option("-a", "--all", action="store_true", |
|
309 |
help="Run all sections defined in launchpad.conf (in order)", |
|
310 |
dest="all", default=False) |
|
311 |
||
312 |
def main(self): |
|
313 |
possible_targets = [target.category_and_section_names[1] |
|
314 |
for target in config.getByCategory('gina_target')] |
|
315 |
targets = self.args |
|
316 |
if self.options.all: |
|
317 |
targets = possible_targets[:] |
|
318 |
else: |
|
319 |
if not targets: |
|
320 |
self.parser.error( |
|
321 |
"Must specify at least one target to run, or --all") |
|
322 |
for target in targets: |
|
323 |
if target not in possible_targets: |
|
324 |
self.parser.error( |
|
325 |
"No Gina target %s in config file" % target) |
|
326 |
||
327 |
for target in targets: |
|
328 |
target_section = config['gina_target.%s' % target] |
|
329 |
run_gina(self.options, self.txn, target_section) |
|
330 |
||
331 |
||
1964
by Canonical.com Patch Queue Manager
[r=spiv] full gina refactor |
332 |
if __name__ == "__main__": |
11416.2.1
by Steve Kowalik
* Brutally hack at gina again, this time making it use LaunchpadCronScript. |
333 |
gina = Gina() |
334 |
gina.lock_and_run() |