Просмотр исходного кода

Supports no automatic
Author: jgg
Date: 1998-12-14 08:07:28 GMT
Supports no automatic

Arch Librarian лет назад: 22
Родитель
Сommit
3c124dde95
5 измененных файлов с 47 добавлено и 16 удалено
  1. 5 2
      apt-pkg/cacheiterators.h
  2. 3 4
      apt-pkg/deb/deblistparser.cc
  3. 5 4
      apt-pkg/depcache.cc
  4. 31 1
      apt-pkg/pkgcache.cc
  5. 3 5
      apt-pkg/pkgcache.h

+ 5 - 2
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)

+ 3 - 4
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();
 }

+ 5 - 4
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;
       }
 	 

+ 31 - 1
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

+ 3 - 5
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
 };