From 138d4b3d84035f2e0547d7de999d7c7ebb6b7adc Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:52:55 +0000 Subject: [PATCH] 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 --- apt-pkg/deb/deblistparser.cc | 8 ++++++-- apt-pkg/packagemanager.cc | 12 +++++------- apt-pkg/pkgcache.h | 5 ++--- apt-pkg/tagfile.cc | 17 +++++++++++++---- cmdline/apt-get.cc | 15 +++++++++++++-- debian/control | 2 +- 6 files changed, 40 insertions(+), 19 deletions(-) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 82d4f3ee..157a465f 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.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. @@ -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; - if (Section.FindFlag("Immediate-Configure",Pkg->Flags,pkgCache::Flag::ImmediateConf) == false) + if (Section.FindFlag("Important",Pkg->Flags,pkgCache::Flag::Important) == false) return false; + + if (strcmp(Pkg.Name(),"apt") == 0) + Pkg->Flags |= pkgCache::Flag::Important; + if (ParseStatus(Pkg,Ver) == false) return false; return true; diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 1b58cc25..3b09871e 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -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++) { - // 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); @@ -158,10 +159,7 @@ bool pkgPackageManager::CreateOrderList() 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; diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index ce9c866f..4e4bf029 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.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 @@ -80,8 +80,7 @@ class pkgCache 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)}; }; diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 9a581c3e..5d45b59b 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -46,7 +46,7 @@ bool pkgTagFile::Step(pkgTagSection &Tag) 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(); @@ -116,11 +116,19 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long Offset) 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) - return _error->Error("Unable to parse package file"); + return _error->Error("Unable to parse package file %s (2)",Fd.Name().c_str()); + return true; } /*}}}*/ @@ -155,6 +163,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength) if (Stop == 0) return false; + 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++; } - + return false; } /*}}}*/ diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 451519c7..da364e03 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1,6 +1,6 @@ // -*- 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 @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -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; } - + + // 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) diff --git a/debian/control b/debian/control index 6e9366a1..466565eb 100644 --- a/debian/control +++ b/debian/control @@ -1,6 +1,6 @@ Source: apt Section: admin -Priority: optional +Priority: standard Maintainer: APT Development Team Standards-Version: 2.4.1 -- 2.20.1