Skip to content

Commit 6c4dac4

Browse files
authored
Merge pull request #14 from jpopelka/20
2.0
2 parents 4ca2c1e + 227ead6 commit 6c4dac4

12 files changed

+77
-63
lines changed

Diff for: .pre-commit-config.yaml

+8-11
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,14 @@
33
# pre-commit install -t pre-commit -t pre-push
44

55
repos:
6-
- repo: https://github.com/psf/black
7-
rev: 23.9.1
8-
hooks:
9-
- id: black
10-
- repo: https://github.com/pre-commit/mirrors-prettier
11-
rev: v3.0.3
12-
hooks:
13-
- id: prettier
146
- repo: https://github.com/astral-sh/ruff-pre-commit
15-
rev: v0.0.291
7+
rev: v0.1.5
168
hooks:
9+
- id: ruff-format
1710
- id: ruff
1811
args: [--fix, --exit-non-zero-on-fix]
1912
- repo: https://github.com/pre-commit/pre-commit-hooks
20-
rev: v4.4.0
13+
rev: v4.5.0
2114
hooks:
2215
- id: check-added-large-files
2316
- id: check-ast
@@ -29,11 +22,15 @@ repos:
2922
- id: mixed-line-ending
3023
- id: trailing-whitespace
3124
- repo: https://github.com/pre-commit/mirrors-mypy
32-
rev: v1.5.1
25+
rev: v1.7.0
3326
hooks:
3427
- id: mypy
3528
additional_dependencies: [types-requests, types-six]
3629
exclude: docs/conf.py
30+
- repo: https://github.com/pre-commit/mirrors-prettier
31+
rev: v3.1.0
32+
hooks:
33+
- id: prettier
3734
- repo: https://github.com/packit/pre-commit-hooks
3835
rev: v1.2.0
3936
hooks:

Diff for: docs/CHANGES.rst

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
---------
33

4+
2.0
5+
~~~~~~
6+
7+
* Make metalinks work on CentOS Stream 9
8+
49
2.0rc3
510
~~~~~~
611

Diff for: docs/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
copyright = "2016, Red Hat"
1010
author = "rpmdeplint contributors"
1111

12-
version = "1.0"
13-
release = "1.0"
12+
version = "2.0"
13+
release = "2.0"
1414

1515
language = None
1616

@@ -47,7 +47,7 @@
4747
(
4848
"rpmdeplint",
4949
"rpmdeplint",
50-
"a tool to find errors in RPM packages in the context of their dependency graph",
50+
"a tool to find errors in RPM packages in the context of their dependency graph", # noqa: E501
5151
[author],
5252
1,
5353
)

Diff for: docs/rpmdeplint.rst

+6-7
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Synopsis
1111
Description
1212
~~~~~~~~~~~
1313

14-
The :program:`rpmdeplint` command will test dependency satisfiability of given
15-
RPM packages against given repositories.
14+
The :program:`rpmdeplint` command tests the dependency satisfiability of
15+
specified RPM packages against given repositories.
1616

1717
Options
1818
~~~~~~~
@@ -22,13 +22,13 @@ Options
2222
Load yum repository specified by name or by URL/path.
2323

2424
If the repo is already configured in :file:`/etc/yum.repos.d/{*}.repo`
25-
you can just specify its name, like::
25+
simply specify its name like::
2626

2727
--repo=fedora
2828

29-
Otherwise, specify a name and the baseurl or metalink. The NAME is for
29+
Otherwise, specify a name and the base URL or metalink. The NAME is for
3030
descriptive purposes only in this case. It has no impact on dependency
31-
resolution. If rpmdeplint finds a dependency problem relating to a package
31+
resolution. If rpmdeplint identifies a dependency issue relating to a package
3232
in this repo, the NAME will appear in the error message. Examples::
3333

3434
--repo=fedora,https://download.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/
@@ -99,8 +99,7 @@ check-repoclosure
9999

100100
check-conflicts
101101
Checks for undeclared file conflicts in the given RPM packages: that is, when
102-
one of the given package contains a file which is also contained in some
103-
other package.
102+
a given package contains a file also contained in another package.
104103

105104
This command will not report a file as conflicting between two packages if:
106105

Diff for: pyproject.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,7 @@ select = [
7777
ignore = [
7878
"SIM115", # open-file-with-context-handler
7979
]
80-
line-length = 100
8180
target-version = "py39"
81+
82+
[tool.mypy]
83+
python_version = "3.9"

Diff for: rpmdeplint.spec

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
%global upstream_version 2.0rc3
2-
31
Name: rpmdeplint
4-
Version: 2.0~rc3
2+
Version: 2.0
53
Release: %autorelease
64
Summary: Tool to find errors in RPM packages in the context of their dependency graph
75
License: GPL-2.0-or-later
@@ -37,7 +35,7 @@ dependency graph.
3735
This package provides a Python 3 API for performing the checks.
3836

3937
%prep
40-
%autosetup -n rpmdeplint-%{upstream_version}
38+
%autosetup -n rpmdeplint-%{version}
4139

4240
%generate_buildrequires
4341
# The -w flag is required for EPEL 9's older hatchling

Diff for: rpmdeplint/analyzer.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ def packages_with_problems(self) -> list[str]:
111111
@property
112112
def package_dependencies(self) -> dict[str, dict[str, list]]:
113113
"""
114-
Dict in the form {package: {'dependencies': list of packages, 'problems': list of problems}}
114+
Dict in the form {package: {'dependencies': list of packages,
115+
'problems': list of problems}}
115116
"""
116117
return dict(self._packagedeps)
117118

@@ -141,7 +142,8 @@ def __init__(
141142
self.pool = Pool()
142143
self.pool.setarch(arch)
143144

144-
#: List of :py:class:`solv.Solvable` to be tested (corresponding to *packages* parameter)
145+
# List of :py:class:`solv.Solvable` to be tested
146+
# (corresponding to *packages* parameter)
145147
self.solvables: list[XSolvable] = []
146148
self.commandline_repo = self.pool.add_repo("@commandline")
147149
for rpmpath in packages:
@@ -153,9 +155,8 @@ def __init__(
153155
)
154156
self.solvables.append(solvable)
155157

156-
self.repos_by_name = (
157-
{}
158-
) #: Mapping of {repo name: :py:class:`rpmdeplint.repodata.Repo`}
158+
# Mapping of {repo name: :py:class:`rpmdeplint.repodata.Repo`}
159+
self.repos_by_name = {}
159160
for repo in repos:
160161
try:
161162
repo.download_repodata()
@@ -236,7 +237,8 @@ def _select_obsoleted_by(self, solvables: Iterable[XSolvable]) -> Selection:
236237
sel = self.pool.Selection()
237238
for solvable in solvables:
238239
# Select every solvable with the same name and lower EVR.
239-
# XXX are there some special cases with arch-noarch upgrades which this does not handle?
240+
# XXX are there some special cases with arch-noarch upgrades
241+
# which this does not handle?
240242
sel.add(
241243
self.pool.select(
242244
f"{solvable.name}.{solvable.arch} < {solvable.evr}",
@@ -268,7 +270,8 @@ def find_repoclosure_problems(self) -> list[str]:
268270
solver = self.pool.Solver()
269271
# This selection matches packages obsoleted by our packages under test.
270272
obs_sel = self._select_obsoleted_by(self.solvables)
271-
# This selection matches packages obsoleted by other existing packages in the repo.
273+
# This selection matches packages obsoleted
274+
# by other existing packages in the repo.
272275
existing_obs_sel = self._select_obsoleted_by(
273276
s for s in self.pool.solvables if s.repo.name != "@commandline"
274277
)
@@ -491,11 +494,13 @@ def find_upgrade_problems(self) -> list[str]:
491494
continue # it's kept, so no problem here
492495
if action == transaction.SOLVER_TRANSACTION_UPGRADED:
493496
problems.append(
494-
f"{solvable} would be upgraded by {other} from repo {other.repo.name}"
497+
f"{solvable} would be upgraded by {other} "
498+
f"from repo {other.repo.name}"
495499
)
496500
elif action == transaction.SOLVER_TRANSACTION_OBSOLETED:
497501
problems.append(
498-
f"{solvable} would be obsoleted by {other} from repo {other.repo.name}"
502+
f"{solvable} would be obsoleted by {other} "
503+
f"from repo {other.repo.name}"
499504
)
500505
else:
501506
raise RuntimeError(f"Unrecognised transaction step type {action}")

Diff for: rpmdeplint/cli.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def add_common_dependency_analyzer_args(parser):
168168
action="append",
169169
dest="repos",
170170
default=[],
171-
help="Name and optional (baseurl or metalink or local path) of a repo to test against",
171+
help="Name and optional (baseurl or metalink or local path) "
172+
"of a repo to test against",
172173
)
173174
parser.add_argument(
174175
"-R",

Diff for: tests/acceptance/test_check.py

+12-9
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,18 @@ def cleanUp():
7070
+ [p.get_built_rpm("i386") for p in test_packages]
7171
)
7272
assert exitcode == 3
73-
assert err == (
74-
"Problems with dependency set:\n"
75-
"nothing provides doesnotexist needed by e-1.0-1.i386\n"
76-
"Dependency problems with repos:\n"
77-
"package d-0.1-1.i386 requires libfoo.so.4, but none of the providers can be installed\n"
78-
"Undeclared file conflicts:\n"
79-
"f-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n"
80-
"Upgrade problems:\n"
81-
"a-4.0-1.i386 would be upgraded by a-5.0-1.i386 from repo base\n"
73+
assert (
74+
err
75+
== (
76+
"Problems with dependency set:\n"
77+
"nothing provides doesnotexist needed by e-1.0-1.i386\n"
78+
"Dependency problems with repos:\n"
79+
"package d-0.1-1.i386 requires libfoo.so.4, but none of the providers can be installed\n" # noqa: E501
80+
"Undeclared file conflicts:\n"
81+
"f-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n" # noqa: E501
82+
"Upgrade problems:\n"
83+
"a-4.0-1.i386 would be upgraded by a-5.0-1.i386 from repo base\n"
84+
)
8285
)
8386

8487

Diff for: tests/acceptance/test_check_conflicts.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def cleanUp():
4949
assert exitcode == 3
5050
assert err == (
5151
"Undeclared file conflicts:\n"
52-
"a-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n"
52+
"a-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n" # noqa: E501
5353
)
5454

5555

@@ -87,7 +87,7 @@ def cleanUp():
8787
assert exitcode == 3
8888
assert err == (
8989
"Undeclared file conflicts:\n"
90-
"a-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n"
90+
"a-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n" # noqa: E501
9191
)
9292

9393

@@ -258,17 +258,20 @@ def cleanUp():
258258
]
259259
)
260260
assert exitcode == 3
261-
assert err == (
262-
"Undeclared file conflicts:\n"
263-
"x-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n"
264-
"x-0.1-1.i386 provides /usr/share/thing which is also provided by y-0.1-1.i386\n"
265-
"x-0.1-1.i386 provides /usr/share/thing which is also provided by z-0.1-1.i386\n"
266-
"y-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n"
267-
"y-0.1-1.i386 provides /usr/share/thing which is also provided by x-0.1-1.i386\n"
268-
"y-0.1-1.i386 provides /usr/share/thing which is also provided by z-0.1-1.i386\n"
269-
"z-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n"
270-
"z-0.1-1.i386 provides /usr/share/thing which is also provided by x-0.1-1.i386\n"
271-
"z-0.1-1.i386 provides /usr/share/thing which is also provided by y-0.1-1.i386\n"
261+
assert (
262+
err
263+
== (
264+
"Undeclared file conflicts:\n"
265+
"x-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n" # noqa: E501
266+
"x-0.1-1.i386 provides /usr/share/thing which is also provided by y-0.1-1.i386\n" # noqa: E501
267+
"x-0.1-1.i386 provides /usr/share/thing which is also provided by z-0.1-1.i386\n" # noqa: E501
268+
"y-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n" # noqa: E501
269+
"y-0.1-1.i386 provides /usr/share/thing which is also provided by x-0.1-1.i386\n" # noqa: E501
270+
"y-0.1-1.i386 provides /usr/share/thing which is also provided by z-0.1-1.i386\n" # noqa: E501
271+
"z-0.1-1.i386 provides /usr/share/thing which is also provided by b-0.1-1.i386\n" # noqa: E501
272+
"z-0.1-1.i386 provides /usr/share/thing which is also provided by x-0.1-1.i386\n" # noqa: E501
273+
"z-0.1-1.i386 provides /usr/share/thing which is also provided by y-0.1-1.i386\n" # noqa: E501
274+
)
272275
)
273276

274277

@@ -343,7 +346,7 @@ def cleanUp():
343346
assert exitcode == 3
344347
assert err == (
345348
"Undeclared file conflicts:\n"
346-
"b-0.1-1.i386 provides /usr/share/thing which is also provided by a-0.1-1.x86_64\n"
349+
"b-0.1-1.i386 provides /usr/share/thing which is also provided by a-0.1-1.x86_64\n" # noqa: E501
347350
)
348351

349352

@@ -399,7 +402,8 @@ def test_finds_conflicts_in_installonly_packages(request, dir_server):
399402
installPath="usr/share/licenses/kernel-core/COPYING",
400403
sourceFile=SourceFile("COPYING", "content\n"),
401404
)
402-
# The modern mechanism for telling DNF a package is installonly is to add this virtual provide.
405+
# The modern mechanism for telling DNF a package is installonly
406+
# is to add this virtual provide.
403407
kernel1.add_provides("installonlypkg(kernel)")
404408
baserepo = YumRepoBuild([kernel1])
405409
baserepo.make("i386")

Diff for: tests/acceptance/test_check_repoclosure.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def cleanUp():
4545
assert exitcode == 3
4646
assert err == (
4747
"Dependency problems with repos:\n"
48-
"package b-0.1-1.i386 requires libfoo.so.4, but none of the providers can be installed\n"
48+
"package b-0.1-1.i386 requires libfoo.so.4, but none of the providers can be installed\n" # noqa: E501
4949
)
5050

5151

@@ -84,7 +84,7 @@ def cleanUp():
8484
assert exitcode == 3
8585
assert err == (
8686
"Dependency problems with repos:\n"
87-
"package b-0.1-1.i386 requires libfoo.so.4, but none of the providers can be installed\n"
87+
"package b-0.1-1.i386 requires libfoo.so.4, but none of the providers can be installed\n" # noqa: E501
8888
)
8989

9090

Diff for: tests/acceptance/test_check_sat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def cleanUp():
3838
assert exitcode == 3
3939
assert (
4040
err
41-
== "Problems with dependency set:\nnothing provides doesnotexist needed by a-0.1-1.i386\n"
41+
== "Problems with dependency set:\nnothing provides doesnotexist needed by a-0.1-1.i386\n" # noqa: E501
4242
)
4343
assert out == ""
4444

0 commit comments

Comments
 (0)