소스 검색

Free space check, fixed parser jump bug, added importat
Author: jgg
Date: 1999-02-21 08:38:53 GMT
Free space check, fixed parser jump bug, added importat

Arch Librarian 22 년 전
부모
커밋
138d4b3d84
6개의 변경된 파일40개의 추가작업 그리고 19개의 파일을 삭제
  1. 6 2
      apt-pkg/deb/deblistparser.cc
  2. 5 7
      apt-pkg/packagemanager.cc
  3. 2 3
      apt-pkg/pkgcache.h
  4. 13 4
      apt-pkg/tagfile.cc
  5. 13 2
      cmdline/apt-get.cc
  6. 1 1
      debian/control

+ 6 - 2
apt-pkg/deb/deblistparser.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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");
       Pkg->Section = UniqFindTagWrite("Section");
    if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
    if (Section.FindFlag("Essential",Pkg->Flags,pkgCache::Flag::Essential) == false)
       return 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)
    if (ParseStatus(Pkg,Ver) == false)
       return false;
       return false;
    return true;
    return true;

+ 5 - 7
apt-pkg/packagemanager.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    // Generate the list of affected packages and sort it
    for (PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
    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)
 	  NoImmConfigure == false)
       {
       {
 	 List->Flag(I,pkgOrderList::Immediate);
 	 List->Flag(I,pkgOrderList::Immediate);
@@ -158,10 +159,7 @@ bool pkgPackageManager::CreateOrderList()
 	 continue;
 	 continue;
       
       
       // Append it to the list
       // 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;

+ 2 - 3
apt-pkg/pkgcache.h

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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)};
    };
    };
    
    

+ 13 - 4
apt-pkg/tagfile.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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;
 	 return false;
       
       
       if (Tag.Scan(Start,End - Start) == 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();
    Start += Tag.size();
    iOffset += Tag.size();
    iOffset += Tag.size();
@@ -116,11 +116,19 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset)
       return false;
       return false;
    End = Start = Buffer;
    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)
    if (Fill() == false)
       return false;
       return false;
    
    
    if (Tag.Scan(Start,End - Start) == 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)
       if (Stop == 0)
 	 return false;
 	 return false;
+      
       for (; Stop[1] == '\r' && Stop+1 < End; Stop++);
       for (; Stop[1] == '\r' && Stop+1 < End; Stop++);
 
 
       // Double newline marks the end of the record
       // 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;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 13 - 2
cmdline/apt-get.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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 <termios.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
+#include <sys/vfs.h>
 #include <signal.h>
 #include <signal.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <stdio.h>
@@ -534,7 +535,17 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true)
       c0out << DebBytes << ',' << Cache->DebSize() << endl;
       c0out << DebBytes << ',' << Cache->DebSize() << endl;
       c0out << "How odd.. The sizes didn't match, email apt@packages.debian.org" << 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
    // Number of bytes
    c1out << "Need to get ";
    c1out << "Need to get ";
    if (DebBytes != FetchBytes)
    if (DebBytes != FetchBytes)

+ 1 - 1
debian/control

@@ -1,6 +1,6 @@
 Source: apt
 Source: apt
 Section: admin
 Section: admin
-Priority: optional
+Priority: standard
 Maintainer: APT Development Team <deity@lists.debian.org>
 Maintainer: APT Development Team <deity@lists.debian.org>
 Standards-Version: 2.4.1
 Standards-Version: 2.4.1