Update compose, phases{buildinstall,createiso,gather/__ini__} to use correct productmd API calls

This commit is contained in:
Adam Miller 2015-06-02 17:32:21 -05:00
parent 4e8e1d4d90
commit 5fa5fcdd06
4 changed files with 20 additions and 19 deletions

View File

@ -27,27 +27,28 @@ import tempfile
import shutil import shutil
import kobo.log import kobo.log
from productmd.composeinfo import Compose from productmd.composeinfo import ComposeInfo
from productmd.images import Images from productmd.images import Images
from pungi.wrappers.variants import VariantsXmlParser from pungi.wrappers.variants import VariantsXmlParser
from pungi.paths import Paths from pungi.paths import Paths
from pungi.wrappers.scm import get_file_from_scm from pungi.wrappers.scm import get_file_from_scm
from pungi.util import makedirs from pungi.util import makedirs
from pungi.metadata import compose_to_composeinfo
def get_compose_dir(topdir, conf, compose_type="production", compose_date=None, compose_respin=None, compose_label=None, already_exists_callbacks=None): def get_compose_dir(topdir, conf, compose_type="production", compose_date=None, compose_respin=None, compose_label=None, already_exists_callbacks=None):
topdir = os.path.abspath(topdir)
already_exists_callbacks = already_exists_callbacks or [] already_exists_callbacks = already_exists_callbacks or []
# create an incomplete composeinfo to generate compose ID # create an incomplete composeinfo to generate compose ID
ci = Compose() ci = ComposeInfo()
ci.product.name = conf["product_name"] ci.compose.name = conf["product_name"]
ci.product.short = conf["product_short"] ci.release.name = conf["product_name"]
ci.product.version = conf["product_version"] ci.compose.short = conf["product_short"]
ci.product.is_layered = bool(conf.get("product_is_layered", False)) ci.release.short = conf["product_short"]
if ci.product.is_layered: ci.compose.version = conf["product_version"]
ci.release.version = conf["product_version"]
ci.compose.is_layered = bool(conf.get("product_is_layered", False))
if ci.compose.is_layered:
ci.base_product.name = conf["base_product_name"] ci.base_product.name = conf["base_product_name"]
ci.base_product.short = conf["base_product_short"] ci.base_product.short = conf["base_product_short"]
ci.base_product.version = conf["base_product_version"] ci.base_product.version = conf["base_product_version"]
@ -57,9 +58,6 @@ def get_compose_dir(topdir, conf, compose_type="production", compose_date=None,
ci.compose.date = compose_date or time.strftime("%Y%m%d", time.localtime()) ci.compose.date = compose_date or time.strftime("%Y%m%d", time.localtime())
ci.compose.respin = compose_respin or 0 ci.compose.respin = compose_respin or 0
# HACK - add topdir for callbacks
ci.topdir = topdir
while 1: while 1:
ci.compose.id = ci.create_compose_id() ci.compose.id = ci.create_compose_id()
@ -113,7 +111,7 @@ class Compose(kobo.log.LoggingBase):
self.paths = Paths(self) self.paths = Paths(self)
# to provide compose_id, compose_date and compose_respin # to provide compose_id, compose_date and compose_respin
self.ci_base = Compose() self.ci_base = ComposeInfo()
self.ci_base.load(os.path.join(self.paths.work.topdir(arch="global"), "composeinfo-base.json")) self.ci_base.load(os.path.join(self.paths.work.topdir(arch="global"), "composeinfo-base.json"))
self.supported = supported self.supported = supported
@ -121,7 +119,7 @@ class Compose(kobo.log.LoggingBase):
self.log_info("Automatically setting 'supported' flag for a Release Candidate (%s) compose." % self.compose_label) self.log_info("Automatically setting 'supported' flag for a Release Candidate (%s) compose." % self.compose_label)
self.supported = True self.supported = True
self.im = ImageManifest() self.im = Images()
if self.DEBUG: if self.DEBUG:
try: try:
self.im.load(self.paths.compose.metadata("images.json")) self.im.load(self.paths.compose.metadata("images.json"))
@ -198,7 +196,10 @@ class Compose(kobo.log.LoggingBase):
self.variants = VariantsXmlParser(file_obj, tree_arches).parse() self.variants = VariantsXmlParser(file_obj, tree_arches).parse()
# populate ci_base with variants - needed for layered-products (compose_id) # populate ci_base with variants - needed for layered-products (compose_id)
self.ci_base = compose_to_composeinfo(self) ####FIXME - compose_to_composeinfo is no longer needed and has been
#### removed, but I'm not entirely sure what this is needed for
#### or if it is at all
#self.ci_base = compose_to_composeinfo(self)
def get_variants(self, types=None, arch=None, recursive=False): def get_variants(self, types=None, arch=None, recursive=False):
result = [] result = []

View File

@ -26,7 +26,7 @@ import errno
from kobo.threads import ThreadPool, WorkerThread from kobo.threads import ThreadPool, WorkerThread
from kobo.shortcuts import run, read_checksum_file, relative_path from kobo.shortcuts import run, read_checksum_file, relative_path
from productmd.imagemanifest import Image from productmd.images import Image
from pungi.util import get_buildroot_rpms, get_volid from pungi.util import get_buildroot_rpms, get_volid
from pungi.wrappers.lorax import LoraxWrapper from pungi.wrappers.lorax import LoraxWrapper

View File

@ -23,7 +23,7 @@ import shutil
import koji import koji
import productmd.treeinfo import productmd.treeinfo
from productmd.imagemanifest import Image from productmd.images import Image
from kobo.threads import ThreadPool, WorkerThread from kobo.threads import ThreadPool, WorkerThread
from kobo.shortcuts import run, read_checksum_file, relative_path from kobo.shortcuts import run, read_checksum_file, relative_path

View File

@ -21,7 +21,7 @@ import shutil
import json import json
from kobo.rpmlib import parse_nvra from kobo.rpmlib import parse_nvra
from productmd import RpmManifest from productmd.rpms import Rpms
from pungi.wrappers.scm import get_file_from_scm from pungi.wrappers.scm import get_file_from_scm
from link import link_files from link import link_files
@ -112,7 +112,7 @@ class GatherPhase(PhaseBase):
pkg_map = gather_wrapper(self.compose, self.pkgset_phase.package_sets, self.pkgset_phase.path_prefix) pkg_map = gather_wrapper(self.compose, self.pkgset_phase.package_sets, self.pkgset_phase.path_prefix)
manifest_file = self.compose.paths.compose.metadata("rpms.json") manifest_file = self.compose.paths.compose.metadata("rpms.json")
manifest = RpmManifest() manifest = Rpms()
manifest.compose.id = self.compose.compose_id manifest.compose.id = self.compose.compose_id
manifest.compose.type = self.compose.compose_type manifest.compose.type = self.compose.compose_type
manifest.compose.date = self.compose.compose_date manifest.compose.date = self.compose.compose_date