summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cacheiterators.h7
-rw-r--r--apt-pkg/deb/deblistparser.cc7
-rw-r--r--apt-pkg/depcache.cc9
-rw-r--r--apt-pkg/pkgcache.cc32
-rw-r--r--apt-pkg/pkgcache.h8
5 files changed, 47 insertions, 16 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index c5b4b14c0..1de574634 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cacheiterators.h,v 1.10 1998/12/14 02:23:46 jgg Exp $
+// $Id: cacheiterators.h,v 1.11 1998/12/14 08:07:28 jgg Exp $
/* ######################################################################
Cache Iterators - Iterators for navigating the cache structure
@@ -127,7 +127,10 @@ class pkgCache::VerIterator
inline unsigned long Index() const {return Ver - Owner.VerP;};
bool Downloadable() const;
const char *PriorityType();
-
+
+ bool Automatic() const;
+ VerFileIterator NewestFile() const;
+
inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg), Owner(Owner)
{
if (Ver == 0)
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 585006451..669c5cd50 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: deblistparser.cc,v 1.12 1998/12/14 06:54:43 jgg Exp $
+// $Id: deblistparser.cc,v 1.13 1998/12/14 08:07:29 jgg Exp $
/* ######################################################################
Package Cache Generator - Generator for the cache structure.
@@ -469,10 +469,9 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
if (Section.Find("Architecture",Start,Stop) == true)
FileI->Architecture = WriteUniqString(Start,Stop - Start);
- unsigned long Fl = 0;
- if (Section.FindFlag("NotAutomatic",Fl,1) == false)
+ if (Section.FindFlag("NotAutomatic",FileI->Flags,
+ pkgCache::Flag::NotAutomatic) == false)
_error->Warning("Bad NotAutomatic flag");
- FileI->NotAutomatic = Fl;
return !_error->PendingError();
}
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index eb9d5a35b..cd3597ef7 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: depcache.cc,v 1.11 1998/12/10 04:22:45 jgg Exp $
+// $Id: depcache.cc,v 1.12 1998/12/14 08:07:29 jgg Exp $
/* ######################################################################
Dependency Cache - Caches Dependency information.
@@ -104,14 +104,15 @@ pkgDepCache::VerIterator pkgDepCache::GetCandidateVer(PkgIterator Pkg)
// Try to use an explicit target
if (Pkg->TargetVer == 0)
{
- /* Not source versions cannot be a candidate version unless they
- are already installed */
+ /* Not source/not automatic versions cannot be a candidate version
+ unless they are already installed */
for (VerIterator I = Pkg.VersionList(); I.end() == false; I++)
{
if (Pkg.CurrentVer() == I)
return I;
for (VerFileIterator J = I.FileList(); J.end() == false; J++)
- if ((J.File()->Flags & Flag::NotSource) == 0)
+ if ((J.File()->Flags & Flag::NotSource) == 0 &&
+ (J.File()->Flags & Flag::NotAutomatic) == 0)
return I;
}
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index ac1de021a..8ad501e96 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.21 1998/12/14 03:39:15 jgg Exp $
+// $Id: pkgcache.cc,v 1.22 1998/12/14 08:07:29 jgg Exp $
/* ######################################################################
Package Cache - Accessor code for the cache
@@ -438,6 +438,36 @@ const char *pkgCache::VerIterator::PriorityType()
return "";
}
/*}}}*/
+// VerIterator::Automatic - Check if this version is 'automatic' /*{{{*/
+// ---------------------------------------------------------------------
+/* This checks to see if any of the versions files are not NotAutomatic.
+ True if this version is selectable for automatic installation. */
+bool pkgCache::VerIterator::Automatic() const
+{
+ VerFileIterator Files = FileList();
+ for (; Files.end() == false; Files++)
+ if ((Files.File()->Flags & pkgCache::Flag::NotAutomatic) != pkgCache::Flag::NotAutomatic)
+ return true;
+ return false;
+}
+ /*}}}*/
+// VerIterator::NewestFile - Return the newest file version relation /*{{{*/
+// ---------------------------------------------------------------------
+/* This looks at the version numbers associated with all of the sources
+ this version is in and returns the highest.*/
+pkgCache::VerFileIterator pkgCache::VerIterator::NewestFile() const
+{
+ VerFileIterator Files = FileList();
+ VerFileIterator Highest = Files;
+ for (; Files.end() == false; Files++)
+ {
+ if (pkgVersionCompare(Files.File().Version(),Highest.File().Version()) > 0)
+ Highest = Files;
+ }
+
+ return Highest;
+}
+ /*}}}*/
// PkgFileIterator::IsOk - Checks if the cache is in sync with the file /*{{{*/
// ---------------------------------------------------------------------
/* This stats the file and compares its stats with the ones that were
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index f959f4233..2d174cc01 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: pkgcache.h,v 1.14 1998/12/14 03:39:15 jgg Exp $
+// $Id: pkgcache.h,v 1.15 1998/12/14 08:07:29 jgg Exp $
/* ######################################################################
Cache - Structure definitions for the cache file
@@ -82,7 +82,7 @@ class pkgCache
{
enum PkgFlags {Auto=(1<<0),New=(1<<1),Obsolete=(1<<2),Essential=(1<<3),
ImmediateConf=(1<<4)};
- enum PkgFFlags {NotSource=(1<<0)};
+ enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1)};
};
protected:
@@ -207,13 +207,11 @@ struct pkgCache::PackageFile
__apt_ptrloc Label; // Stringtable
__apt_ptrloc Architecture; // Stringtable
unsigned long Size;
- unsigned char NotAutomatic; // Bool
-
+ unsigned long Flags;
// Linked list
__apt_ptrloc NextFile; // PackageFile
unsigned short ID;
- unsigned long Flags;
time_t mtime; // Modification time for the file
};