def _writeSuiteArchOrSource(self, distroseries, pocket, component, file_stub, arch_name, arch_path, all_series_files): """Write out a Release file for an architecture or source.""" # XXX kiko 2006-08-24: Untested method. suite = distroseries.getSuite(pocket) self.log.debug("Writing Release file for %s/%s/%s" % ( suite, component, arch_path)) # Now, grab the actual (non-di) files inside each of # the suite's architectures file_stub = os.path.join(component, arch_path, file_stub) all_series_files.update(get_suffixed_indices(file_stub)) all_series_files.add(os.path.join(component, arch_path, "Release")) release_file = Release() release_file["Archive"] = suite release_file["Version"] = distroseries.version release_file["Component"] = component release_file["Origin"] = self._getOrigin() release_file["Label"] = self._getLabel() release_file["Architecture"] = arch_name with open(os.path.join(self._config.distsroot, suite, component, arch_path, "Release"), "w") as f: release_file.dump(f, "utf-8")
async def write_suite_files( base_path, db, package_info_provider, suite, components, arches, origin, gpg_context ): stamp = mktime(datetime.utcnow().timetuple()) r = Release() r["Origin"] = origin r["Label"] = suite.debian_build.archive_description r["Codename"] = suite.name r["Suite"] = suite.name r["Date"] = formatdate(timeval=stamp, localtime=False, usegmt=True) r["NotAutomatic"] = "yes" r["ButAutomaticUpgrades"] = "yes" r["Architectures"] = " ".join(arches) r["Components"] = " ".join(components) r["Description"] = "Generated by the Debian Janitor" for component in components: logger.debug('Publishing component %s/%s', suite.name, component) component_dir = component os.makedirs(os.path.join(base_path, component_dir), exist_ok=True) for arch in arches: arch_dir = os.path.join(component_dir, "binary-%s" % arch) os.makedirs(os.path.join(base_path, arch_dir), exist_ok=True) br = Release() br["Origin"] = origin br["Label"] = suite.debian_build.archive_description br["Archive"] = suite.name br["Architecture"] = arch br["Component"] = component bp = os.path.join(arch_dir, "Release") with open(os.path.join(base_path, bp), "wb") as f: r.dump(f) add_file_info(r, base_path, bp) packages_path = os.path.join(component, "binary-%s" % arch, "Packages") SUFFIXES = { "": open, ".gz": gzip.GzipFile, ".bz2": bz2.BZ2File, } with ExitStack() as es: fs = [] for suffix, fn in SUFFIXES.items(): fs.append( es.enter_context( fn(os.path.join(base_path, packages_path + suffix), "wb") ) ) async for chunk in get_packages( db, package_info_provider, suite.name, component, arch): for f in fs: f.write(chunk) for suffix in SUFFIXES: add_file_info(r, base_path, packages_path + suffix) await asyncio.sleep(0) await asyncio.sleep(0) logger.debug('Writing Release file for %s', suite.name) with open(os.path.join(base_path, "Release"), "wb") as f: r.dump(f) logger.debug('Writing Release.gpg file for %s', suite.name) data = gpg.Data(r.dump()) with open(os.path.join(base_path, "Release.gpg"), "wb") as f: signature, result = gpg_context.sign(data, mode=gpg_mode.DETACH) f.write(signature) logger.debug('Writing InRelease file for %s', suite.name) data = gpg.Data(r.dump()) with open(os.path.join(base_path, "InRelease"), "wb") as f: signature, result = gpg_context.sign(data, mode=gpg_mode.CLEAR) f.write(signature)