setup: uninstalling an orphaned package
Ken Brown
kbrown@cornell.edu
Tue Mar 27 19:05:00 GMT 2018
On 3/26/2018 1:55 PM, Ken Brown wrote:
> In ChooserPage::applyCommandLinePackageSelection() we have the following
> code:
>
>      bool wanted   = pkg.isManuallyWanted();
>      bool deleted  = pkg.isManuallyDeleted();
>      bool basemisc = (pkg.categories.find ("Base") !=
> pkg.categories.end ()
> Â Â Â Â Â Â Â Â Â Â Â Â || pkg.categories.find ("Orphaned") != pkg.categories.end
> ());
> [...]
>      bool reinstall = (wanted || basemisc) && deleted;
>
> One strange consequence of this is that if the user tries to uninstall
> an orphaned package on the command line, then setup will instead try to
> reinstall it.
>
> This behavior was introduced in the following commit:
>
> commit a667a8b289ccb6e70ec6bf4c70cceeca4d3fb5d3
> Author: Corinna Vinschen <corinna@vinschen.de>
> Date:Â Â Thu Jul 25 12:03:49 2013 +0000
>
> [...]
> Uninstalled packages in categories "Base" or "Misc" are always selected
> for installation; installed packages in these categories are not
> eligible for deletion and will be reinstalled or upgraded instead.
> [...]
>
> I can't understand the rationale for this. Did "Misc" (which has since
> been renamed to "Orphaned") used to have a different meaning?
>
> I found it very surprising when I tried to uninstall a bunch of packages
> in unattended mode, and setup failed with download errors because it
> tried to reinstall orphaned packages.
Patch attached.
Ken
-------------- next part --------------
From 3a78453fd8a3b5d9734a11b839f13e68c84d1c05 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Tue, 27 Mar 2018 13:56:27 -0400
Subject: [PATCH setup] Allow command-line uninstallation of specific orphaned
packages
Also change the implementation of the "--delete-orphans" option to use
the same definition of "orphaned" that's used elsewhere in the code.
---
choose.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/choose.cc b/choose.cc
index 5a4d3ad..1249efa 100644
--- a/choose.cc
+++ b/choose.cc
@@ -295,13 +295,13 @@ ChooserPage::applyCommandLinePackageSelection()
packagemeta &pkg = *(i->second);
bool wanted = pkg.isManuallyWanted();
bool deleted = pkg.isManuallyDeleted();
- bool basemisc = (pkg.categories.find ("Base") != pkg.categories.end ()
- || pkg.categories.find ("Orphaned") != pkg.categories.end ());
- bool upgrade = wanted || (!pkg.installed && basemisc);
+ bool base = pkg.categories.find ("Base") != pkg.categories.end ();
+ bool orphaned = pkg.categories.find ("Orphaned") != pkg.categories.end ();
+ bool upgrade = wanted || (!pkg.installed && base);
bool install = wanted && !deleted && !pkg.installed;
- bool reinstall = (wanted || basemisc) && deleted;
- bool uninstall = (!(wanted || basemisc) && (deleted || PruneInstallOption))
- || (!pkg.curr && CleanOrphansOption);
+ bool reinstall = (wanted || base) && deleted;
+ bool uninstall = (!(wanted || base) && (deleted || PruneInstallOption))
+ || (orphaned && CleanOrphansOption);
if (install)
pkg.set_action (packagemeta::Install_action, pkg.curr);
else if (reinstall)
--
2.16.2
More information about the Cygwin-apps
mailing list