diff --git a/pungi/metadata.py b/pungi/metadata.py index bb922cc3..b3e895cd 100644 --- a/pungi/metadata.py +++ b/pungi/metadata.py @@ -244,7 +244,8 @@ def write_tree_info(compose, arch, variant, timestamp=None): ti.variants.add(var) repomd_path = os.path.join(var.repository, "repodata", "repomd.xml") - ti.checksums.add(repomd_path, "sha256", root_dir=os_tree) + if os.path.isfile(repomd_path): + ti.checksums.add(repomd_path, "sha256", root_dir=os_tree) for i in variant.get_variants(types=["addon"], arch=arch): addon = productmd.treeinfo.Variant(ti) @@ -259,7 +260,8 @@ def write_tree_info(compose, arch, variant, timestamp=None): var.add(addon) repomd_path = os.path.join(addon.repository, "repodata", "repomd.xml") - ti.checksums.add(repomd_path, "sha256", root_dir=os_tree) + if os.path.isfile(repomd_path): + ti.checksums.add(repomd_path, "sha256", root_dir=os_tree) class LoraxProduct(productmd.treeinfo.Release): def _check_short(self): diff --git a/pungi/phases/createrepo.py b/pungi/phases/createrepo.py index 761b55f1..4327b1f5 100644 --- a/pungi/phases/createrepo.py +++ b/pungi/phases/createrepo.py @@ -155,7 +155,7 @@ def create_variant_repo(compose, arch, variant, pkg_type): manifest = productmd.rpms.Rpms() manifest.load(manifest_file) - for rpms_arch, data in manifest.rpms[variant.uid].iteritems(): + for rpms_arch, data in manifest.rpms.get(variant.uid, {}).iteritems(): if arch is not None and arch != rpms_arch: continue for srpm_data in data.itervalues(): diff --git a/pungi/phases/gather/__init__.py b/pungi/phases/gather/__init__.py index 05152d98..d14559f7 100644 --- a/pungi/phases/gather/__init__.py +++ b/pungi/phases/gather/__init__.py @@ -114,6 +114,13 @@ class GatherPhase(PhaseBase): PhaseBase.__init__(self, compose) # pkgset_phase provides package_sets and path_prefix self.pkgset_phase = pkgset_phase + # Prepare empty manifest + self.manifest_file = self.compose.paths.compose.metadata("rpms.json") + self.manifest = Rpms() + self.manifest.compose.id = self.compose.compose_id + self.manifest.compose.type = self.compose.compose_type + self.manifest.compose.date = self.compose.compose_date + self.manifest.compose.respin = self.compose.compose_respin @staticmethod def check_deps(): @@ -124,22 +131,24 @@ class GatherPhase(PhaseBase): for i in ["release_name", "release_short", "release_version"]: errors.append(self.conf_assert_str(i)) - def run(self): - pkg_map = gather_wrapper(self.compose, self.pkgset_phase.package_sets, self.pkgset_phase.path_prefix) + def _write_manifest(self): + self.compose.log_info("Writing RPM manifest: %s" % self.manifest_file) + self.manifest.dump(self.manifest_file) - manifest_file = self.compose.paths.compose.metadata("rpms.json") - manifest = Rpms() - manifest.compose.id = self.compose.compose_id - manifest.compose.type = self.compose.compose_type - manifest.compose.date = self.compose.compose_date - manifest.compose.respin = self.compose.compose_respin + def run(self): + pkg_map = gather_wrapper(self.compose, self.pkgset_phase.package_sets, + self.pkgset_phase.path_prefix) for arch in self.compose.get_arches(): for variant in self.compose.get_variants(arch=arch): - link_files(self.compose, arch, variant, pkg_map[arch][variant.uid], self.pkgset_phase.package_sets, manifest=manifest) + link_files(self.compose, arch, variant, + pkg_map[arch][variant.uid], + self.pkgset_phase.package_sets, + manifest=self.manifest) - self.compose.log_info("Writing RPM manifest: %s" % manifest_file) - manifest.dump(manifest_file) + def stop(self): + self._write_manifest() + super(GatherPhase, self).stop() def get_parent_pkgs(arch, variant, result_dict):