]> git.saurik.com Git - apt.git/commitdiff
Free space check, fixed parser jump bug, added importat
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:52:55 +0000 (16:52 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:52:55 +0000 (16:52 +0000)
Author: jgg
Date: 1999-02-21 08:38:53 GMT
Free space check, fixed parser jump bug, added importat

apt-pkg/deb/deblistparser.cc
apt-pkg/packagemanager.cc
apt-pkg/pkgcache.h
apt-pkg/tagfile.cc
cmdline/apt-get.cc
debian/control

index 82d4f3ee935cd8b580f93aac190bfe19fe955a72..157a465f48c82b2a523c9c83f15172befbd3d981 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: deblistparser.cc,v 1.16 1999/02/08 07:30:50 jgg Exp $
+// $Id: deblistparser.cc,v 1.17 1999/02/21 08:38:53 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -119,8 +119,12 @@ bool debListParser::UsePackage(pkgCache::PkgIterator Pkg,
       Pkg->Section = UniqFindTagWrite("Section");
    if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
       return false;
       Pkg->Section = UniqFindTagWrite("Section");
    if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
       return false;
-   if (Section.FindFlag("Immediate-Configure",Pkg->Flags,pkgCache::Flag::ImmediateConf) == false)
+   if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false)
       return false;
       return false;
+
+   if (strcmp(Pkg.Name(),"apt") == 0)
+      Pkg->Flags |= pkgCache::Flag::Important;
+   
    if (ParseStatus(Pkg,Ver) == false)
       return false;
    return true;
    if (ParseStatus(Pkg,Ver) == false)
       return false;
    return true;
index 1b58cc25dcbe8dc9a793184eae69d4345e9348b4..3b09871e500d40be749338fde975faa6ffba11ff 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: packagemanager.cc,v 1.13 1999/02/19 07:56:07 jgg Exp $
+// $Id: packagemanager.cc,v 1.14 1999/02/21 08:38:53 jgg Exp $
 /* ######################################################################
 
    Package Manager - Abstacts the package manager
 /* ######################################################################
 
    Package Manager - Abstacts the package manager
@@ -130,8 +130,9 @@ bool pkgPackageManager::CreateOrderList()
    // Generate the list of affected packages and sort it
    for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
    {
    // Generate the list of affected packages and sort it
    for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
    {
-      // Mark the package for immediate configuration
-      if ((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential &&
+      // Mark the package and its dependends for immediate configuration
+      if (((I->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential ||
+          (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) &&
          NoImmConfigure == false)
       {
         List->Flag(I,pkgOrderList::Immediate);
          NoImmConfigure == false)
       {
         List->Flag(I,pkgOrderList::Immediate);
@@ -158,10 +159,7 @@ bool pkgPackageManager::CreateOrderList()
         continue;
       
       // Append it to the list
         continue;
       
       // Append it to the list
-      List->push_back(I);
-      
-      if ((I->Flags & pkgCache::Flag::ImmediateConf) == pkgCache::Flag::ImmediateConf)
-        List->Flag(I,pkgOrderList::Immediate);
+      List->push_back(I);      
    }
    
    return true;
    }
    
    return true;
index ce9c866fb6cdc96ad26232422d4e21db3785f05c..4e4bf0290084d60ba5f74304d94403bd3f40005e 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.h,v 1.16 1999/02/01 02:22:11 jgg Exp $
+// $Id: pkgcache.h,v 1.17 1999/02/21 08:38:53 jgg Exp $
 /* ######################################################################
    
    Cache - Structure definitions for the cache file
 /* ######################################################################
    
    Cache - Structure definitions for the cache file
@@ -80,8 +80,7 @@ class pkgCache
    
    struct Flag
    {
    
    struct Flag
    {
-      enum PkgFlags {Auto=(1<<0),New=(1<<1),Obsolete=(1<<2),Essential=(1<<3),
-        ImmediateConf=(1<<4)};
+      enum PkgFlags {Auto=(1<<0),Essential=(1<<3),Important=(1<<4)};
       enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1)};
    };
    
       enum PkgFFlags {NotSource=(1<<0),NotAutomatic=(1<<1)};
    };
    
index 9a581c3e86ce5dc93e9c8d3ca65ab81baf46716c..5d45b59bcb33ed2afd81863aa0b182587dc2ff38 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: tagfile.cc,v 1.22 1999/01/31 21:52:27 jgg Exp $
+// $Id: tagfile.cc,v 1.23 1999/02/21 08:38:53 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -46,7 +46,7 @@ bool pkgTagFile::Step(pkgTagSection &Tag)
         return false;
       
       if (Tag.Scan(Start,End - Start) == false)
         return false;
       
       if (Tag.Scan(Start,End - Start) == false)
-        return _error->Error("Unable to parse package file %s",Fd.Name().c_str());
+        return _error->Error("Unable to parse package file %s (1)",Fd.Name().c_str());
    }   
    Start += Tag.size();
    iOffset += Tag.size();
    }   
    Start += Tag.size();
    iOffset += Tag.size();
@@ -116,11 +116,19 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
       return false;
    End = Start = Buffer;
    
       return false;
    End = Start = Buffer;
    
+   if (Fill() == false)
+      return false;
+
+   if (Tag.Scan(Start,End - Start) == true)
+      return true;
+   
+   // This appends a double new line (for the real eof handling)
    if (Fill() == false)
       return false;
    
    if (Tag.Scan(Start,End - Start) == false)
    if (Fill() == false)
       return false;
    
    if (Tag.Scan(Start,End - Start) == false)
-      return _error->Error("Unable to parse package file");
+      return _error->Error("Unable to parse package file %s (2)",Fd.Name().c_str());
+  
    return true;
 }
                                                                        /*}}}*/
    return true;
 }
                                                                        /*}}}*/
@@ -155,6 +163,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
       
       if (Stop == 0)
         return false;
       
       if (Stop == 0)
         return false;
+      
       for (; Stop[1] == '\r' && Stop+1 < End; Stop++);
 
       // Double newline marks the end of the record
       for (; Stop[1] == '\r' && Stop+1 < End; Stop++);
 
       // Double newline marks the end of the record
@@ -167,7 +176,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
       
       Stop++;
    }
       
       Stop++;
    }
-   
+
    return false;
 }
                                                                        /*}}}*/
    return false;
 }
                                                                        /*}}}*/
index 451519c7c1fea39d5183a6f46c5340bc5f554455..da364e03c238f6ed673e8c2212b4df67ce216d72 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: apt-get.cc,v 1.42 1999/02/15 08:23:10 jgg Exp $
+// $Id: apt-get.cc,v 1.43 1999/02/21 08:38:53 jgg Exp $
 /* ######################################################################
    
    apt-get - Cover for dpkg
 /* ######################################################################
    
    apt-get - Cover for dpkg
@@ -46,6 +46,7 @@
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/vfs.h>
 #include <signal.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <signal.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -534,7 +535,17 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
       c0out << DebBytes << ',' << Cache->DebSize() << endl;
       c0out << "How odd.. The sizes didn't match, email apt@packages.debian.org" << endl;
    }
       c0out << DebBytes << ',' << Cache->DebSize() << endl;
       c0out << "How odd.. The sizes didn't match, email apt@packages.debian.org" << endl;
    }
-      
+
+   // Check for enough free space
+   struct statfs Buf;
+   string OutputDir = _config->FindDir("Dir::Cache::Archives");
+   if (statfs(OutputDir.c_str(),&Buf) != 0)
+      return _error->Errno("statfs","Couldn't determine free space in %s",
+                          OutputDir.c_str());
+   if (unsigned(Buf.f_bfree) < FetchBytes/Buf.f_bsize)
+      return _error->Error("Sorry, you don't have enough free space in %s",
+                          OutputDir.c_str());
+   
    // Number of bytes
    c1out << "Need to get ";
    if (DebBytes != FetchBytes)
    // Number of bytes
    c1out << "Need to get ";
    if (DebBytes != FetchBytes)
index 6e9366a18284018cd65d81ece37ec4dfb8b2d44e..466565ebbded96d425a034a65076e4ea344bfbbc 100644 (file)
@@ -1,6 +1,6 @@
 Source: apt
 Section: admin
 Source: apt
 Section: admin
-Priority: optional
+Priority: standard
 Maintainer: APT Development Team <deity@lists.debian.org>
 Standards-Version: 2.4.1
 
 Maintainer: APT Development Team <deity@lists.debian.org>
 Standards-Version: 2.4.1