Redesign dnf shared libraries & scan installed DNF comps#1507
Redesign dnf shared libraries & scan installed DNF comps#1507
Conversation
Thank you for contributing to the Leapp project!Please note that every PR needs to comply with the leapp-repository contribution and development guidelines and must pass all tests in order to be mergeable.
Packit will automatically schedule regression tests for this PR's build and latest upstream leapp build.
Note that first time contributors cannot run tests automatically - they need to be started by a reviewer. It is possible to schedule specific on-demand tests as well. Currently 2 test sets are supported,
See other labels for particular jobs defined in the Please open ticket in case you experience technical problem with the CI. (RH internal only) Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please contact leapp-infra. |
Consolidate DNF-related libraries (dnfconfig, dnfplugin, module) into a new dnflibs package for better organization. The old module locations remain as deprecated shims using @deprecated decorator, ensuring full backward compatibility while encouraging migration to the new structure. I plan additional changes in future and I consider the original structure problematic, like: * I want to expose some of private functions, but there is no good place where to put them - and keeping them in original places is not good. * The module.py library has kind of ambiguous name and it was not clear what to expect from it without reading the content. With this change, all actions related to DNF are nicely closured. Changes: - Create repos/system_upgrade/common/libraries/dnflibs/ package - Move dnfconfig.py to dnflibs/dnfconfig.py - Move dnfplugin.py to dnflibs/dnfplugin.py - Move module.py to dnflibs/dnfmodule.py (renamed) - Mark original libraries and their content as deprecated - Update the documentation to reflect deprecated functionality Assisted-by: Claude Sonnet 4.5
c2d1f02 to
aae1228
Compare
aae1228 to
cdf9cf2
Compare
Update all actors and tests to import DNF libraries from the new dnflibs package location instead of the deprecated root paths. Changes: - Update dnfplugin imports to use dnflibs.dnfplugin - Update module imports to use dnflibs.dnfmodule - Affects 8 actors and 3 test files This completes the migration to the new library structure, ensuring all internal code uses the new import paths while maintaining backward compatibility through deprecation shims. Assisted-by: Claude Sonnet 4.5
cdf9cf2 to
17978ec
Compare
This function is not used anywhere anymore. Let's just remove it.
This has been deprecated for a long time - dropping it finally to clean the code a little bit after the moving to a new path.
Originally the library raised usually StopActorExecutionError exception in case of issues. But as we agreed recently, we want to start to raise rather proper exceptions in libraries and handle this better in callers (actors). For the comfort (and sake of safety) the newly created exception classes are inherit from the StopActorExecutionError, so these exceptions will be properly handled also if they are not caught correctly in actors. Also, in case of this library we kind of know that we are the only callers of these functions as they are fundamental for the upgrade process and majority of them can be executed just once per the upgrade process. Docstrings in functions have been properly updated to reflect the change. List of new exceptions: * DNFPluginInstallError * DNFExecutionError * DNFUpgradeTransactionError * RegisteredWorkaroundApplicationError
Disclaimer: This is temporary commit supposed to be modified/dropped. I plan to move and change the _create_or_get_dnf_base function, so it can be used also in actors or other libraries directly for additional purposes. The original StopActorExecutionError exception has been replaced by DNFRepoError so it's easier to identify and handle the possible problem in callers (actors). The new exception class is inherited from StopActorExecutionError so such an exception is still handled by framework if not caught by a caller.
Consolidate DNF-related libraries (dnfconfig, dnfplugin, module) into a new dnflibs package for better organization. The old module locations remain as deprecated shims using @deprecated decorator, ensuring full backward compatibility while encouraging migration to the new structure.
I plan additional changes in future and I consider the original structure problematic, like:
place where to put them - and keeping them in original places is
not good.
clear what to expect from it without reading the content.
With this change, all actions related to DNF are nicely closured.
Changes:
This PR is prerequisite for #1506.
TODO