Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

versionlock: Fix wildcards handling in add command #2009

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented Jan 14, 2025

There’s a bug in how the dnf5 versionlock add <spec> command handles
package specifications when the spec contains a wildcard and matches
multiple package names with the same version (EVR). In such cases, only
the first package is considered, while the rest are quietly skipped.
For example there are three packages matching 'aws-checksums*' pattern,
but only one is actually locked:

❯ dnf repoquery 'aws-checksums*'
Repositories loaded.
aws-checksums-0:0.2.2-1.fc40.i686
aws-checksums-0:0.2.2-1.fc40.x86_64
aws-checksums-devel-0:0.2.2-1.fc40.i686
aws-checksums-devel-0:0.2.2-1.fc40.x86_64
aws-checksums-libs-0:0.2.2-1.fc40.i686
aws-checksums-libs-0:0.2.2-1.fc40.x86_64

❯ dnf versionlock add 'aws-checksums*'
Repositories loaded.
Adding versionlock on "aws-checksums = 0.2.2-1.fc40".

With this patch, each group of packages with the same name is handled
separately, ensuring that all the packages are correctly locked:

❯ dnf5 versionlock add 'aws-checksums*'
Repositories loaded.
Adding versionlock on "aws-checksums = 0.2.2-1.fc40".
Adding versionlock on "aws-checksums-devel = 0.2.2-1.fc40".
Adding versionlock on "aws-checksums-libs = 0.2.2-1.fc40".

For: #1895

There’s a bug in how the `dnf5 versionlock add <spec>` command handles
package specifications when the `spec` contains a wildcard and matches
multiple package names with the same version (EVR). In such cases, only
the first package is considered, while the rest are quietly skipped.
For example there are three packages matching 'aws-checksums*' pattern,
but only one is actually locked:

❯ dnf repoquery 'aws-checksums*'
Repositories loaded.
aws-checksums-0:0.2.2-1.fc40.i686
aws-checksums-0:0.2.2-1.fc40.x86_64
aws-checksums-devel-0:0.2.2-1.fc40.i686
aws-checksums-devel-0:0.2.2-1.fc40.x86_64
aws-checksums-libs-0:0.2.2-1.fc40.i686
aws-checksums-libs-0:0.2.2-1.fc40.x86_64

❯ dnf versionlock add 'aws-checksums*'
Repositories loaded.
Adding versionlock on "aws-checksums = 0.2.2-1.fc40".

With this patch, each group of packages with the same name is handled
separately, ensuring that all the packages are correctly locked:

❯ dnf5 versionlock add 'aws-checksums*'
Repositories loaded.
Adding versionlock on "aws-checksums = 0.2.2-1.fc40".
Adding versionlock on "aws-checksums-devel = 0.2.2-1.fc40".
Adding versionlock on "aws-checksums-libs = 0.2.2-1.fc40".

For: #1895
Copy link
Contributor

@kontura kontura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, I have created a simple test here: rpm-software-management/ci-dnf-stack#1620

I am curious, I see this doesn't really work with architectures and the docs do say at the beginning that it works with set of names and versions for packages, on the other hand they specify package-spec as an argument.
From the description of the add subcommand I would expect that
versionlock add name*.x86_64
would work just for x86_64.

Is the support for architectures being considered?

@kontura kontura added this pull request to the merge queue Jan 20, 2025
Merged via the queue into main with commit fe32348 Jan 20, 2025
17 checks passed
@kontura kontura deleted the mblaha/versionlock-wildcard branch January 20, 2025 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants