-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add capabilities for storing and replaying a transaction #1005
Conversation
I have rebased the PR and also added support for installing rpm packages from path. |
I am not sure whether |
Sure, I think we will also need some command for the offline actions. I would do that in a different PR thought. |
53f1f84
to
c78188b
Compare
I have marked the new API as |
I discovered confusing output
|
@kontura May I ask you to verify following scenario |
Similar to #1005 (comment)
|
rpm_specs.emplace_back(GoalAction::REMOVE, package_replay.nevra, settings_per_package); | ||
} | ||
} else if (package_replay.action == transaction::TransactionItemAction::REASON_CHANGE) { | ||
rpm_reason_change_specs.emplace_back( |
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.
Shell we pass full NEVRA here or only name.arch of the package?
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 would make the REASON_CHANGE
work even if a different version than expected is installed.
But why should it work differently than all other actions?
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.
This is a good question with no good answer.
I can argue that:
dnf5 mark
with argument dnf
will be impossible to replay when a different version is installed. We also know, that internal implementation does not care about version and only stores name.arch
information.
In the following example the original version was not in any repository
$ sudo dnf5 mark dependency yum
$ dnf5 history store 61
$ sudo dnf5 upgrade yum
$ sudo dnf5 mark user yum
$ dnf5 history replay transaction.json
Updating and loading repositories:
Repositories loaded.
Failed to resolve the transaction:
No match for argument: yum-0:4.18.1-20231110004827.0.g41a287e2.fc38.noarch
When I replay reason change (to dep) after I changed installed version and also after I changed reason (from dep to user) I got following problem.
dnf5 history replay transaction.json
Updating and loading repositories:
Repositories loaded.
Failed to resolve the transaction:
Argument 'yum-0:4.18.1-20231130005028.8.g6229c1d4.fc38.noarch' matches only excluded packages.
I think that the implementation in PR is more strict then it has to be. Then it is not robust to any changes of installed package when the reason change is replayed.
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.
From my point of view there is an option for this: --ignore-installed
. It is not implemented in dnf5 yet but in old dnf it behaves like this.
For example: if there is a stored transaction updating a-1
to a-3
but a-2
is on the system. Running it normally will fail but with --ignore-installed
it works.
It would make sense to me if REASON_CHANGE
also worked like this.
What do you think?
Why is this expected to fail? Similarly, I can do: amatej@fedora ~ $ sudo echo "File by root" > file
[sudo] password for amatej:
amatej@fedora ~ $ echo "Overwritten file" > file
amatej@fedora ~ $ cat file
Overwritten file
amatej@fedora ~ $ |
I am not able to reproduce this, for me it says:
Which seems reasonable. |
This is the history db transaction.
This is used during transaction replay to ensure stored reasons are used after the transaction is resolved again.
This is used during transaction replay because it always installs/removes/upgrades groups without their packages (they are handled separately).
The problem was fixed just recently (After my testing) - see 763f9cc |
I compared the behavior with
The second command ends with
|
I think there are 3 remaining items:
I consider only |
Yes, I think this is because However I have added a commit which adds a user confirmation request if a file should be overwritten. This matches old dnf behavior. |
I have dropped the |
LGTM |
6f2ab62
This is a second iteration for: #978 I have made a new PR because it nearly completely changed and the old comments could be confusing.
Now there is only one approach and replaying a transaction must go through a
libdnf5::Goal
. The new API is:void libdnf5::Goal::add_transaction_replay(const std::string & json_serialized_transaction, libdnf5::GoalJobSettings & settings_p);
std::string libdnf5::base::transaction::serialize_to_json();
std::string libdnf5::transaction::transaction::serialize_to_json();
For: #999