From: Ken Brown <kbrown@cornell.edu>
To: cygwin-apps <cygwin-apps@cygwin.com>
Subject: [setup topic/libsolv] Packages contained in multiple repositories
Date: Wed, 18 Oct 2017 14:15:00 -0000 [thread overview]
Message-ID: <9db21b28-18fa-603d-dec2-e49f72f9832e@cornell.edu> (raw)
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
When a package (with specified version) is contained in multiple
repositories, we register in packagemeta the last one we see. But if
libsolv decides that the package needs to be installed, its solution may
arbitrarily specify one from a different repo. This caused me some
confusion when debugging an unrelated issue, and I created the attached
patch to "fix" it.
In retrospect, I'm not sure this patch is right, but I'm sending it
anyway for the sake of discussion. My hesitation comes from the fact
that libsolv might have a good reason for preferring the one it chose,
e.g., if we've assigned priorities to the repos. On the other hand, if
we've gone to the trouble of assigning priorities, shouldn't packagemeta
reflect our choice?
I'm of two minds here.
Ken
[-- Attachment #2: 0001-Prefer-the-packageversion-registered-in-packagemeta.patch --]
[-- Type: text/plain, Size: 1932 bytes --]
From 2c0c1edbecad7cdce69a02cef0506b93fe5d7981 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Wed, 18 Oct 2017 09:24:48 -0400
Subject: [PATCH] Prefer the packageversion registered in packagemeta
When a packageversion that is contained in multiple repositories is
being installed, the solver has no way to know which one we prefer.
Change the solution, if necessary, to use the one we registered in
packagemeta when we parsed the setup.ini files.
---
libsolv.cc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/libsolv.cc b/libsolv.cc
index 3a244d4..3750867 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -21,6 +21,8 @@
#include "LogSingleton.h"
#include <iomanip>
+#include <set>
+#include <assert.h>
// ---------------------------------------------------------------------------
// Utility functions for mapping between Operators and Relation Ids
@@ -762,10 +764,21 @@ SolverSolution::update(SolverTasks &tasks, updateMode update, bool use_test_pack
for (int i = 0; i < t->steps.count; i++)
{
- Id id = t->steps.elements[i];
SolverTransaction::transType tt = type(t, i);
+ SolvableVersion sv = SolvableVersion(t->steps.elements[i], pool.pool);
+ // If we are installing a package that is contained in multiple
+ // repositories, we want to use the one registered in
+ // packagemeta.
+ if (tt == SolverTransaction::transInstall)
+ {
+ packagedb db;
+ packagemeta *pkg = db.findBinary(PackageSpecification(sv.Name()));
+ std::set <packageversion>::iterator j = pkg->versions.find(sv);
+ assert (j != pkg->versions.end());
+ sv = *j;
+ }
if (tt != SolverTransaction::transIgnore)
- trans.push_back(SolverTransaction(SolvableVersion(id, pool.pool), tt));
+ trans.push_back(SolverTransaction(sv, tt));
}
// add install and remove tasks for anything marked as reinstall
--
2.14.2
next reply other threads:[~2017-10-18 14:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-18 14:15 Ken Brown [this message]
2017-10-18 16:41 ` Achim Gratz
2017-10-19 13:36 ` Jon Turney
2017-10-19 17:14 ` Achim Gratz
2017-10-21 20:21 ` Ken Brown
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=9db21b28-18fa-603d-dec2-e49f72f9832e@cornell.edu \
--to=kbrown@cornell.edu \
--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).