diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:50:58 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:50:58 +0000 |
commit | c5162d564ac98a1e97812ec5d290d2375c0820d8 (patch) | |
tree | 547a70fd355e85f1fa5d74a1b015e612f905e160 | |
parent | 6f27a7fc6c8471534c5cee39cffdc2def1388bdc (diff) |
Sync
Author: jgg
Date: 1998-09-18 02:42:38 GMT
Sync
-rw-r--r-- | apt-pkg/contrib/error.cc | 28 | ||||
-rw-r--r-- | apt-pkg/contrib/error.h | 3 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 26 |
3 files changed, 51 insertions, 6 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc index 42e01e9fe..bbd081d50 100644 --- a/apt-pkg/contrib/error.cc +++ b/apt-pkg/contrib/error.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: error.cc,v 1.4 1998/09/12 02:46:26 jgg Exp $ +// $Id: error.cc,v 1.5 1998/09/18 02:42:40 jgg Exp $ /* ###################################################################### Global Erorr Class - Global error mechanism @@ -94,6 +94,32 @@ bool GlobalError::Errno(const char *Function,const char *Description,...) return false; } /*}}}*/ +// GlobalError::WarningE - Get part of the warn string from errno /*{{{*/ +// --------------------------------------------------------------------- +/* Function indicates the stdlib function that failed and Description is + a user string that leads the text. Form is: + Description - Function (errno: strerror) + Carefull of the buffer overrun, sprintf. + */ +bool GlobalError::WarningE(const char *Function,const char *Description,...) +{ + va_list args; + va_start(args,Description); + + // sprintf the description + char S[400]; + vsprintf(S,Description,args); + sprintf(S + strlen(S)," - %s (%i %s)",Function,errno,strerror(errno)); + + // Put it on the list + Item *Itm = new Item; + Itm->Text = S; + Itm->Error = false; + Insert(Itm); + + return false; +} + /*}}}*/ // GlobalError::Error - Add an error to the list /*{{{*/ // --------------------------------------------------------------------- /* Just vsprintfs and pushes */ diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index 7250bb1c0..9b54b72a5 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: error.h,v 1.4 1998/09/12 02:46:27 jgg Exp $ +// $Id: error.h,v 1.5 1998/09/18 02:42:41 jgg Exp $ /* ###################################################################### Global Erorr Class - Global error mechanism @@ -64,6 +64,7 @@ class GlobalError // Call to generate an error from a library call. bool Errno(const char *Function,const char *Description,...); + bool WarningE(const char *Function,const char *Description,...); /* A warning should be considered less severe than an error, and may be ignored by the client. */ diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 825af40c0..46ae33c83 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: pkgcachegen.cc,v 1.15 1998/09/07 05:28:37 jgg Exp $ +// $Id: pkgcachegen.cc,v 1.16 1998/09/18 02:42:38 jgg Exp $ /* ###################################################################### Package Cache Generator - Generator for the cache structure. @@ -409,9 +409,23 @@ bool pkgSrcCacheCheck(pkgSourceList &List) _error->Discard(); return false; } - + + // Count the number of missing files + int Missing = 0; + for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++) + { + string File = ListDir + URItoFileName(I->PackagesURI()); + struct stat Buf; + if (stat(File.c_str(),&Buf) != 0) + { + _error->WarningE("stat","Couldn't stat source package list '%s' (%s)", + I->PackagesInfo().c_str(),File.c_str()); + Missing++; + } + } + // They are certianly out of sync - if (Cache.Head().PackageFileCount != List.size()) + if (Cache.Head().PackageFileCount != List.size() - Missing) return false; for (pkgCache::PkgFileIterator F(Cache); F.end() == false; F++) @@ -572,7 +586,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress) { string File = ListDir + URItoFileName(I->PackagesURI()); if (stat(File.c_str(),&Buf) != 0) - return _error->Errno("stat","Couldn't stat source package list %s",File.c_str()); + continue; TotalSize += Buf.st_size; } @@ -584,6 +598,10 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress) for (pkgSourceList::const_iterator I = List.begin(); I != List.end(); I++) { string File = ListDir + URItoFileName(I->PackagesURI()); + + if (stat(File.c_str(),&Buf) != 0) + continue; + FileFd Pkg(File,FileFd::ReadOnly); debListParser Parser(Pkg); Progress.OverallProgress(CurrentSize,TotalSize,Pkg.Size(),"Reading Package Lists"); |