-
Notifications
You must be signed in to change notification settings - Fork 90
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
Implement system-upgrade and arbitrary offline transactions #1280
Implement system-upgrade and arbitrary offline transactions #1280
Conversation
3b12b42
to
589a4e6
Compare
I see this is still a draft but I would prefer if the commits got restructured. Specifically I think adding the plugin and then removing it right away is just complicating things, I would squash the commits. Also I think the |
Yeah, that's reasonable, I'll reorganize this. Since I'm doing it after the fact, it might not be super tidy (each intermediate commit may not compile), but the history will be more readable. |
589a4e6
to
94c3d97
Compare
OK, I've squashed the commits from the old PR (#1209) and split the large commit into (1) the addition of the |
This needs a rebase on current mainline. It does not apply. |
include/libdnf5/offline/offline.hpp
Outdated
void read(); | ||
std::exception_ptr read_exception; | ||
std::filesystem::path path; | ||
OfflineTransactionStateData data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we hide this into a p_impl
?
Perhaps also the OfflineTransactionStateData
could store the data in p_impl
and have a bunch of getters/setters for the values?
This would allow us to do modifications later without breaking ABI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we no longer need to do this if the offline
module is not in libdnf5, right?
include/libdnf5/offline/offline.hpp
Outdated
TOML11_DEFINE_CONVERSION_NON_INTRUSIVE( | ||
libdnf5::offline::OfflineTransactionStateData, | ||
state_version, | ||
status, | ||
cachedir, | ||
target_releasever, | ||
system_releasever, | ||
verb, | ||
cmd_line, | ||
poweroff_after, | ||
enabled_repos, | ||
disabled_repos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this also be moved to the cpp file?
The conversions are only used in offline.cpp
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but IMHO it's best to keep it in the header since all users of the struct should agree on how to serialize/deserialize it.
It probably makes sense to offer a build conditional for this since dnf5 on non-systemd distributions (such as Yocto) is going to be a thing. |
94c3d97
to
56c9a02
Compare
8e39a69
to
995d379
Compare
Done in 705de82, thanks for the reminder. |
I'm marking this as RFR now, I think it's in a good state. I'd like to add the tests in a separate PR. |
Implement `offline` and `system-upgrade` commands. `dnf5 system-upgrade` is intended to be backwards-compatible with `dnf4 system-upgrade`. All of system-upgrade's functionality, with the exception of the `download` subcommand, is implemented in the new `offline` command, and system-upgrade shares subcommands with it. This is more or less a port of `dnf4 system-upgrade`. This behavior of `dnf5 offline` was proposed here: rpm-software-management#1224 (comment). For rpm-software-management#1052
Adds a new --offline argument that allows any operation to be performed offline, as proposed here: rpm-software-management#1224 (comment). The following commands support `--offline`: `autoremove`, `distro-sync`, `downgrade`, `install`, `group install`, `group upgrade`, `reinstall`, `remove`, `swap`, and `upgrade`.
- Disable autocomplete for dnf5 offline _execute - Collapse SystemUpgradeSubcommand and its subclass SystemUpgradeDownloadCommand - Move include/libdnf5/offline/offline.hpp to dnf5/include/dnf5/offline.hpp - Add journald messages that use OFFLINE_FINISHED_ID, REBOOT_REQUESTED_ID, and DOWNLOAD_FINISHED_ID - Make Context.should_store_offline private with a getter and setter - Make cacheonly setting in `dnf5 offline _execute` actually work by applying it in `pre_configure`, not `configure` - Translate some strings
--installroot with `system-upgrade` and `offline` should now work as it does in DNF 4.
- Store module_platform_id in offline-transaction-state.toml - Set nogpgcheck in `dnf5 offline execute` since the gpgcheck should have already been performed when preparing the transaction
Document the system-upgrade and offline commands and the --offline flag.
bae9603
to
520d21b
Compare
6799f77
to
377527c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there is some issue with systemd
, its not building on f38 and f39.
On Monday I would also like to run the CLI by everyone again to make sure they are ok with it. It is a lot of changes.
['offline-distrosync'] | ||
type = 'command' | ||
attached_command = 'distro-sync' | ||
group_id = 'commands-compatibility-aliases' | ||
complete = true | ||
attached_named_args = [ | ||
{ id_path = 'distro-sync.offline' } | ||
] | ||
|
||
['offline-upgrade'] | ||
type = 'command' | ||
attached_command = 'upgrade' | ||
group_id = 'commands-compatibility-aliases' | ||
complete = true | ||
attached_named_args = [ | ||
{ id_path = 'upgrade.offline' } | ||
] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see these aliases don't match the dnf4 commands.
It basically changes dnf offline-distrosync download
-> dnf5 offline-distrosync
and discards the rest.
We do have all the functionality so I think we could build the aliases to (more or less) fit.
Something like:
['offline-distrosync']
type = 'command'
attached_command = 'distro-sync'
group_id = 'commands-compatibility-aliases'
complete = true
['offline-distrosync.download']
type = 'command'
attached_command = 'distro-sync'
complete = true
attached_named_args = [
{ id_path = 'distro-sync.offline' }
]
['offline-distrosync.log']
type = 'command'
attached_command = 'offline.log'
complete = true
...
(If we do decide to do that I would rather do it in a separate PR.)
Alright, I think it's fixed. We needed to get the |
Thank you! |
e8c5901
This PR supersedes #1209.
Resolves #1052.
Together with #1264, resolves #1224.
This patch implements
dnf5 system-upgrade
as a regular command rather than a plugin.system-upgrade
is responsible for performing offline upgrades of the system to a new major release. It has three main subcommands:dnf5 system-upgrade download --releasever XX
: Does a dry run of an upgrade to a newreleasever
and stores the resulting transaction for later.dnf5 system-upgrade reboot
: Creates a "magic symlink" at/system-update
to trigger the start ofdnf5-offline-transaction.service
on the next boot, then reboots. See https://www.freedesktop.org/software/systemd/man/latest/systemd.offline-updates.html.dnf5-offline-transaction.service
will take the place of the usual boot target so we can preform the upgrade without disturbing too many running processes.dnf5 system-upgrade _execute
: Not intended to be run by the user directly, but rather bydnf5-offline-transaction.service
. Loads the transaction saved bysystem-upgrade download
and performs the upgrade. Interacts with Plymouth (if it's available) to show upgrade progress on the animated boot screen. The usual DNF 5 stdout is additionally logged to journald. Reboots or powers off when the upgrade is complete.This PR also adds a new command,
dnf5 offline
, which shares thereboot
,log
, andclean
subcommands withdnf5 system-upgrade
, and adds a new--offline
argument that allows any operation to be performed offline, as proposed here: #1224 (comment). For example, the process for running an offline upgrade would look like:The following commands support
--offline
:autoremove
,distro-sync
,downgrade
,install
,group install
,group upgrade
,reinstall
,remove
,swap
, andupgrade
.A caveat of making
system-upgrade
andoffline
regular commands instead of plugins is thatlibsystemd
andsdbus-c++
now have to be build dependencies ofdnf5
, sincednf5 offline log
uses these libraries to display logs from offline transactions.Remaining tasks:
dnf5 offline-distrosync
anddnf5 offline-upgrade
aliases todnf5 distro-sync --offline
anddnf5 upgrade --offline
, respectivelysystemd
build condition so we don't have to always depend on libsystemd+sdbus-c++dnf5 offline status
subcommanddnf-plugins-extras
to make sure no historical issues with DNF 4 system-upgrade are present in the new implementationI'll implement the tests in a separate PR if that works. We have the DNF 4 tests to go from: https://github.com/rpm-software-management/dnf-plugins-core/blob/master/tests/test_system_upgrade.py