public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* setup: uninstalling an orphaned package
@ 2018-03-26 17:55 Ken Brown
  2018-03-27 19:05 ` Ken Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2018-03-26 17:55 UTC (permalink / raw)
  To: cygwin-apps

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.

Ken

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: setup: uninstalling an orphaned package
  2018-03-26 17:55 setup: uninstalling an orphaned package Ken Brown
@ 2018-03-27 19:05 ` Ken Brown
  2018-06-10 20:58   ` Jon Turney
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2018-03-27 19:05 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]

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


[-- Attachment #2: 0001-Allow-command-line-uninstallation-of-specific-orphan.patch --]
[-- Type: text/plain, Size: 1745 bytes --]

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: setup: uninstalling an orphaned package
  2018-03-27 19:05 ` Ken Brown
@ 2018-06-10 20:58   ` Jon Turney
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Turney @ 2018-06-10 20:58 UTC (permalink / raw)
  To: cygwin-apps

On 27/03/2018 20:04, Ken Brown wrote:
> 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.
>>
[...]
> 
> Patch attached.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-10 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-26 17:55 setup: uninstalling an orphaned package Ken Brown
2018-03-27 19:05 ` Ken Brown
2018-06-10 20:58   ` Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).