Implement koji profiles.
CHANGE: pkgset_koji_url and pkgset_koji_path_prefix config options replaced with koji_profile. ACTION: Add 'koji_profile = "<profile_name>"' (use "koji" for Fedora) to config files. You can safely remove and pkgset_koji_url and pkgset_koji_path_prefix from config files.
This commit is contained in:
parent
017bc76093
commit
afa05021f0
@ -1,3 +1,8 @@
|
||||
DATE: 2015-08-09
|
||||
CHANGE: pkgset_koji_url and pkgset_koji_path_prefix config options replaced with koji_profile.
|
||||
ACTION: Add 'koji_profile = "<profile_name>"' (use "koji" for Fedora) to config files.
|
||||
You can safely remove and pkgset_koji_url and pkgset_koji_path_prefix from config files.
|
||||
|
||||
DATE: 2015-08-08
|
||||
CHANGE: create_optional_isos config option now defaults to False.
|
||||
ACTION: You can safely remove 'create_optional_isos = False' from config files.
|
||||
|
@ -29,6 +29,7 @@ import kobo.rpmlib
|
||||
|
||||
from kobo.threads import WorkerThread, ThreadPool
|
||||
|
||||
import pungi.wrappers.kojiwrapper
|
||||
from pungi.util import pkg_is_srpm
|
||||
from pungi.arch import get_valid_arches
|
||||
|
||||
@ -195,31 +196,27 @@ class FilelistPackageSet(PackageSetBase):
|
||||
|
||||
|
||||
class KojiPackageSet(PackageSetBase):
|
||||
def __init__(self, koji_proxy, sigkey_ordering, arches=None, logger=None):
|
||||
def __init__(self, koji_wrapper, sigkey_ordering, arches=None, logger=None):
|
||||
PackageSetBase.__init__(self, sigkey_ordering=sigkey_ordering, arches=arches, logger=logger)
|
||||
self.koji_proxy = koji_proxy
|
||||
self.koji_pathinfo = getattr(__import__(koji_proxy.__module__, {}, {}, []), "pathinfo")
|
||||
self.koji_wrapper = koji_wrapper
|
||||
|
||||
def __getstate__(self):
|
||||
result = self.__dict__.copy()
|
||||
result["koji_class"] = self.koji_proxy.__class__.__name__
|
||||
result["koji_module"] = self.koji_proxy.__class__.__module__
|
||||
result["koji_baseurl"] = self.koji_proxy.baseurl
|
||||
result["koji_opts"] = self.koji_proxy.opts
|
||||
del result["koji_proxy"]
|
||||
del result["koji_pathinfo"]
|
||||
result["koji_profile"] = self.koji_wrapper.koji_module.config.profile
|
||||
del result["koji_wrapper"]
|
||||
del result["_logger"]
|
||||
return result
|
||||
|
||||
def __setstate__(self, data):
|
||||
class_name = data.pop("koji_class")
|
||||
module_name = data.pop("koji_module")
|
||||
module = __import__(module_name, {}, {}, [class_name])
|
||||
cls = getattr(module, class_name)
|
||||
self.koji_proxy = cls(data.pop("koji_baseurl"), data.pop("koji_opts"))
|
||||
koji_profile = data.pop("koji_profile")
|
||||
self.koji_wrapper = pungi.wrappers.kojiwrapper.KojiWrapper(koji_profile)
|
||||
self._logger = None
|
||||
self.__dict__.update(data)
|
||||
|
||||
@property
|
||||
def koji_proxy(self):
|
||||
return self.koji_wrapper.koji_proxy
|
||||
|
||||
def get_latest_rpms(self, tag, event, inherit=True):
|
||||
return self.koji_proxy.listTaggedRPMS(tag, event=event, inherit=inherit, latest=True)
|
||||
|
||||
@ -227,7 +224,7 @@ class KojiPackageSet(PackageSetBase):
|
||||
rpm_info, build_info = queue_item
|
||||
rpm_path = None
|
||||
found = False
|
||||
pathinfo = self.koji_pathinfo
|
||||
pathinfo = self.koji_wrapper.koji_module.pathinfo
|
||||
for sigkey in self.sigkey_ordering:
|
||||
if sigkey is None:
|
||||
# we're looking for *signed* copies here
|
||||
|
@ -21,6 +21,7 @@ import json
|
||||
|
||||
import koji
|
||||
|
||||
import pungi.wrappers.kojiwrapper
|
||||
import pungi.phases.pkgset.pkgsets
|
||||
from pungi.arch import get_valid_arches
|
||||
|
||||
@ -33,15 +34,15 @@ import pungi.phases.pkgset.source
|
||||
class PkgsetSourceKoji(pungi.phases.pkgset.source.PkgsetSourceBase):
|
||||
enabled = True
|
||||
config_options = (
|
||||
{
|
||||
"name": "koji_profile",
|
||||
"expected_types": [str],
|
||||
},
|
||||
{
|
||||
"name": "pkgset_source",
|
||||
"expected_types": [str],
|
||||
"expected_values": "koji",
|
||||
},
|
||||
{
|
||||
"name": "pkgset_koji_url",
|
||||
"expected_types": [str],
|
||||
},
|
||||
{
|
||||
"name": "pkgset_koji_tag",
|
||||
"expected_types": [str],
|
||||
@ -51,48 +52,23 @@ class PkgsetSourceKoji(pungi.phases.pkgset.source.PkgsetSourceBase):
|
||||
"expected_types": [bool],
|
||||
"optional": True,
|
||||
},
|
||||
{
|
||||
"name": "pkgset_koji_path_prefix",
|
||||
"expected_types": [str],
|
||||
},
|
||||
)
|
||||
|
||||
def __call__(self):
|
||||
compose = self.compose
|
||||
koji_url = compose.conf["pkgset_koji_url"]
|
||||
# koji_tag = compose.conf["pkgset_koji_tag"]
|
||||
path_prefix = compose.conf["pkgset_koji_path_prefix"].rstrip("/") + "/" # must contain trailing '/'
|
||||
|
||||
koji_proxy = koji.ClientSession(koji_url)
|
||||
package_sets = get_pkgset_from_koji(self.compose, koji_proxy, path_prefix)
|
||||
koji_profile = compose.conf["koji_profile"]
|
||||
self.koji_wrapper = pungi.wrappers.kojiwrapper.KojiWrapper(koji_profile)
|
||||
path_prefix = self.koji_wrapper.koji_module.config.topdir.rstrip("/") + "/" # must contain trailing '/'
|
||||
package_sets = get_pkgset_from_koji(self.compose, self.koji_wrapper, path_prefix)
|
||||
return (package_sets, path_prefix)
|
||||
|
||||
|
||||
'''
|
||||
class PkgsetKojiPhase(PhaseBase):
|
||||
"""PKGSET"""
|
||||
name = "pkgset"
|
||||
def get_pkgset_from_koji(compose, koji_wrapper, path_prefix):
|
||||
koji_proxy = koji_wrapper.koji_proxy
|
||||
event_info = get_koji_event_info(compose, koji_wrapper)
|
||||
tag_info = get_koji_tag_info(compose, koji_wrapper)
|
||||
|
||||
def __init__(self, compose):
|
||||
PhaseBase.__init__(self, compose)
|
||||
self.package_sets = None
|
||||
self.path_prefix = None
|
||||
|
||||
def run(self):
|
||||
path_prefix = self.compose.conf["koji_path_prefix"]
|
||||
path_prefix = path_prefix.rstrip("/") + "/" # must contain trailing '/'
|
||||
koji_url = self.compose.conf["koji_url"]
|
||||
koji_proxy = koji.ClientSession(koji_url)
|
||||
self.package_sets = get_pkgset_from_koji(self.compose, koji_proxy, path_prefix)
|
||||
self.path_prefix = path_prefix
|
||||
'''
|
||||
|
||||
|
||||
def get_pkgset_from_koji(compose, koji_proxy, path_prefix):
|
||||
event_info = get_koji_event_info(compose, koji_proxy)
|
||||
tag_info = get_koji_tag_info(compose, koji_proxy)
|
||||
|
||||
pkgset_global = populate_global_pkgset(compose, koji_proxy, path_prefix, tag_info, event_info)
|
||||
pkgset_global = populate_global_pkgset(compose, koji_wrapper, path_prefix, tag_info, event_info)
|
||||
# get_extra_packages(compose, pkgset_global)
|
||||
package_sets = populate_arch_pkgsets(compose, path_prefix, pkgset_global)
|
||||
package_sets["global"] = pkgset_global
|
||||
@ -105,7 +81,8 @@ def get_pkgset_from_koji(compose, koji_proxy, path_prefix):
|
||||
return package_sets
|
||||
|
||||
|
||||
def populate_global_pkgset(compose, koji_proxy, path_prefix, compose_tag, event_id):
|
||||
def populate_global_pkgset(compose, koji_wrapper, path_prefix, compose_tag, event_id):
|
||||
koji_proxy = koji_wrapper.koji_proxy
|
||||
ALL_ARCHES = set(["src"])
|
||||
for arch in compose.get_arches():
|
||||
is_multilib = arch in compose.conf["multilib_arches"]
|
||||
@ -121,7 +98,7 @@ def populate_global_pkgset(compose, koji_proxy, path_prefix, compose_tag, event_
|
||||
pkgset = pickle.load(open(global_pkgset_path, "r"))
|
||||
else:
|
||||
compose.log_info(msg)
|
||||
pkgset = pungi.phases.pkgset.pkgsets.KojiPackageSet(koji_proxy, compose.conf["sigkeys"], logger=compose._logger, arches=ALL_ARCHES)
|
||||
pkgset = pungi.phases.pkgset.pkgsets.KojiPackageSet(koji_wrapper, compose.conf["sigkeys"], logger=compose._logger, arches=ALL_ARCHES)
|
||||
pkgset.populate(compose_tag, event_id, inherit=inherit)
|
||||
f = open(global_pkgset_path, "w")
|
||||
data = pickle.dumps(pkgset)
|
||||
@ -133,7 +110,8 @@ def populate_global_pkgset(compose, koji_proxy, path_prefix, compose_tag, event_
|
||||
return pkgset
|
||||
|
||||
|
||||
def get_koji_event_info(compose, koji_proxy):
|
||||
def get_koji_event_info(compose, koji_wrapper):
|
||||
koji_proxy = koji_wrapper.koji_proxy
|
||||
event_file = os.path.join(compose.paths.work.topdir(arch="global"), "koji-event")
|
||||
|
||||
if compose.koji_event:
|
||||
@ -153,7 +131,8 @@ def get_koji_event_info(compose, koji_proxy):
|
||||
return result
|
||||
|
||||
|
||||
def get_koji_tag_info(compose, koji_proxy):
|
||||
def get_koji_tag_info(compose, koji_wrapper):
|
||||
koji_proxy = koji_wrapper.koji_proxy
|
||||
tag_file = os.path.join(compose.paths.work.topdir(arch="global"), "koji-tag")
|
||||
msg = "Getting a koji tag info"
|
||||
if compose.DEBUG and os.path.exists(tag_file):
|
||||
|
@ -29,7 +29,8 @@ class KojiWrapper(object):
|
||||
self.profile = profile
|
||||
# assumption: profile name equals executable name (it's a symlink -> koji)
|
||||
self.executable = self.profile.replace("_", "-")
|
||||
self.koji_module = __import__(self.profile)
|
||||
self.koji_module = koji.get_profile_module(profile)
|
||||
self.koji_proxy = koji.ClientSession(self.koji_module.config.server)
|
||||
|
||||
def get_runroot_cmd(self, target, arch, command, quiet=False, use_shell=True, channel=None, packages=None, mounts=None, weight=None, task_id=True):
|
||||
cmd = [self.executable, "runroot"]
|
||||
|
Loading…
Reference in New Issue
Block a user