def makeIndexFiles(self, script, distroseries): """Create a limited subset of index files for testing.""" ensure_directory_exists(script.config.temproot) for component in distroseries.components: source_index = RepositoryIndexFile( get_sources_path(script.config, distroseries.name, component), script.config.temproot) for spp in distroseries.getSourcePackagePublishing( PackagePublishingPocket.RELEASE, component, distroseries.main_archive): stanza = spp.getIndexStanza().encode("utf-8") + "\n\n" source_index.write(stanza) source_index.close() for arch in distroseries.architectures: package_index = RepositoryIndexFile( get_packages_path( script.config, distroseries.name, component, arch), script.config.temproot) for bpp in distroseries.getBinaryPackagePublishing( arch.architecturetag, PackagePublishingPocket.RELEASE, component, distroseries.main_archive): stanza = bpp.getIndexStanza().encode("utf-8") + "\n\n" package_index.write(stanza) package_index.close()
def _writeComponentIndexes(self, distroseries, pocket, component): """Write Index files for single distroseries + pocket + component. Iterates over all supported architectures and 'sources', no support for installer-* yet. Write contents using LP info to an extra plain file (Packages.lp and Sources.lp . """ suite_name = distroseries.getSuite(pocket) self.log.debug("Generate Indexes for %s/%s" % (suite_name, component.name)) self.log.debug("Generating Sources") source_index = RepositoryIndexFile( get_sources_path(self._config, suite_name, component), self._config.temproot) for spp in distroseries.getSourcePackagePublishing( pocket, component, self.archive): stanza = spp.getIndexStanza().encode('utf8') + '\n\n' source_index.write(stanza) source_index.close() for arch in distroseries.architectures: if not arch.enabled: continue arch_path = 'binary-%s' % arch.architecturetag self.log.debug("Generating Packages for %s" % arch_path) indices = {} indices[None] = RepositoryIndexFile( get_packages_path(self._config, suite_name, component, arch), self._config.temproot) for subcomp in self.subcomponents: indices[subcomp] = RepositoryIndexFile( get_packages_path( self._config, suite_name, component, arch, subcomp), self._config.temproot) for bpp in distroseries.getBinaryPackagePublishing( arch.architecturetag, pocket, component, self.archive): subcomp = FORMAT_TO_SUBCOMPONENT.get( bpp.binarypackagerelease.binpackageformat) if subcomp not in indices: # Skip anything that we're not generating indices # for, eg. ddebs where publish_debug_symbols is # disabled. continue stanza = bpp.getIndexStanza().encode('utf-8') + '\n\n' indices[subcomp].write(stanza) for index in indices.itervalues(): index.close()