From 1645f2b13616ec71054a5ad35bce864f1f3e0dca Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sun, 11 Mar 2018 10:43:06 -0400 Subject: [PATCH 1/2] Make SolvableVersion::accessible() useful for local installs For a local install, make SolvableVersion::accessible() indicate whether or not there is an archive available in the local cache. This is used in packagemeta::set_action() to prevent the chooser from offering unavailable versions. --- libsolv.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/libsolv.cc b/libsolv.cc index 0dc7557..604ff7e 100644 --- a/libsolv.cc +++ b/libsolv.cc @@ -14,6 +14,7 @@ #include "libsolv.h" #include "package_db.h" #include "package_meta.h" +#include "resource.h" #include "solv/solver.h" #include "solv/solverdebug.h" @@ -239,21 +240,16 @@ SolvableVersion::source() const return (packagesource *)repo_lookup_num(solvable->repo, id, psrc_attr, (unsigned long long)&empty_source); } +// If we're doing a locall install, is there an archive available? +// This assumes that ScanDownloadedFiles() has already been called. bool SolvableVersion::accessible () const { - // The 'accessible' check used to test if an archive was available locally or - // from a mirror. - // - // This seems utterly pointless. as binary packages which aren't 'accessible' - // never get to appear in the package list. - // - // For source packages, it's equivalent to the bool conversion operator.) - // - if (id != 0) - return TRUE; - else - return FALSE; + if (id == 0) + return false; + if (::source == IDC_SOURCE_LOCALDIR) + return source ()->Cached (); + return true; } package_stability_t -- 2.16.2