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

conf: New classes for append options #1495

Merged
merged 5 commits into from
May 27, 2024
Merged

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented May 15, 2024

Introducing OptionStringAppendList and OptionStringAppendSet classes
for append options.

The current implementation of append options is flawed because it requires
the options to be set in ascending order of priority for proper
functionality. This is necessary for the resetting mechanism using an empty
item to work correctly. However, in dnf5, options are not processed
strictly in priority order. For instance, command line options like
--exclude are processed before the configuration files, despite having a
higher priority than config files.

The new classes accumulate all setting attempts and only process them in
priority order when the option value is needed.

Resolves: #1331

@m-blaha m-blaha force-pushed the mblaha/append-option-2 branch 3 times, most recently from 8132629 to 71bcf4a Compare May 20, 2024 12:19
@m-blaha m-blaha marked this pull request as ready for review May 21, 2024 07:35
@jan-kolarik jan-kolarik self-assigned this May 23, 2024
Copy link
Member

@jan-kolarik jan-kolarik left a comment

Choose a reason for hiding this comment

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

It might be useful to also add some more unit / CI tests for the empty values inside of the option containers to make sure it behaves like it should...

include/libdnf5/conf/option_string_list.hpp Outdated Show resolved Hide resolved
libdnf5/conf/option_string_list.cpp Outdated Show resolved Hide resolved
libdnf5/conf/option_string_list.cpp Show resolved Hide resolved
@m-blaha
Copy link
Member Author

m-blaha commented May 27, 2024

It might be useful to also add some more unit / CI tests for the empty values inside of the option containers to make sure it behaves like it should...

Good point. I will add more tests.

Introducing `OptionStringAppendList` and `OptionStringAppendSet` classes for
append options.

The current implementation of append options is flawed because it
requires the options to be set in ascending order of priority for proper
functionality. This is necessary for the resetting mechanism using an
empty item to work correctly. However, in dnf5, options are not
processed strictly in priority order. For instance, command line options
like `--exclude` are processed before the configuration files, despite
having a higher priority than config files.

The new classes accumulate all setting attempts and then process them in
priority order to compute the actual value.
Converted main options:
- excludepkgs
- includepkgs
- installonlypkgs
- optional_metadata_types
- protected_packages
- tsflags

Converted repository options:
- excludepkgs
- includepkgs
- protected_packages
- Add couple of tests of append option behavior
- Fix Python config option unittest
@jan-kolarik jan-kolarik added this pull request to the merge queue May 27, 2024
Merged via the queue into main with commit 285977e May 27, 2024
14 of 15 checks passed
@jan-kolarik jan-kolarik deleted the mblaha/append-option-2 branch May 27, 2024 12:57
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.

dnf5 append options functionality is broken
2 participants