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

Since we use rpmtsAddReinstallElement rpm also uninstalls the package #1660

Merged

Conversation

kontura
Copy link
Contributor

@kontura kontura commented May 3, 2024

It calls callbacks for RPMCALLBACK_INST_START and RPMCALLBACK_INST_PROGRESS just like before when the reinstall was done through regural install (rpmtsAddInstallElement) but in addition it also calls RPMCALLBACK_UNINST_START and RPMCALLBACK_UNINST_PROGRESS. To ensure they find the DnfPackage add it to remove_helper array.

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall). We could try to hide one of the them but I think a better solution is to report what is actually happening and report one install and one uninstall.

Fixes: #1653

This is for the context part of libdnf (microdnf, packagekit, ...)

It calls callbacks for `RPMCALLBACK_INST_START` and
`RPMCALLBACK_INST_PROGRESS` just like before when the reinstall was done
through regural install (rpmtsAddInstallElement) but in addition it also
calls `RPMCALLBACK_UNINST_START` and `RPMCALLBACK_UNINST_PROGRESS`. To
ensure they find the `DnfPackage` add it to `remove_helper` array.

Unfortunaly this means that the reinstall action is reported twice to
the clients (one install and one uninstall). We could try to hide one of
the them but I think a better solution is to report what is actually
happening and report one install and one uninstall.

This is for the context part of libdnf (microdnf, packagekit, ...)

Fixes: rpm-software-management#1653
@kontura kontura force-pushed the reinstall_callbacks branch from 19f358f to 60c328f Compare May 3, 2024 07:46
@jan-kolarik jan-kolarik self-assigned this May 13, 2024
@jan-kolarik
Copy link
Member

jan-kolarik commented May 14, 2024

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall).

Does this mean that the package is mentioned twice in the transaction table?

@kontura
Copy link
Contributor Author

kontura commented May 15, 2024

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall).

Does this mean that the package is mentioned twice in the transaction table?

It looks like this:

Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                                                            Repository                                                 Size
Reinstalling:
 bash-5.2.26-3.fc40.x86_64                                                                                                                         fedora                                                   1.9 MB
   replacing bash-5.2.26-3.fc40.x86_64
Transaction Summary:
 Installing:        0 packages
 Reinstalling:      1 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Is this ok [y/N]: y
Downloading packages...
Running transaction test...
Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora
Complete.

Before instead of:

Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora

there was just:

Reinstalling: bash;5.2.26-3.fc40;x86_64;fedora

@jan-kolarik
Copy link
Member

Unfortunaly this means that the reinstall action is reported twice to the clients (one install and one uninstall).

Does this mean that the package is mentioned twice in the transaction table?

It looks like this:

Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                                                            Repository                                                 Size
Reinstalling:
 bash-5.2.26-3.fc40.x86_64                                                                                                                         fedora                                                   1.9 MB
   replacing bash-5.2.26-3.fc40.x86_64
Transaction Summary:
 Installing:        0 packages
 Reinstalling:      1 packages
 Upgrading:         0 packages
 Obsoleting:        0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Is this ok [y/N]: y
Downloading packages...
Running transaction test...
Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora
Complete.

Before instead of:

Installing: bash;5.2.26-3.fc40;x86_64;fedora
Removing: bash;5.2.26-3.fc40;x86_64;fedora

there was just:

Reinstalling: bash;5.2.26-3.fc40;x86_64;fedora

That looks fine, thanks for the example!

@jan-kolarik jan-kolarik merged commit bc37168 into rpm-software-management:dnf-4-master May 15, 2024
9 of 11 checks passed
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.

Reinstalling a packge warns "cannot find THE_PACKAGE in uninst-start"
2 participants