summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog10
-rw-r--r--debian/control2
-rw-r--r--debian/copyright2
-rw-r--r--debian/patches/python-skbuild-path.patch4
-rw-r--r--debian/tests/pyproject.toml6
-rwxr-xr-xdebian/tests/repotest.py59
-rw-r--r--debian/tests/setup.cfg2
-rw-r--r--debian/tests/tox.ini41
-rw-r--r--src/python/CMakeLists.txt2
9 files changed, 88 insertions, 40 deletions
diff --git a/debian/changelog b/debian/changelog
index 35da3a0..f762689 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+createrepo-c (0.17.3-2) unstable; urgency=medium
+
+ * Fix FTBFS with Python 3.11: use importlib.resources.files() instead of
+ the deprecated .path(). Closes: #1027839, inspired by a patch by
+ Sebastiaan Couwenber
+ * Declare compliance with Policy 4.6.2 with no changes.
+ * Add the year 2023 to my debian/* copyright notice.
+
+ -- Peter Pentchev <roam@debian.org> Fri, 06 Jan 2023 00:16:32 +0200
+
createrepo-c (0.17.3-1) unstable; urgency=medium
* Declare compliance with Debian Policy 4.6.0 with no changes.
diff --git a/debian/control b/debian/control
index f2e155f..a137cdb 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,7 @@ Build-Depends:
rpm <!nocheck>,
zchunk <!nocheck>,
zlib1g-dev
-Standards-Version: 4.6.1
+Standards-Version: 4.6.2
Homepage: https://github.com/rpm-software-management/createrepo_c/
#Vcs-Git: https://gitlab.com/confget/confget.git -b debian
#Vcs-Browser: https://gitlab.com/confget/confget/tree/debian
diff --git a/debian/copyright b/debian/copyright
index 6df7cc3..2274a3b 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -38,7 +38,7 @@ License: GPL-2+
Files: debian/*
Copyright:
- (c) 2018-2022 Peter Pentchev
+ (c) 2018-2023 Peter Pentchev
License: GPL-2+
License: GPL-2+
diff --git a/debian/patches/python-skbuild-path.patch b/debian/patches/python-skbuild-path.patch
index 886e3ca..d654c27 100644
--- a/debian/patches/python-skbuild-path.patch
+++ b/debian/patches/python-skbuild-path.patch
@@ -1,7 +1,7 @@
Description: Make the Python module build with scikit-build
Forwarded: no
Author: Peter Pentchev <roam@ringlet.net>
-Last-Update: 2022-09-05
+Last-Update: 2023-01-05
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -23,7 +23,7 @@ Last-Update: 2022-09-05
)
IF (SKBUILD)
-+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import importlib.resources; print(importlib.resources.path('skbuild', 'resources') / 'cmake', end='')" OUTPUT_VARIABLE PYTHON_SKLIB_CMAKE_DIR)
++ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import importlib.resources; print(importlib.resources.files('skbuild') / 'resources/cmake', end='')" OUTPUT_VARIABLE PYTHON_SKLIB_CMAKE_DIR)
+ MESSAGE(STATUS "Python skbuild CMake dir is ${PYTHON_SKLIB_CMAKE_DIR}")
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PYTHON_SKLIB_CMAKE_DIR}/")
find_package(PythonExtensions REQUIRED)
diff --git a/debian/tests/pyproject.toml b/debian/tests/pyproject.toml
new file mode 100644
index 0000000..c9f44f1
--- /dev/null
+++ b/debian/tests/pyproject.toml
@@ -0,0 +1,6 @@
+[tool.black]
+line-length = 100
+
+[tool.mypy]
+strict = true
+python_version = "3.7"
diff --git a/debian/tests/repotest.py b/debian/tests/repotest.py
index dcc79a0..7d686cf 100755
--- a/debian/tests/repotest.py
+++ b/debian/tests/repotest.py
@@ -2,6 +2,7 @@
"""Perform a createrepo test run."""
import argparse
+import functools
import pathlib
import subprocess
import sys
@@ -12,17 +13,15 @@ from typing import Dict, NamedTuple
import createrepo_c # type: ignore # pylint: disable=import-error
-Config = NamedTuple(
- "Config",
- [
- ("rpmtree", pathlib.Path),
- ("repo", pathlib.Path),
- ("repomd", pathlib.Path),
- ("source", pathlib.Path),
- ("spec", pathlib.Path),
- ("tempd", pathlib.Path),
- ],
-)
+class Config(NamedTuple):
+ """Runtime configuration for the repotest program."""
+
+ rpmtree: pathlib.Path
+ repo: pathlib.Path
+ repomd: pathlib.Path
+ source: pathlib.Path
+ spec: pathlib.Path
+ tempd: pathlib.Path
def parse_args(tempd: pathlib.Path) -> Config:
@@ -34,22 +33,21 @@ def parse_args(tempd: pathlib.Path) -> Config:
required=True,
help="path to the source directory",
)
- parser.add_argument(
- "--spec", type=str, required=True, help="path to the spec file"
- )
+ parser.add_argument("--spec", type=str, required=True, help="path to the spec file")
args = parser.parse_args()
# A sanity check
source = pathlib.Path(args.source)
if not source.is_dir():
- sys.exit("Not a directory: {source}".format(source=source))
- if not (source / "GNUmakefile").is_file():
- sys.exit("Not a file: {source}".format(source=source / "GNUmakefile"))
+ sys.exit(f"Not a directory: {source}")
+ makefile = source / "GNUmakefile"
+ if not makefile.is_file():
+ sys.exit(f"Not a file: {makefile}")
spec = pathlib.Path(args.spec)
if not spec.is_file():
- sys.exit("Not a file: {spec}".format(spec=spec))
+ sys.exit(f"Not a file: {spec}")
return Config(
repo=tempd / "repo",
@@ -89,9 +87,7 @@ def build_rpmtree(cfg: Config, source: pathlib.Path) -> None:
dest = cfg.rpmtree / "SOURCES" / source.name
try:
- subprocess.check_call(
- ["install", "-m", "644", "--", source, dest], shell=False
- )
+ subprocess.check_call(["install", "-m", "644", "--", source, dest], shell=False)
except subprocess.CalledProcessError as err:
sys.exit(f"Could not copy {source} to {dest}: {err}")
@@ -111,9 +107,7 @@ def parse_repo(cfg: Config) -> Dict[str, pathlib.Path]:
repomd = createrepo_c.Repomd(str(cfg.repomd))
primary = next(rec for rec in repomd.records if rec.type == "primary")
- def add_package(
- res: Dict[str, pathlib.Path], pkg: createrepo_c.Package
- ) -> None:
+ def add_package(res: Dict[str, pathlib.Path], pkg: createrepo_c.Package) -> None:
"""Record information about a single package."""
path = cfg.repo / pkg.location_href
idx = f"{pkg.name}:{pkg.arch}"
@@ -127,8 +121,7 @@ def parse_repo(cfg: Config) -> Dict[str, pathlib.Path]:
res: Dict[str, pathlib.Path] = {}
createrepo_c.xml_parse_primary(
- str(cfg.repo / primary.location_href),
- pkgcb=lambda pkg: add_package(res, pkg),
+ str(cfg.repo / primary.location_href), pkgcb=functools.partial(add_package, res)
)
return res
@@ -137,7 +130,7 @@ def parse_repo(cfg: Config) -> Dict[str, pathlib.Path]:
def copy_rpm_packages(cfg: Config) -> None:
"""Copy the packages built by rpmbuild to the repo."""
print("Copying the source RPM package")
- srcs = list((cfg.rpmtree / "SRPMS").rglob("*"))
+ srcs = sorted((cfg.rpmtree / "SRPMS").rglob("*"))
if len(srcs) != 1:
sys.exit(f"Expected a single source package, got {srcs}")
if not srcs[0].is_file() or not srcs[0].name.endswith(".src.rpm"):
@@ -152,9 +145,7 @@ def copy_rpm_packages(cfg: Config) -> None:
)
print("Copying the binary RPM packages")
- rpms = list(
- path for path in (cfg.rpmtree / "RPMS").rglob("*") if path.is_file()
- )
+ rpms = sorted(path for path in (cfg.rpmtree / "RPMS").rglob("*") if path.is_file())
if len(rpms) != 2:
sys.exit(f"Expected two RPM packages, got {rpms!r}")
if not all(path.name.endswith(".rpm") for path in rpms):
@@ -167,9 +158,7 @@ def copy_rpm_packages(cfg: Config) -> None:
dstdir = cfg.repo / src.suffixes[-2].split(".", 1)[1]
dstdir.mkdir(mode=0o755)
print(f"- {src} -> {dstdir}")
- subprocess.check_call(
- ["install", "-m", "644", "--", src, dstdir / src.name], shell=False
- )
+ subprocess.check_call(["install", "-m", "644", "--", src, dstdir / src.name], shell=False)
print("Running createrepo_c again")
subprocess.check_call(["createrepo_c", "--", cfg.repo], shell=False)
@@ -226,10 +215,10 @@ def main() -> None:
missing = known - keys
if missing:
sys.exit(f"Expected at least {known!r}, got {keys!r}")
- remaining = keys - known
+ remaining = sorted(keys - known)
if len(remaining) != 1:
sys.exit(f"Expected a single different key, got {remaining!r}")
- if list(remaining)[0].split(":", 1)[0] != "foo":
+ if remaining[0].split(":", 1)[0] != "foo":
sys.exit(f"Expected a arch:foo key, got {remaining!r}")
print("Seems fine!")
diff --git a/debian/tests/setup.cfg b/debian/tests/setup.cfg
new file mode 100644
index 0000000..3f13854
--- /dev/null
+++ b/debian/tests/setup.cfg
@@ -0,0 +1,2 @@
+[flake8]
+max_line_length = 100
diff --git a/debian/tests/tox.ini b/debian/tests/tox.ini
new file mode 100644
index 0000000..c0b9a69
--- /dev/null
+++ b/debian/tests/tox.ini
@@ -0,0 +1,41 @@
+[tox]
+envlist =
+ black
+ flake8
+ mypy
+ pylint
+skipsdist = true
+
+[defs]
+pyfiles =
+ repotest.py
+
+[testenv:black]
+deps =
+ black >= 22, < 23
+commands =
+ black --check {[defs]pyfiles}
+
+[testenv:black-reformat]
+deps =
+ black >= 22, < 23
+commands =
+ black {[defs]pyfiles}
+
+[testenv:flake8]
+deps =
+ flake8 >= 5, < 6
+commands =
+ flake8 {[defs]pyfiles}
+
+[testenv:mypy]
+deps =
+ mypy >= 0.942
+commands =
+ mypy {[defs]pyfiles}
+
+[testenv:pylint]
+deps =
+ pylint >= 2.14, < 2.16
+commands =
+ pylint {[defs]pyfiles}
diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
index 2e787fd..af5e9ec 100644
--- a/src/python/CMakeLists.txt
+++ b/src/python/CMakeLists.txt
@@ -59,7 +59,7 @@ TARGET_LINK_LIBRARIES(_createrepo_c
)
IF (SKBUILD)
- EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import importlib.resources; print(importlib.resources.path('skbuild', 'resources') / 'cmake', end='')" OUTPUT_VARIABLE PYTHON_SKLIB_CMAKE_DIR)
+ EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import importlib.resources; print(importlib.resources.files('skbuild') / 'resources/cmake', end='')" OUTPUT_VARIABLE PYTHON_SKLIB_CMAKE_DIR)
MESSAGE(STATUS "Python skbuild CMake dir is ${PYTHON_SKLIB_CMAKE_DIR}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PYTHON_SKLIB_CMAKE_DIR}/")
find_package(PythonExtensions REQUIRED)