From fbe503c07e02049e84ced07bd250cea4f6295ba3 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Feb 25 2025 13:07:15 +0000
Subject: Fix test containers


New Fedora containers are available and EOLed CentOS images
are re-enabled to be able to build again.

Furthermore, new make targets (containers, container-test) are added
to run all tests in all supported containers locally.

---

diff --git a/Makefile b/Makefile
index f8a85b1..dedf942 100644
--- a/Makefile
+++ b/Makefile
@@ -152,7 +152,18 @@ force-tag::
 	@echo "Tagged with: $(TAG)"
 	@echo
 
-# If and only if "make build" fails, use "make force-tag" to 
+containers:
+	make -C devtools/containers all
+
+container-test: containers
+	podman run -it --rm -v `pwd`:/mnt:z koji-test-fedora:41 bash -c "cd /mnt ; tox -re py3"
+	podman run -it --rm -v `pwd`:/mnt:z koji-test-fedora:42 bash -c "cd /mnt ; tox -re py3"
+	podman run -it --rm -v `pwd`:/mnt:z koji-test-fedora:rawhide bash -c "cd /mnt ; tox -re py3"
+	podman run -it --rm -v `pwd`:/mnt:z koji-test-centos:7 bash -c "cd /mnt ; tox -re py2"
+	podman run -it --rm -v `pwd`:/mnt:z koji-test-centos:8 bash -c "cd /mnt ; tox -re py3"
+	podman run -it --rm -v `pwd`:/mnt:z koji-test-centos:9 bash -c "cd /mnt ; tox -re py3"
+
+# If and only if "make build" fails, use "make force-tag" to
 # re-tag the version.
 #force-tag: $(SPECFILE)
 #	@$(MAKE) tag TAG_OPTS="-F $(TAG_OPTS)"
@@ -170,3 +181,4 @@ install:
 
 	for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` \
 		-C $$d install TYPE=$(TYPE); [ $$? = 0 ] || exit 1; done
+
diff --git a/devtools/containers/Dockerfile.centos7 b/devtools/containers/Dockerfile.centos7
index 35ef358..d72a629 100644
--- a/devtools/containers/Dockerfile.centos7
+++ b/devtools/containers/Dockerfile.centos7
@@ -1,6 +1,13 @@
 FROM quay.io/centos/centos:7
+
+
+ADD files/centos7-eol.repo /etc/yum.repos.d/centos7-eol.repo
+#ADD files/centos7-epel-eol.repo /etc/yum.repos.d/centos7-epel-eol.repo
+
+RUN rm -f /etc/yum.repos.d/CentOS*.repo
+
 RUN \
-  yum -y update && \
+  yum install -y epel-release && \
   yum install -y \
     dnf \
     dnf-plugins-core \
@@ -10,12 +17,12 @@ RUN \
     python-devel \
     python-librepo \
     python-requests \
-    rpm-build  && \
-  yum install -y epel-release && \
-  yum install -y \
+    rpm-build \
     python-defusedxml \
-    python-pip \
     python-psycopg2 && \
-  yum clean all && \
-  pip install -U 'pip==9.0.1' && \
+  yum clean all
+
+RUN curl -O http://pylegacy.org/hub/get-pip-pyopenssl.py && \
+  python get-pip-pyopenssl.py && \
+  #pip install -U 'pip==9.0.1' && \
   pip install -U tox
diff --git a/devtools/containers/Dockerfile.centos8 b/devtools/containers/Dockerfile.centos8
index 4c43ac7..af327e6 100644
--- a/devtools/containers/Dockerfile.centos8
+++ b/devtools/containers/Dockerfile.centos8
@@ -1,5 +1,9 @@
 FROM quay.io/centos/centos:stream8
 
+RUN rm -f /etc/yum.repos.d/*
+
+ADD files/centos8-eol.repo /etc/yum.repos.d/centos8-eol.repo
+
 RUN \
   dnf -y update --nodocs --setopt=install_weak_deps=False && \
   dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \
diff --git a/devtools/containers/Dockerfile.f34 b/devtools/containers/Dockerfile.f34
deleted file mode 100644
index ce9b7b6..0000000
--- a/devtools/containers/Dockerfile.f34
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM registry.fedoraproject.org/fedora:34
-RUN \
-  dnf -y update --nodocs --setopt=install_weak_deps=False && \
-  dnf install -y --nodocs --setopt=install_weak_deps=False \
-  gcc \
-  glibc-langpack-en \
-  krb5-devel \
-  python3-defusedxml \
-  python3-devel \
-  python3-librepo \
-  python3-setuptools \
-  python3-tox \
-  rpm-build && \
-  dnf clean all
diff --git a/devtools/containers/Dockerfile.f35 b/devtools/containers/Dockerfile.f35
deleted file mode 100644
index b16e937..0000000
--- a/devtools/containers/Dockerfile.f35
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM registry.fedoraproject.org/fedora:35
-RUN \
-  dnf -y update --nodocs --setopt=install_weak_deps=False && \
-  dnf install -y --nodocs --setopt=install_weak_deps=False \
-  gcc \
-  glibc-langpack-en \
-  krb5-devel \
-  python3-defusedxml \
-  python3-devel \
-  python3-librepo \
-  python3-setuptools \
-  python3-tox \
-  rpm-build && \
-  dnf clean all
diff --git a/devtools/containers/Dockerfile.f36 b/devtools/containers/Dockerfile.f36
deleted file mode 100644
index 93b5e84..0000000
--- a/devtools/containers/Dockerfile.f36
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM registry.fedoraproject.org/fedora:36
-RUN \
-  dnf -y update --nodocs --setopt=install_weak_deps=False && \
-  dnf install -y --nodocs --setopt=install_weak_deps=False \
-  gcc \
-  glibc-langpack-en \
-  krb5-devel \
-  python3-defusedxml \
-  python3-devel \
-  python3-librepo \
-  python3-setuptools \
-  python3-tox \
-  rpm-build && \
-  dnf clean all
diff --git a/devtools/containers/Dockerfile.f37 b/devtools/containers/Dockerfile.f37
deleted file mode 100644
index 75d8b81..0000000
--- a/devtools/containers/Dockerfile.f37
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM registry.fedoraproject.org/fedora:37
-RUN \
-  dnf -y update --nodocs --setopt=install_weak_deps=False && \
-  dnf install -y --nodocs --setopt=install_weak_deps=False \
-  gcc \
-  glibc-langpack-en \
-  krb5-devel \
-  python3-defusedxml \
-  python3-devel \
-  python3-librepo \
-  python3-setuptools \
-  python3-tox \
-  rpm-build && \
-  dnf clean all
diff --git a/devtools/containers/Dockerfile.f38 b/devtools/containers/Dockerfile.f38
deleted file mode 100644
index b241903..0000000
--- a/devtools/containers/Dockerfile.f38
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM registry.fedoraproject.org/fedora:38
-RUN \
-  dnf -y update --nodocs --setopt=install_weak_deps=False && \
-  dnf install -y --nodocs --setopt=install_weak_deps=False \
-  gcc \
-  glibc-langpack-en \
-  krb5-devel \
-  python3-defusedxml \
-  python3-devel \
-  python3-librepo \
-  python3-setuptools \
-  python3-tox \
-  rpm-build && \
-  dnf clean all
diff --git a/devtools/containers/Dockerfile.f39 b/devtools/containers/Dockerfile.f39
deleted file mode 100644
index 7ecb136..0000000
--- a/devtools/containers/Dockerfile.f39
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM registry.fedoraproject.org/fedora:39
-RUN \
-  dnf -y update --nodocs --setopt=install_weak_deps=False && \
-  dnf install -y --nodocs --setopt=install_weak_deps=False \
-  gcc \
-  glibc-langpack-en \
-  krb5-devel \
-  python3-defusedxml \
-  python3-devel \
-  python3-librepo \
-  python3-setuptools \
-  python3-tox \
-  rpm-build && \
-  dnf clean all
diff --git a/devtools/containers/Dockerfile.f41 b/devtools/containers/Dockerfile.f41
new file mode 100644
index 0000000..face3b6
--- /dev/null
+++ b/devtools/containers/Dockerfile.f41
@@ -0,0 +1,17 @@
+FROM registry.fedoraproject.org/fedora:41
+RUN \
+  dnf -y update --nodocs --setopt=install_weak_deps=False && \
+  dnf install -y --nodocs --setopt=install_weak_deps=False \
+  gcc \
+  glibc-langpack-en \
+  krb5-devel \
+  python3-cheetah \
+  python3-defusedxml \
+  python3-devel \
+  python3-dnf \
+  python3-librepo \
+  python3-rpm \
+  python3-setuptools \
+  python3-tox \
+  rpm-build && \
+  dnf clean all
diff --git a/devtools/containers/Dockerfile.f42 b/devtools/containers/Dockerfile.f42
new file mode 100644
index 0000000..97680e2
--- /dev/null
+++ b/devtools/containers/Dockerfile.f42
@@ -0,0 +1,17 @@
+FROM registry.fedoraproject.org/fedora:42
+RUN \
+  dnf -y update --nodocs --setopt=install_weak_deps=False && \
+  dnf install -y --nodocs --setopt=install_weak_deps=False \
+  gcc \
+  glibc-langpack-en \
+  krb5-devel \
+  python3-cheetah \
+  python3-defusedxml \
+  python3-devel \
+  python3-dnf \
+  python3-librepo \
+  python3-rpm \
+  python3-setuptools \
+  python3-tox \
+  rpm-build && \
+  dnf clean all
diff --git a/devtools/containers/Dockerfile.rawhide b/devtools/containers/Dockerfile.rawhide
index ee5fa76..965a5a4 100644
--- a/devtools/containers/Dockerfile.rawhide
+++ b/devtools/containers/Dockerfile.rawhide
@@ -5,9 +5,12 @@ RUN \
   gcc \
   glibc-langpack-en \
   krb5-devel \
+  python3-cheetah \
   python3-defusedxml \
   python3-devel \
+  python3-dnf \
   python3-librepo \
+  python3-rpm \
   python3-setuptools \
   python3-tox \
   rpm-build && \
diff --git a/devtools/containers/Makefile b/devtools/containers/Makefile
new file mode 100644
index 0000000..8ff0ff2
--- /dev/null
+++ b/devtools/containers/Makefile
@@ -0,0 +1,8 @@
+all:
+	podman build -f Dockerfile.f41 -t koji-test-fedora:41
+	podman build -f Dockerfile.f42 -t koji-test-fedora:42
+	podman build -f Dockerfile.rawhide -t koji-test-fedora:rawhide
+	podman build -f Dockerfile.centos7 -t koji-test-centos:7
+	podman build -f Dockerfile.centos8 -t koji-test-centos:8
+	podman build -f Dockerfile.centos9 -t koji-test-centos:9
+
diff --git a/requirements.txt b/requirements.txt
index 8917561..8a8cecf 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
 -e .
 Cheetah;python_version < '3.0'
-Cheetah3;python_version >= '3.0'
+CT3;python_version >= '3.0'
 psycopg2-binary;python_version >= '3.0'
 python-multilib
 python-qpid-proton<0.38.0;python_version < '3.0'
diff --git a/tox.ini b/tox.ini
index 2ceede7..c25839d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -37,13 +37,13 @@ commands_pre =
 [testenv:py3]
 deps =
     -r{toxinidir}/test-requirements.txt
-setenv = 
+setenv =
     {[testenv]setenv}
     PYTHONPATH=.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib
 commands_pre =
     {[testenv]commands_pre}
     python -m coverage erase --rcfile .coveragerc3
-commands = 
+commands =
     python -m pytest -n auto --cov --cov-config .coveragerc3 --cov-report=html
 
 [testenv:py2]

