Commit Graph

4086 Commits

Author SHA1 Message Date
Evan Goode ca1eaefc86 actions: Replace L10N_SSH_KEY secret with RSM CI GitHub token
This will reduce the number of secrets we have to manage. We already use
the RSM_CI_APP_ID and RSM_CI_APP_PRIVATE_KEY in `do-release.yaml`.
2025-07-28 09:26:43 +00:00
Jaroslav Rohel 2463666afe dnf5: Support --installed-from-repo= for "do" 2025-07-25 05:22:27 +00:00
Aleš Matěj 71839dbc26 Disable fastest_mirror callback for package downloading
See the comment for more info.
For: https://bugzilla.redhat.com/show_bug.cgi?id=2381859
2025-07-24 11:36:10 +00:00
Aleš Matěj 141dabd943 Copy return value from `SetConstIterator::operator*`
`SetConstIterator::operator*` returns a reference, this is visible in
cpp and the user behaves accordingly.

In Python the user expects automatic memory management, the object
returned from query iterator should be valid as long as there is a
reference to it.
To ensure this add swig typemaps that copy the returned object.
It works because none of the queries (RepoQeury, GroupQuery,
EnvironmentQuery) store the actual data. They just store some kind of
proxy (RepoWeakPtr or wrapped libsolv ids) so if we copy the RepoWeakPtr
it still points to the same Repo object.

The PackageQuery and AdvisoryQuery return by value even in cpp so they
don't have this problem.
2025-07-24 06:53:45 +00:00
Aleš Matěj 6ae73f6c5d tests: verify `SetConstIterator` works in Python bindings
The problem is that the assignment statement in Python never copies
objects, this means that when we get a reference (returned by
`SetConstIterator::operator*()` to internal query object it is valid
only as long as the query lives.

This means that without additional changes this is a problem for
`RepoQuery`, `GroupQuery` and `EnvironmentQuery`. For me it doesn't
crash with `RepoQuery` (probably due to different memory layout) but it
is caught when run with Sanitizers or valgrind.

To verify with valgrind:
from `dnf5/test/python3/libdnf5` do
`$ PROJECT_BINARY_DIR=../../../build \
PROJECT_SOURCE_DIR=../../../ valgrind python3.13 -m unittest \
repo.test_repo_query.TestRepoQuery.test_repo_query`

This behavior is unexpected in Python, it should manage livetimes
automatically.
2025-07-24 06:53:45 +00:00
Aleš Matěj 2282ae41a5 test_nevra.py: change formatting to satisfy autopep8
The code can be formatted in multiple shapes (that autopep8 accepts).
This versions seems the most acceptable to me.
2025-07-23 08:36:57 +00:00
Luca Boccassi edb3286dc3 Fix various typos found by Lintian 2025-07-22 14:49:38 +00:00
Luca Boccassi f042ef5ab6 tests: fix compat with dash and other shellcheck warnings
With /bin/sh that is not bash:

test/data/build-rpms-and-repos.sh: 4: Syntax error: "(" unexpected
2025-07-22 07:57:22 +00:00
Jaroslav Rohel 85bc321067 dnf5: Support --installed-from-repo= for swap 2025-07-22 06:53:59 +00:00
Jaroslav Rohel 0bf47a05c8 dnf5: Support --installed-from-repo= for upgrade/downgrade/distro-sync 2025-07-22 06:53:59 +00:00
Jaroslav Rohel 97c9d726ab Goal: add_rpm_(upgrade/distro_sync) Improve support from_repo_ids
When `from_repo_ids` is specified, we want to perform `upgrade` and
`distro-sync` only for packages installed from the specified
repositories.
Using UPGRADE_ALL, UPGRADE_ALL_MINIMAL, and DISTROSYNC_ALL is not
possible in this case.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel 1c3a1c708f Goal: Honor set_from_repo_ids in add_up_down_distrosync_to_goal
The `add_up_down_distrosync_to_goal` function now properly takes
`GoalJobsSettings::set_from_repo_ids` into account. This ensures
that goal operations respect the specified repository origins.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel c39d2770f2 dnf5: Support --installed-from-repo= for reinstall/remove 2025-07-22 06:53:59 +00:00
Jaroslav Rohel 9717c48fb1 Goal: Honor set_from_repo_ids in add_(remove,reinstall)_to_goal
The `add_remove_to_goal` and `add_reinstall_to_goal` functions
now properly account for `GoalJobsSettings::set_from_repo_ids`.
This ensures that goal operations respect the specified repository
origins.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel 507cfad8aa dnf5: Support --installed-from-repo= for repoquery/list/info
Adds the `--installed-from-repo=` option to `dnf5 repoquery` `dnf5 list`
and `dnf5 info` commands. This new filter allows users to narrow down
the displayed installed packages to only those that originated from
a specified repositories ID.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel fcd19ec8d5 rpm::PackageQuery: New filter "filter_from_repo_id"
This filter can be used toimplement GoalJobsSettings::set_from_repo_ids.

Within the dnf5 application, this filter will be utilized to filter
installed packages using the command-line option
"--installed-from-repo=".
2025-07-22 06:53:59 +00:00
Jaroslav Rohel 0db4bf62d4 dnf5: "--from-repo=" option enables and validates source repositories
We need to ensure repositories for requested packages are enabled.
During the enabling process, a check will also be performed to verify
that the requested repositories exist.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel 2cb47936a3 Goal::Impl::add_install_to_goal: Fix to_repo_ids handling
If our package installation request includes a restriction to only
repositories defined in `to_repo_ids`, we must retain only
the corresponding installed packages, and do so before checking
if the packages requested for installation are already installed.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel 257d985d08 dnf5: upgrade/distro-sync: Apply --from-repo only if pkgs are specified
This change ensures that `--from-repo` is applied only when specific
packages are provided on the command line.

I am preparing support for filtering from-repo in the DISTRO_SYNC_ALL,
UPGRADE_ALL, and UPGRADE_ALL_MINILMAL actions in libdnf5.
This adjustment in the dnf5 application ensures its behavior won't
change unexpectedly once the full support is added.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel 9a5bd317e6 Goal::Impl::add_specs_to_goal: Skip processing of empty query in *ALL*
The actions UPGRADE_ALL, UPGRADE_ALL_MINIMAL, and DISTRO_SYNC_ALL
unnecessarily processed an empty queries, creating an empty IdQueue and
passing it to the functions `rpm_goal.add_upgrade` and
`rpm_goal.add_distro_sync`.
2025-07-22 06:53:59 +00:00
Jaroslav Rohel fff1ee6c09 Goal::Impl::add_specs_to_goal: Apply to_repo_ids settings in *ALL*
The actions UPGRADE_ALL, UPGRADE_ALL_MINIMAL, and DISTRO_SYNC_ALL
resolve package IDs directly (they do not call additional functions).
During resolution, the to_repo_ids setting was ignored. This fix ensures
that the setting is now taken into account.
2025-07-22 06:53:59 +00:00
Pavla Kratochvilova 8ae46e4553 Add unit tests for nevra parsing 2025-07-21 04:02:22 +00:00
Pavla Kratochvilova 1c6ec4dec1 swig: Add bindings for templated functions that convert nevra to string
Resolves: https://github.com/rpm-software-management/dnf5/issues/1644
2025-07-21 04:02:22 +00:00
pkratoch f30888b5b8 Release 5.2.15.0 2025-07-11 11:39:29 +00:00
GitHub Workflow f528e1fe69 Update translations from weblate 2025-07-11 11:39:29 +00:00
Aleš Matěj 728a093201 Adapt missing gpg key check for parallel downloading
For: https://github.com/rpm-software-management/dnf5/issues/2323

Unfortunaly the errors from librepo parallel downloading API are
reported only as strings (to improve that we would have to break librepo
ABI).
https://github.com/rpm-software-management/librepo/blob/master/librepo/metadata_downloader.h#L61-L62

This approach also works with the nested exceptions (still used by local
repo loading) because we check the suffix (the inner most exception).
2025-07-10 13:53:24 +00:00
Adam Williamson 5672bffb1e repoclosure: skip rich dependencies
Similar to autodetect_unsatisfied_installed_weak_dependencies (in
fact I stole the code from there). repoclosure can give bogus
failures for dependencies like (foo if bar). If nothing provides
foo in the repo(s) under test, but also bar is not present, that
should not be considered a repoclosure failure, but repoclosure
reports it as an "unresolved dep". See:

https://github.com/rpm-software-management/dnf-plugins-core/issues/549

Ideally we should handle rich dependencies correctly, but I cannot
see how to do that, so I'm sending this as an alternative that's
at least less-bad than the current state.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-07-10 12:57:38 +00:00
Petr Písař f5082772c4 search: Do not separate a package from a summary with a colon
It was reported that selecting a package name from an output of "dnf5
search" command was difficult because of a colon adjacent to the
pacakge name:

    $ dnf5 search dontpanic
    Updating and loading repositories:
    Repositories loaded.
    Matched fields: name (exact)
    dontpanic.i686: Very simple library and executable used in testing Alien::Base

Double-clicking on "dontpanic" word selected "dontpanic.i686:",
including the colon character. That made dificult to copy and paste
the found packages.

While this is a problem of the terminal emulator and later the reporter
found a setttings of his terminal not to do it, I think we should use
a pure white-space separator to help people with not so advanced
terminals.

This patch replaces the ": " separator with a single tabulation
character:

    $ dnf5 search dontpanic
    Updating and loading repositories:
    Repositories loaded.
    Matched fields: name (exact)
    dontpanic.i686	Very simple library and executable used in testing Alien::Base

Resolves #2166
2025-07-08 11:14:53 +00:00
Jaroslav Rohel bb05c49822 Fix: add_up_down_distrosync_to_goal: to_repo_ids filtering
When we want distrosync to only use specified repositories for certain
packages, we shouldn't include their already installed versions. If
we did, distr-sync wouldn't perform the necessary downgrades to
the desired package versions, leaving the currently installed versions
in place instead.
2025-07-07 20:16:25 +00:00
Jaroslav Rohel cfe3c38801 dnf5: distro-sync: Argument "--from-repo"
The `--from-repo` argument allows the user to run distro-sync on
packages in the specified repositories. However, any dependency
resolution takes into account packages from all allowed repositories.

Multiple repository ids can be specified, separated by commas, and globs
can be used. Usage is similar to the `install` command.
2025-07-07 20:16:25 +00:00
Pavla Kratochvilova 54fabbcd4b swig: Add %thread directive for repo_sack.hpp for Python
The purpose is to enable multithread support in python. With the %thread
directive, the Python GIL is released before entering the methods from
repo_sack.hpp and acquired when exiting them. In case the methods are
called in a thread, another thread is not blocked by it. This is
especially important in case of loading repositories which can take
a lot of time.
2025-07-07 11:13:20 +00:00
Milan Crha 3fb6c85464 dnfdaemon: Fix a crash under dnf5daemon::DownloadCB::create_signal_download()
The compiler decides when the variables are freed at the end of the function
and when the `user_data` is freed before the `downloader`, then the `downloader`
uses just freed `user_data` in the callbacks. The free order can be different
when the function is left due to an exception.

Fixes https://github.com/rpm-software-management/dnf5/issues/2015
2025-07-04 10:46:03 +00:00
Marek Blaha 2b466777a8 Add dnf5daemon-server requirement for polkit subpkg
Add the base package dependency for the dnf5daemon-server-polkit
subpackage to ensure that dnf5daemon-server also gets updated when the
polkit rule changes.

Resolves: https://github.com/rpm-software-management/dnf5/issues/2313
2025-07-03 04:44:51 +00:00
Petr Písař 1b0f80599f doc: Correct handling the translations
The POT files are actually generated by GitHub and pushed to dnf5-l10n
and the translations are commited into this repository.
2025-07-03 03:13:08 +00:00
Marek Blaha 8a53412ac0 dnfdaemon-client: Call server methods asynchronously
We need to call server methods without blocking the current thread.
Otherwise, the dnf5daemon-client cannot handle signals reporting
progress of repository/package downloading and RPM transactions.
Unfortunately, the repository key import confirmation workflow also
depends on signal handling.

Curiously, blocking calls used to work with sdbus-cpp v1, but with v2
any signal handler was blocked until the call finished.
2025-07-01 14:48:26 +00:00
Petr Písař 049f247ed4 offline: Require D-Bus socket service from dnf5-offline-transaction.service
In my test system there is no D-Bus server running in systemd updates
environment. Therefore rebooting by calling a D-Bus method fails:

    čen 30 13:17:52 fedora-43 dnf5[642]: Couldn't connect to D-Bus: [org.freedesktop.DBus.Error.FileNotFound] Failed to open bus (No such file or directory)
    čen 30 13:17:52 fedora-43 systemd[1]: dnf5-offline-transaction.service: Main process exited, code=exited, status=1/FAILURE
    čen 30 13:17:52 fedora-43 systemd[1]: dnf5-offline-transaction.service: Failed with result 'exit-code'.
    čen 30 13:17:52 fedora-43 systemd[1]: Failed to start dnf5-offline-transaction.service - Offline upgrades/transactions using DNF 5.

I tried to exececute "shutdown -r now" command or "systemctl reboot"
command instead to avoid starting D-Bus and logind daemons. The
commands indeed initiated the reboot, but still complained on missing
D-Bus.

Let's swallow the bitter pill and accept that systemd requires D-Bus:
This patch adds a dependency on dbus.socket to
dnf5-offline-transaction.service.

(Neveretheless, sometimes systemd is persuaded that dnf5 program finished
with a failure:

    čen 30 16:03:17 fedora-43 systemd-logind[647]: The system will reboot now!
    [...]
    čen 30 16:03:17 fedora-43 dnf5[637]: Complete!
    [...]
    čen 30 16:03:18 fedora-43 systemd[1]: dnf5-offline-transaction.service: Main process exited, code=exited, status=1/FAILURE

but that's a different issue #2327).
2025-07-01 06:20:03 +00:00
Petr Písař b7a8cba119 offline: Perform gracefull powerof/reboot instead of immediate one
When rebooting machine on an off-line upgrade, the system could be
rebooted without unmouning file systems because
org.freedesktop.systemd1.Manager.Reboot() D-Bus call performs
an immediate reboot.

This patch fixes it by using org.freedesktop.login1.Manger interface
which performs graceful shutdown. That means stopping services and
unmounting file systems. The logind method also employs inhibition
locks preventing e.g. inadverternt reboot when another users are
logged in.

The true argument enables interactive authorization with polkit.
That's useless after applying the updates, but useful before applying
them when a user issues "dnf5 offline reboot".

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2350947
2025-07-01 06:20:03 +00:00
Aleš Matěj 29995d448f readthedocs: add swig include to fix doc builds
Since commit 9930310 the binding files include
`#include "bindings/libdnf5/exception.hpp"` when running swig to
generate docs we need to include a path from where it can be found.
2025-06-26 09:50:59 +00:00
Aleš Matěj a5bb8e7bb9 readthedocs: extract `SOURCE_DIR` variable
This simplifies path joining and is clearer.
2025-06-26 09:50:59 +00:00
Aleš Matěj bbcc3fc7fe readthedocs: fix path joining
We want to use `os.path.join(...)` not join two strings.
2025-06-26 09:50:59 +00:00
Marek Blaha d13eb0a506 dnfdaemon: Make permission check more consistent
Change permissions required for:
- clean cache
- clean or cancel offline transaction (only before the rpm transaction begins)
- set finish action after offline transaction (reboot or poweroff)

Currently the main user of these APIs is gnome software which can (if
the dnf5daemon-server-polkit package is installed) allow wheel group
users to install/upgrade packages from configured repositories without
being prompted for passwords. We need to set the same checks also for
offline transaction management APIs. Otherwise the user is allowed to
prepare an offline transaction, but is prompted for a password anyway
due to the `set_finish_action()` call that is executed after the
packages are downloaded and the offline transaction is prepared and
stored.
2025-06-26 08:52:02 +00:00
Marek Blaha 0f8ca4157a dnfdaemon: Removed incorrect output parameter names
The method does not return any output parameters.

Resolves: https://github.com/rpm-software-management/dnf5/issues/2317
2025-06-25 08:51:08 +00:00
Marek Blaha 2aff305f2a dnfdaemon: support all_advisories option for recent_changes()
If "all_advisories" option is present, not only advisories for the
currently installed version of the upgraded package are returned, but
also advisories for all versions between the original and currently
installed versions.
2025-06-24 12:54:15 +00:00
Marek Blaha a56219fc0b advisory: Add support for filtering advisories by Nevra
This commit introduces a new overload of the
AdvisoryQuery::filter_packages method that accepts a vector of
libdnf5::rpm::Nevra objects. This allows filtering advisories based on
whether they contain at least one AdvisoryPackage that matches a
provided NEVRA, using a specified comparison operator.

The reason is to be able to get advisories related to the given
transaction from the history database. These transactions can contain
packages that are no longer available in repositories; thus, we need to
filter not by the IDs stored in PackageSet, but directly by NEVRA
objects.
2025-06-24 12:54:15 +00:00
Marek Blaha a4f60a2688 dnfdaemon: support installonly pkgs in recent_changes()
Installed/removed installonly packages are correctly returned in
History::recent_changes().
2025-06-24 12:54:15 +00:00
Marek Blaha db35547a26 dnfdaemon: Add new History interface
Create a new D-Bus interface to retrieve information from the dnf5
transaction history. The new History interface currently supports only
one method: "recent_changes". This method retrieves information from the
history database about changes in the installed package set since the
specified point in time.
2025-06-24 12:54:15 +00:00
Jaroslav Rohel 16608e4430 dnf5: repoclosure: Support globs in "--check=" option 2025-06-24 06:35:56 +00:00
Petr Písař 88f9f3f25e doc: Handling translations
Users reporting mistakes in translations needs to be directed to Fedora Weblate.
2025-06-23 10:16:53 +00:00
Aleš Matěj c3062130ed Docs: enhance install command behavior description 2025-06-23 08:40:21 +00:00
Aleš Matěj 455085cfa3 Unify commands help with package specs 2025-06-23 08:40:21 +00:00