prepping treeinfo outside
This commit is contained in:
parent
760967211b
commit
7d7163a156
@ -78,6 +78,7 @@ class RepoSync:
|
||||
self.compose_root = config['compose_root']
|
||||
self.compose_base = config['compose_root'] + "/" + major
|
||||
self.profile = rlvars['profile']
|
||||
self.iso_map = rlvars['iso_map']
|
||||
|
||||
# Relevant major version items
|
||||
self.shortname = config['shortname']
|
||||
@ -935,7 +936,8 @@ class RepoSync:
|
||||
def deploy_treeinfo(self, repo, sync_root, arch):
|
||||
"""
|
||||
Deploys initial treeinfo files. These have the potential of being
|
||||
overwritten by our ISO process, which is fine.
|
||||
overwritten by our ISO process, which is fine. If there is a treeinfo
|
||||
found, it will be skipped.
|
||||
"""
|
||||
arches_to_tree = self.arches
|
||||
if arch:
|
||||
|
@ -450,7 +450,7 @@ class IsoBuild:
|
||||
for arch in arches_to_unpack:
|
||||
for variant in self.iso_map['images']:
|
||||
self.log.info(
|
||||
'Configuring treeinfo for %s%s %s%s' % (Color.BOLD, arch, variant, Color.END)
|
||||
'Configuring treeinfo and discinfo for %s%s %s%s' % (Color.BOLD, arch, variant, Color.END)
|
||||
)
|
||||
|
||||
self._treeinfo_wrapper(arch, variant)
|
||||
@ -741,12 +741,15 @@ class IsoBuild:
|
||||
|
||||
def _treeinfo_wrapper(self, arch, variant):
|
||||
"""
|
||||
Ensure treeinfo is written correctly based on the variant passed. Each
|
||||
.treeinfo file should be configured similarly but also differently from
|
||||
the next.
|
||||
Ensure treeinfo and discinfo is written correctly based on the variant
|
||||
passed. Each file should be configured similarly but also differently
|
||||
from the next. The Shared module does have a .treeinfo writer, but it
|
||||
is for basic use. Eventually it'll be expanded to handle this scenario.
|
||||
"""
|
||||
image = os.path.join(self.lorax_work_dir, arch, variant)
|
||||
treeinfo = os.path.join(image, '.treeinfo')
|
||||
discinfo = os.path.join(image, '.discinfo')
|
||||
mediarepo = os.path.join(image, 'media.repo')
|
||||
imagemap = self.iso_map['images'][variant]
|
||||
primary = imagemap['variant']
|
||||
repos = imagemap['repos']
|
||||
@ -827,6 +830,10 @@ class IsoBuild:
|
||||
|
||||
# Set default variant
|
||||
ti.dump(treeinfo, main_variant=primary)
|
||||
# Set discinfo
|
||||
Shared.discinfo_write(self.timestamp, self.fullname, arch, discinfo)
|
||||
# Set media.repo
|
||||
Shared.media_repo_write(self.timestamp, self.fullname, mediarepo)
|
||||
|
||||
# Next set of functions are loosely borrowed (in concept) from pungi. Some
|
||||
# stuff may be combined/mixed together, other things may be simplified or
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import productmd.treeinfo
|
||||
|
||||
class Shared:
|
||||
"""
|
||||
@ -44,6 +45,46 @@ class Shared:
|
||||
checksum.hexdigest()
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def treeinfo_new_write(
|
||||
file_path,
|
||||
distname,
|
||||
shortname,
|
||||
release,
|
||||
arch,
|
||||
time,
|
||||
repo
|
||||
):
|
||||
"""
|
||||
Writes really basic treeinfo, this is for single repository treeinfo
|
||||
data. This is usually called in the case of a fresh run and each repo
|
||||
needs one.
|
||||
"""
|
||||
ti = productmd.treeinfo.TreeInfo()
|
||||
ti.release.name = distname
|
||||
ti.release.short = shortname
|
||||
ti.release.version = release
|
||||
ti.tree.arch = arch
|
||||
ti.tree.build_timestamp = time
|
||||
# Variants (aka repos)
|
||||
variant = productmd.treeinfo.Variant(ti)
|
||||
variant.id = repo
|
||||
variant.uid = repo
|
||||
variant.name = repo
|
||||
variant.type = "variant"
|
||||
variant.repository = "."
|
||||
variant.packages = "Packages"
|
||||
ti.variants.add(variant)
|
||||
ti.dump(file_path)
|
||||
|
||||
@staticmethod
|
||||
def treeinfo_modify_write():
|
||||
"""
|
||||
Modifies a specific treeinfo with already available data. This is in
|
||||
the case of modifying treeinfo for primary repos or images.
|
||||
"""
|
||||
|
||||
|
||||
@staticmethod
|
||||
def discinfo_write(timestamp, fullname, arch, file_path):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user