Merge lp:~wgrant/launchpad/no-lucilleconfig-distroseries into lp:launchpad
- no-lucilleconfig-distroseries
- Merge into devel
| Status: | Merged |
|---|---|
| Approved by: | William Grant on 2010-12-19 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 12110 |
| Proposed branch: | lp:~wgrant/launchpad/no-lucilleconfig-distroseries |
| Merge into: | lp:launchpad |
| Diff against target: |
744 lines (+86/-477) 8 files modified
lib/lp/archivepublisher/config.py (+3/-46) lib/lp/archivepublisher/ftparchive.py (+5/-14) lib/lp/archivepublisher/tests/apt-data/apt.conf (+75/-75) lib/lp/archivepublisher/tests/publisher-config.txt (+0/-14) lib/lp/archivepublisher/tests/test_config.py (+0/-52) lib/lp/archivepublisher/tests/test_ftparchive.py (+0/-13) lib/lp/archivepublisher/tests/test_pool.py (+3/-2) lib/lp/archivepublisher/tests/util.py (+0/-261) |
| To merge this branch: | bzr merge lp:~wgrant/launchpad/no-lucilleconfig-distroseries |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Tim Penhey (community) | 2010-12-19 | Approve on 2010-12-19 | |
|
Review via email:
|
|||
Commit Message
[r=thumper]
Description of the Change
A continuation of my anti-lucilleconfig tirade from lp:~wgrant/launchpad/no-lucilleconfig-stayofexecution, this branch obsoletes DistroSeries.
Formerly used also to determine publishing components, DistroSeries.
Most of lp.archivepubli
Preview Diff
| 1 | === modified file 'lib/lp/archivepublisher/config.py' |
| 2 | --- lib/lp/archivepublisher/config.py 2010-10-17 12:26:56 +0000 |
| 3 | +++ lib/lp/archivepublisher/config.py 2010-12-19 23:04:18 +0000 |
| 4 | @@ -6,9 +6,7 @@ |
| 5 | # to managing the archive publisher's configuration as stored in the |
| 6 | # distribution and distroseries tables |
| 7 | |
| 8 | -from ConfigParser import ConfigParser |
| 9 | import os |
| 10 | -from StringIO import StringIO |
| 11 | |
| 12 | from canonical.config import config |
| 13 | from lp.soyuz.enums import ArchivePurpose |
| 14 | @@ -24,11 +22,11 @@ |
| 15 | modified according local context, it basically fixes the archive |
| 16 | paths to cope with non-primary and PPA archives publication workflow. |
| 17 | """ |
| 18 | - pubconf = Config(archive.distribution) |
| 19 | + pubconf = Config() |
| 20 | ppa_config = config.personalpackagearchive |
| 21 | |
| 22 | pubconf.temproot = os.path.join( |
| 23 | - config.archivepublisher.root, '%s-temp' % pubconf.distroName) |
| 24 | + config.archivepublisher.root, '%s-temp' % archive.distribution.name) |
| 25 | |
| 26 | if archive.is_ppa: |
| 27 | if archive.private: |
| 28 | @@ -95,49 +93,8 @@ |
| 29 | how the database stores configuration then the publisher will not |
| 30 | need to be re-coded to cope""" |
| 31 | |
| 32 | - def __init__(self, distribution): |
| 33 | - """Initialise the configuration""" |
| 34 | - self.distroName = distribution.name.encode('utf-8') |
| 35 | - self._distroseries = {} |
| 36 | - if not distribution.lucilleconfig: |
| 37 | - raise LucilleConfigError( |
| 38 | - 'No Lucille config section for %s' % distribution.name) |
| 39 | - |
| 40 | - for dr in distribution: |
| 41 | - distroseries_name = dr.name.encode('utf-8') |
| 42 | - config_segment = {} |
| 43 | - |
| 44 | - if dr.lucilleconfig: |
| 45 | - strio = StringIO(dr.lucilleconfig.encode('utf-8')) |
| 46 | - config_segment["config"] = ConfigParser() |
| 47 | - config_segment["config"].readfp(strio) |
| 48 | - strio.close() |
| 49 | - |
| 50 | - self._distroseries[distroseries_name] = config_segment |
| 51 | - |
| 52 | - strio = StringIO(distribution.lucilleconfig.encode('utf-8')) |
| 53 | - self._distroconfig = ConfigParser() |
| 54 | - self._distroconfig.readfp(strio) |
| 55 | - strio.close() |
| 56 | - |
| 57 | - def distroSeriesNames(self): |
| 58 | - # Because dicts iterate for keys only; this works to get dr names |
| 59 | - return self._distroseries.keys() |
| 60 | - |
| 61 | - def series(self, dr): |
| 62 | - try: |
| 63 | - return self._distroseries[dr] |
| 64 | - except KeyError: |
| 65 | - raise LucilleConfigError( |
| 66 | - 'No Lucille config section for %s in %s' % |
| 67 | - (dr, self.distroName)) |
| 68 | - |
| 69 | def setupArchiveDirs(self): |
| 70 | - """Create missing required directories in archive. |
| 71 | - |
| 72 | - For PPA publication path are overriden after instantiation |
| 73 | - and empty locations should not be considered for creation. |
| 74 | - """ |
| 75 | + """Create missing required directories in archive.""" |
| 76 | required_directories = [ |
| 77 | self.distroroot, |
| 78 | self.poolroot, |
| 79 | |
| 80 | === modified file 'lib/lp/archivepublisher/ftparchive.py' |
| 81 | --- lib/lp/archivepublisher/ftparchive.py 2010-11-09 08:43:34 +0000 |
| 82 | +++ lib/lp/archivepublisher/ftparchive.py 2010-12-19 23:04:18 +0000 |
| 83 | @@ -146,14 +146,6 @@ |
| 84 | self._config = config |
| 85 | self._diskpool = diskpool |
| 86 | self.distro = distro |
| 87 | - self.distroseries = [] |
| 88 | - for distroseries in self.distro.series: |
| 89 | - if not distroseries.name in self._config.distroSeriesNames(): |
| 90 | - self.log.warning("Distroseries %s in %s doesn't have " |
| 91 | - "a lucille configuration.", distroseries.name, |
| 92 | - self.distro.name) |
| 93 | - else: |
| 94 | - self.distroseries.append(distroseries) |
| 95 | self.publisher = publisher |
| 96 | |
| 97 | # We need somewhere to note down where the debian-installer |
| 98 | @@ -195,7 +187,7 @@ |
| 99 | We do this to have Packages or Sources for them even if we lack |
| 100 | anything in them currently. |
| 101 | """ |
| 102 | - for distroseries in self.distroseries: |
| 103 | + for distroseries in self.distro.series: |
| 104 | components = [ |
| 105 | comp.name for comp in |
| 106 | self.publisher.archive.getComponentsForSeries(distroseries)] |
| 107 | @@ -358,7 +350,7 @@ |
| 108 | |
| 109 | def generateOverrides(self, fullpublish=False): |
| 110 | """Collect packages that need overrides, and generate them.""" |
| 111 | - for distroseries in self.distroseries: |
| 112 | + for distroseries in self.distro.series: |
| 113 | for pocket in PackagePublishingPocket.items: |
| 114 | if not fullpublish: |
| 115 | if not self.publisher.isDirty(distroseries, pocket): |
| 116 | @@ -624,7 +616,7 @@ |
| 117 | |
| 118 | def generateFileLists(self, fullpublish=False): |
| 119 | """Collect currently published FilePublishings and write filelists.""" |
| 120 | - for distroseries in self.distroseries: |
| 121 | + for distroseries in self.distro.series: |
| 122 | for pocket in PackagePublishingPocket.items: |
| 123 | if not fullpublish: |
| 124 | if not self.publisher.isDirty(distroseries, pocket): |
| 125 | @@ -750,14 +742,13 @@ |
| 126 | |
| 127 | # confixtext now contains a basic header. Add a dists entry for |
| 128 | # each of the distroseries we've touched |
| 129 | - for distroseries_name in self._config.distroSeriesNames(): |
| 130 | - distroseries = self.distro[distroseries_name] |
| 131 | + for distroseries in self.distro.series: |
| 132 | for pocket in PackagePublishingPocket.items: |
| 133 | |
| 134 | if not fullpublish: |
| 135 | if not self.publisher.isDirty(distroseries, pocket): |
| 136 | self.log.debug("Skipping a-f stanza for %s/%s" % |
| 137 | - (distroseries_name, pocket.name)) |
| 138 | + (distroseries.name, pocket.name)) |
| 139 | continue |
| 140 | self.publisher.checkDirtySuiteBeforePublishing( |
| 141 | distroseries, pocket) |
| 142 | |
| 143 | === modified file 'lib/lp/archivepublisher/tests/apt-data/apt.conf' |
| 144 | --- lib/lp/archivepublisher/tests/apt-data/apt.conf 2010-10-14 23:14:00 +0000 |
| 145 | +++ lib/lp/archivepublisher/tests/apt-data/apt.conf 2010-12-19 23:04:18 +0000 |
| 146 | @@ -22,81 +22,6 @@ |
| 147 | }; |
| 148 | |
| 149 | |
| 150 | -tree "dists/breezy-autotest" |
| 151 | -{ |
| 152 | - FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest_$(SECTION)_binary-$(ARCH)"; |
| 153 | - SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest_$(SECTION)_source"; |
| 154 | - Sections "main restricted universe multiverse"; |
| 155 | - Architectures "source"; |
| 156 | - BinOverride "override.breezy-autotest.$(SECTION)"; |
| 157 | - SrcOverride "override.breezy-autotest.$(SECTION).src"; |
| 158 | - ExtraOverride "override.breezy-autotest.extra.$(SECTION)"; |
| 159 | - Packages::Extensions ".deb"; |
| 160 | - BinCacheDB "packages-$(ARCH).db"; |
| 161 | - Contents " "; |
| 162 | -} |
| 163 | - |
| 164 | - |
| 165 | -tree "dists/breezy-autotest-security" |
| 166 | -{ |
| 167 | - FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-security_$(SECTION)_binary-$(ARCH)"; |
| 168 | - SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-security_$(SECTION)_source"; |
| 169 | - Sections "main restricted universe multiverse"; |
| 170 | - Architectures "source"; |
| 171 | - BinOverride "override.breezy-autotest-security.$(SECTION)"; |
| 172 | - SrcOverride "override.breezy-autotest-security.$(SECTION).src"; |
| 173 | - ExtraOverride "override.breezy-autotest-security.extra.$(SECTION)"; |
| 174 | - Packages::Extensions ".deb"; |
| 175 | - BinCacheDB "packages-$(ARCH).db"; |
| 176 | - Contents " "; |
| 177 | -} |
| 178 | - |
| 179 | - |
| 180 | -tree "dists/breezy-autotest-updates" |
| 181 | -{ |
| 182 | - FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-updates_$(SECTION)_binary-$(ARCH)"; |
| 183 | - SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-updates_$(SECTION)_source"; |
| 184 | - Sections "main restricted universe multiverse"; |
| 185 | - Architectures "source"; |
| 186 | - BinOverride "override.breezy-autotest-updates.$(SECTION)"; |
| 187 | - SrcOverride "override.breezy-autotest-updates.$(SECTION).src"; |
| 188 | - ExtraOverride "override.breezy-autotest-updates.extra.$(SECTION)"; |
| 189 | - Packages::Extensions ".deb"; |
| 190 | - BinCacheDB "packages-$(ARCH).db"; |
| 191 | - Contents " "; |
| 192 | -} |
| 193 | - |
| 194 | - |
| 195 | -tree "dists/breezy-autotest-proposed" |
| 196 | -{ |
| 197 | - FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-proposed_$(SECTION)_binary-$(ARCH)"; |
| 198 | - SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-proposed_$(SECTION)_source"; |
| 199 | - Sections "main restricted universe multiverse"; |
| 200 | - Architectures "source"; |
| 201 | - BinOverride "override.breezy-autotest-proposed.$(SECTION)"; |
| 202 | - SrcOverride "override.breezy-autotest-proposed.$(SECTION).src"; |
| 203 | - ExtraOverride "override.breezy-autotest-proposed.extra.$(SECTION)"; |
| 204 | - Packages::Extensions ".deb"; |
| 205 | - BinCacheDB "packages-$(ARCH).db"; |
| 206 | - Contents " "; |
| 207 | -} |
| 208 | - |
| 209 | - |
| 210 | -tree "dists/breezy-autotest-backports" |
| 211 | -{ |
| 212 | - FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_binary-$(ARCH)"; |
| 213 | - SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_source"; |
| 214 | - Sections "main restricted universe multiverse"; |
| 215 | - Architectures "source"; |
| 216 | - BinOverride "override.breezy-autotest-backports.$(SECTION)"; |
| 217 | - SrcOverride "override.breezy-autotest-backports.$(SECTION).src"; |
| 218 | - ExtraOverride "override.breezy-autotest-backports.extra.$(SECTION)"; |
| 219 | - Packages::Extensions ".deb"; |
| 220 | - BinCacheDB "packages-$(ARCH).db"; |
| 221 | - Contents " "; |
| 222 | -} |
| 223 | - |
| 224 | - |
| 225 | tree "dists/hoary-test" |
| 226 | { |
| 227 | FileList "/var/tmp/archive/ubuntutest-overrides/hoary-test_$(SECTION)_binary-$(ARCH)"; |
| 228 | @@ -231,3 +156,78 @@ |
| 229 | Contents " "; |
| 230 | } |
| 231 | |
| 232 | + |
| 233 | +tree "dists/breezy-autotest" |
| 234 | +{ |
| 235 | + FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest_$(SECTION)_binary-$(ARCH)"; |
| 236 | + SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest_$(SECTION)_source"; |
| 237 | + Sections "main restricted universe multiverse"; |
| 238 | + Architectures "source"; |
| 239 | + BinOverride "override.breezy-autotest.$(SECTION)"; |
| 240 | + SrcOverride "override.breezy-autotest.$(SECTION).src"; |
| 241 | + ExtraOverride "override.breezy-autotest.extra.$(SECTION)"; |
| 242 | + Packages::Extensions ".deb"; |
| 243 | + BinCacheDB "packages-$(ARCH).db"; |
| 244 | + Contents " "; |
| 245 | +} |
| 246 | + |
| 247 | + |
| 248 | +tree "dists/breezy-autotest-security" |
| 249 | +{ |
| 250 | + FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-security_$(SECTION)_binary-$(ARCH)"; |
| 251 | + SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-security_$(SECTION)_source"; |
| 252 | + Sections "main restricted universe multiverse"; |
| 253 | + Architectures "source"; |
| 254 | + BinOverride "override.breezy-autotest-security.$(SECTION)"; |
| 255 | + SrcOverride "override.breezy-autotest-security.$(SECTION).src"; |
| 256 | + ExtraOverride "override.breezy-autotest-security.extra.$(SECTION)"; |
| 257 | + Packages::Extensions ".deb"; |
| 258 | + BinCacheDB "packages-$(ARCH).db"; |
| 259 | + Contents " "; |
| 260 | +} |
| 261 | + |
| 262 | + |
| 263 | +tree "dists/breezy-autotest-updates" |
| 264 | +{ |
| 265 | + FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-updates_$(SECTION)_binary-$(ARCH)"; |
| 266 | + SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-updates_$(SECTION)_source"; |
| 267 | + Sections "main restricted universe multiverse"; |
| 268 | + Architectures "source"; |
| 269 | + BinOverride "override.breezy-autotest-updates.$(SECTION)"; |
| 270 | + SrcOverride "override.breezy-autotest-updates.$(SECTION).src"; |
| 271 | + ExtraOverride "override.breezy-autotest-updates.extra.$(SECTION)"; |
| 272 | + Packages::Extensions ".deb"; |
| 273 | + BinCacheDB "packages-$(ARCH).db"; |
| 274 | + Contents " "; |
| 275 | +} |
| 276 | + |
| 277 | + |
| 278 | +tree "dists/breezy-autotest-proposed" |
| 279 | +{ |
| 280 | + FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-proposed_$(SECTION)_binary-$(ARCH)"; |
| 281 | + SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-proposed_$(SECTION)_source"; |
| 282 | + Sections "main restricted universe multiverse"; |
| 283 | + Architectures "source"; |
| 284 | + BinOverride "override.breezy-autotest-proposed.$(SECTION)"; |
| 285 | + SrcOverride "override.breezy-autotest-proposed.$(SECTION).src"; |
| 286 | + ExtraOverride "override.breezy-autotest-proposed.extra.$(SECTION)"; |
| 287 | + Packages::Extensions ".deb"; |
| 288 | + BinCacheDB "packages-$(ARCH).db"; |
| 289 | + Contents " "; |
| 290 | +} |
| 291 | + |
| 292 | + |
| 293 | +tree "dists/breezy-autotest-backports" |
| 294 | +{ |
| 295 | + FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_binary-$(ARCH)"; |
| 296 | + SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_source"; |
| 297 | + Sections "main restricted universe multiverse"; |
| 298 | + Architectures "source"; |
| 299 | + BinOverride "override.breezy-autotest-backports.$(SECTION)"; |
| 300 | + SrcOverride "override.breezy-autotest-backports.$(SECTION).src"; |
| 301 | + ExtraOverride "override.breezy-autotest-backports.extra.$(SECTION)"; |
| 302 | + Packages::Extensions ".deb"; |
| 303 | + BinCacheDB "packages-$(ARCH).db"; |
| 304 | + Contents " "; |
| 305 | +} |
| 306 | + |
| 307 | |
| 308 | === modified file 'lib/lp/archivepublisher/tests/publisher-config.txt' |
| 309 | --- lib/lp/archivepublisher/tests/publisher-config.txt 2010-10-17 12:26:56 +0000 |
| 310 | +++ lib/lp/archivepublisher/tests/publisher-config.txt 2010-12-19 23:04:18 +0000 |
| 311 | @@ -20,8 +20,6 @@ |
| 312 | >>> def dump_config(config): |
| 313 | ... for attr_name in config_attributes: |
| 314 | ... print '%s: %s' % (attr_name, getattr(config, attr_name)) |
| 315 | - ... for distroseries_name in sorted(config.distroSeriesNames()): |
| 316 | - ... print '%s' % distroseries_name |
| 317 | |
| 318 | |
| 319 | == Primary == |
| 320 | @@ -41,8 +39,6 @@ |
| 321 | cacheroot: /var/tmp/archive/ubuntutest-cache |
| 322 | miscroot: /var/tmp/archive/ubuntutest-misc |
| 323 | temproot: /var/tmp/archive/ubuntutest-temp |
| 324 | - breezy-autotest |
| 325 | - hoary-test |
| 326 | |
| 327 | |
| 328 | == PPAs == |
| 329 | @@ -85,8 +81,6 @@ |
| 330 | cacheroot: None |
| 331 | miscroot: None |
| 332 | temproot: /var/tmp/archive/ubuntutest-temp |
| 333 | - breezy-autotest |
| 334 | - hoary-test |
| 335 | |
| 336 | There is a separate location for private PPAs that is used if the |
| 337 | archive is marked as private: |
| 338 | @@ -115,8 +109,6 @@ |
| 339 | cacheroot: None |
| 340 | miscroot: None |
| 341 | temproot: /var/tmp/archive/ubuntutest-temp |
| 342 | - breezy-autotest |
| 343 | - hoary-test |
| 344 | |
| 345 | |
| 346 | == Partner == |
| 347 | @@ -140,8 +132,6 @@ |
| 348 | cacheroot: None |
| 349 | miscroot: None |
| 350 | temproot: /var/tmp/archive/ubuntutest-temp |
| 351 | - breezy-autotest |
| 352 | - hoary-test |
| 353 | |
| 354 | |
| 355 | == DEBUG == |
| 356 | @@ -166,8 +156,6 @@ |
| 357 | cacheroot: None |
| 358 | miscroot: None |
| 359 | temproot: /var/tmp/archive/ubuntutest-temp |
| 360 | - breezy-autotest |
| 361 | - hoary-test |
| 362 | |
| 363 | |
| 364 | == COPY == |
| 365 | @@ -190,5 +178,3 @@ |
| 366 | cacheroot: /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-cache |
| 367 | miscroot: /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-misc |
| 368 | temproot: /var/tmp/archive/ubuntutest-rebuildtest99/ubuntutest-temp |
| 369 | - breezy-autotest |
| 370 | - hoary-test |
| 371 | |
| 372 | === removed file 'lib/lp/archivepublisher/tests/test_config.py' |
| 373 | --- lib/lp/archivepublisher/tests/test_config.py 2010-12-19 03:48:38 +0000 |
| 374 | +++ lib/lp/archivepublisher/tests/test_config.py 1970-01-01 00:00:00 +0000 |
| 375 | @@ -1,52 +0,0 @@ |
| 376 | -# Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
| 377 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
| 378 | - |
| 379 | -"""Tests for Config.py""" |
| 380 | - |
| 381 | -__metaclass__ = type |
| 382 | - |
| 383 | -from zope.component import getUtility |
| 384 | - |
| 385 | -from canonical.config import config |
| 386 | -from canonical.testing.layers import LaunchpadZopelessLayer |
| 387 | -from lp.archivepublisher.config import ( |
| 388 | - Config, |
| 389 | - LucilleConfigError, |
| 390 | - ) |
| 391 | -from lp.registry.interfaces.distribution import IDistributionSet |
| 392 | -from lp.testing import TestCaseWithFactory |
| 393 | - |
| 394 | - |
| 395 | -class TestConfig(TestCaseWithFactory): |
| 396 | - layer = LaunchpadZopelessLayer |
| 397 | - |
| 398 | - def setUp(self): |
| 399 | - super(TestConfig, self).setUp() |
| 400 | - self.layer.switchDbUser(config.archivepublisher.dbuser) |
| 401 | - self.ubuntutest = getUtility(IDistributionSet)['ubuntutest'] |
| 402 | - |
| 403 | - def testMissingDistroSeries(self): |
| 404 | - distroseries = self.factory.makeDistroSeries( |
| 405 | - distribution=self.ubuntutest, name="somename") |
| 406 | - d = Config(self.ubuntutest) |
| 407 | - dsns = d.distroSeriesNames() |
| 408 | - self.assertEquals(len(dsns), 2) |
| 409 | - self.assertEquals(dsns[0], "breezy-autotest") |
| 410 | - self.assertEquals(dsns[1], "hoary-test") |
| 411 | - |
| 412 | - def testInstantiate(self): |
| 413 | - """Config should instantiate""" |
| 414 | - d = Config(self.ubuntutest) |
| 415 | - |
| 416 | - def testDistroName(self): |
| 417 | - """Config should be able to return the distroName""" |
| 418 | - d = Config(self.ubuntutest) |
| 419 | - self.assertEqual(d.distroName, "ubuntutest") |
| 420 | - |
| 421 | - def testDistroSeriesNames(self): |
| 422 | - """Config should return two distroseries names""" |
| 423 | - d = Config(self.ubuntutest) |
| 424 | - dsns = d.distroSeriesNames() |
| 425 | - self.assertEquals(len(dsns), 2) |
| 426 | - self.assertEquals(dsns[0], "breezy-autotest") |
| 427 | - self.assertEquals(dsns[1], "hoary-test") |
| 428 | |
| 429 | === modified file 'lib/lp/archivepublisher/tests/test_ftparchive.py' |
| 430 | --- lib/lp/archivepublisher/tests/test_ftparchive.py 2010-12-18 00:14:32 +0000 |
| 431 | +++ lib/lp/archivepublisher/tests/test_ftparchive.py 2010-12-19 23:04:18 +0000 |
| 432 | @@ -125,19 +125,6 @@ |
| 433 | self._publisher) |
| 434 | return fa |
| 435 | |
| 436 | - def test_NoLucilleConfig(self): |
| 437 | - # Distroseries without a lucille configuration get ignored |
| 438 | - # and trigger a warning, they don't break the publisher |
| 439 | - logger = BufferLogger() |
| 440 | - publisher = Publisher( |
| 441 | - logger, self._config, self._dp, self._archive) |
| 442 | - self.factory.makeDistroSeries(self._distribution, name="somename") |
| 443 | - fa = FTPArchiveHandler(logger, self._config, self._dp, |
| 444 | - self._distribution, publisher) |
| 445 | - fa.createEmptyPocketRequests(fullpublish=True) |
| 446 | - self.assertEquals("WARNING: Distroseries somename in ubuntutest doesn't " |
| 447 | - "have a lucille configuration.\n", logger.buffer.getvalue()) |
| 448 | - |
| 449 | def test_getSourcesForOverrides(self): |
| 450 | # getSourcesForOverrides returns a list of tuples containing: |
| 451 | # (sourcename, suite, component, section) |
| 452 | |
| 453 | === modified file 'lib/lp/archivepublisher/tests/test_pool.py' |
| 454 | --- lib/lp/archivepublisher/tests/test_pool.py 2010-08-20 20:31:18 +0000 |
| 455 | +++ lib/lp/archivepublisher/tests/test_pool.py 2010-12-19 23:04:18 +0000 |
| 456 | @@ -11,11 +11,11 @@ |
| 457 | from tempfile import mkdtemp |
| 458 | import unittest |
| 459 | |
| 460 | +from canonical.launchpad.scripts.logger import QuietFakeLogger |
| 461 | from lp.archivepublisher.diskpool import ( |
| 462 | DiskPool, |
| 463 | poolify, |
| 464 | ) |
| 465 | -from lp.archivepublisher.tests.util import FakeLogger |
| 466 | |
| 467 | |
| 468 | class MockFile: |
| 469 | @@ -82,7 +82,8 @@ |
| 470 | def setUp(self): |
| 471 | self.pool_path = mkdtemp() |
| 472 | self.temp_path = mkdtemp() |
| 473 | - self.pool = DiskPool(self.pool_path, self.temp_path, FakeLogger()) |
| 474 | + self.pool = DiskPool( |
| 475 | + self.pool_path, self.temp_path, QuietFakeLogger()) |
| 476 | |
| 477 | def tearDown(self): |
| 478 | shutil.rmtree(self.pool_path) |
| 479 | |
| 480 | === removed file 'lib/lp/archivepublisher/tests/util.py' |
| 481 | --- lib/lp/archivepublisher/tests/util.py 2010-10-21 04:19:36 +0000 |
| 482 | +++ lib/lp/archivepublisher/tests/util.py 1970-01-01 00:00:00 +0000 |
| 483 | @@ -1,261 +0,0 @@ |
| 484 | -# Copyright 2009 Canonical Ltd. This software is licensed under the |
| 485 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
| 486 | - |
| 487 | -"""Utilities to aid testing archivepublisher.""" |
| 488 | - |
| 489 | -__metaclass__ = type |
| 490 | - |
| 491 | -# Utility functions/classes for testing the archive publisher. |
| 492 | - |
| 493 | -from lp.archivepublisher.tests import datadir |
| 494 | -from lp.registry.interfaces.pocket import PackagePublishingPocket |
| 495 | -from lp.registry.interfaces.series import SeriesStatus |
| 496 | - |
| 497 | - |
| 498 | -__all__ = ['FakeLogger'] |
| 499 | - |
| 500 | - |
| 501 | -class FakeLogger: |
| 502 | - |
| 503 | - def debug(self, *args, **kwargs): |
| 504 | - pass |
| 505 | - |
| 506 | - def error(self, *args, **kwargs): |
| 507 | - pass |
| 508 | - |
| 509 | - |
| 510 | -class FakeDistribution: |
| 511 | - |
| 512 | - def __init__(self, name, conf): |
| 513 | - self.name = name.decode('utf-8') |
| 514 | - self.lucilleconfig = conf.decode('utf-8') |
| 515 | - self.series = [] |
| 516 | - |
| 517 | - def registerSeries(self, series): |
| 518 | - self.series.append(series) |
| 519 | - |
| 520 | - def __getitem__(self, name): |
| 521 | - for series in self.series: |
| 522 | - if series.name == name: |
| 523 | - return series |
| 524 | - return None |
| 525 | - |
| 526 | - |
| 527 | -class FakeDistroSeries: |
| 528 | - |
| 529 | - def __init__(self, name, conf, distro): |
| 530 | - self.name = name.decode('utf-8') |
| 531 | - self.lucilleconfig = conf.decode('utf-8') |
| 532 | - self.distribution = distro |
| 533 | - self.architectures = [FakeDistroArchSeries(self, "i386"), |
| 534 | - FakeDistroArchSeries(self, "powerpc")] |
| 535 | - self.status = SeriesStatus.DEVELOPMENT |
| 536 | - self.distribution.registerSeries(self) |
| 537 | - |
| 538 | - |
| 539 | -class FakeDistroArchSeries: |
| 540 | - |
| 541 | - def __init__(self, series, archtag): |
| 542 | - self.distroseries = series |
| 543 | - self.architecturetag = archtag |
| 544 | - |
| 545 | - |
| 546 | -class FakeSource: |
| 547 | - |
| 548 | - def __init__(self, version, status, name=""): |
| 549 | - self.version = version.decode('utf-8') |
| 550 | - self.status = status |
| 551 | - self.datepublished = None |
| 552 | - self.sourcepackagename = name.decode('utf-8') |
| 553 | - |
| 554 | - def _deepCopy(self): |
| 555 | - return FakeSource( |
| 556 | - self.version.encode('utf-8'), |
| 557 | - self.status, |
| 558 | - self.sourcepackagename.encode('utf-8')) |
| 559 | - |
| 560 | - |
| 561 | -class FakeBinary: |
| 562 | - |
| 563 | - def __init__(self, version, status, name=""): |
| 564 | - self.version = version.decode('utf-8') |
| 565 | - self.status = status |
| 566 | - self.datepublished = None |
| 567 | - self.packagename = name.decode('utf-8') |
| 568 | - |
| 569 | - def _deepCopy(self): |
| 570 | - return FakeBinary( |
| 571 | - self.version.encode('utf-8'), |
| 572 | - self.status, |
| 573 | - self.packagename.encode('utf-8')) |
| 574 | - |
| 575 | - |
| 576 | -class FakeSourcePublishing: |
| 577 | - """Mocks a SourcePackagePublishingHistory object.""" |
| 578 | - id = 1 |
| 579 | - |
| 580 | - def __init__(self, source, component, alias, section, ds): |
| 581 | - |
| 582 | - class Dummy: |
| 583 | - id = 1 |
| 584 | - |
| 585 | - self.sourcepackagerelease = Dummy() |
| 586 | - self.sourcepackagerelease.name = source |
| 587 | - self.component = Dummy() |
| 588 | - self.component.name = component |
| 589 | - self.libraryfilealias = alias |
| 590 | - self.section = Dummy() |
| 591 | - self.section.name = section |
| 592 | - self.distroseries = Dummy() |
| 593 | - self.distroseries.name = ds |
| 594 | - self.pocket = PackagePublishingPocket.RELEASE |
| 595 | - |
| 596 | - def _deepCopy(self): |
| 597 | - return FakeSourcePublishing( |
| 598 | - self.sourcepackage.name, |
| 599 | - self.component.name, |
| 600 | - self.libraryfilealias, |
| 601 | - self.section.name, |
| 602 | - self.distroseries.name, |
| 603 | - ) |
| 604 | - |
| 605 | - |
| 606 | -class FakeBinaryPublishing: |
| 607 | - """Mocks a BinaryPackagePublishingHistory object.""" |
| 608 | - id = 1 |
| 609 | - |
| 610 | - def __init__(self, binary, source, component, alias, |
| 611 | - section, ds, prio, archtag): |
| 612 | - |
| 613 | - class Dummy: |
| 614 | - id = 1 |
| 615 | - |
| 616 | - self.binarypackagerelease = Dummy() |
| 617 | - self.binarypackagerelease.name = source |
| 618 | - self.sourcepackagerelease = Dummy() |
| 619 | - self.sourcepackagerelease.name = source |
| 620 | - self.binarypackage = Dummy() |
| 621 | - self.binarypackage.name = source |
| 622 | - self.component = Dummy() |
| 623 | - self.component.name = component |
| 624 | - self.section = Dummy() |
| 625 | - self.section.name = section |
| 626 | - self.distroarchseries = Dummy() |
| 627 | - self.distroarchseries.distroseries = Dummy() |
| 628 | - self.distroarchseries.distroseries.name = ds |
| 629 | - self.libraryfilealias = alias |
| 630 | - self.priority = prio |
| 631 | - self.architecturetag = archtag |
| 632 | - self.pocket = PackagePublishingPocket.RELEASE |
| 633 | - |
| 634 | - def _deepCopy(self): |
| 635 | - return FakeBinaryPublishing( |
| 636 | - self.binarypackagerelease.name, |
| 637 | - self.sourcepackagerelease.name, |
| 638 | - self.component.name, |
| 639 | - self.libraryfilealias, |
| 640 | - self.section.name, |
| 641 | - self.distroseries.name, |
| 642 | - self.priority, |
| 643 | - self.architecturetag, |
| 644 | - ) |
| 645 | - |
| 646 | - |
| 647 | -class FakeSourceFilePublishing: |
| 648 | - """Mocks a SourcePackageFilePublishing object.""" |
| 649 | - |
| 650 | - def __init__(self, source, component, leafname, alias, section, ds): |
| 651 | - self.sourcepackagename = source |
| 652 | - self.componentname = component |
| 653 | - self.libraryfilealiasfilename = leafname |
| 654 | - self.libraryfilealias = alias |
| 655 | - self.sectionname = section |
| 656 | - self.distroseriesname = ds |
| 657 | - self.pocket = PackagePublishingPocket.RELEASE |
| 658 | - |
| 659 | - def _deepCopy(self): |
| 660 | - return FakeSourceFilePublishing( |
| 661 | - self.sourcepackagename, |
| 662 | - self.componentname, |
| 663 | - self.libraryfilealiasfilename, |
| 664 | - self.libraryfilealias, |
| 665 | - self.sectionname, |
| 666 | - self.distroseriesname, |
| 667 | - ) |
| 668 | - |
| 669 | - |
| 670 | -class FakeBinaryFilePublishing: |
| 671 | - """Mocks a BinaryPackageFilePublishing object.""" |
| 672 | - |
| 673 | - def __init__(self, source, component, leafname, alias, section, |
| 674 | - ds, archtag): |
| 675 | - self.sourcepackagename = source |
| 676 | - self.componentname = component |
| 677 | - self.libraryfilealiasfilename = leafname |
| 678 | - self.libraryfilealias = alias |
| 679 | - self.sectionname = section |
| 680 | - self.distroseriesname = ds |
| 681 | - self.architecturetag = archtag |
| 682 | - self.pocket = PackagePublishingPocket.RELEASE |
| 683 | - |
| 684 | - def _deepCopy(self): |
| 685 | - return FakeBinaryFilePublishing( |
| 686 | - self.sourcepackagename, |
| 687 | - self.componentname, |
| 688 | - self.libraryfilealiasfilename, |
| 689 | - self.libraryfilealias, |
| 690 | - self.sectionname, |
| 691 | - self.distroseriesname, |
| 692 | - self.architecturetag, |
| 693 | - ) |
| 694 | - |
| 695 | -sentinel = object() |
| 696 | - |
| 697 | - |
| 698 | -def _deepCopy(thing): |
| 699 | - if type(thing) == dict: |
| 700 | - ret = {} |
| 701 | - for key in thing: |
| 702 | - ret[key] = _deepCopy(thing[key]) |
| 703 | - return ret |
| 704 | - if type(thing) == list: |
| 705 | - ret = [] |
| 706 | - for val in thing: |
| 707 | - ret.append(_deepCopy(val)) |
| 708 | - return ret |
| 709 | - if type(thing) == tuple: |
| 710 | - ret = [] |
| 711 | - for val in thing: |
| 712 | - ret.append(_deepCopy(val)) |
| 713 | - return tuple(ret) |
| 714 | - if getattr(thing, "_deepCopy", sentinel) != sentinel: |
| 715 | - return thing._deepCopy() |
| 716 | - return thing # Assume we can't copy it deeply |
| 717 | - |
| 718 | - |
| 719 | -# NOTE: If you alter the configs here remember to add tests in test_config.py |
| 720 | -fake_ubuntu = FakeDistribution("ubuntu", |
| 721 | - """ |
| 722 | -[publishing] |
| 723 | -pendingremovalduration=5 |
| 724 | -root=FOO |
| 725 | -archiveroot=FOO/BAR |
| 726 | -poolroot=FOO/BAR/pool |
| 727 | -distsroot=FOO/BAR/dists |
| 728 | -overrideroot=FOO/overrides |
| 729 | -cacheroot=FOO/cache |
| 730 | -miscroot=FOO/misc |
| 731 | - """.replace( |
| 732 | - "FOO", datadir("distro")).replace("BAR", "ubuntu")) |
| 733 | - |
| 734 | -fake_ubuntu_series = [ |
| 735 | - FakeDistroSeries("warty", |
| 736 | - """ |
| 737 | -[publishing] |
| 738 | -components = main restricted universe |
| 739 | - """, fake_ubuntu), |
| 740 | - FakeDistroSeries("hoary", |
| 741 | - """ |
| 742 | -[publishing] |
| 743 | -components = main restricted universe |
| 744 | - """, fake_ubuntu)] |

As far as the code looks, it looks fine.