public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH setup] Ignore reinstall requests if version is not accessible
@ 2022-12-11 15:11 Christian Franke
  2022-12-15 17:39 ` Jon Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Franke @ 2022-12-11 15:11 UTC (permalink / raw)
  To: cygwin-apps

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

This prevents accidental package loss if reinstall is run from local 
directory but the package is no longer cached.

Possible further improvement: Do not offer "Reinstall" in the popup menu 
in this case.

-- 
Regards,
Christian


[-- Attachment #2: 0001-Ignore-reinstall-requests-if-version-is-not-accessib.patch --]
[-- Type: text/plain, Size: 717 bytes --]

From 054697c297a3e21ee5e63f51b27431640cab5cde Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.franke@t-online.de>
Date: Sun, 11 Dec 2022 15:55:47 +0100
Subject: [PATCH] Ignore reinstall requests if version is not accessible

---
 package_meta.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package_meta.cc b/package_meta.cc
index 2257b59..3daa970 100644
--- a/package_meta.cc
+++ b/package_meta.cc
@@ -672,7 +672,7 @@ packagemeta::set_action (_actions action, packageversion const &default_version,
   else if (action == Reinstall_action)
     {
       desired = installed;
-      if (desired)
+      if (desired.accessible ())
 	{
 	  pick (true);
 	  srcpick (false);
-- 
2.38.1


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

* Re: [PATCH setup] Ignore reinstall requests if version is not accessible
  2022-12-11 15:11 [PATCH setup] Ignore reinstall requests if version is not accessible Christian Franke
@ 2022-12-15 17:39 ` Jon Turney
  2022-12-16 15:40   ` Christian Franke
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Turney @ 2022-12-15 17:39 UTC (permalink / raw)
  To: cygwin-apps, Christian Franke

On 11/12/2022 15:11, Christian Franke via Cygwin-apps wrote:
> This prevents accidental package loss if reinstall is run from local 
> directory but the package is no longer cached.

Thanks.  This seems right, so please apply.

> Possible further improvement: Do not offer "Reinstall" in the popup menu 
> in this case.

Indeed.

That might be simply fixable, but really, we need to keep an index of 
the files in the package cache, so we can handle situations like this 
properly, without spending lots of time spinning rust (we could then 
also do some expiry on the cache, which is a feature that has been 
needed for decades...)


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

* Re: [PATCH setup] Ignore reinstall requests if version is not accessible
  2022-12-15 17:39 ` Jon Turney
@ 2022-12-16 15:40   ` Christian Franke
  2022-12-17 17:00     ` Jon Turney
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Franke @ 2022-12-16 15:40 UTC (permalink / raw)
  To: Jon Turney, cygwin-apps

Jon Turney wrote:
> On 11/12/2022 15:11, Christian Franke via Cygwin-apps wrote:
>> This prevents accidental package loss if reinstall is run from local 
>> directory but the package is no longer cached.
>
> Thanks.  This seems right, so please apply.

Done.

Could you please also review "[PATCH setup] Add tooltip for Ctrl+I/R/U 
accelerator keys" before next release?


>
>> Possible further improvement: Do not offer "Reinstall" in the popup 
>> menu in this case.
>
> Indeed.
>
> That might be simply fixable, but really, we need to keep an index of 
> the files in the package cache, so we can handle situations like this 
> properly, without spending lots of time spinning rust 

Agree. "Install from Local Directory" is in particular slow on HDDs when 
directory tree is fragmented or even slower if the cache is on a network 
share.


> (we could then also do some expiry on the cache, which is a feature 
> that has been needed for decades...)


For example: Add checkbox(es) to LocalDirPage to enable/configure cache 
cleanup. In a later step remove all files that could no longer be 
downloaded (like Debian's "apt-get autoclean") and are no longer 
installed. The latter would need some heuristics for source packages as 
these do not appear in installed.db.

BTW, I have a local bash-script 'cygcache' which allows to list package 
states ([auto]installed, cached, curr/prev/test), cleanup the cache 
using above rules (configurable) or merge cache directories into one. 
Still requires some polishing. If there is any interest, I could ITP it 
next year.


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

* Re: [PATCH setup] Ignore reinstall requests if version is not accessible
  2022-12-16 15:40   ` Christian Franke
@ 2022-12-17 17:00     ` Jon Turney
  0 siblings, 0 replies; 4+ messages in thread
From: Jon Turney @ 2022-12-17 17:00 UTC (permalink / raw)
  To: Christian Franke, cygwin-apps

On 16/12/2022 15:40, Christian Franke via Cygwin-apps wrote:
> Jon Turney wrote:
>> On 11/12/2022 15:11, Christian Franke via Cygwin-apps wrote:
>>> This prevents accidental package loss if reinstall is run from local 
>>> directory but the package is no longer cached.
>>
>> Thanks.  This seems right, so please apply.
> 
> Done.
> 
> Could you please also review "[PATCH setup] Add tooltip for Ctrl+I/R/U 
> accelerator keys" before next release?

Yes, I hadn't forgotten about that, but I think it will be a bit before 
I get back to setup...

> BTW, I have a local bash-script 'cygcache' which allows to list package 
> states ([auto]installed, cached, curr/prev/test), cleanup the cache 
> using above rules (configurable) or merge cache directories into one. 
> Still requires some polishing. If there is any interest, I could ITP it 
> next year.

There's been a few ad-hoc solutions over the years, I think, but unless 
it's built into setup somehow, it's not going to reach the majority of 
users, I think.

It's been pointed out recently that the top-level cache directory should 
probably be the release label (e.g 'cygwin') rather than the mirror URL.
(There's some historical cache layout compatibility stuff in Cygwin for 
an even older scheme, but I can't remember the details...)


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

end of thread, other threads:[~2022-12-17 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-11 15:11 [PATCH setup] Ignore reinstall requests if version is not accessible Christian Franke
2022-12-15 17:39 ` Jon Turney
2022-12-16 15:40   ` Christian Franke
2022-12-17 17:00     ` 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).