Always generate rpms.json file
Even if gather phase is skipped, it will still generate a rpms.json metadata file. It will have no payload, but the header structure is there. Createrepo phase had to be updated to ignore variants that have no RPMs listed in metadata. There is one more fix for writing treeinfo files: if repomd.xml files are not generated, it will no longer crash. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
00e11b2f51
commit
8323a735e7
@ -244,7 +244,8 @@ def write_tree_info(compose, arch, variant, timestamp=None):
|
|||||||
ti.variants.add(var)
|
ti.variants.add(var)
|
||||||
|
|
||||||
repomd_path = os.path.join(var.repository, "repodata", "repomd.xml")
|
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):
|
for i in variant.get_variants(types=["addon"], arch=arch):
|
||||||
addon = productmd.treeinfo.Variant(ti)
|
addon = productmd.treeinfo.Variant(ti)
|
||||||
@ -259,7 +260,8 @@ def write_tree_info(compose, arch, variant, timestamp=None):
|
|||||||
var.add(addon)
|
var.add(addon)
|
||||||
|
|
||||||
repomd_path = os.path.join(addon.repository, "repodata", "repomd.xml")
|
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):
|
class LoraxProduct(productmd.treeinfo.Release):
|
||||||
def _check_short(self):
|
def _check_short(self):
|
||||||
|
@ -155,7 +155,7 @@ def create_variant_repo(compose, arch, variant, pkg_type):
|
|||||||
manifest = productmd.rpms.Rpms()
|
manifest = productmd.rpms.Rpms()
|
||||||
manifest.load(manifest_file)
|
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:
|
if arch is not None and arch != rpms_arch:
|
||||||
continue
|
continue
|
||||||
for srpm_data in data.itervalues():
|
for srpm_data in data.itervalues():
|
||||||
|
@ -114,6 +114,13 @@ class GatherPhase(PhaseBase):
|
|||||||
PhaseBase.__init__(self, compose)
|
PhaseBase.__init__(self, compose)
|
||||||
# pkgset_phase provides package_sets and path_prefix
|
# pkgset_phase provides package_sets and path_prefix
|
||||||
self.pkgset_phase = pkgset_phase
|
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
|
@staticmethod
|
||||||
def check_deps():
|
def check_deps():
|
||||||
@ -124,22 +131,24 @@ class GatherPhase(PhaseBase):
|
|||||||
for i in ["release_name", "release_short", "release_version"]:
|
for i in ["release_name", "release_short", "release_version"]:
|
||||||
errors.append(self.conf_assert_str(i))
|
errors.append(self.conf_assert_str(i))
|
||||||
|
|
||||||
def run(self):
|
def _write_manifest(self):
|
||||||
pkg_map = gather_wrapper(self.compose, self.pkgset_phase.package_sets, self.pkgset_phase.path_prefix)
|
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")
|
def run(self):
|
||||||
manifest = Rpms()
|
pkg_map = gather_wrapper(self.compose, self.pkgset_phase.package_sets,
|
||||||
manifest.compose.id = self.compose.compose_id
|
self.pkgset_phase.path_prefix)
|
||||||
manifest.compose.type = self.compose.compose_type
|
|
||||||
manifest.compose.date = self.compose.compose_date
|
|
||||||
manifest.compose.respin = self.compose.compose_respin
|
|
||||||
|
|
||||||
for arch in self.compose.get_arches():
|
for arch in self.compose.get_arches():
|
||||||
for variant in self.compose.get_variants(arch=arch):
|
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)
|
def stop(self):
|
||||||
manifest.dump(manifest_file)
|
self._write_manifest()
|
||||||
|
super(GatherPhase, self).stop()
|
||||||
|
|
||||||
|
|
||||||
def get_parent_pkgs(arch, variant, result_dict):
|
def get_parent_pkgs(arch, variant, result_dict):
|
||||||
|
Loading…
Reference in New Issue
Block a user