-
Notifications
You must be signed in to change notification settings - Fork 70
toltecctl: Honour dependencies when uninstalling #456
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
toltecctl: Honour dependencies when uninstalling #456
Conversation
`toltecctl uninstall` will now try to uninstall packages in the reverse order of their dependencies, so that a package can use binaries it depends on during its removal scripts (see #448). Packages in a dependency cycle are removed in an unspecified order. Test plan: Upgrade `toltec-bootstrap`, install some packages, then run `toltecctl uninstall`. You should see packages removed in reverse dependency order, so for example: * `libc`, `libpthread`, `libgcc` should generally be the last removed packages * graphical apps should get removed before `display` * `toltec-bootstrap` should get removed before `coreutils-tsort`
raisjn
left a comment
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.
looks cool! is this much slower than normal opkg uninstall because its doing the listing of dependencies for each package?
|
Thanks for the review! From my tests, having installed the base Entware distribution + around 10 extra packages, the dependency ordering step took around 10 seconds. The Your message prompted me to think about how to cut this time. It turns out We should be just a simple awk script away from turning this into a dependency-ordered list of packages. I’m going to take a look into this and will report on the time saved by this approach. EDIT: The following awk script and Bash pipeline produce the expected ordered list of packages in about 400 ms. /^.* depends on:$/{
from=$1;
print from " " from;
}
/^\t/{
print from " " $1;
}opkg depends '*' | awk "$awk_script" | tsort |
|
Looks good to me, what else is it waiting on? |
|
I haven't replaced the package ordering code with the faster version yet. I'll take care of it tomorrow. |
|
I added the new (faster) code for ordering packages. I executed the test plan again on rM2 and it’s working fine, there is no longer a noticeable delay during the package ordering step. |
`toltecctl uninstall` will now try to uninstall packages in the reverse order of their dependencies, so that a package can use binaries it depends on during its removal scripts (see #448). Packages in a dependency cycle are removed in an unspecified order.
`toltecctl uninstall` will now try to uninstall packages in the reverse order of their dependencies, so that a package can use binaries it depends on during its removal scripts (see #448). Packages in a dependency cycle are removed in an unspecified order.
* toltecctl: Honour dependencies when uninstalling (#456) `toltecctl uninstall` will now try to uninstall packages in the reverse order of their dependencies, so that a package can use binaries it depends on during its removal scripts (see #448). Packages in a dependency cycle are removed in an unspecified order. * [rmkit] upgrade remux with rM1 support on 2.9 (#450) this brings remux up to date with rmkit-dev/rmkit@8254893 major improvement is proper support for touch gestures in remux on rM1 after rebooting. the main issue was the display was resizing after remux started, so the touch gestures were using the wrong display size. holding the center button on rM1 would cause remux to restart (and fix this problem), so there is a workaround available. * Update KOReader to 2021.10 (#467) Co-authored-by: raisjn <70462544+raisjn@users.noreply.github.com> * Add cache for dependencies install (#473) * Add cache for dependencies install Co-authored-by: Mattéo Delabre <1370040+matteodelabre@users.noreply.github.com> Co-authored-by: raisjn <70462544+raisjn@users.noreply.github.com> Co-authored-by: Mattéo Delabre <spam@delab.re>
Following #456, a dependency on coreutils-tsort was added to the toltec-bootstrap package. That dependency is only needed during uninstall and is used to sort the packages in reverse dependency order. The bootstrap script does an initial temporary install of toltec-bootstrap in order to use the toltecctl definitions. It does not expect the package to have dependencies. As a consequence, the script fails to perform installs in its current state. This fix makes the script ignore dependencies for the temporary install. The dependencies do get installed at the end of the install procedure. I also added a warning above the dependency list in toltec-bootstrap to inform future contributors that those dependencies will not be honored in the initial temporary install of toltec-bootstrap. Sorry that I missed this when writing #456!
Following #456, a dependency on coreutils-tsort was added to the toltec-bootstrap package. That dependency is only needed during uninstall and is used to sort the packages in reverse dependency order. The bootstrap script does an initial temporary install of toltec-bootstrap in order to use the toltecctl definitions. It does not expect the package to have dependencies. As a consequence, the script fails to perform installs in its current state. This fix makes the script ignore dependencies for the temporary install. The dependencies do get installed at the end of the install procedure. I also added a warning above the dependency list in toltec-bootstrap to inform future contributors that those dependencies will not be honored in the initial temporary install of toltec-bootstrap. Sorry that I missed this when writing #456!
toltecctl uninstallwill now try to uninstall packages in the reverse order of their dependencies, so that a package can use binaries it depends on during its removal scripts (see #448). Packages in a dependency cycle are removed in an unspecified order.Test plan: Upgrade
toltec-bootstrap, install some packages, then runtoltecctl uninstall. You should see packages removed in reverse dependency order, so for example:libc,libpthread,libgccshould generally be the last removed packagesdisplaytoltec-bootstrapshould get removed beforecoreutils-tsort