Merge lp:~cjwatson/launchpad/xz-indexes into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 17920
Proposed branch: lp:~cjwatson/launchpad/xz-indexes
Merge into: lp:launchpad
Prerequisite: lp:~cjwatson/launchpad/distroseries-publishing-options-2
Diff against target: 1108 lines (+318/-50)
15 files modified
lib/lp/archivepublisher/model/ftparchive.py (+19/-6)
lib/lp/archivepublisher/publishing.py (+7/-5)
lib/lp/archivepublisher/tests/apt-data/apt.conf (+90/-3)
lib/lp/archivepublisher/tests/apt-data/apt_conf_single_empty_suite_test (+15/-3)
lib/lp/archivepublisher/tests/test_ftparchive.py (+1/-1)
lib/lp/archivepublisher/tests/test_publisher.py (+44/-8)
lib/lp/archivepublisher/tests/test_repositoryindexfile.py (+41/-10)
lib/lp/archivepublisher/utils.py (+32/-10)
lib/lp/registry/configure.zcml (+2/-1)
lib/lp/registry/interfaces/distroseries.py (+10/-1)
lib/lp/registry/model/distroseries.py (+25/-0)
lib/lp/registry/tests/test_distroseries.py (+15/-1)
lib/lp/soyuz/enums.py (+15/-1)
setup.py (+1/-0)
versions.cfg (+1/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/xz-indexes
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+285238@code.launchpad.net

Commit message

Make index compression types configurable per-series, and add xz support.

Description of the change

Make index compression types configurable per-series, and add xz support.

I have amd64 and i386 eggs of backports.lzma which I can check into lp-source-dependencies before landing this.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archivepublisher/model/ftparchive.py'
--- lib/lp/archivepublisher/model/ftparchive.py 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/model/ftparchive.py 2016-02-05 20:34:36 +0000
@@ -27,6 +27,7 @@
27from lp.services.osutils import write_file27from lp.services.osutils import write_file
28from lp.soyuz.enums import (28from lp.soyuz.enums import (
29 BinaryPackageFormat,29 BinaryPackageFormat,
30 IndexCompressionType,
30 PackagePublishingStatus,31 PackagePublishingStatus,
31 )32 )
32from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild33from lp.soyuz.model.binarypackagebuild import BinaryPackageBuild
@@ -67,10 +68,7 @@
6768
68Default69Default
69{70{
70 Packages::Compress "gzip bzip2";
71 Sources::Compress "gzip bzip2";
72 Contents::Compress "gzip";71 Contents::Compress "gzip";
73 Translation::Compress "gzip bzip2";
74 DeLinkLimit 0;72 DeLinkLimit 0;
75 MaxContentsChange 12000;73 MaxContentsChange 12000;
76 FileMode 0644;74 FileMode 0644;
@@ -95,6 +93,9 @@
95 SrcOverride "override.%(DISTRORELEASE)s.$(SECTION).src";93 SrcOverride "override.%(DISTRORELEASE)s.$(SECTION).src";
96 %(HIDEEXTRA)sExtraOverride "override.%(DISTRORELEASE)s.extra.$(SECTION)";94 %(HIDEEXTRA)sExtraOverride "override.%(DISTRORELEASE)s.extra.$(SECTION)";
97 Packages::Extensions "%(EXTENSIONS)s";95 Packages::Extensions "%(EXTENSIONS)s";
96 Packages::Compress "%(COMPRESSORS)s";
97 Sources::Compress "%(COMPRESSORS)s";
98 Translation::Compress "%(COMPRESSORS)s";
98 BinCacheDB "packages%(CACHEINSERT)s-$(ARCH).db";99 BinCacheDB "packages%(CACHEINSERT)s-$(ARCH).db";
99 SrcCacheDB "sources%(CACHEINSERT)s.db";100 SrcCacheDB "sources%(CACHEINSERT)s.db";
100 Contents " ";101 Contents " ";
@@ -115,6 +116,13 @@
115116
116CLEANUP_FREQUENCY = 60 * 60 * 24117CLEANUP_FREQUENCY = 60 * 60 * 24
117118
119COMPRESSOR_TO_CONFIG = {
120 IndexCompressionType.UNCOMPRESSED: '.',
121 IndexCompressionType.GZIP: 'gzip',
122 IndexCompressionType.BZIP2: 'bzip2',
123 IndexCompressionType.XZ: 'xz',
124 }
125
118126
119class AptFTPArchiveFailure(Exception):127class AptFTPArchiveFailure(Exception):
120 """Failure while running apt-ftparchive."""128 """Failure while running apt-ftparchive."""
@@ -743,7 +751,8 @@
743751
744 self.writeAptConfig(752 self.writeAptConfig(
745 apt_config, suite, comps, archs,753 apt_config, suite, comps, archs,
746 distroseries.include_long_descriptions)754 distroseries.include_long_descriptions,
755 distroseries.index_compressors)
747756
748 # XXX: 2006-08-24 kiko: Why do we do this directory creation here?757 # XXX: 2006-08-24 kiko: Why do we do this directory creation here?
749 for comp in comps:758 for comp in comps:
@@ -759,8 +768,10 @@
759 component_path, subcomp, "binary-" + arch))768 component_path, subcomp, "binary-" + arch))
760769
761 def writeAptConfig(self, apt_config, suite, comps, archs,770 def writeAptConfig(self, apt_config, suite, comps, archs,
762 include_long_descriptions):771 include_long_descriptions, index_compressors):
763 self.log.debug("Generating apt config for %s" % suite)772 self.log.debug("Generating apt config for %s" % suite)
773 compressors = " ".join(
774 COMPRESSOR_TO_CONFIG[c] for c in index_compressors)
764 apt_config.write(STANZA_TEMPLATE % {775 apt_config.write(STANZA_TEMPLATE % {
765 "LISTPATH": self._config.overrideroot,776 "LISTPATH": self._config.overrideroot,
766 "DISTRORELEASE": suite,777 "DISTRORELEASE": suite,
@@ -769,6 +780,7 @@
769 "ARCHITECTURES": " ".join(archs + ["source"]),780 "ARCHITECTURES": " ".join(archs + ["source"]),
770 "SECTIONS": " ".join(comps),781 "SECTIONS": " ".join(comps),
771 "EXTENSIONS": ".deb",782 "EXTENSIONS": ".deb",
783 "COMPRESSORS": compressors,
772 "CACHEINSERT": "",784 "CACHEINSERT": "",
773 "DISTS": os.path.basename(self._config.distsroot),785 "DISTS": os.path.basename(self._config.distsroot),
774 "HIDEEXTRA": "",786 "HIDEEXTRA": "",
@@ -787,6 +799,7 @@
787 "ARCHITECTURES": " ".join(archs),799 "ARCHITECTURES": " ".join(archs),
788 "SECTIONS": subcomp,800 "SECTIONS": subcomp,
789 "EXTENSIONS": '.%s' % SUBCOMPONENT_TO_EXT[subcomp],801 "EXTENSIONS": '.%s' % SUBCOMPONENT_TO_EXT[subcomp],
802 "COMPRESSORS": compressors,
790 "CACHEINSERT": "-%s" % subcomp,803 "CACHEINSERT": "-%s" % subcomp,
791 "DISTS": os.path.basename(self._config.distsroot),804 "DISTS": os.path.basename(self._config.distsroot),
792 "HIDEEXTRA": "// ",805 "HIDEEXTRA": "// ",
@@ -828,7 +841,7 @@
828 comps.add(comp.name)841 comps.add(comp.name)
829 self.writeAptConfig(842 self.writeAptConfig(
830 apt_config, "nonexistent-suite", sorted(comps), sorted(archs),843 apt_config, "nonexistent-suite", sorted(comps), sorted(archs),
831 True)844 True, [IndexCompressionType.UNCOMPRESSED])
832845
833 with open(apt_config_filename, "w") as fp:846 with open(apt_config_filename, "w") as fp:
834 fp.write(apt_config.getvalue())847 fp.write(apt_config.getvalue())
835848
=== modified file 'lib/lp/archivepublisher/publishing.py'
--- lib/lp/archivepublisher/publishing.py 2016-02-05 02:12:06 +0000
+++ lib/lp/archivepublisher/publishing.py 2016-02-05 20:34:36 +0000
@@ -118,13 +118,15 @@
118 return path[:-len('.gz')]118 return path[:-len('.gz')]
119 elif path.endswith('.bz2'):119 elif path.endswith('.bz2'):
120 return path[:-len('.bz2')]120 return path[:-len('.bz2')]
121 elif path.endswith('.xz'):
122 return path[:-len('.xz')]
121 else:123 else:
122 return path124 return path
123125
124126
125def get_suffixed_indices(path):127def get_suffixed_indices(path):
126 """Return a set of paths to compressed copies of the given index."""128 """Return a set of paths to compressed copies of the given index."""
127 return set([path + suffix for suffix in ('', '.gz', '.bz2')])129 return set([path + suffix for suffix in ('', '.gz', '.bz2', '.xz')])
128130
129131
130def _getDiskPool(pubconf, log):132def _getDiskPool(pubconf, log):
@@ -685,11 +687,11 @@
685 translation_en = RepositoryIndexFile(687 translation_en = RepositoryIndexFile(
686 os.path.join(self._config.distsroot, suite_name,688 os.path.join(self._config.distsroot, suite_name,
687 component.name, "i18n", "Translation-en"),689 component.name, "i18n", "Translation-en"),
688 self._config.temproot)690 self._config.temproot, distroseries.index_compressors)
689691
690 source_index = RepositoryIndexFile(692 source_index = RepositoryIndexFile(
691 get_sources_path(self._config, suite_name, component),693 get_sources_path(self._config, suite_name, component),
692 self._config.temproot)694 self._config.temproot, distroseries.index_compressors)
693695
694 for spp in distroseries.getSourcePackagePublishing(696 for spp in distroseries.getSourcePackagePublishing(
695 pocket, component, self.archive):697 pocket, component, self.archive):
@@ -710,13 +712,13 @@
710 indices = {}712 indices = {}
711 indices[None] = RepositoryIndexFile(713 indices[None] = RepositoryIndexFile(
712 get_packages_path(self._config, suite_name, component, arch),714 get_packages_path(self._config, suite_name, component, arch),
713 self._config.temproot)715 self._config.temproot, distroseries.index_compressors)
714716
715 for subcomp in self.subcomponents:717 for subcomp in self.subcomponents:
716 indices[subcomp] = RepositoryIndexFile(718 indices[subcomp] = RepositoryIndexFile(
717 get_packages_path(719 get_packages_path(
718 self._config, suite_name, component, arch, subcomp),720 self._config, suite_name, component, arch, subcomp),
719 self._config.temproot)721 self._config.temproot, distroseries.index_compressors)
720722
721 for bpp in distroseries.getBinaryPackagePublishing(723 for bpp in distroseries.getBinaryPackagePublishing(
722 arch.architecturetag, pocket, component, self.archive):724 arch.architecturetag, pocket, component, self.archive):
723725
=== modified file 'lib/lp/archivepublisher/tests/apt-data/apt.conf'
--- lib/lp/archivepublisher/tests/apt-data/apt.conf 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/tests/apt-data/apt.conf 2016-02-05 20:34:36 +0000
@@ -8,10 +8,7 @@
88
9Default9Default
10{10{
11 Packages::Compress "gzip bzip2";
12 Sources::Compress "gzip bzip2";
13 Contents::Compress "gzip";11 Contents::Compress "gzip";
14 Translation::Compress "gzip bzip2";
15 DeLinkLimit 0;12 DeLinkLimit 0;
16 MaxContentsChange 12000;13 MaxContentsChange 12000;
17 FileMode 0644;14 FileMode 0644;
@@ -34,6 +31,9 @@
34 SrcOverride "override.hoary-test.$(SECTION).src";31 SrcOverride "override.hoary-test.$(SECTION).src";
35 ExtraOverride "override.hoary-test.extra.$(SECTION)";32 ExtraOverride "override.hoary-test.extra.$(SECTION)";
36 Packages::Extensions ".deb";33 Packages::Extensions ".deb";
34 Packages::Compress "gzip bzip2";
35 Sources::Compress "gzip bzip2";
36 Translation::Compress "gzip bzip2";
37 BinCacheDB "packages-$(ARCH).db";37 BinCacheDB "packages-$(ARCH).db";
38 SrcCacheDB "sources.db";38 SrcCacheDB "sources.db";
39 Contents " ";39 Contents " ";
@@ -51,6 +51,9 @@
51 SrcOverride "override.hoary-test.main.$(SECTION).src";51 SrcOverride "override.hoary-test.main.$(SECTION).src";
52 // ExtraOverride "override.hoary-test.main.extra.$(SECTION)";52 // ExtraOverride "override.hoary-test.main.extra.$(SECTION)";
53 Packages::Extensions ".udeb";53 Packages::Extensions ".udeb";
54 Packages::Compress "gzip bzip2";
55 Sources::Compress "gzip bzip2";
56 Translation::Compress "gzip bzip2";
54 BinCacheDB "packages-debian-installer-$(ARCH).db";57 BinCacheDB "packages-debian-installer-$(ARCH).db";
55 SrcCacheDB "sources-debian-installer.db";58 SrcCacheDB "sources-debian-installer.db";
56 Contents " ";59 Contents " ";
@@ -68,6 +71,9 @@
68 SrcOverride "override.hoary-test.restricted.$(SECTION).src";71 SrcOverride "override.hoary-test.restricted.$(SECTION).src";
69 // ExtraOverride "override.hoary-test.restricted.extra.$(SECTION)";72 // ExtraOverride "override.hoary-test.restricted.extra.$(SECTION)";
70 Packages::Extensions ".udeb";73 Packages::Extensions ".udeb";
74 Packages::Compress "gzip bzip2";
75 Sources::Compress "gzip bzip2";
76 Translation::Compress "gzip bzip2";
71 BinCacheDB "packages-debian-installer-$(ARCH).db";77 BinCacheDB "packages-debian-installer-$(ARCH).db";
72 SrcCacheDB "sources-debian-installer.db";78 SrcCacheDB "sources-debian-installer.db";
73 Contents " ";79 Contents " ";
@@ -85,6 +91,9 @@
85 SrcOverride "override.hoary-test.universe.$(SECTION).src";91 SrcOverride "override.hoary-test.universe.$(SECTION).src";
86 // ExtraOverride "override.hoary-test.universe.extra.$(SECTION)";92 // ExtraOverride "override.hoary-test.universe.extra.$(SECTION)";
87 Packages::Extensions ".udeb";93 Packages::Extensions ".udeb";
94 Packages::Compress "gzip bzip2";
95 Sources::Compress "gzip bzip2";
96 Translation::Compress "gzip bzip2";
88 BinCacheDB "packages-debian-installer-$(ARCH).db";97 BinCacheDB "packages-debian-installer-$(ARCH).db";
89 SrcCacheDB "sources-debian-installer.db";98 SrcCacheDB "sources-debian-installer.db";
90 Contents " ";99 Contents " ";
@@ -102,6 +111,9 @@
102 SrcOverride "override.hoary-test.multiverse.$(SECTION).src";111 SrcOverride "override.hoary-test.multiverse.$(SECTION).src";
103 // ExtraOverride "override.hoary-test.multiverse.extra.$(SECTION)";112 // ExtraOverride "override.hoary-test.multiverse.extra.$(SECTION)";
104 Packages::Extensions ".udeb";113 Packages::Extensions ".udeb";
114 Packages::Compress "gzip bzip2";
115 Sources::Compress "gzip bzip2";
116 Translation::Compress "gzip bzip2";
105 BinCacheDB "packages-debian-installer-$(ARCH).db";117 BinCacheDB "packages-debian-installer-$(ARCH).db";
106 SrcCacheDB "sources-debian-installer.db";118 SrcCacheDB "sources-debian-installer.db";
107 Contents " ";119 Contents " ";
@@ -119,6 +131,9 @@
119 SrcOverride "override.hoary-test-security.$(SECTION).src";131 SrcOverride "override.hoary-test-security.$(SECTION).src";
120 ExtraOverride "override.hoary-test-security.extra.$(SECTION)";132 ExtraOverride "override.hoary-test-security.extra.$(SECTION)";
121 Packages::Extensions ".deb";133 Packages::Extensions ".deb";
134 Packages::Compress "gzip bzip2";
135 Sources::Compress "gzip bzip2";
136 Translation::Compress "gzip bzip2";
122 BinCacheDB "packages-$(ARCH).db";137 BinCacheDB "packages-$(ARCH).db";
123 SrcCacheDB "sources.db";138 SrcCacheDB "sources.db";
124 Contents " ";139 Contents " ";
@@ -136,6 +151,9 @@
136 SrcOverride "override.hoary-test-security.main.$(SECTION).src";151 SrcOverride "override.hoary-test-security.main.$(SECTION).src";
137 // ExtraOverride "override.hoary-test-security.main.extra.$(SECTION)";152 // ExtraOverride "override.hoary-test-security.main.extra.$(SECTION)";
138 Packages::Extensions ".udeb";153 Packages::Extensions ".udeb";
154 Packages::Compress "gzip bzip2";
155 Sources::Compress "gzip bzip2";
156 Translation::Compress "gzip bzip2";
139 BinCacheDB "packages-debian-installer-$(ARCH).db";157 BinCacheDB "packages-debian-installer-$(ARCH).db";
140 SrcCacheDB "sources-debian-installer.db";158 SrcCacheDB "sources-debian-installer.db";
141 Contents " ";159 Contents " ";
@@ -153,6 +171,9 @@
153 SrcOverride "override.hoary-test-security.restricted.$(SECTION).src";171 SrcOverride "override.hoary-test-security.restricted.$(SECTION).src";
154 // ExtraOverride "override.hoary-test-security.restricted.extra.$(SECTION)";172 // ExtraOverride "override.hoary-test-security.restricted.extra.$(SECTION)";
155 Packages::Extensions ".udeb";173 Packages::Extensions ".udeb";
174 Packages::Compress "gzip bzip2";
175 Sources::Compress "gzip bzip2";
176 Translation::Compress "gzip bzip2";
156 BinCacheDB "packages-debian-installer-$(ARCH).db";177 BinCacheDB "packages-debian-installer-$(ARCH).db";
157 SrcCacheDB "sources-debian-installer.db";178 SrcCacheDB "sources-debian-installer.db";
158 Contents " ";179 Contents " ";
@@ -170,6 +191,9 @@
170 SrcOverride "override.hoary-test-security.universe.$(SECTION).src";191 SrcOverride "override.hoary-test-security.universe.$(SECTION).src";
171 // ExtraOverride "override.hoary-test-security.universe.extra.$(SECTION)";192 // ExtraOverride "override.hoary-test-security.universe.extra.$(SECTION)";
172 Packages::Extensions ".udeb";193 Packages::Extensions ".udeb";
194 Packages::Compress "gzip bzip2";
195 Sources::Compress "gzip bzip2";
196 Translation::Compress "gzip bzip2";
173 BinCacheDB "packages-debian-installer-$(ARCH).db";197 BinCacheDB "packages-debian-installer-$(ARCH).db";
174 SrcCacheDB "sources-debian-installer.db";198 SrcCacheDB "sources-debian-installer.db";
175 Contents " ";199 Contents " ";
@@ -187,6 +211,9 @@
187 SrcOverride "override.hoary-test-security.multiverse.$(SECTION).src";211 SrcOverride "override.hoary-test-security.multiverse.$(SECTION).src";
188 // ExtraOverride "override.hoary-test-security.multiverse.extra.$(SECTION)";212 // ExtraOverride "override.hoary-test-security.multiverse.extra.$(SECTION)";
189 Packages::Extensions ".udeb";213 Packages::Extensions ".udeb";
214 Packages::Compress "gzip bzip2";
215 Sources::Compress "gzip bzip2";
216 Translation::Compress "gzip bzip2";
190 BinCacheDB "packages-debian-installer-$(ARCH).db";217 BinCacheDB "packages-debian-installer-$(ARCH).db";
191 SrcCacheDB "sources-debian-installer.db";218 SrcCacheDB "sources-debian-installer.db";
192 Contents " ";219 Contents " ";
@@ -204,6 +231,9 @@
204 SrcOverride "override.hoary-test-updates.$(SECTION).src";231 SrcOverride "override.hoary-test-updates.$(SECTION).src";
205 ExtraOverride "override.hoary-test-updates.extra.$(SECTION)";232 ExtraOverride "override.hoary-test-updates.extra.$(SECTION)";
206 Packages::Extensions ".deb";233 Packages::Extensions ".deb";
234 Packages::Compress "gzip bzip2";
235 Sources::Compress "gzip bzip2";
236 Translation::Compress "gzip bzip2";
207 BinCacheDB "packages-$(ARCH).db";237 BinCacheDB "packages-$(ARCH).db";
208 SrcCacheDB "sources.db";238 SrcCacheDB "sources.db";
209 Contents " ";239 Contents " ";
@@ -221,6 +251,9 @@
221 SrcOverride "override.hoary-test-updates.main.$(SECTION).src";251 SrcOverride "override.hoary-test-updates.main.$(SECTION).src";
222 // ExtraOverride "override.hoary-test-updates.main.extra.$(SECTION)";252 // ExtraOverride "override.hoary-test-updates.main.extra.$(SECTION)";
223 Packages::Extensions ".udeb";253 Packages::Extensions ".udeb";
254 Packages::Compress "gzip bzip2";
255 Sources::Compress "gzip bzip2";
256 Translation::Compress "gzip bzip2";
224 BinCacheDB "packages-debian-installer-$(ARCH).db";257 BinCacheDB "packages-debian-installer-$(ARCH).db";
225 SrcCacheDB "sources-debian-installer.db";258 SrcCacheDB "sources-debian-installer.db";
226 Contents " ";259 Contents " ";
@@ -238,6 +271,9 @@
238 SrcOverride "override.hoary-test-updates.restricted.$(SECTION).src";271 SrcOverride "override.hoary-test-updates.restricted.$(SECTION).src";
239 // ExtraOverride "override.hoary-test-updates.restricted.extra.$(SECTION)";272 // ExtraOverride "override.hoary-test-updates.restricted.extra.$(SECTION)";
240 Packages::Extensions ".udeb";273 Packages::Extensions ".udeb";
274 Packages::Compress "gzip bzip2";
275 Sources::Compress "gzip bzip2";
276 Translation::Compress "gzip bzip2";
241 BinCacheDB "packages-debian-installer-$(ARCH).db";277 BinCacheDB "packages-debian-installer-$(ARCH).db";
242 SrcCacheDB "sources-debian-installer.db";278 SrcCacheDB "sources-debian-installer.db";
243 Contents " ";279 Contents " ";
@@ -255,6 +291,9 @@
255 SrcOverride "override.hoary-test-updates.universe.$(SECTION).src";291 SrcOverride "override.hoary-test-updates.universe.$(SECTION).src";
256 // ExtraOverride "override.hoary-test-updates.universe.extra.$(SECTION)";292 // ExtraOverride "override.hoary-test-updates.universe.extra.$(SECTION)";
257 Packages::Extensions ".udeb";293 Packages::Extensions ".udeb";
294 Packages::Compress "gzip bzip2";
295 Sources::Compress "gzip bzip2";
296 Translation::Compress "gzip bzip2";
258 BinCacheDB "packages-debian-installer-$(ARCH).db";297 BinCacheDB "packages-debian-installer-$(ARCH).db";
259 SrcCacheDB "sources-debian-installer.db";298 SrcCacheDB "sources-debian-installer.db";
260 Contents " ";299 Contents " ";
@@ -272,6 +311,9 @@
272 SrcOverride "override.hoary-test-updates.multiverse.$(SECTION).src";311 SrcOverride "override.hoary-test-updates.multiverse.$(SECTION).src";
273 // ExtraOverride "override.hoary-test-updates.multiverse.extra.$(SECTION)";312 // ExtraOverride "override.hoary-test-updates.multiverse.extra.$(SECTION)";
274 Packages::Extensions ".udeb";313 Packages::Extensions ".udeb";
314 Packages::Compress "gzip bzip2";
315 Sources::Compress "gzip bzip2";
316 Translation::Compress "gzip bzip2";
275 BinCacheDB "packages-debian-installer-$(ARCH).db";317 BinCacheDB "packages-debian-installer-$(ARCH).db";
276 SrcCacheDB "sources-debian-installer.db";318 SrcCacheDB "sources-debian-installer.db";
277 Contents " ";319 Contents " ";
@@ -289,6 +331,9 @@
289 SrcOverride "override.hoary-test-proposed.$(SECTION).src";331 SrcOverride "override.hoary-test-proposed.$(SECTION).src";
290 ExtraOverride "override.hoary-test-proposed.extra.$(SECTION)";332 ExtraOverride "override.hoary-test-proposed.extra.$(SECTION)";
291 Packages::Extensions ".deb";333 Packages::Extensions ".deb";
334 Packages::Compress "gzip bzip2";
335 Sources::Compress "gzip bzip2";
336 Translation::Compress "gzip bzip2";
292 BinCacheDB "packages-$(ARCH).db";337 BinCacheDB "packages-$(ARCH).db";
293 SrcCacheDB "sources.db";338 SrcCacheDB "sources.db";
294 Contents " ";339 Contents " ";
@@ -306,6 +351,9 @@
306 SrcOverride "override.hoary-test-proposed.main.$(SECTION).src";351 SrcOverride "override.hoary-test-proposed.main.$(SECTION).src";
307 // ExtraOverride "override.hoary-test-proposed.main.extra.$(SECTION)";352 // ExtraOverride "override.hoary-test-proposed.main.extra.$(SECTION)";
308 Packages::Extensions ".udeb";353 Packages::Extensions ".udeb";
354 Packages::Compress "gzip bzip2";
355 Sources::Compress "gzip bzip2";
356 Translation::Compress "gzip bzip2";
309 BinCacheDB "packages-debian-installer-$(ARCH).db";357 BinCacheDB "packages-debian-installer-$(ARCH).db";
310 SrcCacheDB "sources-debian-installer.db";358 SrcCacheDB "sources-debian-installer.db";
311 Contents " ";359 Contents " ";
@@ -323,6 +371,9 @@
323 SrcOverride "override.hoary-test-proposed.restricted.$(SECTION).src";371 SrcOverride "override.hoary-test-proposed.restricted.$(SECTION).src";
324 // ExtraOverride "override.hoary-test-proposed.restricted.extra.$(SECTION)";372 // ExtraOverride "override.hoary-test-proposed.restricted.extra.$(SECTION)";
325 Packages::Extensions ".udeb";373 Packages::Extensions ".udeb";
374 Packages::Compress "gzip bzip2";
375 Sources::Compress "gzip bzip2";
376 Translation::Compress "gzip bzip2";
326 BinCacheDB "packages-debian-installer-$(ARCH).db";377 BinCacheDB "packages-debian-installer-$(ARCH).db";
327 SrcCacheDB "sources-debian-installer.db";378 SrcCacheDB "sources-debian-installer.db";
328 Contents " ";379 Contents " ";
@@ -340,6 +391,9 @@
340 SrcOverride "override.hoary-test-proposed.universe.$(SECTION).src";391 SrcOverride "override.hoary-test-proposed.universe.$(SECTION).src";
341 // ExtraOverride "override.hoary-test-proposed.universe.extra.$(SECTION)";392 // ExtraOverride "override.hoary-test-proposed.universe.extra.$(SECTION)";
342 Packages::Extensions ".udeb";393 Packages::Extensions ".udeb";
394 Packages::Compress "gzip bzip2";
395 Sources::Compress "gzip bzip2";
396 Translation::Compress "gzip bzip2";
343 BinCacheDB "packages-debian-installer-$(ARCH).db";397 BinCacheDB "packages-debian-installer-$(ARCH).db";
344 SrcCacheDB "sources-debian-installer.db";398 SrcCacheDB "sources-debian-installer.db";
345 Contents " ";399 Contents " ";
@@ -357,6 +411,9 @@
357 SrcOverride "override.hoary-test-proposed.multiverse.$(SECTION).src";411 SrcOverride "override.hoary-test-proposed.multiverse.$(SECTION).src";
358 // ExtraOverride "override.hoary-test-proposed.multiverse.extra.$(SECTION)";412 // ExtraOverride "override.hoary-test-proposed.multiverse.extra.$(SECTION)";
359 Packages::Extensions ".udeb";413 Packages::Extensions ".udeb";
414 Packages::Compress "gzip bzip2";
415 Sources::Compress "gzip bzip2";
416 Translation::Compress "gzip bzip2";
360 BinCacheDB "packages-debian-installer-$(ARCH).db";417 BinCacheDB "packages-debian-installer-$(ARCH).db";
361 SrcCacheDB "sources-debian-installer.db";418 SrcCacheDB "sources-debian-installer.db";
362 Contents " ";419 Contents " ";
@@ -374,6 +431,9 @@
374 SrcOverride "override.hoary-test-backports.$(SECTION).src";431 SrcOverride "override.hoary-test-backports.$(SECTION).src";
375 ExtraOverride "override.hoary-test-backports.extra.$(SECTION)";432 ExtraOverride "override.hoary-test-backports.extra.$(SECTION)";
376 Packages::Extensions ".deb";433 Packages::Extensions ".deb";
434 Packages::Compress "gzip bzip2";
435 Sources::Compress "gzip bzip2";
436 Translation::Compress "gzip bzip2";
377 BinCacheDB "packages-$(ARCH).db";437 BinCacheDB "packages-$(ARCH).db";
378 SrcCacheDB "sources.db";438 SrcCacheDB "sources.db";
379 Contents " ";439 Contents " ";
@@ -391,6 +451,9 @@
391 SrcOverride "override.hoary-test-backports.main.$(SECTION).src";451 SrcOverride "override.hoary-test-backports.main.$(SECTION).src";
392 // ExtraOverride "override.hoary-test-backports.main.extra.$(SECTION)";452 // ExtraOverride "override.hoary-test-backports.main.extra.$(SECTION)";
393 Packages::Extensions ".udeb";453 Packages::Extensions ".udeb";
454 Packages::Compress "gzip bzip2";
455 Sources::Compress "gzip bzip2";
456 Translation::Compress "gzip bzip2";
394 BinCacheDB "packages-debian-installer-$(ARCH).db";457 BinCacheDB "packages-debian-installer-$(ARCH).db";
395 SrcCacheDB "sources-debian-installer.db";458 SrcCacheDB "sources-debian-installer.db";
396 Contents " ";459 Contents " ";
@@ -408,6 +471,9 @@
408 SrcOverride "override.hoary-test-backports.restricted.$(SECTION).src";471 SrcOverride "override.hoary-test-backports.restricted.$(SECTION).src";
409 // ExtraOverride "override.hoary-test-backports.restricted.extra.$(SECTION)";472 // ExtraOverride "override.hoary-test-backports.restricted.extra.$(SECTION)";
410 Packages::Extensions ".udeb";473 Packages::Extensions ".udeb";
474 Packages::Compress "gzip bzip2";
475 Sources::Compress "gzip bzip2";
476 Translation::Compress "gzip bzip2";
411 BinCacheDB "packages-debian-installer-$(ARCH).db";477 BinCacheDB "packages-debian-installer-$(ARCH).db";
412 SrcCacheDB "sources-debian-installer.db";478 SrcCacheDB "sources-debian-installer.db";
413 Contents " ";479 Contents " ";
@@ -425,6 +491,9 @@
425 SrcOverride "override.hoary-test-backports.universe.$(SECTION).src";491 SrcOverride "override.hoary-test-backports.universe.$(SECTION).src";
426 // ExtraOverride "override.hoary-test-backports.universe.extra.$(SECTION)";492 // ExtraOverride "override.hoary-test-backports.universe.extra.$(SECTION)";
427 Packages::Extensions ".udeb";493 Packages::Extensions ".udeb";
494 Packages::Compress "gzip bzip2";
495 Sources::Compress "gzip bzip2";
496 Translation::Compress "gzip bzip2";
428 BinCacheDB "packages-debian-installer-$(ARCH).db";497 BinCacheDB "packages-debian-installer-$(ARCH).db";
429 SrcCacheDB "sources-debian-installer.db";498 SrcCacheDB "sources-debian-installer.db";
430 Contents " ";499 Contents " ";
@@ -442,6 +511,9 @@
442 SrcOverride "override.hoary-test-backports.multiverse.$(SECTION).src";511 SrcOverride "override.hoary-test-backports.multiverse.$(SECTION).src";
443 // ExtraOverride "override.hoary-test-backports.multiverse.extra.$(SECTION)";512 // ExtraOverride "override.hoary-test-backports.multiverse.extra.$(SECTION)";
444 Packages::Extensions ".udeb";513 Packages::Extensions ".udeb";
514 Packages::Compress "gzip bzip2";
515 Sources::Compress "gzip bzip2";
516 Translation::Compress "gzip bzip2";
445 BinCacheDB "packages-debian-installer-$(ARCH).db";517 BinCacheDB "packages-debian-installer-$(ARCH).db";
446 SrcCacheDB "sources-debian-installer.db";518 SrcCacheDB "sources-debian-installer.db";
447 Contents " ";519 Contents " ";
@@ -459,6 +531,9 @@
459 SrcOverride "override.breezy-autotest.$(SECTION).src";531 SrcOverride "override.breezy-autotest.$(SECTION).src";
460 ExtraOverride "override.breezy-autotest.extra.$(SECTION)";532 ExtraOverride "override.breezy-autotest.extra.$(SECTION)";
461 Packages::Extensions ".deb";533 Packages::Extensions ".deb";
534 Packages::Compress "gzip bzip2";
535 Sources::Compress "gzip bzip2";
536 Translation::Compress "gzip bzip2";
462 BinCacheDB "packages-$(ARCH).db";537 BinCacheDB "packages-$(ARCH).db";
463 SrcCacheDB "sources.db";538 SrcCacheDB "sources.db";
464 Contents " ";539 Contents " ";
@@ -476,6 +551,9 @@
476 SrcOverride "override.breezy-autotest-security.$(SECTION).src";551 SrcOverride "override.breezy-autotest-security.$(SECTION).src";
477 ExtraOverride "override.breezy-autotest-security.extra.$(SECTION)";552 ExtraOverride "override.breezy-autotest-security.extra.$(SECTION)";
478 Packages::Extensions ".deb";553 Packages::Extensions ".deb";
554 Packages::Compress "gzip bzip2";
555 Sources::Compress "gzip bzip2";
556 Translation::Compress "gzip bzip2";
479 BinCacheDB "packages-$(ARCH).db";557 BinCacheDB "packages-$(ARCH).db";
480 SrcCacheDB "sources.db";558 SrcCacheDB "sources.db";
481 Contents " ";559 Contents " ";
@@ -493,6 +571,9 @@
493 SrcOverride "override.breezy-autotest-updates.$(SECTION).src";571 SrcOverride "override.breezy-autotest-updates.$(SECTION).src";
494 ExtraOverride "override.breezy-autotest-updates.extra.$(SECTION)";572 ExtraOverride "override.breezy-autotest-updates.extra.$(SECTION)";
495 Packages::Extensions ".deb";573 Packages::Extensions ".deb";
574 Packages::Compress "gzip bzip2";
575 Sources::Compress "gzip bzip2";
576 Translation::Compress "gzip bzip2";
496 BinCacheDB "packages-$(ARCH).db";577 BinCacheDB "packages-$(ARCH).db";
497 SrcCacheDB "sources.db";578 SrcCacheDB "sources.db";
498 Contents " ";579 Contents " ";
@@ -510,6 +591,9 @@
510 SrcOverride "override.breezy-autotest-proposed.$(SECTION).src";591 SrcOverride "override.breezy-autotest-proposed.$(SECTION).src";
511 ExtraOverride "override.breezy-autotest-proposed.extra.$(SECTION)";592 ExtraOverride "override.breezy-autotest-proposed.extra.$(SECTION)";
512 Packages::Extensions ".deb";593 Packages::Extensions ".deb";
594 Packages::Compress "gzip bzip2";
595 Sources::Compress "gzip bzip2";
596 Translation::Compress "gzip bzip2";
513 BinCacheDB "packages-$(ARCH).db";597 BinCacheDB "packages-$(ARCH).db";
514 SrcCacheDB "sources.db";598 SrcCacheDB "sources.db";
515 Contents " ";599 Contents " ";
@@ -527,6 +611,9 @@
527 SrcOverride "override.breezy-autotest-backports.$(SECTION).src";611 SrcOverride "override.breezy-autotest-backports.$(SECTION).src";
528 ExtraOverride "override.breezy-autotest-backports.extra.$(SECTION)";612 ExtraOverride "override.breezy-autotest-backports.extra.$(SECTION)";
529 Packages::Extensions ".deb";613 Packages::Extensions ".deb";
614 Packages::Compress "gzip bzip2";
615 Sources::Compress "gzip bzip2";
616 Translation::Compress "gzip bzip2";
530 BinCacheDB "packages-$(ARCH).db";617 BinCacheDB "packages-$(ARCH).db";
531 SrcCacheDB "sources.db";618 SrcCacheDB "sources.db";
532 Contents " ";619 Contents " ";
533620
=== modified file 'lib/lp/archivepublisher/tests/apt-data/apt_conf_single_empty_suite_test'
--- lib/lp/archivepublisher/tests/apt-data/apt_conf_single_empty_suite_test 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/tests/apt-data/apt_conf_single_empty_suite_test 2016-02-05 20:34:36 +0000
@@ -8,10 +8,7 @@
88
9Default9Default
10{10{
11 Packages::Compress "gzip bzip2";
12 Sources::Compress "gzip bzip2";
13 Contents::Compress "gzip";11 Contents::Compress "gzip";
14 Translation::Compress "gzip bzip2";
15 DeLinkLimit 0;12 DeLinkLimit 0;
16 MaxContentsChange 12000;13 MaxContentsChange 12000;
17 FileMode 0644;14 FileMode 0644;
@@ -34,6 +31,9 @@
34 SrcOverride "override.hoary-test-updates.$(SECTION).src";31 SrcOverride "override.hoary-test-updates.$(SECTION).src";
35 ExtraOverride "override.hoary-test-updates.extra.$(SECTION)";32 ExtraOverride "override.hoary-test-updates.extra.$(SECTION)";
36 Packages::Extensions ".deb";33 Packages::Extensions ".deb";
34 Packages::Compress "gzip bzip2";
35 Sources::Compress "gzip bzip2";
36 Translation::Compress "gzip bzip2";
37 BinCacheDB "packages-$(ARCH).db";37 BinCacheDB "packages-$(ARCH).db";
38 SrcCacheDB "sources.db";38 SrcCacheDB "sources.db";
39 Contents " ";39 Contents " ";
@@ -51,6 +51,9 @@
51 SrcOverride "override.hoary-test-updates.main.$(SECTION).src";51 SrcOverride "override.hoary-test-updates.main.$(SECTION).src";
52 // ExtraOverride "override.hoary-test-updates.main.extra.$(SECTION)";52 // ExtraOverride "override.hoary-test-updates.main.extra.$(SECTION)";
53 Packages::Extensions ".udeb";53 Packages::Extensions ".udeb";
54 Packages::Compress "gzip bzip2";
55 Sources::Compress "gzip bzip2";
56 Translation::Compress "gzip bzip2";
54 BinCacheDB "packages-debian-installer-$(ARCH).db";57 BinCacheDB "packages-debian-installer-$(ARCH).db";
55 SrcCacheDB "sources-debian-installer.db";58 SrcCacheDB "sources-debian-installer.db";
56 Contents " ";59 Contents " ";
@@ -68,6 +71,9 @@
68 SrcOverride "override.hoary-test-updates.restricted.$(SECTION).src";71 SrcOverride "override.hoary-test-updates.restricted.$(SECTION).src";
69 // ExtraOverride "override.hoary-test-updates.restricted.extra.$(SECTION)";72 // ExtraOverride "override.hoary-test-updates.restricted.extra.$(SECTION)";
70 Packages::Extensions ".udeb";73 Packages::Extensions ".udeb";
74 Packages::Compress "gzip bzip2";
75 Sources::Compress "gzip bzip2";
76 Translation::Compress "gzip bzip2";
71 BinCacheDB "packages-debian-installer-$(ARCH).db";77 BinCacheDB "packages-debian-installer-$(ARCH).db";
72 SrcCacheDB "sources-debian-installer.db";78 SrcCacheDB "sources-debian-installer.db";
73 Contents " ";79 Contents " ";
@@ -85,6 +91,9 @@
85 SrcOverride "override.hoary-test-updates.universe.$(SECTION).src";91 SrcOverride "override.hoary-test-updates.universe.$(SECTION).src";
86 // ExtraOverride "override.hoary-test-updates.universe.extra.$(SECTION)";92 // ExtraOverride "override.hoary-test-updates.universe.extra.$(SECTION)";
87 Packages::Extensions ".udeb";93 Packages::Extensions ".udeb";
94 Packages::Compress "gzip bzip2";
95 Sources::Compress "gzip bzip2";
96 Translation::Compress "gzip bzip2";
88 BinCacheDB "packages-debian-installer-$(ARCH).db";97 BinCacheDB "packages-debian-installer-$(ARCH).db";
89 SrcCacheDB "sources-debian-installer.db";98 SrcCacheDB "sources-debian-installer.db";
90 Contents " ";99 Contents " ";
@@ -102,6 +111,9 @@
102 SrcOverride "override.hoary-test-updates.multiverse.$(SECTION).src";111 SrcOverride "override.hoary-test-updates.multiverse.$(SECTION).src";
103 // ExtraOverride "override.hoary-test-updates.multiverse.extra.$(SECTION)";112 // ExtraOverride "override.hoary-test-updates.multiverse.extra.$(SECTION)";
104 Packages::Extensions ".udeb";113 Packages::Extensions ".udeb";
114 Packages::Compress "gzip bzip2";
115 Sources::Compress "gzip bzip2";
116 Translation::Compress "gzip bzip2";
105 BinCacheDB "packages-debian-installer-$(ARCH).db";117 BinCacheDB "packages-debian-installer-$(ARCH).db";
106 SrcCacheDB "sources-debian-installer.db";118 SrcCacheDB "sources-debian-installer.db";
107 Contents " ";119 Contents " ";
108120
=== modified file 'lib/lp/archivepublisher/tests/test_ftparchive.py'
--- lib/lp/archivepublisher/tests/test_ftparchive.py 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/tests/test_ftparchive.py 2016-02-05 20:34:36 +0000
@@ -459,7 +459,7 @@
459 # Test that a publisher run now will generate an empty apt459 # Test that a publisher run now will generate an empty apt
460 # config and nothing else.460 # config and nothing else.
461 apt_conf = fa.generateConfig()461 apt_conf = fa.generateConfig()
462 assert len(file(apt_conf).readlines()) == 25462 self.assertEqual(22, len(file(apt_conf).readlines()))
463463
464 # XXX cprov 2007-03-21: see above, do not run a-f on dev machines.464 # XXX cprov 2007-03-21: see above, do not run a-f on dev machines.
465 fa.runApt(apt_conf)465 fa.runApt(apt_conf)
466466
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2016-02-05 20:34:36 +0000
@@ -18,6 +18,10 @@
18import time18import time
1919
20from debian.deb822 import Release20from debian.deb822 import Release
21try:
22 import lzma
23except ImportError:
24 from backports import lzma
21from testtools.matchers import ContainsAll25from testtools.matchers import ContainsAll
22import transaction26import transaction
23from zope.component import getUtility27from zope.component import getUtility
@@ -56,6 +60,7 @@
56 ArchivePurpose,60 ArchivePurpose,
57 ArchiveStatus,61 ArchiveStatus,
58 BinaryPackageFormat,62 BinaryPackageFormat,
63 IndexCompressionType,
59 PackagePublishingStatus,64 PackagePublishingStatus,
60 PackageUploadStatus,65 PackageUploadStatus,
61 )66 )
@@ -1014,11 +1019,10 @@
1014 """Assert that the various compressed versions of a file are equal.1019 """Assert that the various compressed versions of a file are equal.
10151020
1016 Check that the various versions of a compressed file, such as1021 Check that the various versions of a compressed file, such as
1017 Packages.gz/Packages.bz2 and Sources.gz/Sources.bz2, and bz21022 Packages.{gz,bz2,xz} and Sources.{gz,bz2,xz} all have identical
1018 variations, all have identical contents. The file paths are1023 contents. The file paths are relative to breezy-autotest/main under
1019 relative to breezy-autotest/main under the archive_publisher's1024 the archive_publisher's configured dist root. 'breezy-autotest' is
1020 configured dist root. 'breezy-autotest' is our test distroseries1025 our test distroseries name.
1021 name.
10221026
1023 The contents of the uncompressed file is returned as a list of lines1027 The contents of the uncompressed file is returned as a list of lines
1024 in the file.1028 in the file.
@@ -1033,6 +1037,8 @@
1033 open_func = gzip.open1037 open_func = gzip.open
1034 elif suffix == '.bz2':1038 elif suffix == '.bz2':
1035 open_func = bz2.BZ2File1039 open_func = bz2.BZ2File
1040 elif suffix == '.xz':
1041 open_func = lzma.LZMAFile
1036 else:1042 else:
1037 open_func = open1043 open_func = open
1038 with open_func(index_base_path + suffix) as index_file:1044 with open_func(index_base_path + suffix) as index_file:
@@ -1044,7 +1050,7 @@
1044 return all_contents[0]1050 return all_contents[0]
10451051
1046 def setupPPAArchiveIndexTest(self, long_descriptions=True,1052 def setupPPAArchiveIndexTest(self, long_descriptions=True,
1047 feature_flag=False):1053 feature_flag=False, index_compressors=None):
1048 # Setup for testPPAArchiveIndex tests1054 # Setup for testPPAArchiveIndex tests
1049 allowed_suites = []1055 allowed_suites = []
10501056
@@ -1082,10 +1088,12 @@
1082 self.assertEqual('enabled', getFeatureFlag(1088 self.assertEqual('enabled', getFeatureFlag(
1083 'soyuz.ppa.separate_long_descriptions'))1089 'soyuz.ppa.separate_long_descriptions'))
10841090
1091 ds = self.ubuntutest.getSeries('breezy-autotest')
1085 if not long_descriptions:1092 if not long_descriptions:
1086 # Make sure that NMAF generates i18n/Translation-en* files.1093 # Make sure that NMAF generates i18n/Translation-en* files.
1087 ds = self.ubuntutest.getSeries('breezy-autotest')
1088 ds.include_long_descriptions = False1094 ds.include_long_descriptions = False
1095 if index_compressors is not None:
1096 ds.index_compressors = index_compressors
10891097
1090 archive_publisher.A_publish(False)1098 archive_publisher.A_publish(False)
1091 self.layer.txn.commit()1099 self.layer.txn.commit()
@@ -1218,6 +1226,8 @@
1218 os.path.join(i18n_path, 'Translation-en.gz')))1226 os.path.join(i18n_path, 'Translation-en.gz')))
1219 self.assertFalse(os.path.exists(1227 self.assertFalse(os.path.exists(
1220 os.path.join(i18n_path, 'Translation-en.bz2')))1228 os.path.join(i18n_path, 'Translation-en.bz2')))
1229 self.assertFalse(os.path.exists(
1230 os.path.join(i18n_path, 'Translation-en.xz')))
12211231
1222 # remove PPA root1232 # remove PPA root
1223 shutil.rmtree(config.personalpackagearchive.root)1233 shutil.rmtree(config.personalpackagearchive.root)
@@ -1237,6 +1247,8 @@
1237 os.path.join(i18n_path, 'Translation-en.gz')))1247 os.path.join(i18n_path, 'Translation-en.gz')))
1238 self.assertFalse(os.path.exists(1248 self.assertFalse(os.path.exists(
1239 os.path.join(i18n_path, 'Translation-en.bz2')))1249 os.path.join(i18n_path, 'Translation-en.bz2')))
1250 self.assertFalse(os.path.exists(
1251 os.path.join(i18n_path, 'Translation-en.xz')))
12401252
1241 # remove PPA root1253 # remove PPA root
1242 shutil.rmtree(config.personalpackagearchive.root)1254 shutil.rmtree(config.personalpackagearchive.root)
@@ -1401,10 +1413,32 @@
1401 with open(release_path) as release_file:1413 with open(release_path) as release_file:
1402 content = release_file.read()1414 content = release_file.read()
1403 self.assertIn('main/i18n/Translation-en.bz2', content)1415 self.assertIn('main/i18n/Translation-en.bz2', content)
1416 self.assertIn('main/i18n/Translation-en.gz', content)
14041417
1405 # remove PPA root1418 # remove PPA root
1406 shutil.rmtree(config.personalpackagearchive.root)1419 shutil.rmtree(config.personalpackagearchive.root)
14071420
1421 def testPPAArchiveIndexCompressors(self):
1422 # Archive index generation honours DistroSeries.index_compressors.
1423 archive_publisher = self.setupPPAArchiveIndexTest(
1424 long_descriptions=False, feature_flag=True,
1425 index_compressors=[
1426 IndexCompressionType.UNCOMPRESSED, IndexCompressionType.XZ])
1427 suite_path = os.path.join(
1428 archive_publisher._config.distsroot, 'breezy-autotest', 'main')
1429 for uncompressed_file_path in (
1430 os.path.join('source', 'Sources'),
1431 os.path.join('binary-i386', 'Packages'),
1432 os.path.join('debian-installer', 'binary-i386', 'Packages'),
1433 os.path.join('debug', 'binary-i386', 'Packages'),
1434 os.path.join('i18n', 'Translation-en'),
1435 ):
1436 for suffix in ('bz2', 'gz'):
1437 self.assertFalse(os.path.exists(os.path.join(
1438 suite_path, '%s.%s' % (uncompressed_file_path, suffix))))
1439 self._checkCompressedFiles(
1440 archive_publisher, uncompressed_file_path, ['.xz'])
1441
1408 def checkDirtyPockets(self, publisher, expected):1442 def checkDirtyPockets(self, publisher, expected):
1409 """Check dirty_pockets contents of a given publisher."""1443 """Check dirty_pockets contents of a given publisher."""
1410 sorted_dirty_pockets = sorted(list(publisher.dirty_pockets))1444 sorted_dirty_pockets = sorted(list(publisher.dirty_pockets))
@@ -1768,6 +1802,7 @@
1768 content = release_file.read()1802 content = release_file.read()
1769 for component in components:1803 for component in components:
1770 self.assertIn(component + '/i18n/Translation-en.bz2', content)1804 self.assertIn(component + '/i18n/Translation-en.bz2', content)
1805 self.assertIn(component + '/i18n/Translation-en.gz', content)
17711806
1772 def testReleaseFileForContents(self):1807 def testReleaseFileForContents(self):
1773 """Test Release file writing for Contents files."""1808 """Test Release file writing for Contents files."""
@@ -1942,7 +1977,8 @@
19421977
1943 # Write compressed versions of a zero-length Translation-en file.1978 # Write compressed versions of a zero-length Translation-en file.
1944 translation_en_index = RepositoryIndexFile(1979 translation_en_index = RepositoryIndexFile(
1945 os.path.join(i18n_root, 'Translation-en'), self.config.temproot)1980 os.path.join(i18n_root, 'Translation-en'), self.config.temproot,
1981 self.ubuntutest['breezy-autotest'].index_compressors)
1946 translation_en_index.close()1982 translation_en_index.close()
19471983
1948 all_files = set()1984 all_files = set()
19491985
=== modified file 'lib/lp/archivepublisher/tests/test_repositoryindexfile.py'
--- lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/tests/test_repositoryindexfile.py 2016-02-05 20:34:36 +0000
@@ -13,7 +13,13 @@
13import tempfile13import tempfile
14import unittest14import unittest
1515
16try:
17 import lzma
18except ImportError:
19 from backports import lzma
20
16from lp.archivepublisher.utils import RepositoryIndexFile21from lp.archivepublisher.utils import RepositoryIndexFile
22from lp.soyuz.enums import IndexCompressionType
1723
1824
19class TestRepositoryArchiveIndex(unittest.TestCase):25class TestRepositoryArchiveIndex(unittest.TestCase):
@@ -32,14 +38,20 @@
32 for path in [self.root, self.temp_root]:38 for path in [self.root, self.temp_root]:
33 shutil.rmtree(path)39 shutil.rmtree(path)
3440
35 def getRepoFile(self, filename):41 def getRepoFile(self, filename, compressors=None):
36 """Return a `RepositoryIndexFile` for the given filename.42 """Return a `RepositoryIndexFile` for the given filename.
3743
38 The `RepositoryIndexFile` is created with the test 'root' and44 The `RepositoryIndexFile` is created with the test 'root' and
39 'temp_root'.45 'temp_root'.
40 """46 """
47 if compressors is None:
48 compressors = [
49 IndexCompressionType.GZIP,
50 IndexCompressionType.BZIP2,
51 IndexCompressionType.XZ,
52 ]
41 return RepositoryIndexFile(53 return RepositoryIndexFile(
42 os.path.join(self.root, filename), self.temp_root)54 os.path.join(self.root, filename), self.temp_root, compressors)
4355
44 def testWorkflow(self):56 def testWorkflow(self):
45 """`RepositoryIndexFile` workflow.57 """`RepositoryIndexFile` workflow.
@@ -58,15 +70,16 @@
58 repo_file = self.getRepoFile('boing')70 repo_file = self.getRepoFile('boing')
5971
60 self.assertEqual(0, len(os.listdir(self.root)))72 self.assertEqual(0, len(os.listdir(self.root)))
61 self.assertEqual(2, len(os.listdir(self.temp_root)))73 self.assertEqual(3, len(os.listdir(self.temp_root)))
6274
63 repo_file.close()75 repo_file.close()
6476
65 self.assertEqual(2, len(os.listdir(self.root)))77 self.assertEqual(3, len(os.listdir(self.root)))
66 self.assertEqual(0, len(os.listdir(self.temp_root)))78 self.assertEqual(0, len(os.listdir(self.temp_root)))
6779
68 resulting_files = sorted(os.listdir(self.root))80 resulting_files = sorted(os.listdir(self.root))
69 self.assertEqual(['boing.bz2', 'boing.gz'], resulting_files)81 self.assertEqual(
82 ['boing.bz2', 'boing.gz', 'boing.xz'], resulting_files)
7083
71 for filename in resulting_files:84 for filename in resulting_files:
72 file_path = os.path.join(self.root, filename)85 file_path = os.path.join(self.root, filename)
@@ -89,10 +102,21 @@
89 gzip_content = gzip.open(os.path.join(self.root, 'boing.gz')).read()102 gzip_content = gzip.open(os.path.join(self.root, 'boing.gz')).read()
90 bz2_content = bz2.decompress(103 bz2_content = bz2.decompress(
91 open(os.path.join(self.root, 'boing.bz2')).read())104 open(os.path.join(self.root, 'boing.bz2')).read())
105 xz_content = lzma.open(os.path.join(self.root, 'boing.xz')).read()
92106
93 self.assertEqual(gzip_content, bz2_content)107 self.assertEqual(gzip_content, bz2_content)
108 self.assertEqual(gzip_content, xz_content)
94 self.assertEqual('hello', gzip_content)109 self.assertEqual('hello', gzip_content)
95110
111 def testCompressors(self):
112 """`RepositoryIndexFile` honours the supplied list of compressors."""
113 repo_file = self.getRepoFile(
114 'boing',
115 compressors=[
116 IndexCompressionType.UNCOMPRESSED, IndexCompressionType.XZ])
117 repo_file.close()
118 self.assertEqual(['boing', 'boing.xz'], sorted(os.listdir(self.root)))
119
96 def testUnreferencing(self):120 def testUnreferencing(self):
97 """`RepositoryIndexFile` unreferencing.121 """`RepositoryIndexFile` unreferencing.
98122
@@ -102,7 +126,7 @@
102 repo_file = self.getRepoFile('boing')126 repo_file = self.getRepoFile('boing')
103127
104 self.assertEqual(0, len(os.listdir(self.root)))128 self.assertEqual(0, len(os.listdir(self.root)))
105 self.assertEqual(2, len(os.listdir(self.temp_root)))129 self.assertEqual(3, len(os.listdir(self.temp_root)))
106130
107 del repo_file131 del repo_file
108132
@@ -112,15 +136,20 @@
112 def testRootCreation(self):136 def testRootCreation(self):
113 """`RepositoryIndexFile` creates given 'root' path if necessary."""137 """`RepositoryIndexFile` creates given 'root' path if necessary."""
114 missing_root = os.path.join(self.root, 'donotexist')138 missing_root = os.path.join(self.root, 'donotexist')
139 compressors = [
140 IndexCompressionType.GZIP,
141 IndexCompressionType.BZIP2,
142 IndexCompressionType.XZ,
143 ]
115 repo_file = RepositoryIndexFile(144 repo_file = RepositoryIndexFile(
116 os.path.join(missing_root, 'boing'), self.temp_root)145 os.path.join(missing_root, 'boing'), self.temp_root, compressors)
117146
118 self.assertFalse(os.path.exists(missing_root))147 self.assertFalse(os.path.exists(missing_root))
119148
120 repo_file.close()149 repo_file.close()
121150
122 self.assertEqual(151 self.assertEqual(
123 ['boing.bz2', 'boing.gz'],152 ['boing.bz2', 'boing.gz', 'boing.xz'],
124 sorted(os.listdir(missing_root)))153 sorted(os.listdir(missing_root)))
125154
126 def testMissingTempRoot(self):155 def testMissingTempRoot(self):
@@ -128,7 +157,8 @@
128 missing_temp_root = os.path.join(self.temp_root, 'donotexist')157 missing_temp_root = os.path.join(self.temp_root, 'donotexist')
129 self.assertRaises(158 self.assertRaises(
130 AssertionError, RepositoryIndexFile,159 AssertionError, RepositoryIndexFile,
131 os.path.join(self.root, 'boing'), missing_temp_root)160 os.path.join(self.root, 'boing'), missing_temp_root,
161 [IndexCompressionType.UNCOMPRESSED])
132162
133 def testRemoveOld(self):163 def testRemoveOld(self):
134 """`RepositoryIndexFile` removes old index files."""164 """`RepositoryIndexFile` removes old index files."""
@@ -139,4 +169,5 @@
139 repo_file = self.getRepoFile('boing')169 repo_file = self.getRepoFile('boing')
140 repo_file.close()170 repo_file.close()
141 self.assertEqual(171 self.assertEqual(
142 ['boing.bz2', 'boing.gz'], sorted(os.listdir(self.root)))172 ['boing.bz2', 'boing.gz', 'boing.xz'],
173 sorted(os.listdir(self.root)))
143174
=== modified file 'lib/lp/archivepublisher/utils.py'
--- lib/lp/archivepublisher/utils.py 2016-02-04 19:46:52 +0000
+++ lib/lp/archivepublisher/utils.py 2016-02-05 20:34:36 +0000
@@ -17,7 +17,15 @@
17import stat17import stat
18import tempfile18import tempfile
1919
20from lp.soyuz.enums import ArchivePurpose20try:
21 import lzma
22except ImportError:
23 from backports import lzma
24
25from lp.soyuz.enums import (
26 ArchivePurpose,
27 IndexCompressionType,
28 )
21from lp.soyuz.interfaces.archive import default_name_by_purpose29from lp.soyuz.interfaces.archive import default_name_by_purpose
2230
2331
@@ -38,6 +46,8 @@
3846
39class PlainTempFile:47class PlainTempFile:
4048
49 # Enumerated identifier.
50 compression_type = IndexCompressionType.UNCOMPRESSED
41 # Filename suffix.51 # Filename suffix.
42 suffix = ''52 suffix = ''
43 # File path built on initialization.53 # File path built on initialization.
@@ -71,6 +81,7 @@
7181
7282
73class GzipTempFile(PlainTempFile):83class GzipTempFile(PlainTempFile):
84 compression_type = IndexCompressionType.GZIP
74 suffix = '.gz'85 suffix = '.gz'
7586
76 def _buildFile(self, fd):87 def _buildFile(self, fd):
@@ -78,6 +89,7 @@
7889
7990
80class Bzip2TempFile(PlainTempFile):91class Bzip2TempFile(PlainTempFile):
92 compression_type = IndexCompressionType.BZIP2
81 suffix = '.bz2'93 suffix = '.bz2'
8294
83 def _buildFile(self, fd):95 def _buildFile(self, fd):
@@ -85,14 +97,23 @@
85 return bz2.BZ2File(self.path, mode='wb')97 return bz2.BZ2File(self.path, mode='wb')
8698
8799
100class XZTempFile(PlainTempFile):
101 compression_type = IndexCompressionType.XZ
102 suffix = '.xz'
103
104 def _buildFile(self, fd):
105 os.close(fd)
106 return lzma.LZMAFile(self.path, mode='wb', format=lzma.FORMAT_XZ)
107
108
88class RepositoryIndexFile:109class RepositoryIndexFile:
89 """Facilitates the publication of repository index files.110 """Facilitates the publication of repository index files.
90111
91 It allows callsites to publish index files in different medias112 It allows callsites to publish index files in different medias
92 (plain, gzip and bzip2) transparently and atomically.113 (plain, gzip, bzip2, and xz) transparently and atomically.
93 """114 """
94115
95 def __init__(self, path, temp_root):116 def __init__(self, path, temp_root, compressors):
96 """Store repositories destinations and filename.117 """Store repositories destinations and filename.
97118
98 The given 'temp_root' needs to exist; on the other hand, the119 The given 'temp_root' needs to exist; on the other hand, the
@@ -105,13 +126,14 @@
105 self.root, filename = os.path.split(path)126 self.root, filename = os.path.split(path)
106 assert os.path.exists(temp_root), 'Temporary root does not exist.'127 assert os.path.exists(temp_root), 'Temporary root does not exist.'
107128
108 self.index_files = (129 self.index_files = []
109 GzipTempFile(temp_root, filename),130 self.old_index_files = []
110 Bzip2TempFile(temp_root, filename),131 for cls in (PlainTempFile, GzipTempFile, Bzip2TempFile, XZTempFile):
111 )132 if cls.compression_type in compressors:
112 self.old_index_files = (133 self.index_files.append(cls(temp_root, filename))
113 PlainTempFile(temp_root, filename, auto_open=False),134 else:
114 )135 self.old_index_files.append(
136 cls(temp_root, filename, auto_open=False))
115137
116 def write(self, content):138 def write(self, content):
117 """Write contents to all target medias."""139 """Write contents to all target medias."""
118140
=== modified file 'lib/lp/registry/configure.zcml'
--- lib/lp/registry/configure.zcml 2016-01-26 15:47:37 +0000
+++ lib/lp/registry/configure.zcml 2016-02-05 20:34:36 +0000
@@ -1,4 +1,4 @@
1<!-- Copyright 2009-2015 Canonical Ltd. This software is licensed under the1<!-- Copyright 2009-2016 Canonical Ltd. This software is licensed under the
2 GNU Affero General Public License version 3 (see the file LICENSE).2 GNU Affero General Public License version 3 (see the file LICENSE).
3-->3-->
44
@@ -317,6 +317,7 @@
317 driver317 driver
318 backports_not_automatic318 backports_not_automatic
319 include_long_descriptions319 include_long_descriptions
320 index_compressors
320 inherit_overrides_from_parents"/>321 inherit_overrides_from_parents"/>
321322
322 <!-- NB: check with SABDFL before modifying these, there is potential to323 <!-- NB: check with SABDFL before modifying these, there is potential to
323324
=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py 2015-10-13 13:22:08 +0000
+++ lib/lp/registry/interfaces/distroseries.py 2016-02-05 20:34:36 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the1# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Interfaces including and related to IDistroSeries."""4"""Interfaces including and related to IDistroSeries."""
@@ -91,6 +91,7 @@
91 UniqueField,91 UniqueField,
92 )92 )
93from lp.services.webservice.apihelpers import patch_plain_parameter_type93from lp.services.webservice.apihelpers import patch_plain_parameter_type
94from lp.soyuz.enums import IndexCompressionType
94from lp.soyuz.interfaces.buildrecords import IHasBuildRecords95from lp.soyuz.interfaces.buildrecords import IHasBuildRecords
95from lp.translations.interfaces.hastranslationimports import (96from lp.translations.interfaces.hastranslationimports import (
96 IHasTranslationImports,97 IHasTranslationImports,
@@ -378,6 +379,14 @@
378 on clients, which requires downloading Packages files for379 on clients, which requires downloading Packages files for
379 multiple architectures.""")))380 multiple architectures.""")))
380381
382 index_compressors = exported(List(
383 value_type=Choice(vocabulary=IndexCompressionType),
384 title=_("Compression types to use for published index files"),
385 required=True,
386 description=_("""
387 A list of compression types to use for published index files
388 (Packages, Sources, etc.).""")))
389
381 inherit_overrides_from_parents = Bool(390 inherit_overrides_from_parents = Bool(
382 title=_("Inherit overrides from parents"),391 title=_("Inherit overrides from parents"),
383 readonly=False, required=True)392 readonly=False, required=True)
384393
=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py 2016-02-05 20:34:36 +0000
+++ lib/lp/registry/model/distroseries.py 2016-02-05 20:34:36 +0000
@@ -124,6 +124,7 @@
124from lp.services.worlddata.model.language import Language124from lp.services.worlddata.model.language import Language
125from lp.soyuz.enums import (125from lp.soyuz.enums import (
126 ArchivePurpose,126 ArchivePurpose,
127 IndexCompressionType,
127 PackagePublishingStatus,128 PackagePublishingStatus,
128 PackageUploadStatus,129 PackageUploadStatus,
129 )130 )
@@ -202,6 +203,12 @@
202 ]203 ]
203204
204205
206DEFAULT_INDEX_COMPRESSORS = [
207 IndexCompressionType.GZIP,
208 IndexCompressionType.BZIP2,
209 ]
210
211
205@implementer(212@implementer(
206 IBugSummaryDimension, IDistroSeries, IHasBuildRecords, IHasQueueItems,213 IBugSummaryDimension, IDistroSeries, IHasBuildRecords, IHasQueueItems,
207 IServiceUsage, ISeriesBugTarget)214 IServiceUsage, ISeriesBugTarget)
@@ -266,6 +273,9 @@
266 kwargs["publishing_options"] = {273 kwargs["publishing_options"] = {
267 "backports_not_automatic": False,274 "backports_not_automatic": False,
268 "include_long_descriptions": True,275 "include_long_descriptions": True,
276 "index_compressors": [
277 compressor.title
278 for compressor in DEFAULT_INDEX_COMPRESSORS],
269 }279 }
270 super(DistroSeries, self).__init__(*args, **kwargs)280 super(DistroSeries, self).__init__(*args, **kwargs)
271281
@@ -816,6 +826,21 @@
816 assert isinstance(value, bool)826 assert isinstance(value, bool)
817 self.publishing_options["include_long_descriptions"] = value827 self.publishing_options["include_long_descriptions"] = value
818828
829 @property
830 def index_compressors(self):
831 if "index_compressors" in self.publishing_options:
832 return [
833 IndexCompressionType.getTermByToken(name).value
834 for name in self.publishing_options["index_compressors"]]
835 else:
836 return list(DEFAULT_INDEX_COMPRESSORS)
837
838 @index_compressors.setter
839 def index_compressors(self, value):
840 assert isinstance(value, list)
841 self.publishing_options["index_compressors"] = [
842 compressor.title for compressor in value]
843
819 def _customizeSearchParams(self, search_params):844 def _customizeSearchParams(self, search_params):
820 """Customize `search_params` for this distribution series."""845 """Customize `search_params` for this distribution series."""
821 search_params.setDistroSeries(self)846 search_params.setDistroSeries(self)
822847
=== modified file 'lib/lp/registry/tests/test_distroseries.py'
--- lib/lp/registry/tests/test_distroseries.py 2015-12-15 14:12:25 +0000
+++ lib/lp/registry/tests/test_distroseries.py 2016-02-05 20:34:36 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2015 Canonical Ltd. This software is licensed under the1# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for distroseries."""4"""Tests for distroseries."""
@@ -29,6 +29,7 @@
29from lp.services.webapp.interfaces import OAuthPermission29from lp.services.webapp.interfaces import OAuthPermission
30from lp.soyuz.enums import (30from lp.soyuz.enums import (
31 ArchivePurpose,31 ArchivePurpose,
32 IndexCompressionType,
32 PackagePublishingStatus,33 PackagePublishingStatus,
33 )34 )
34from lp.soyuz.interfaces.archive import IArchiveSet35from lp.soyuz.interfaces.archive import IArchiveSet
@@ -369,6 +370,19 @@
369 self.assertFalse(370 self.assertFalse(
370 naked_distroseries.publishing_options["include_long_descriptions"])371 naked_distroseries.publishing_options["include_long_descriptions"])
371372
373 def test_index_compressors(self):
374 distroseries = self.factory.makeDistroSeries()
375 self.assertEqual(
376 [IndexCompressionType.GZIP, IndexCompressionType.BZIP2],
377 distroseries.index_compressors)
378 with admin_logged_in():
379 distroseries.index_compressors = [IndexCompressionType.XZ]
380 self.assertEqual(
381 [IndexCompressionType.XZ], distroseries.index_compressors)
382 naked_distroseries = removeSecurityProxy(distroseries)
383 self.assertEqual(
384 ["xz"], naked_distroseries.publishing_options["index_compressors"])
385
372386
373class TestDistroSeriesPackaging(TestCaseWithFactory):387class TestDistroSeriesPackaging(TestCaseWithFactory):
374388
375389
=== modified file 'lib/lp/soyuz/enums.py'
--- lib/lp/soyuz/enums.py 2015-09-03 15:14:07 +0000
+++ lib/lp/soyuz/enums.py 2016-02-05 20:34:36 +0000
@@ -1,4 +1,4 @@
1# Copyright 2010-2015 Canonical Ltd. This software is licensed under the1# Copyright 2010-2016 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Enumerations used in the lp/soyuz modules."""4"""Enumerations used in the lp/soyuz modules."""
@@ -13,6 +13,7 @@
13 'archive_suffixes',13 'archive_suffixes',
14 'BinaryPackageFileType',14 'BinaryPackageFileType',
15 'BinaryPackageFormat',15 'BinaryPackageFormat',
16 'IndexCompressionType',
16 'PackageCopyPolicy',17 'PackageCopyPolicy',
17 'PackageCopyStatus',18 'PackageCopyStatus',
18 'PackageDiffStatus',19 'PackageDiffStatus',
@@ -570,3 +571,16 @@
570 Specifies a native package, with a single tar.*. Supports gzip,571 Specifies a native package, with a single tar.*. Supports gzip,
571 bzip2, and xz compression.572 bzip2, and xz compression.
572 """)573 """)
574
575
576class IndexCompressionType(DBEnumeratedType):
577 """Index compression type
578
579 Archive indexes such as Packages and Sources may be compressed using any
580 of several different schemes.
581 """
582
583 UNCOMPRESSED = DBItem(0, "uncompressed")
584 GZIP = DBItem(1, "gzip")
585 BZIP2 = DBItem(2, "bzip2")
586 XZ = DBItem(3, "xz")
573587
=== modified file 'setup.py'
--- setup.py 2015-11-04 14:30:09 +0000
+++ setup.py 2016-02-05 20:34:36 +0000
@@ -29,6 +29,7 @@
29 'ampoule',29 'ampoule',
30 'auditorclient',30 'auditorclient',
31 'auditorfixture',31 'auditorfixture',
32 'backports.lzma',
32 'BeautifulSoup',33 'BeautifulSoup',
33 'bzr',34 'bzr',
34 'cssselect',35 'cssselect',
3536
=== modified file 'versions.cfg'
--- versions.cfg 2015-12-17 14:51:27 +0000
+++ versions.cfg 2016-02-05 20:34:36 +0000
@@ -15,6 +15,7 @@
15auditor = 0.0.315auditor = 0.0.3
16auditorclient = 0.0.416auditorclient = 0.0.4
17auditorfixture = 0.0.517auditorfixture = 0.0.5
18backports.lzma = 0.0.3
18BeautifulSoup = 3.2.119BeautifulSoup = 3.2.1
19billiard = 3.3.0.2020billiard = 3.3.0.20
20bson = 0.3.321bson = 0.3.3