]> git.saurik.com Git - apt.git/commitdiff
CDROM and GlobOr fix
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:50 +0000 (16:51 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:51:50 +0000 (16:51 +0000)
Author: jgg
Date: 1998-12-04 22:56:50 GMT
CDROM and GlobOr fix

apt-pkg/acquire-method.cc
apt-pkg/acquire-method.h
apt-pkg/pkgcache.cc
cmdline/apt-cache.cc
methods/cdrom.cc

index 1cebf9a71d2d313700fc1f352b5b44bfbe477f23..fc060d83eaa3c8c9db720d060b8dda1e11c0c625 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-method.cc,v 1.11 1998/12/04 21:16:46 jgg Exp $
+// $Id: acquire-method.cc,v 1.12 1998/12/04 22:56:50 jgg Exp $
 /* ######################################################################
 
    Acquire Method
@@ -189,7 +189,7 @@ void pkgAcqMethod::URIDone(FetchResult &Res, FetchResult *Alt)
 // ---------------------------------------------------------------------
 /* This sends a 403 Media Failure message to the APT and waits for it
    to be ackd */
-void pkgAcqMethod::MediaFail(string Required,string Drive)
+bool pkgAcqMethod::MediaFail(string Required,string Drive)
 {
    char S[1024];
    snprintf(S,sizeof(S),"403 Media Failure\nMedia: %s\nDrive: %s\n\n",
index 08c88265cf60b5171942ac2885d60822a2a4077c..69ed28585aeedce1d018e536ba9699c85f1fa753 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: acquire-method.h,v 1.5 1998/12/03 07:29:17 jgg Exp $
+// $Id: acquire-method.h,v 1.6 1998/12/04 22:56:51 jgg Exp $
 /* ######################################################################
 
    Acquire Method - Method helper class + functions
@@ -58,7 +58,7 @@ class pkgAcqMethod
    void Fail(string Why, bool Transient = false);
    void URIStart(FetchResult &Res);
    void URIDone(FetchResult &Res,FetchResult *Alt = 0);
-   void MediaFail(string Required,string Drive);
+   bool MediaFail(string Required,string Drive);
    
    public:
 
index 06cad4b16667b0983896489c41b64ef5604fb245..8b0e85ea364940997893547583194d26094404c3 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.cc,v 1.18 1998/11/27 00:07:24 jgg Exp $
+// $Id: pkgcache.cc,v 1.19 1998/12/04 22:56:52 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
@@ -379,9 +379,10 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
    // Compute a single dependency element (glob or)
    Start = *this;
    End = *this;
-   for (bool LastOR = true; end() == false && LastOR == true; (*this)++)
+   for (bool LastOR = true; end() == false && LastOR == true;)
    {
       LastOR = (Dep->CompareOp & pkgCache::Dep::Or) == pkgCache::Dep::Or;
+      (*this)++;
       if (LastOR == true)
         End = (*this);
    }
index 3bdeb373c663d271ce82aba89b30546d6592c270..2e1d43dedd19bb0aa4949ecf0600ca391042781b 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-cache.cc,v 1.13 1998/11/27 01:52:53 jgg Exp $
+// $Id: apt-cache.cc,v 1.14 1998/12/04 22:56:53 jgg Exp $
 /* ######################################################################
    
    apt-cache - Manages the cache files
 /* */
 bool UnMet(pkgCache &Cache)
 {
+   bool Important = _config->FindB("Important",false);
+   
    for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
    {
       for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
       {
         bool Header = false;
-        for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
+        for (pkgCache::DepIterator D = V.DependsList(); D.end() == false;)
         {
            // Collect or groups
            pkgCache::DepIterator Start;
            pkgCache::DepIterator End;
            D.GlobOr(Start,End);
            
-           // Skip everything but depends
+/*         cout << "s: Check " << Start.TargetPkg().Name() << ',' <<
+              End.TargetPkg().Name() << endl;*/
+              
+           // Skip conflicts and replaces
            if (End->Type != pkgCache::Dep::PreDepends &&
                End->Type != pkgCache::Dep::Depends && 
                End->Type != pkgCache::Dep::Suggests &&
                End->Type != pkgCache::Dep::Recommends)
               continue;
 
+           // Important deps only
+           if (Important == true)
+              if (End->Type != pkgCache::Dep::PreDepends &&
+                  End->Type != pkgCache::Dep::Depends)
+                 continue;
+           
            // Verify the or group
            bool OK = false;
            pkgCache::DepIterator RealStart = Start;
@@ -330,7 +341,7 @@ bool DoAdd(CommandLine &CmdL)
       return _error->Error("You must give at least one file name");
    
    // Open the cache
-   FileFd CacheF(_config->FindFile("Dir::Cache::srcpkgcache"),FileFd::WriteAny);
+   FileFd CacheF(_config->FindFile("Dir::Cache::pkgcache"),FileFd::WriteAny);
    if (_error->PendingError() == true)
       return false;
    
@@ -347,7 +358,8 @@ bool DoAdd(CommandLine &CmdL)
    for (const char **I = CmdL.FileList + 1; *I != 0; I++)
    {
       Progress.OverallProgress(I - CmdL.FileList,Length,1,"Generating cache");
-      
+      Progress.SubProgress(Length);
+
       // Do the merge
       FileFd TagF(*I,FileFd::ReadOnly);
       debListParser Parser(TagF);
@@ -433,6 +445,7 @@ int main(int argc,const char *argv[])
       {'p',"pkg-cache","Dir::Cache::pkgcache",CommandLine::HasArg},
       {'s',"src-cache","Dir::Cache::srcpkgcache",CommandLine::HasArg},
       {'q',"quiet","quiet",CommandLine::IntLevel},
+      {'i',"important","Important",0},
       {'c',"config-file",0,CommandLine::ConfigFile},
       {'o',"option",0,CommandLine::ArbItem},
       {0,0,0,0}};
index 0d1e8f031b0363ed0c5fd4d7eaa1c28d2efe638d..933d88fc4fbac9c62f17099576a66d53685d84fd 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: cdrom.cc,v 1.1 1998/12/03 07:29:21 jgg Exp $
+// $Id: cdrom.cc,v 1.2 1998/12/04 22:56:55 jgg Exp $
 /* ######################################################################
 
    CDROM URI method for APT
@@ -115,7 +115,12 @@ bool CDROMMethod::Fetch(FetchItem *Itm)
         break;
       
       UnmountCdrom(CDROM);
-      MediaFail(Get.Host,CDROM);
+      if (MediaFail(Get.Host,CDROM) == false)
+      {
+        ID = "FAIL";
+        break;
+      }
+      
       MountCdrom(CDROM);
    }