Remove pungi/gather.py and associated code

This commit completly drops support for Yum as a depsolving/repoclosure
backend.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2024-11-18 09:58:23 +01:00
parent 3bc35a9a27
commit f5702e4c9d
20 changed files with 17 additions and 2437 deletions

View file

@ -1,27 +0,0 @@
FROM centos:7
LABEL \
name="Pungi test" \
description="Run tests using tox with Python 2" \
vendor="Pungi developers" \
license="MIT"
RUN yum -y update && yum -y install epel-release && yum -y install \
git \
libmodulemd2 \
make \
python3 \
python-createrepo_c \
python-gobject-base \
python-gssapi \
python-libcomps \
pykickstart \
&& yum clean all
# python-tox in yum repo is too old, let's install latest version
RUN pip3 install tox
WORKDIR /src
COPY . .
CMD ["tox", "-e", "py27"]

1
tests/Jenkinsfile vendored
View file

@ -40,7 +40,6 @@ git fetch proposed
git checkout origin/master
git merge --no-ff "proposed/$params.BRANCH" -m "Merge PR"
podman run --rm -v .:/src:Z quay.io/exd-guild-compose/pungi-test tox -r -e flake8,black,py3,bandit
podman run --rm -v .:/src:Z quay.io/exd-guild-compose/pungi-test-py2 tox -r -e py27
"""
sh "cat job.sh"
sh "ssh -o StrictHostKeyChecking=no root@$hostname mkdir $remote_dir"

View file

@ -752,15 +752,6 @@ class StatusTest(unittest.TestCase):
self.compose.conf["createrepo_database"] = True
self.assertTrue(self.compose.should_create_yum_database)
def test_no_database_with_yum_backend(self):
self.compose.conf["gather_backend"] = "yum"
self.assertTrue(self.compose.should_create_yum_database)
def test_no_database_with_yum_backend_config_override(self):
self.compose.conf["gather_backend"] = "yum"
self.compose.conf["createrepo_database"] = False
self.assertFalse(self.compose.should_create_yum_database)
class DumpContainerMetadataTest(unittest.TestCase):
def setUp(self):

View file

@ -275,16 +275,6 @@ class GatherConfigTestCase(ConfigTestCase):
self.assertValidation(cfg, [])
self.assertEqual(cfg["gather_backend"], "dnf")
def test_yum_backend_is_default_on_py2(self):
cfg = load_config(
pkgset_source="koji",
pkgset_koji_tag="f27",
)
with mock.patch("six.PY2", new=True):
self.assertValidation(cfg, [])
self.assertEqual(cfg["gather_backend"], "yum")
def test_yum_backend_is_rejected_on_py3(self):
cfg = load_config(
pkgset_source="koji",
@ -468,7 +458,7 @@ class RepoclosureTestCase(ConfigTestCase):
repoclosure_backend="fnd", # Intentionally with a typo
)
options = ["yum", "dnf"] if six.PY2 else ["dnf"]
options = ["dnf"]
self.assertValidation(
cfg,
[

View file

@ -25,11 +25,6 @@ try:
except ImportError:
HAS_DNF = False
if six.PY2:
HAS_YUM = True
else:
HAS_YUM = False
def convert_pkg_map(data):
"""
@ -2137,71 +2132,6 @@ class DepsolvingBase(object):
self.assertEqual(pkg_map["debuginfo"], [])
@unittest.skipUnless(HAS_YUM, "YUM only available on Python 2")
class PungiYumDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
def setUp(self):
super(PungiYumDepsolvingTestCase, self).setUp()
self.ks = os.path.join(self.tmp_dir, "ks")
self.out = os.path.join(self.tmp_dir, "out")
self.cwd = os.path.join(self.tmp_dir, "cwd")
os.mkdir(self.cwd)
self.old_cwd = os.getcwd()
os.chdir(self.cwd)
logger = logging.getLogger("Pungi")
if not logger.handlers:
formatter = logging.Formatter("%(name)s:%(levelname)s: %(message)s")
console = logging.StreamHandler(sys.stdout)
console.setFormatter(formatter)
console.setLevel(logging.INFO)
logger.addHandler(console)
def tearDown(self):
os.chdir(self.old_cwd)
super(PungiYumDepsolvingTestCase, self).tearDown()
def go(
self,
packages,
groups,
lookaside=None,
prepopulate=None,
fulltree_excludes=None,
multilib_blacklist=None,
multilib_whitelist=None,
**kwargs
):
"""
Write a kickstart with given packages and groups, then run the
depsolving and parse the output.
"""
p = PungiWrapper()
repos = {"repo": self.repo}
if lookaside:
repos["lookaside"] = lookaside
kwargs["lookaside_repos"] = ["lookaside"]
p.write_kickstart(
self.ks,
repos,
groups,
packages,
prepopulate=prepopulate,
multilib_whitelist=multilib_whitelist,
multilib_blacklist=multilib_blacklist,
fulltree_excludes=fulltree_excludes,
)
kwargs.setdefault("cache_dir", self.tmp_dir)
# Unless the test specifies an arch, we need to default to x86_64.
# Otherwise the arch of current machine will be used, which will cause
# failure most of the time.
kwargs.setdefault("arch", "x86_64")
p.run_pungi(self.ks, self.tmp_dir, "DP", **kwargs)
with open(self.out, "r") as f:
pkg_map, self.broken_deps, _ = p.parse_log(f)
return convert_pkg_map(pkg_map)
def convert_dnf_packages(pkgs, flags):
convert_table = {
# Hawkey returns nosrc package as src

View file

@ -1,11 +1,5 @@
# -*- coding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from unittest import mock
except ImportError:
@ -15,20 +9,6 @@ import six
import pungi.phases.repoclosure as repoclosure_phase
from tests.helpers import DummyCompose, PungiTestCase, mk_boom
try:
import dnf # noqa: F401
HAS_DNF = True
except ImportError:
HAS_DNF = False
try:
import yum # noqa: F401
HAS_YUM = True
except ImportError:
HAS_YUM = False
class TestRepoclosure(PungiTestCase):
def setUp(self):
@ -52,53 +32,6 @@ class TestRepoclosure(PungiTestCase):
self.assertEqual(mock_grc.call_args_list, [])
@unittest.skipUnless(HAS_YUM, "YUM is not available")
@mock.patch("pungi.wrappers.repoclosure.get_repoclosure_cmd")
@mock.patch("pungi.phases.repoclosure.run")
def test_repoclosure_default_backend(self, mock_run, mock_grc):
with mock.patch("six.PY2", new=True):
compose = DummyCompose(self.topdir, {})
repoclosure_phase.run_repoclosure(compose)
six.assertCountEqual(
self,
mock_grc.call_args_list,
[
mock.call(
backend="yum",
arch=["amd64", "x86_64", "noarch"],
lookaside={},
repos=self._get_repo(compose.compose_id, "Everything", "amd64"),
),
mock.call(
backend="yum",
arch=["amd64", "x86_64", "noarch"],
lookaside={},
repos=self._get_repo(compose.compose_id, "Client", "amd64"),
),
mock.call(
backend="yum",
arch=["amd64", "x86_64", "noarch"],
lookaside={},
repos=self._get_repo(compose.compose_id, "Server", "amd64"),
),
mock.call(
backend="yum",
arch=["x86_64", "noarch"],
lookaside={},
repos=self._get_repo(compose.compose_id, "Server", "x86_64"),
),
mock.call(
backend="yum",
arch=["x86_64", "noarch"],
lookaside={},
repos=self._get_repo(compose.compose_id, "Everything", "x86_64"),
),
],
)
@unittest.skipUnless(HAS_DNF, "DNF is not available")
@mock.patch("pungi.wrappers.repoclosure.get_repoclosure_cmd")
@mock.patch("pungi.phases.repoclosure.run")
def test_repoclosure_dnf_backend(self, mock_run, mock_grc):
@ -182,7 +115,6 @@ class TestRepoclosure(PungiTestCase):
with self.assertRaises(RuntimeError):
repoclosure_phase.run_repoclosure(compose)
@unittest.skipUnless(HAS_DNF, "DNF is not available")
@mock.patch("pungi.wrappers.repoclosure.get_repoclosure_cmd")
@mock.patch("pungi.phases.repoclosure.run")
def test_repoclosure_overwrite_options_creates_correct_commands(

View file

@ -9,11 +9,6 @@ from . import helpers
class RepoclosureWrapperTestCase(helpers.BaseTestCase):
def test_minimal_command(self):
self.assertEqual(
rc.get_repoclosure_cmd(), ["/usr/bin/repoclosure", "--tempcache"]
)
def test_minimal_dnf_command(self):
self.assertEqual(rc.get_repoclosure_cmd(backend="dnf"), ["dnf", "repoclosure"])
@ -23,37 +18,6 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
self.assertEqual(str(ctx.exception), "Unknown repoclosure backend: rpm")
def test_multiple_arches(self):
self.assertEqual(
rc.get_repoclosure_cmd(arch=["x86_64", "i686", "noarch"]),
[
"/usr/bin/repoclosure",
"--tempcache",
"--arch=x86_64",
"--arch=i686",
"--arch=noarch",
],
)
def test_full_command(self):
repos = {"my-repo": "/mnt/koji/repo"}
lookaside = {"fedora": "http://kojipkgs.fp.o/repo"}
cmd = rc.get_repoclosure_cmd(arch="x86_64", repos=repos, lookaside=lookaside)
self.assertEqual(cmd[0], "/usr/bin/repoclosure")
six.assertCountEqual(
self,
cmd[1:],
[
"--tempcache",
"--arch=x86_64",
"--repofrompath=my-repo,file:///mnt/koji/repo",
"--repofrompath=fedora,http://kojipkgs.fp.o/repo",
"--repoid=my-repo",
"--lookaside=fedora",
],
)
def test_full_dnf_command(self):
repos = {"my-repo": "/mnt/koji/repo"}
lookaside = {"fedora": "http://kojipkgs.fp.o/repo"}
@ -103,44 +67,6 @@ class RepoclosureWrapperTestCase(helpers.BaseTestCase):
],
)
def test_expand_repo(self):
repos = {
"local": "/mnt/koji/repo",
"remote": "http://kojipkgs.fp.o/repo",
}
cmd = rc.get_repoclosure_cmd(repos=repos)
self.assertEqual(cmd[0], "/usr/bin/repoclosure")
six.assertCountEqual(
self,
cmd[1:],
[
"--tempcache",
"--repofrompath=local,file:///mnt/koji/repo",
"--repofrompath=remote,http://kojipkgs.fp.o/repo",
"--repoid=local",
"--repoid=remote",
],
)
def test_expand_lookaside(self):
repos = {
"local": "/mnt/koji/repo",
"remote": "http://kojipkgs.fp.o/repo",
}
cmd = rc.get_repoclosure_cmd(lookaside=repos)
self.assertEqual(cmd[0], "/usr/bin/repoclosure")
six.assertCountEqual(
self,
cmd[1:],
[
"--tempcache",
"--repofrompath=local,file:///mnt/koji/repo",
"--repofrompath=remote,http://kojipkgs.fp.o/repo",
"--lookaside=local",
"--lookaside=remote",
],
)
class FusExtractorTestCase(helpers.PungiTestCase):
def setUp(self):

View file

@ -9,20 +9,6 @@ import os
import pungi.phases.test as test_phase
from tests.helpers import DummyCompose, PungiTestCase, touch, FIXTURE_DIR
try:
import dnf # noqa: F401
HAS_DNF = True
except ImportError:
HAS_DNF = False
try:
import yum # noqa: F401
HAS_YUM = True
except ImportError:
HAS_YUM = False
PAD = b"\0" * 100
UNBOOTABLE_ISO = (b"\0" * 0x8001) + b"CD001" + PAD