public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: "cygwin-apps@cygwin.com" <cygwin-apps@cygwin.com>
Subject: Re: setup: problems with local install
Date: Wed, 14 Mar 2018 16:07:00 -0000	[thread overview]
Message-ID: <a79cb3bb-d8bf-88c3-103f-c02916f42f2a@dronecode.org.uk> (raw)
In-Reply-To: <c5f1a88d-6c0c-1e79-b556-4596e84b7127@cornell.edu>

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

On 12/03/2018 13:22, Ken Brown wrote:
> On 3/8/2018 4:59 PM, Ken Brown wrote:
>> On 3/8/2018 10:59 AM, Ken Brown wrote:
>>> On 3/7/2018 4:52 PM, Ken Brown wrote:
>>>> On 3/6/2018 1:47 PM, Jon Turney wrote:
>>>>> On 06/03/2018 15:18, Jon Turney wrote:
>>>>>> So yeah, I guess putting some complexity back in accessible() 
>>>>>> would work, or perhaps the attached?  (This doesn't do the right 
>>>>>> thing for a few packages, for reasons I'm still looking into...)
>>>>>
>>>>> To be specific it was doing the wrong thing for those few packages 
>>>>> with no source
>>>>>
>>>>>>   /* scan for local copies of package */
>>>>>> -void
>>>>>> +bool
>>>>>>   packagemeta::scan (const packageversion &pkg, bool mirror_mode)
>>>>>>   {
>>>>>> -  /* Already have something */
>>>>>> +  /* empty version */
>>>>>>     if (!pkg)
>>>>>> -    return;
>>>>>> +    return true;
>>>>>
>>>>> So, this needs to be 'return false', as the empty version is always 
>>>>> inaccessible, to get the same behaviour as before.
>>>>
>>>> I've found another problem with local installs: If a package needs 
>>>> upgrading, then the chooser will offer the upgraded version for 
>>>> install, even if there's no archive available.  As a result, the 
>>>> current version will get uninstalled, and then setup will discover 
>>>> that it doesn't have the archive to install the new version.

Thanks very much for finding this.

>>>> The problem occurs because packagedb::defaultTrust() is called after 
>>>> ScanDownloadedFiles() has already done its work.  solution.update() 
>>>> and solution.trans2db() are called, and pkg->desired is set equal to 
>>>> an inaccessible version pv (which has been previously removed from 
>>>> pkg->versions).
>>>>
>>>> I guess trans2db() should check that pv is in pkg->versions before 
>>>> acting on an install transaction for pv.  And then we also have to 
>>>> make sure to ignore the erase transaction for the current version of 
>>>> pkg.
>>>>
>>>> Alternatively, can we just remove an inaccessible packageversion 
>>>> from the libsolv pool, or at at least just tell libsolv that we 
>>>> don't want to install it?

Attached is an attempt at that.

I think this is preferable, if it works correctly, as I think avoiding 
solutions with these unavailable versions is better than trying to 
massage the solution afterwards.

>>> Still another alternative, and maybe the simplest, is to make sure 
>>> that the chooser never shows a version that is not in pkg->versions. 
>>> packagemeta::set_action (trusts const trust) almost does this, except 
>>> for one useless desired.accessible() call.  So that should be fixed, 
>>> as well as the setting of the initial action.
>>
>> Sorry for this stream of consciousness series of posts, but I'll stop 
>> after this one.  I think it's possible that restoring the previous 
>> meaning of 'accessible()', at least for local installs, might solve 
>> this problem.

Thanks for the patches.



[-- Attachment #2: 0001-Remove-packages-not-found-by-scan-from-solver.patch --]
[-- Type: text/plain, Size: 1819 bytes --]

From 2ec3a89555409b43b35a2d5a8f161c41c1a993d9 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Wed, 14 Mar 2018 14:52:57 +0000
Subject: [PATCH setup] Remove packages not found by scan from solver

Remove (not installed) packages not found by scan from solver, as well as
from packagemeta, to avoid solutions including them from being proposed.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 libsolv.cc      | 10 ++++++++++
 libsolv.h       |  2 ++
 package_meta.cc |  3 +++
 3 files changed, 15 insertions(+)

diff --git a/libsolv.cc b/libsolv.cc
index 674d576..fc4e5ec 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -304,6 +304,16 @@ SolvableVersion::compareVersions(const SolvableVersion &a,
   return pool_evrcmp(pool, evra, evrb, EVRCMP_COMPARE);
 }
 
+void
+SolvableVersion::remove() const
+{
+  if (!id)
+    return;
+
+  Solvable *solvable = pool_id2solvable(pool, id);
+  repo_free_solvable(solvable->repo, id, 0);
+}
+
 // ---------------------------------------------------------------------------
 // implements class SolverPool
 //
diff --git a/libsolv.h b/libsolv.h
index fc68895..7bb0be2 100644
--- a/libsolv.h
+++ b/libsolv.h
@@ -88,6 +88,8 @@ class SolvableVersion
   bool operator > (SolvableVersion const &) const;
   bool operator >= (SolvableVersion const &) const;
 
+  void remove() const;
+
  private:
   Id id;
   Pool *pool;
diff --git a/package_meta.cc b/package_meta.cc
index 8a33bcb..7f8110d 100644
--- a/package_meta.cc
+++ b/package_meta.cc
@@ -724,7 +724,10 @@ packagemeta::ScanDownloadedFiles (bool mirror_mode)
 		pkg.curr = packageversion ();
 	      if (pkg.exp == *i)
 		pkg.exp = packageversion ();
+
+	      i->remove();
 	      pkg.versions.erase (i++);
+
 	      /* For now, leave the source version alone */
 	    }
 	  else
-- 
2.16.2


  reply	other threads:[~2018-03-14 16:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-05 18:34 Ken Brown
2018-03-06  2:18 ` Ken Brown
2018-03-06 16:38   ` Jon Turney
2018-03-06 15:18 ` Jon Turney
2018-03-06 18:47   ` Jon Turney
2018-03-07 21:53     ` Ken Brown
2018-03-08 15:59       ` Ken Brown
2018-03-08 21:59         ` Ken Brown
2018-03-12 13:22           ` Ken Brown
2018-03-14 16:07             ` Jon Turney [this message]
2018-03-14 19:25               ` Ken Brown
2018-03-15 21:02                 ` Jon Turney
2018-03-06 19:31   ` Ken Brown
2018-03-06 22:13     ` Jon Turney
2018-03-07  7:32     ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a79cb3bb-d8bf-88c3-103f-c02916f42f2a@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).