Skip to content

Commit

Permalink
Merge pull request #19 from jpopelka/conflict-with-modular
Browse files Browse the repository at this point in the history
Skip modular packages when checking for conflicts
  • Loading branch information
jpopelka authored Jan 15, 2024
2 parents f1aa0c6 + a113602 commit c8406b4
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.7
rev: v0.1.13
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -22,7 +22,7 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-requests, types-six]
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ dev
* Exclude dirs known to be owned by many packages from conflict checking.
* If check-upgrade finds a package upgradable by its modular version, skip it.
* Make it possible to run rpmdeplint as a library.
* Skip modular packages when checking for conflicts.

2.0
~~~~~~
Expand Down
6 changes: 4 additions & 2 deletions docs/rpmdeplint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Options
--repo=myrepo,/home/me/my_repo

Note that the URL/path should point at a directory containing
``repodata/repomd.xml``. Examples::
``repodata/repomd.xml``.

.. option:: --repos-from-system, -R

Expand Down Expand Up @@ -107,11 +107,13 @@ check-conflicts
* the file’s checksum, permissions, owner, and group are identical in both
packages (RPM allows both packages to own the file in this case); or
* the file’s color is different between the two packages (RPM will
silently resolve the conflict in favour of the 64-bit file).
silently resolve the conflict in favour of the 64-bit file); or
* any (or both) of them is/are a modular package.

check-upgrade
Checks that there are no existing packages in the repositories which would
upgrade or obsolete the given packages.
Modular packages are not considered as candidates.

If this check fails, it means that the package under test will never be
installed (since the package manager will always pick the newer or obsoleting
Expand Down
15 changes: 11 additions & 4 deletions rpmdeplint/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ def find_conflicts(self) -> list[str]:
# solver = self.pool.Solver()
problems = []
for solvable in self.solvables:
if ".module" in solvable.evr:
logger.debug("Skipping modular %s", solvable)
continue
logger.debug("Checking all files in %s for conflicts", solvable)
filenames = self._files_in_solvable(solvable)
# In libsolv, iterating all solvables is fast, and listing all
Expand All @@ -427,10 +430,11 @@ def find_conflicts(self) -> list[str]:
# Hence, this approach, where we visit each solvable and use Python
# set operations to look for any overlapping filenames.
for conflicting in self.pool.solvables_iter():
# Conflicts cannot happen between identical solvables and also
# between solvables with the same name - such solvables cannot
# be installed next to each other.
if conflicting == solvable or conflicting.name == solvable.name:
# Conflicts cannot happen between solvables with the same name,
# such solvables cannot be installed next to each other.
if conflicting.name == solvable.name:
continue
if ".module" in conflicting.evr:
continue
# Intersect files owned by solvable and conflicting and remove
# dirs that are known to be owned by many packages.
Expand Down Expand Up @@ -501,6 +505,9 @@ def find_upgrade_problems(self) -> list[str]:
transaction = solver.transaction()
problems = []
for solvable in self.solvables:
if ".module" in solvable.evr:
logger.debug("Skipping modular %s", solvable)
continue
action = transaction.steptype(
solvable, transaction.SOLVER_TRANSACTION_SHOW_OBSOLETES
)
Expand Down
2 changes: 1 addition & 1 deletion rpmdeplint/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def validate_common_dependency_analyzer_args(parser, args):
)


def main(args=None):
def main(args=None) -> ExitCode:
def add_subparser(
subcommand: str, _help: str, subcommand_func: Callable[..., ExitCode]
):
Expand Down

0 comments on commit c8406b4

Please sign in to comment.