summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:31 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:31 +0000
commit1fcbfcb8ba78224fd0e4d532d4fa976f0ea00fef (patch)
treeeb6d17fabc08f717f8ba2b4ac24cc2a4253a60a8 /apt-pkg/pkgcache.cc
parentee989411b3d28ad7e16aae6b996ee6c803e94d26 (diff)
downloadapt-1fcbfcb8ba78224fd0e4d532d4fa976f0ea00fef.tar.gz
Fixed espy's bug with experimental
Author: jgg Date: 1999-04-12 04:21:20 GMT Fixed espy's bug with experimental
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc39
1 files changed, 38 insertions, 1 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 017c4accb..6af04268a 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcache.cc,v 1.23 1999/02/23 06:46:24 jgg Exp $
+// $Id: pkgcache.cc,v 1.24 1999/04/12 04:21:20 jgg Exp $
/* ######################################################################
Package Cache - Accessor code for the cache
@@ -177,6 +177,43 @@ const char *pkgCache::Priority(unsigned char Prio)
return 0;
}
/*}}}*/
+// Cache::GetCandidateVer - Returns the Candidate install version /*{{{*/
+// ---------------------------------------------------------------------
+/* The default just returns the highest available version that is not
+ a source and automatic */
+pkgCache::VerIterator pkgCache::GetCandidateVer(PkgIterator Pkg,
+ bool AllowCurrent)
+{
+ /* Not source/not automatic versions cannot be a candidate version
+ unless they are already installed */
+ VerIterator Last(*this,0);
+
+ for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
+ {
+ if (Pkg.CurrentVer() == I && AllowCurrent == true)
+ return I;
+
+ for (VerFileIterator J = I.FileList(); J.end() == false; J++)
+ {
+ if ((J.File()->Flags & Flag::NotSource) != 0)
+ continue;
+
+ /* Stash the highest version of a not-automatic source, we use it
+ if there is nothing better */
+ if ((J.File()->Flags & Flag::NotAutomatic) != 0)
+ {
+ if (Last.end() == true)
+ Last = I;
+ continue;
+ }
+
+ return I;
+ }
+ }
+
+ return Last;
+}
+ /*}}}*/
// Bases for iterator classes /*{{{*/
void pkgCache::VerIterator::_dummy() {}