pkgset: Drop kobo.plugin usage from PkgsetSource

Relates: https://pagure.io/pungi/issue/1488
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2021-01-27 15:46:28 +01:00
parent 0f4b0577f7
commit c87fce30ac
5 changed files with 25 additions and 19 deletions

View File

@ -29,13 +29,10 @@ class PkgsetPhase(PhaseBase):
self.path_prefix = None
def run(self):
pkgset_source = "PkgsetSource%s" % self.compose.conf["pkgset_source"]
from .source import PkgsetSourceContainer
from . import sources
PkgsetSourceContainer.register_module(sources)
container = PkgsetSourceContainer()
SourceClass = container[pkgset_source]
SourceClass = sources.ALL_SOURCES[self.compose.conf["pkgset_source"].lower()]
self.package_sets, self.path_prefix = SourceClass(self.compose)()
def validate(self):

View File

@ -14,15 +14,6 @@
# along with this program; if not, see <https://gnu.org/licenses/>.
import kobo.plugins
class PkgsetSourceBase(kobo.plugins.Plugin):
class PkgsetSourceBase(object):
def __init__(self, compose):
self.compose = compose
class PkgsetSourceContainer(kobo.plugins.PluginContainer):
@classmethod
def normalize_name(cls, name):
return name.lower()

View File

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://gnu.org/licenses/>.
from .source_koji import PkgsetSourceKoji
from .source_repos import PkgsetSourceRepos
ALL_SOURCES = {
"koji": PkgsetSourceKoji,
"repos": PkgsetSourceRepos,
}

View File

@ -184,8 +184,6 @@ def get_koji_modules(compose, koji_wrapper, event, module_info_str):
class PkgsetSourceKoji(pungi.phases.pkgset.source.PkgsetSourceBase):
enabled = True
def __call__(self):
compose = self.compose
koji_profile = compose.conf["koji_profile"]

View File

@ -31,8 +31,6 @@ import pungi.phases.pkgset.source
class PkgsetSourceRepos(pungi.phases.pkgset.source.PkgsetSourceBase):
enabled = True
def __call__(self):
package_sets, path_prefix = get_pkgset_from_repos(self.compose)
return (package_sets, path_prefix)