launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01574
[Merge] lp:~wgrant/launchpad/more-a-f-cleanup into lp:launchpad/devel
William Grant has proposed merging lp:~wgrant/launchpad/more-a-f-cleanup into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch is just a cleanup of lp.archivepublisher, mainly related to pocket handling.
Nothing should use pocketsuffix directly -- if iteration over the pockets is wanted, PackagePublishingPocket.items is your friend. If you want to create a suite name, use distroseries.getSuite(pocket).
I also renamed a few insanities like 'dr_pocketed' and 'full_name' to 'suite', as they should have been from the start. suffixpocket also turns out to be unused in archivepublisher, so I moved it back to Registry with the rest.
apt.conf's diff is just a reordering of stanzas to match the proper order of pockets as defined in PPP, rather than the pocketsuffix dict order.
--
https://code.launchpad.net/~wgrant/launchpad/more-a-f-cleanup/+merge/38646
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/more-a-f-cleanup into lp:launchpad/devel.
=== modified file 'lib/lp/archivepublisher/ftparchive.py'
--- lib/lp/archivepublisher/ftparchive.py 2010-10-15 11:13:01 +0000
+++ lib/lp/archivepublisher/ftparchive.py 2010-10-17 10:19:44 +0000
@@ -23,10 +23,7 @@
MAIN_STORE,
)
from lp.archivepublisher.utils import process_in_batches
-from lp.registry.interfaces.pocket import (
- PackagePublishingPocket,
- pocketsuffix,
- )
+from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.registry.model.sourcepackagename import SourcePackageName
from lp.soyuz.enums import PackagePublishingStatus
from lp.soyuz.model.component import Component
@@ -227,26 +224,25 @@
".".join(["override", distroseries.name, comp,
"debian-installer"]))
- full_distroseries_name = distroseries.name + pocketsuffix[pocket]
-
- # Touch the source file lists and override files
- f_touch(self._config.overrideroot,
- ".".join(["override", full_distroseries_name, comp]))
- f_touch(self._config.overrideroot,
- ".".join(["override", full_distroseries_name, "extra", comp]))
- f_touch(self._config.overrideroot,
- ".".join(["override", full_distroseries_name, comp, "src"]))
-
- f_touch(self._config.overrideroot,
- "_".join([full_distroseries_name, comp, "source"]))
+ suite = distroseries.getSuite(pocket)
+
+ # Create empty override lists.
+ for path in ((comp, ), ("extra", comp), (comp, "src")):
+ f_touch(os.path.join(
+ self._config.overrideroot,
+ ".".join(("override", suite) + path)))
+
+ # Create empty file lists.
+ def touch_list(*parts):
+ f_touch(os.path.join(
+ self._config.overrideroot,
+ "_".join((suite, ) + parts)))
+ touch_list(comp, "source")
for arch in self._config.archTagsForSeries(distroseries.name):
# Touch more file lists for the archs.
- f_touch(self._config.overrideroot,
- "_".join([full_distroseries_name, comp, "binary-"+arch]))
- f_touch(self._config.overrideroot,
- "_".join([full_distroseries_name, comp,
- "debian-installer", "binary-"+arch]))
+ touch_list(comp, "binary-" + arch)
+ touch_list(comp, "debian-installer", "binary-" + arch)
#
# Override Generation
@@ -291,7 +287,7 @@
SourcePackagePublishingHistory.status ==
PackagePublishingStatus.PUBLISHED)
- suite = distroseries.name + pocketsuffix[pocket]
+ suite = distroseries.getSuite(pocket)
def add_suite(result):
name, component, section = result
return (name, suite, component, section)
@@ -346,7 +342,7 @@
BinaryPackagePublishingHistory.status ==
PackagePublishingStatus.PUBLISHED)
- suite = distroseries.name + pocketsuffix[pocket]
+ suite = distroseries.getSuite(pocket)
def add_suite(result):
name, component, section, priority = result
return (name, suite, component, section, priority.title.lower())
@@ -571,7 +567,7 @@
SourcePackageFilePublishing.publishingstatus ==
PackagePublishingStatus.PUBLISHED)
- suite = distroseries.name + pocketsuffix[pocket]
+ suite = distroseries.getSuite(pocket)
def add_suite(result):
name, filename, component = result
return (name, suite, filename, component)
@@ -608,7 +604,7 @@
BinaryPackageFilePublishing.publishingstatus ==
PackagePublishingStatus.PUBLISHED)
- suite = distroseries.name + pocketsuffix[pocket]
+ suite = distroseries.getSuite(pocket)
def add_suite(result):
name, filename, component, architecturetag = result
architecture = 'binary-' + architecturetag
@@ -621,7 +617,7 @@
def generateFileLists(self, fullpublish=False):
"""Collect currently published FilePublishings and write filelists."""
for distroseries in self.distroseries:
- for pocket in pocketsuffix:
+ for pocket in PackagePublishingPocket.items:
if not fullpublish:
if not self.publisher.isDirty(distroseries, pocket):
continue
@@ -746,7 +742,7 @@
# each of the distroseries we've touched
for distroseries_name in self._config.distroSeriesNames():
distroseries = self.distro[distroseries_name]
- for pocket in pocketsuffix:
+ for pocket in PackagePublishingPocket.items:
if not fullpublish:
if not self.publisher.isDirty(distroseries, pocket):
@@ -759,8 +755,7 @@
if not self.publisher.isAllowed(distroseries, pocket):
continue
- self.generateConfigForPocket(
- apt_config, distroseries, distroseries_name, pocket)
+ self.generateConfigForPocket(apt_config, distroseries, pocket)
# And now return that string.
s = apt_config.getvalue()
@@ -772,20 +767,19 @@
fp.close()
return apt_config_filename
- def generateConfigForPocket(self, apt_config, distroseries,
- distroseries_name, pocket):
+ def generateConfigForPocket(self, apt_config, distroseries, pocket):
"""Generates the config stanza for an individual pocket."""
- dr_pocketed = distroseries_name + pocketsuffix[pocket]
-
- archs = self._config.archTagsForSeries(distroseries_name)
- comps = self._config.componentsForSeries(distroseries_name)
-
- self.log.debug("Generating apt config for %s" % dr_pocketed)
+ suite = distroseries.getSuite(pocket)
+
+ archs = self._config.archTagsForSeries(distroseries.name)
+ comps = self._config.componentsForSeries(distroseries.name)
+
+ self.log.debug("Generating apt config for %s" % suite)
apt_config.write(STANZA_TEMPLATE % {
"LISTPATH": self._config.overrideroot,
- "DISTRORELEASE": dr_pocketed,
- "DISTRORELEASEBYFILE": dr_pocketed,
- "DISTRORELEASEONDISK": dr_pocketed,
+ "DISTRORELEASE": suite,
+ "DISTRORELEASEBYFILE": suite,
+ "DISTRORELEASEONDISK": suite,
"ARCHITECTURES": " ".join(archs + ["source"]),
"SECTIONS": " ".join(comps),
"EXTENSIONS": ".deb",
@@ -793,28 +787,28 @@
"DISTS": os.path.basename(self._config.distsroot),
"HIDEEXTRA": ""})
- if archs and dr_pocketed in self._di_release_components:
- for component in self._di_release_components[dr_pocketed]:
+ if archs and suite in self._di_release_components:
+ for component in self._di_release_components[suite]:
apt_config.write(STANZA_TEMPLATE % {
"LISTPATH": self._config.overrideroot,
- "DISTRORELEASEONDISK": "%s/%s" % (dr_pocketed, component),
- "DISTRORELEASEBYFILE": "%s_%s" % (dr_pocketed, component),
- "DISTRORELEASE": "%s.%s" % (dr_pocketed, component),
+ "DISTRORELEASEONDISK": "%s/%s" % (suite, component),
+ "DISTRORELEASEBYFILE": "%s_%s" % (suite, component),
+ "DISTRORELEASE": "%s.%s" % (suite, component),
"ARCHITECTURES": " ".join(archs),
"SECTIONS": "debian-installer",
"EXTENSIONS": ".udeb",
"CACHEINSERT": "debian-installer-",
"DISTS": os.path.basename(self._config.distsroot),
- "HIDEEXTRA": "// "
+ "HIDEEXTRA": "// ",
})
# XXX: 2006-08-24 kiko: Why do we do this directory creation here?
for comp in comps:
- component_path = os.path.join(self._config.distsroot,
- dr_pocketed, comp)
+ component_path = os.path.join(
+ self._config.distsroot, suite, comp)
base_paths = [component_path]
- if dr_pocketed in self._di_release_components:
- if comp in self._di_release_components[dr_pocketed]:
+ if suite in self._di_release_components:
+ if comp in self._di_release_components[suite]:
base_paths.append(os.path.join(component_path,
"debian-installer"))
for base_path in base_paths:
@@ -822,4 +816,3 @@
safe_mkdir(os.path.join(base_path, "source"))
for arch in archs:
safe_mkdir(os.path.join(base_path, "binary-"+arch))
-
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2010-10-15 10:34:04 +0000
+++ lib/lp/archivepublisher/publishing.py 2010-10-17 10:19:44 +0000
@@ -3,7 +3,6 @@
__all__ = [
'Publisher',
- 'suffixpocket',
'getPublisher',
]
@@ -35,10 +34,7 @@
get_ppa_reference,
RepositoryIndexFile,
)
-from lp.registry.interfaces.pocket import (
- PackagePublishingPocket,
- pocketsuffix,
- )
+from lp.registry.interfaces.pocket import PackagePublishingPocket
from lp.soyuz.enums import (
ArchivePurpose,
ArchiveStatus,
@@ -48,9 +44,6 @@
from lp.soyuz.interfaces.component import IComponentSet
-suffixpocket = dict((v, k) for (k, v) in pocketsuffix.items())
-
-
def reorder_components(components):
"""Return a list of the components provided.
@@ -195,7 +188,7 @@
self.log.debug("* Step A: Publishing packages")
for distroseries in self.distro.series:
- for pocket, suffix in pocketsuffix.items():
+ for pocket in PackagePublishingPocket.items:
if (self.allowed_suites and not (distroseries.name, pocket) in
self.allowed_suites):
self.log.debug(
@@ -235,7 +228,7 @@
# Loop for each pocket in each distroseries:
for distroseries in self.distro.series:
- for pocket, suffix in pocketsuffix.items():
+ for pocket in PackagePublishingPocket.items:
if self.cannotModifySuite(distroseries, pocket):
# We don't want to mark release pockets dirty in a
# stable distroseries, no matter what other bugs
@@ -295,7 +288,7 @@
"""
self.log.debug("* Step C': write indexes directly from DB")
for distroseries in self.distro:
- for pocket, suffix in pocketsuffix.items():
+ for pocket in PackagePublishingPocket.items:
if not is_careful:
if not self.isDirty(distroseries, pocket):
self.log.debug("Skipping index generation for %s/%s" %
@@ -323,8 +316,7 @@
"""
self.log.debug("* Step D: Generating Release files.")
for distroseries in self.distro:
- for pocket, suffix in pocketsuffix.items():
-
+ for pocket in PackagePublishingPocket.items:
if not is_careful:
if not self.isDirty(distroseries, pocket):
self.log.debug("Skipping release files for %s/%s" %
@@ -341,7 +333,7 @@
Write contents using LP info to an extra plain file (Packages.lp
and Sources.lp .
"""
- suite_name = distroseries.name + pocketsuffix[pocket]
+ suite_name = distroseries.getSuite(pocket)
self.log.debug("Generate Indexes for %s/%s"
% (suite_name, component.name))
@@ -475,11 +467,11 @@
else:
drsummary += pocket.name.capitalize()
- full_name = distroseries.getSuite(pocket)
+ suite = distroseries.getSuite(pocket)
release_file = Release()
release_file["Origin"] = self._getOrigin()
release_file["Label"] = self._getLabel()
- release_file["Suite"] = full_name
+ release_file["Suite"] = suite
release_file["Version"] = distroseries.version
release_file["Codename"] = distroseries.name
release_file["Date"] = datetime.utcnow().strftime(
@@ -491,7 +483,7 @@
release_file["Description"] = drsummary
for filename in sorted(list(all_files), key=os.path.dirname):
- entry = self._readIndexFileContents(full_name, filename)
+ entry = self._readIndexFileContents(suite, filename)
if entry is None:
continue
release_file.setdefault("MD5Sum", []).append({
@@ -508,7 +500,7 @@
"size": len(entry)})
f = open(os.path.join(
- self._config.distsroot, full_name, "Release"), "w")
+ self._config.distsroot, suite, "Release"), "w")
try:
release_file.dump(f, "utf-8")
finally:
@@ -521,7 +513,7 @@
# Sign the repository.
archive_signer = IArchiveSigningKey(self.archive)
- archive_signer.signRepository(full_name)
+ archive_signer.signRepository(suite)
def _writeSuiteArchOrSource(self, distroseries, pocket, component,
file_stub, arch_name, arch_path,
=== modified file 'lib/lp/archivepublisher/tests/apt-data/apt.conf'
--- lib/lp/archivepublisher/tests/apt-data/apt.conf 2006-08-24 11:57:44 +0000
+++ lib/lp/archivepublisher/tests/apt-data/apt.conf 2010-10-17 10:19:44 +0000
@@ -37,21 +37,6 @@
}
-tree "dists/breezy-autotest-backports"
-{
- FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_binary-$(ARCH)";
- SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_source";
- Sections "main restricted universe multiverse";
- Architectures "source";
- BinOverride "override.breezy-autotest-backports.$(SECTION)";
- SrcOverride "override.breezy-autotest-backports.$(SECTION).src";
- ExtraOverride "override.breezy-autotest-backports.extra.$(SECTION)";
- Packages::Extensions ".deb";
- BinCacheDB "packages-$(ARCH).db";
- Contents " ";
-}
-
-
tree "dists/breezy-autotest-security"
{
FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-security_$(SECTION)_binary-$(ARCH)";
@@ -97,6 +82,21 @@
}
+tree "dists/breezy-autotest-backports"
+{
+ FileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_binary-$(ARCH)";
+ SourceFileList "/var/tmp/archive/ubuntutest-overrides/breezy-autotest-backports_$(SECTION)_source";
+ Sections "main restricted universe multiverse";
+ Architectures "source";
+ BinOverride "override.breezy-autotest-backports.$(SECTION)";
+ SrcOverride "override.breezy-autotest-backports.$(SECTION).src";
+ ExtraOverride "override.breezy-autotest-backports.extra.$(SECTION)";
+ Packages::Extensions ".deb";
+ BinCacheDB "packages-$(ARCH).db";
+ Contents " ";
+}
+
+
tree "dists/hoary-test"
{
FileList "/var/tmp/archive/ubuntutest-overrides/hoary-test_$(SECTION)_binary-$(ARCH)";
@@ -172,21 +172,6 @@
}
-tree "dists/hoary-test-backports"
-{
- FileList "/var/tmp/archive/ubuntutest-overrides/hoary-test-backports_$(SECTION)_binary-$(ARCH)";
- SourceFileList "/var/tmp/archive/ubuntutest-overrides/hoary-test-backports_$(SECTION)_source";
- Sections "main restricted universe multiverse";
- Architectures "amd64 i386 source";
- BinOverride "override.hoary-test-backports.$(SECTION)";
- SrcOverride "override.hoary-test-backports.$(SECTION).src";
- ExtraOverride "override.hoary-test-backports.extra.$(SECTION)";
- Packages::Extensions ".deb";
- BinCacheDB "packages-$(ARCH).db";
- Contents " ";
-}
-
-
tree "dists/hoary-test-security"
{
FileList "/var/tmp/archive/ubuntutest-overrides/hoary-test-security_$(SECTION)_binary-$(ARCH)";
@@ -231,3 +216,18 @@
Contents " ";
}
+
+tree "dists/hoary-test-backports"
+{
+ FileList "/var/tmp/archive/ubuntutest-overrides/hoary-test-backports_$(SECTION)_binary-$(ARCH)";
+ SourceFileList "/var/tmp/archive/ubuntutest-overrides/hoary-test-backports_$(SECTION)_source";
+ Sections "main restricted universe multiverse";
+ Architectures "amd64 i386 source";
+ BinOverride "override.hoary-test-backports.$(SECTION)";
+ SrcOverride "override.hoary-test-backports.$(SECTION).src";
+ ExtraOverride "override.hoary-test-backports.extra.$(SECTION)";
+ Packages::Extensions ".deb";
+ BinCacheDB "packages-$(ARCH).db";
+ Contents " ";
+}
+
=== modified file 'lib/lp/archivepublisher/tests/test_ftparchive.py'
--- lib/lp/archivepublisher/tests/test_ftparchive.py 2010-10-17 04:13:24 +0000
+++ lib/lp/archivepublisher/tests/test_ftparchive.py 2010-10-17 10:19:44 +0000
@@ -348,6 +348,22 @@
fa.createEmptyPocketRequests(fullpublish=True)
+ # createEmptyPocketRequests creates empty override and file
+ # listings.
+ lists = (
+ 'hoary-test-updates_main_source',
+ 'hoary-test-updates_main_binary-i386',
+ 'hoary-test-updates_main_debian-installer_binary-i386',
+ 'override.hoary-test-updates.main',
+ 'override.hoary-test-updates.extra.main',
+ 'override.hoary-test-updates.main.src',
+ )
+
+ for listname in lists:
+ path = os.path.join(self._config.overrideroot, listname)
+ self.assertTrue(os.path.exists(path))
+ self.assertEquals("", open(path).read())
+
# XXX cprov 2007-03-21: see above, byte-to-byte configuration
# comparing is weak.
apt_conf = fa.generateConfig(fullpublish=True)
=== modified file 'lib/lp/registry/interfaces/pocket.py'
--- lib/lp/registry/interfaces/pocket.py 2010-10-15 10:11:43 +0000
+++ lib/lp/registry/interfaces/pocket.py 2010-10-17 10:19:44 +0000
@@ -12,6 +12,7 @@
__all__ = [
'PackagePublishingPocket',
'pocketsuffix',
+ 'suffixpocket',
]
from lazr.enum import (
@@ -76,3 +77,5 @@
PackagePublishingPocket.PROPOSED: "-proposed",
PackagePublishingPocket.BACKPORTS: "-backports",
}
+
+suffixpocket = dict((v, k) for (k, v) in pocketsuffix.items())
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2010-10-17 04:13:24 +0000
+++ lib/lp/registry/model/distribution.py 2010-10-17 10:19:44 +0000
@@ -129,6 +129,7 @@
validate_public_person,
)
from lp.registry.interfaces.pillar import IPillarNameSet
+from lp.registry.interfaces.pocket import suffixpocket
from lp.registry.interfaces.series import SeriesStatus
from lp.registry.interfaces.sourcepackagename import ISourcePackageName
from lp.registry.model.announcement import MakesAnnouncements
@@ -918,8 +919,6 @@
def getDistroSeriesAndPocket(self, distroseries_name):
"""See `IDistribution`."""
- from lp.archivepublisher.publishing import suffixpocket
-
# Get the list of suffixes.
suffixes = [suffix for suffix, ignored in suffixpocket.items()]
# Sort it longest string first.