Bladeren bron

The 'not dead yet' release

* add hook for MarkInstall and MarkDelete (closes: #470035)
* add the various foldmarkers in apt-pkg & cmdline (no code change)
* versions with a pin of -1 shouldn't be a candidate (Closes: #355237)
* prefer mmap as memory allocator in MMap instead of a static char
  array which can (at least in theory) grow dynamic
* eliminate (hopefully all) segfaults in pkgcachegen.cc and mmap.cc
  which can arise if cache doesn't fit into the mmap (Closes: #535218)
* display warnings instead of errors if the parts dirs doesn't exist
* honor the dpkg hold state in new Marker hooks (closes: #64141)
Michael Vogt 17 jaren geleden
bovenliggende
commit
d597253495

+ 40 - 62
apt-pkg/acquire-item.cc

@@ -131,9 +131,7 @@ void pkgAcquire::Item::Rename(string From,string To)
    }   
    }   
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-
-// AcqDiffIndex::AcqDiffIndex - Constructor			
+// AcqDiffIndex::AcqDiffIndex - Constructor				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Get the DiffIndex file first and see if there are patches availabe 
 /* Get the DiffIndex file first and see if there are patches availabe 
  * If so, create a pkgAcqIndexDiffs fetcher that will get and apply the
  * If so, create a pkgAcqIndexDiffs fetcher that will get and apply the
@@ -184,7 +182,7 @@ pkgAcqDiffIndex::pkgAcqDiffIndex(pkgAcquire *Owner,
    QueueURI(Desc);
    QueueURI(Desc);
 
 
 }
 }
-
+									/*}}}*/
 // AcqIndex::Custom600Headers - Insert custom request headers		/*{{{*/
 // AcqIndex::Custom600Headers - Insert custom request headers		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The only header we use is the last-modified header. */
 /* The only header we use is the last-modified header. */
@@ -202,9 +200,8 @@ string pkgAcqDiffIndex::Custom600Headers()
    
    
    return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
    return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
 }
 }
-
-
-bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
+									/*}}}*/
+bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)		/*{{{*/
 {
 {
    if(Debug)
    if(Debug)
       std::clog << "pkgAcqIndexDiffs::ParseIndexDiff() " << IndexDiffFile 
       std::clog << "pkgAcqIndexDiffs::ParseIndexDiff() " << IndexDiffFile 
@@ -291,8 +288,8 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string IndexDiffFile)
       std::clog << "Can't find a patch in the index file" << std::endl;
       std::clog << "Can't find a patch in the index file" << std::endl;
    return false;
    return false;
 }
 }
-
-void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+									/*}}}*/
+void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)	/*{{{*/
 {
 {
    if(Debug)
    if(Debug)
       std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << std::endl
       std::clog << "pkgAcqDiffIndex failed: " << Desc.URI << std::endl
@@ -305,8 +302,8 @@ void pkgAcqDiffIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    Status = StatDone;
    Status = StatDone;
    Dequeue();
    Dequeue();
 }
 }
-
-void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash,
+									/*}}}*/
+void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash,	/*{{{*/
 			   pkgAcquire::MethodConfig *Cnf)
 			   pkgAcquire::MethodConfig *Cnf)
 {
 {
    if(Debug)
    if(Debug)
@@ -335,10 +332,8 @@ void pkgAcqDiffIndex::Done(string Message,unsigned long Size,string Md5Hash,
    Dequeue();
    Dequeue();
    return;
    return;
 }
 }
-
-
-
-// AcqIndexDiffs::AcqIndexDiffs - Constructor			
+									/*}}}*/
+// AcqIndexDiffs::AcqIndexDiffs - Constructor				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The package diff is added to the queue. one object is constructed
 /* The package diff is added to the queue. one object is constructed
  * for each diff and the index
  * for each diff and the index
@@ -372,9 +367,8 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
       QueueNextDiff();
       QueueNextDiff();
    }
    }
 }
 }
-
-
-void pkgAcqIndexDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+									/*}}}*/
+void pkgAcqIndexDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf)	/*{{{*/
 {
 {
    if(Debug)
    if(Debug)
       std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << std::endl
       std::clog << "pkgAcqIndexDiffs failed: " << Desc.URI << std::endl
@@ -383,9 +377,8 @@ void pkgAcqIndexDiffs::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 		   ExpectedHash);
 		   ExpectedHash);
    Finish();
    Finish();
 }
 }
-
-
-// helper that cleans the item out of the fetcher queue
+									/*}}}*/
+// Finish - helper that cleans the item out of the fetcher queue	/*{{{*/
 void pkgAcqIndexDiffs::Finish(bool allDone)
 void pkgAcqIndexDiffs::Finish(bool allDone)
 {
 {
    // we restore the original name, this is required, otherwise
    // we restore the original name, this is required, otherwise
@@ -420,10 +413,8 @@ void pkgAcqIndexDiffs::Finish(bool allDone)
    Dequeue();
    Dequeue();
    return;
    return;
 }
 }
-
-
-
-bool pkgAcqIndexDiffs::QueueNextDiff()
+									/*}}}*/
+bool pkgAcqIndexDiffs::QueueNextDiff()					/*{{{*/
 {
 {
 
 
    // calc sha1 of the just patched file
    // calc sha1 of the just patched file
@@ -469,10 +460,8 @@ bool pkgAcqIndexDiffs::QueueNextDiff()
 
 
    return true;
    return true;
 }
 }
-
-
-
-void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash,
+									/*}}}*/
+void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash,	/*{{{*/
 			    pkgAcquire::MethodConfig *Cnf)
 			    pkgAcquire::MethodConfig *Cnf)
 {
 {
    if(Debug)
    if(Debug)
@@ -543,8 +532,7 @@ void pkgAcqIndexDiffs::Done(string Message,unsigned long Size,string Md5Hash,
 	 return Finish(true);
 	 return Finish(true);
    }
    }
 }
 }
-
-
+									/*}}}*/
 // AcqIndex::AcqIndex - Constructor					/*{{{*/
 // AcqIndex::AcqIndex - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The package file is added to the queue and a second class is 
 /* The package file is added to the queue and a second class is 
@@ -594,8 +582,7 @@ string pkgAcqIndex::Custom600Headers()
    return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
    return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)	/*{{{*/
 {
 {
    bool descChanged = false;
    bool descChanged = false;
    // no .bz2 found, retry with .gz
    // no .bz2 found, retry with .gz
@@ -630,8 +617,7 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 
 
    Item::Failed(Message,Cnf);
    Item::Failed(Message,Cnf);
 }
 }
-
-
+									/*}}}*/
 // AcqIndex::Done - Finished a fetch					/*{{{*/
 // AcqIndex::Done - Finished a fetch					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This goes through a number of states.. On the initial fetch the
 /* This goes through a number of states.. On the initial fetch the
@@ -735,7 +721,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
    QueueURI(Desc);
    QueueURI(Desc);
    Mode = decompProg;
    Mode = decompProg;
 }
 }
-
+									/*}}}*/
 // AcqIndexTrans::pkgAcqIndexTrans - Constructor			/*{{{*/
 // AcqIndexTrans::pkgAcqIndexTrans - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The Translation file is added to the queue */
 /* The Translation file is added to the queue */
@@ -744,7 +730,6 @@ pkgAcqIndexTrans::pkgAcqIndexTrans(pkgAcquire *Owner,
   : pkgAcqIndex(Owner, URI, URIDesc, ShortDesc, HashString(), "")
   : pkgAcqIndex(Owner, URI, URIDesc, ShortDesc, HashString(), "")
 {
 {
 }
 }
-
 									/*}}}*/
 									/*}}}*/
 // AcqIndexTrans::Failed - Silence failure messages for missing files	/*{{{*/
 // AcqIndexTrans::Failed - Silence failure messages for missing files	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -764,8 +749,7 @@ void pkgAcqIndexTrans::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    Item::Failed(Message,Cnf);
    Item::Failed(Message,Cnf);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
+pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,				/*{{{*/
 			     string URI,string URIDesc,string ShortDesc,
 			     string URI,string URIDesc,string ShortDesc,
 			     string MetaIndexURI, string MetaIndexURIDesc,
 			     string MetaIndexURI, string MetaIndexURIDesc,
 			     string MetaIndexShortDesc,
 			     string MetaIndexShortDesc,
@@ -854,7 +838,7 @@ void pkgAcqMetaSig::Done(string Message,unsigned long Size,string MD5,
 
 
 }
 }
 									/*}}}*/
 									/*}}}*/
-void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
+void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)/*{{{*/
 {
 {
    string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
    string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
 
 
@@ -890,8 +874,8 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    
    
    Item::Failed(Message,Cnf);
    Item::Failed(Message,Cnf);
 }
 }
-
-pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,
+									/*}}}*/
+pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,			/*{{{*/
 				 string URI,string URIDesc,string ShortDesc,
 				 string URI,string URIDesc,string ShortDesc,
 				 string SigFile,
 				 string SigFile,
 				 const vector<struct IndexTarget*>* IndexTargets,
 				 const vector<struct IndexTarget*>* IndexTargets,
@@ -910,7 +894,6 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,
 
 
    QueueURI(Desc);
    QueueURI(Desc);
 }
 }
-
 									/*}}}*/
 									/*}}}*/
 // pkgAcqMetaIndex::Custom600Headers - Insert custom request headers	/*{{{*/
 // pkgAcqMetaIndex::Custom600Headers - Insert custom request headers	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -926,8 +909,8 @@ string pkgAcqMetaIndex::Custom600Headers()
    
    
    return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
    return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
 }
 }
-
-void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash,
+									/*}}}*/
+void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash,	/*{{{*/
 			   pkgAcquire::MethodConfig *Cfg)
 			   pkgAcquire::MethodConfig *Cfg)
 {
 {
    Item::Done(Message,Size,Hash,Cfg);
    Item::Done(Message,Size,Hash,Cfg);
@@ -968,8 +951,8 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long Size,string Hash,
       }
       }
    }
    }
 }
 }
-
-void pkgAcqMetaIndex::RetrievalDone(string Message)
+									/*}}}*/
+void pkgAcqMetaIndex::RetrievalDone(string Message)			/*{{{*/
 {
 {
    // We have just finished downloading a Release file (it is not
    // We have just finished downloading a Release file (it is not
    // verified yet)
    // verified yet)
@@ -1007,8 +990,8 @@ void pkgAcqMetaIndex::RetrievalDone(string Message)
    chmod(FinalFile.c_str(),0644);
    chmod(FinalFile.c_str(),0644);
    DestFile = FinalFile;
    DestFile = FinalFile;
 }
 }
-
-void pkgAcqMetaIndex::AuthDone(string Message)
+									/*}}}*/
+void pkgAcqMetaIndex::AuthDone(string Message)				/*{{{*/
 {
 {
    // At this point, the gpgv method has succeeded, so there is a
    // At this point, the gpgv method has succeeded, so there is a
    // valid signature from a key in the trusted keyring.  We
    // valid signature from a key in the trusted keyring.  We
@@ -1041,8 +1024,8 @@ void pkgAcqMetaIndex::AuthDone(string Message)
    Rename(SigFile,VerifiedSigFile);
    Rename(SigFile,VerifiedSigFile);
    chmod(VerifiedSigFile.c_str(),0644);
    chmod(VerifiedSigFile.c_str(),0644);
 }
 }
-
-void pkgAcqMetaIndex::QueueIndexes(bool verify)
+									/*}}}*/
+void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
 {
 {
    for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
    for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
         Target != IndexTargets->end();
         Target != IndexTargets->end();
@@ -1084,8 +1067,8 @@ void pkgAcqMetaIndex::QueueIndexes(bool verify)
 			    (*Target)->ShortDesc, ExpectedIndexHash);
 			    (*Target)->ShortDesc, ExpectedIndexHash);
    }
    }
 }
 }
-
-bool pkgAcqMetaIndex::VerifyVendor(string Message)
+									/*}}}*/
+bool pkgAcqMetaIndex::VerifyVendor(string Message)			/*{{{*/
 {
 {
 //    // Maybe this should be made available from above so we don't have
 //    // Maybe this should be made available from above so we don't have
 //    // to read and parse it every time?
 //    // to read and parse it every time?
@@ -1171,9 +1154,8 @@ bool pkgAcqMetaIndex::VerifyVendor(string Message)
 
 
    return true;
    return true;
 }
 }
-       								/*}}}*/
-// pkgAcqMetaIndex::Failed - no Release file present or no signature
-//      file present	                                        /*{{{*/
+									/*}}}*/
+// pkgAcqMetaIndex::Failed - no Release file present or no signature file present	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
@@ -1210,9 +1192,7 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    // back to queueing Packages files without verification
    // back to queueing Packages files without verification
    QueueIndexes(false);
    QueueIndexes(false);
 }
 }
-
 									/*}}}*/
 									/*}}}*/
-
 // AcqArchive::AcqArchive - Constructor					/*{{{*/
 // AcqArchive::AcqArchive - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This just sets up the initial fetch environment and queues the first
 /* This just sets up the initial fetch environment and queues the first
@@ -1495,14 +1475,13 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
    }
    }
 }
 }
 									/*}}}*/
 									/*}}}*/
-// AcqArchive::IsTrusted - Determine whether this archive comes from a
-// trusted source							/*{{{*/
+// AcqArchive::IsTrusted - Determine whether this archive comes from a trusted source /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 bool pkgAcqArchive::IsTrusted()
 bool pkgAcqArchive::IsTrusted()
 {
 {
    return Trusted;
    return Trusted;
 }
 }
-
+									/*}}}*/
 // AcqArchive::Finished - Fetching has finished, tidy up		/*{{{*/
 // AcqArchive::Finished - Fetching has finished, tidy up		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -1514,7 +1493,6 @@ void pkgAcqArchive::Finished()
    StoreFilename = string();
    StoreFilename = string();
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // AcqFile::pkgAcqFile - Constructor					/*{{{*/
 // AcqFile::pkgAcqFile - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The file is added to the queue */
 /* The file is added to the queue */

+ 22 - 22
apt-pkg/acquire-item.h

@@ -34,7 +34,7 @@
  *  \file acquire-item.h
  *  \file acquire-item.h
  */
  */
 
 
-/** \brief Represents the process by which a pkgAcquire object should
+/** \brief Represents the process by which a pkgAcquire object should	{{{
  *  retrieve a file or a collection of files.
  *  retrieve a file or a collection of files.
  *
  *
  *  By convention, Item subclasses should insert themselves into the
  *  By convention, Item subclasses should insert themselves into the
@@ -261,8 +261,8 @@ class pkgAcquire::Item
     */
     */
    virtual ~Item();
    virtual ~Item();
 };
 };
-
-/** \brief Information about an index patch (aka diff). */
+									/*}}}*/
+/** \brief Information about an index patch (aka diff). */		/*{{{*/
 struct DiffInfo {
 struct DiffInfo {
    /** The filename of the diff. */
    /** The filename of the diff. */
    string file;
    string file;
@@ -273,8 +273,8 @@ struct DiffInfo {
    /** The size of the diff. */
    /** The size of the diff. */
    unsigned long size;
    unsigned long size;
 };
 };
-
-/** \brief An item that is responsible for fetching an index file of
+									/*}}}*/
+/** \brief An item that is responsible for fetching an index file of	{{{
  *  package list diffs and starting the package list's download.
  *  package list diffs and starting the package list's download.
  *
  *
  *  This item downloads the Index file and parses it, then enqueues
  *  This item downloads the Index file and parses it, then enqueues
@@ -348,8 +348,8 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
    pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
    pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
 		   string ShortDesc, HashString ExpectedHash);
 		   string ShortDesc, HashString ExpectedHash);
 };
 };
-
-/** \brief An item that is responsible for fetching all the patches
+									/*}}}*/
+/** \brief An item that is responsible for fetching all the patches	{{{
  *  that need to be applied to a given package index file.
  *  that need to be applied to a given package index file.
  *
  *
  *  After downloading and applying a single patch, this item will
  *  After downloading and applying a single patch, this item will
@@ -477,8 +477,8 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
 		    string ShortDesc, HashString ExpectedHash,
 		    string ShortDesc, HashString ExpectedHash,
 		    vector<DiffInfo> diffs=vector<DiffInfo>());
 		    vector<DiffInfo> diffs=vector<DiffInfo>());
 };
 };
-
-/** \brief An acquire item that is responsible for fetching an index
+									/*}}}*/
+/** \brief An acquire item that is responsible for fetching an index	{{{
  *  file (e.g., Packages or Sources).
  *  file (e.g., Packages or Sources).
  *
  *
  *  \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans
  *  \sa pkgAcqDiffIndex, pkgAcqIndexDiffs, pkgAcqIndexTrans
@@ -545,8 +545,8 @@ class pkgAcqIndex : public pkgAcquire::Item
    pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
    pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
 	       string ShortDesc, HashString ExpectedHash, string compressExt="");
 	       string ShortDesc, HashString ExpectedHash, string compressExt="");
 };
 };
-
-/** \brief An acquire item that is responsible for fetching a
+									/*}}}*/
+/** \brief An acquire item that is responsible for fetching a		{{{
  *  translated index file.
  *  translated index file.
  *
  *
  *  The only difference from pkgAcqIndex is that transient failures
  *  The only difference from pkgAcqIndex is that transient failures
@@ -579,8 +579,8 @@ class pkgAcqIndexTrans : public pkgAcqIndex
    pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
    pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
 		    string ShortDesc);
 		    string ShortDesc);
 };
 };
-
-/** \brief Information about an index file. */
+									/*}}}*/
+/** \brief Information about an index file. */				/*{{{*/
 struct IndexTarget
 struct IndexTarget
 {
 {
    /** \brief A URI from which the index file can be downloaded. */
    /** \brief A URI from which the index file can be downloaded. */
@@ -597,8 +597,8 @@ struct IndexTarget
     */
     */
    string MetaKey;
    string MetaKey;
 };
 };
-
-/** \brief An acquire item that downloads the detached signature
+									/*}}}*/
+/** \brief An acquire item that downloads the detached signature	{{{
  *  of a meta-index (Release) file, then queues up the release
  *  of a meta-index (Release) file, then queues up the release
  *  file itself.
  *  file itself.
  *
  *
@@ -660,8 +660,8 @@ class pkgAcqMetaSig : public pkgAcquire::Item
 		 const vector<struct IndexTarget*>* IndexTargets,
 		 const vector<struct IndexTarget*>* IndexTargets,
 		 indexRecords* MetaIndexParser);
 		 indexRecords* MetaIndexParser);
 };
 };
-
-/** \brief An item that is responsible for downloading the meta-index
+									/*}}}*/
+/** \brief An item that is responsible for downloading the meta-index	{{{
  *  file (i.e., Release) itself and verifying its signature.
  *  file (i.e., Release) itself and verifying its signature.
  *
  *
  *  Once the download and verification are complete, the downloads of
  *  Once the download and verification are complete, the downloads of
@@ -756,8 +756,8 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
 		   const vector<struct IndexTarget*>* IndexTargets,
 		   const vector<struct IndexTarget*>* IndexTargets,
 		   indexRecords* MetaIndexParser);
 		   indexRecords* MetaIndexParser);
 };
 };
-
-/** \brief An item that is responsible for fetching a package file.
+									/*}}}*/
+/** \brief An item that is responsible for fetching a package file.	{{{
  *
  *
  *  If the package file already exists in the cache, nothing will be
  *  If the package file already exists in the cache, nothing will be
  *  done.
  *  done.
@@ -840,8 +840,8 @@ class pkgAcqArchive : public pkgAcquire::Item
 		 pkgRecords *Recs,pkgCache::VerIterator const &Version,
 		 pkgRecords *Recs,pkgCache::VerIterator const &Version,
 		 string &StoreFilename);
 		 string &StoreFilename);
 };
 };
-
-/** \brief Retrieve an arbitrary file to the current directory.
+									/*}}}*/
+/** \brief Retrieve an arbitrary file to the current directory.		{{{
  *
  *
  *  The file is retrieved even if it is accessed via a URL type that
  *  The file is retrieved even if it is accessed via a URL type that
  *  normally is a NOP, such as "file".  If the download fails, the
  *  normally is a NOP, such as "file".  If the download fails, the
@@ -902,7 +902,7 @@ class pkgAcqFile : public pkgAcquire::Item
 	      string Desc, string ShortDesc,
 	      string Desc, string ShortDesc,
 	      const string &DestDir="", const string &DestFilename="");
 	      const string &DestDir="", const string &DestFilename="");
 };
 };
-
+									/*}}}*/
 /** @} */
 /** @} */
 
 
 #endif
 #endif

+ 0 - 2
apt-pkg/acquire-method.cc

@@ -446,7 +446,6 @@ void pkgAcqMethod::Status(const char *Format,...)
       exit(100);
       exit(100);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // AcqMethod::Redirect - Send a redirect message                       /*{{{*/
 // AcqMethod::Redirect - Send a redirect message                       /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This method sends the redirect message and also manipulates the queue
 /* This method sends the redirect message and also manipulates the queue
@@ -478,7 +477,6 @@ void pkgAcqMethod::Redirect(const string &NewURI)
       QueueBack = I->Next;
       QueueBack = I->Next;
 }
 }
                                                                         /*}}}*/
                                                                         /*}}}*/
-
 // AcqMethod::FetchResult::FetchResult - Constructor			/*{{{*/
 // AcqMethod::FetchResult::FetchResult - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 1 - 4
apt-pkg/acquire.cc

@@ -485,7 +485,7 @@ double pkgAcquire::PartialPresent()
 	 Total += (*I)->PartialSize;
 	 Total += (*I)->PartialSize;
    return Total;
    return Total;
 }
 }
-
+									/*}}}*/
 // Acquire::UriBegin - Start iterator for the uri list			/*{{{*/
 // Acquire::UriBegin - Start iterator for the uri list			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -502,7 +502,6 @@ pkgAcquire::UriIterator pkgAcquire::UriEnd()
    return UriIterator(0);
    return UriIterator(0);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // Acquire::MethodConfig::MethodConfig - Constructor			/*{{{*/
 // Acquire::MethodConfig::MethodConfig - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -516,7 +515,6 @@ pkgAcquire::MethodConfig::MethodConfig()
    Next = 0;
    Next = 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // Queue::Queue - Constructor						/*{{{*/
 // Queue::Queue - Constructor						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -728,7 +726,6 @@ void pkgAcquire::Queue::Bump()
    Cycle();
    Cycle();
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // AcquireStatus::pkgAcquireStatus - Constructor			/*{{{*/
 // AcquireStatus::pkgAcquireStatus - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 12 - 12
apt-pkg/acquire.h

@@ -30,7 +30,7 @@
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 
 
-/** \defgroup acquire Acquire system
+/** \defgroup acquire Acquire system					{{{
  *
  *
  *  \brief The Acquire system is responsible for retrieving files from
  *  \brief The Acquire system is responsible for retrieving files from
  *  local or remote URIs and postprocessing them (for instance,
  *  local or remote URIs and postprocessing them (for instance,
@@ -54,7 +54,7 @@
  *  once, but it is not clear what its behavior in this case is, and
  *  once, but it is not clear what its behavior in this case is, and
  *  no subclass of pkgAcquire::Item seems to actually use this
  *  no subclass of pkgAcquire::Item seems to actually use this
  *  capability.
  *  capability.
- */
+ */									/*}}}*/
 
 
 /** \addtogroup acquire
 /** \addtogroup acquire
  *
  *
@@ -78,7 +78,7 @@ using std::string;
 
 
 class pkgAcquireStatus;
 class pkgAcquireStatus;
 
 
-/** \brief The core download scheduler.
+/** \brief The core download scheduler.					{{{
  *
  *
  *  This class represents an ongoing download.  It manages the lists
  *  This class represents an ongoing download.  It manages the lists
  *  of active and pending downloads and handles setting up and tearing
  *  of active and pending downloads and handles setting up and tearing
@@ -366,8 +366,8 @@ struct pkgAcquire::ItemDesc
    /** brief The underlying item which is to be downloaded. */
    /** brief The underlying item which is to be downloaded. */
    Item *Owner;
    Item *Owner;
 };
 };
-
-/** \brief A single download queue in a pkgAcquire object.
+									/*}}}*/
+/** \brief A single download queue in a pkgAcquire object.		{{{
  *
  *
  *  \todo Why so many protected values?
  *  \todo Why so many protected values?
  */
  */
@@ -528,8 +528,8 @@ class pkgAcquire::Queue
     */
     */
    ~Queue();
    ~Queue();
 };
 };
-
-/** \brief Iterates over all the URIs being fetched by a pkgAcquire object. */
+									/*}}}*/
+/** \brief Iterates over all the URIs being fetched by a pkgAcquire object.	{{{*/
 class pkgAcquire::UriIterator
 class pkgAcquire::UriIterator
 {
 {
    /** The next queue to iterate over. */
    /** The next queue to iterate over. */
@@ -568,8 +568,8 @@ class pkgAcquire::UriIterator
       }
       }
    }   
    }   
 };
 };
-
-/** \brief Information about the properties of a single acquire method. */
+									/*}}}*/
+/** \brief Information about the properties of a single acquire method.	{{{*/
 struct pkgAcquire::MethodConfig
 struct pkgAcquire::MethodConfig
 {
 {
    /** \brief The next link on the acquire method list.
    /** \brief The next link on the acquire method list.
@@ -621,8 +621,8 @@ struct pkgAcquire::MethodConfig
     */
     */
    MethodConfig();
    MethodConfig();
 };
 };
-
-/** \brief A monitor object for downloads controlled by the pkgAcquire class.
+									/*}}}*/
+/** \brief A monitor object for downloads controlled by the pkgAcquire class.	{{{
  *
  *
  *  \todo Why protected members?
  *  \todo Why protected members?
  *
  *
@@ -762,7 +762,7 @@ class pkgAcquireStatus
    pkgAcquireStatus();
    pkgAcquireStatus();
    virtual ~pkgAcquireStatus() {};
    virtual ~pkgAcquireStatus() {};
 };
 };
-
+									/*}}}*/
 /** @} */
 /** @} */
 
 
 #endif
 #endif

+ 5 - 23
apt-pkg/algorithms.cc

@@ -442,7 +442,6 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // ProblemResolver::pkgProblemResolver - Constructor			/*{{{*/
 // ProblemResolver::pkgProblemResolver - Constructor			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -992,26 +991,11 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
 			// Consider other options
 			// Consider other options
 			if (InOr == false)
 			if (InOr == false)
 			{
 			{
-			   if (Cache.AutoInstOk(I, Cache[I].CandidateVerIter(Cache),Start) == true)
-			   {
-			      if (Debug == true)
-			         clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
-			      Cache.MarkDelete(I);
-			      if (Counter > 1)
-			      {
-				 if (Scores[Pkg->ID] > Scores[I->ID])
-				    Scores[I->ID] = Scores[Pkg->ID];
-			      }
-			   } else {
-			      /* The dependency of the TargetPkg would be satisfiable with I but it is
-				 forbidden to install I automatical, so anything we can do is hold
-				 back the TargetPkg.
-			      */
-			      if (Debug == true)
-				 clog << "  Hold back " << Start.TargetPkg().Name() <<
-					" rather than change denied AutoInstall " << I.Name() << endl;
-			      Cache.MarkKeep(Start.TargetPkg());
-			   }
+			   if (Debug == true)
+			      clog << "  Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl;
+			   Cache.MarkDelete(I);
+			   if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID])
+			      Scores[I->ID] = Scores[Pkg->ID];
 			}
 			}
 		     }
 		     }
 		  }
 		  }
@@ -1330,7 +1314,6 @@ void pkgProblemResolver::InstallProtect()
    }   
    }   
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // PrioSortList - Sort a list of versions by priority			/*{{{*/
 // PrioSortList - Sort a list of versions by priority			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This is ment to be used in conjunction with AllTargets to get a list 
 /* This is ment to be used in conjunction with AllTargets to get a list 
@@ -1361,7 +1344,6 @@ void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
    qsort(List,Count,sizeof(*List),PrioComp);
    qsort(List,Count,sizeof(*List),PrioComp);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // CacheFile::ListUpdate - update the cache files                    	/*{{{*/
 // CacheFile::ListUpdate - update the cache files                    	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This is a simple wrapper to update the cache. it will fetch stuff
 /* This is a simple wrapper to update the cache. it will fetch stuff

+ 4 - 4
apt-pkg/algorithms.h

@@ -39,7 +39,7 @@
 
 
 using std::ostream;
 using std::ostream;
 
 
-class pkgSimulate : public pkgPackageManager
+class pkgSimulate : public pkgPackageManager				/*{{{*/
 {
 {
    protected:
    protected:
 
 
@@ -75,8 +75,8 @@ private:
 
 
    pkgSimulate(pkgDepCache *Cache);
    pkgSimulate(pkgDepCache *Cache);
 };
 };
-
-class pkgProblemResolver
+									/*}}}*/
+class pkgProblemResolver						/*{{{*/
 {
 {
    pkgDepCache &Cache;
    pkgDepCache &Cache;
    typedef pkgCache::PkgIterator PkgIterator;
    typedef pkgCache::PkgIterator PkgIterator;
@@ -124,7 +124,7 @@ class pkgProblemResolver
    pkgProblemResolver(pkgDepCache *Cache);
    pkgProblemResolver(pkgDepCache *Cache);
    ~pkgProblemResolver();
    ~pkgProblemResolver();
 };
 };
-
+									/*}}}*/
 bool pkgDistUpgrade(pkgDepCache &Cache);
 bool pkgDistUpgrade(pkgDepCache &Cache);
 bool pkgApplyStatus(pkgDepCache &Cache);
 bool pkgApplyStatus(pkgDepCache &Cache);
 bool pkgFixBroken(pkgDepCache &Cache);
 bool pkgFixBroken(pkgDepCache &Cache);

+ 3 - 4
apt-pkg/cachefile.cc

@@ -24,7 +24,6 @@
     
     
 #include <apti18n.h>
 #include <apti18n.h>
 									/*}}}*/
 									/*}}}*/
-
 // CacheFile::CacheFile - Constructor					/*{{{*/
 // CacheFile::CacheFile - Constructor					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -49,6 +48,7 @@ pkgCacheFile::~pkgCacheFile()
 /* */
 /* */
 bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock)
 bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock)
 {
 {
+   const bool ErrorWasEmpty = _error->empty();
    if (WithLock == true)
    if (WithLock == true)
       if (_system->Lock() == false)
       if (_system->Lock() == false)
 	 return false;
 	 return false;
@@ -71,7 +71,7 @@ bool pkgCacheFile::BuildCaches(OpProgress &Progress,bool WithLock)
       return _error->Error(_("The package lists or status file could not be parsed or opened."));
       return _error->Error(_("The package lists or status file could not be parsed or opened."));
 
 
    /* This sux, remove it someday */
    /* This sux, remove it someday */
-   if (_error->empty() == false)
+   if (ErrorWasEmpty == true && _error->empty() == false)
       _error->Warning(_("You may want to run apt-get update to correct these problems"));
       _error->Warning(_("You may want to run apt-get update to correct these problems"));
 
 
    Cache = new pkgCache(Map);
    Cache = new pkgCache(Map);
@@ -92,6 +92,7 @@ bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock)
    Policy = new pkgPolicy(Cache);
    Policy = new pkgPolicy(Cache);
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return false;
       return false;
+
    if (ReadPinFile(*Policy) == false || ReadPinDir(*Policy) == false)
    if (ReadPinFile(*Policy) == false || ReadPinDir(*Policy) == false)
       return false;
       return false;
    
    
@@ -108,8 +109,6 @@ bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-
 // CacheFile::Close - close the cache files				/*{{{*/
 // CacheFile::Close - close the cache files				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 18 - 18
apt-pkg/cacheiterators.h

@@ -32,7 +32,7 @@
 #define PKGLIB_CACHEITERATORS_H
 #define PKGLIB_CACHEITERATORS_H
 
 
 
 
-// Package Iterator
+// Package Iterator							/*{{{*/
 class pkgCache::PkgIterator
 class pkgCache::PkgIterator
 {
 {
    friend class pkgCache;
    friend class pkgCache;
@@ -96,8 +96,8 @@ class pkgCache::PkgIterator
    };
    };
    inline PkgIterator() : Pkg(0), Owner(0), HashIndex(0) {};
    inline PkgIterator() : Pkg(0), Owner(0), HashIndex(0) {};
 };
 };
-
-// Version Iterator
+									/*}}}*/
+// Version Iterator							/*{{{*/
 class pkgCache::VerIterator
 class pkgCache::VerIterator
 {
 {
    Version *Ver;
    Version *Ver;
@@ -155,8 +155,8 @@ class pkgCache::VerIterator
 	 Ver = Owner.VerP;
 	 Ver = Owner.VerP;
    };
    };
 };
 };
-
-// Description Iterator
+									/*}}}*/
+// Description Iterator							/*{{{*/
 class pkgCache::DescIterator
 class pkgCache::DescIterator
 {
 {
    Description *Desc;
    Description *Desc;
@@ -199,8 +199,8 @@ class pkgCache::DescIterator
 	 Desc = Owner.DescP;
 	 Desc = Owner.DescP;
    };
    };
 };
 };
-
-// Dependency iterator
+									/*}}}*/
+// Dependency iterator							/*{{{*/
 class pkgCache::DepIterator
 class pkgCache::DepIterator
 {
 {
    Dependency *Dep;
    Dependency *Dep;
@@ -258,8 +258,8 @@ class pkgCache::DepIterator
    };
    };
    inline DepIterator() : Dep(0), Type(DepVer), Owner(0) {};
    inline DepIterator() : Dep(0), Type(DepVer), Owner(0) {};
 };
 };
-
-// Provides iterator
+									/*}}}*/
+// Provides iterator							/*{{{*/
 class pkgCache::PrvIterator
 class pkgCache::PrvIterator
 {
 {
    Provides *Prv;
    Provides *Prv;
@@ -311,8 +311,8 @@ class pkgCache::PrvIterator
 	 Prv = Owner.ProvideP;
 	 Prv = Owner.ProvideP;
    };
    };
 };
 };
-
-// Package file 
+									/*}}}*/
+// Package file								/*{{{*/
 class pkgCache::PkgFileIterator
 class pkgCache::PkgFileIterator
 {
 {
    pkgCache *Owner;
    pkgCache *Owner;
@@ -358,8 +358,8 @@ class pkgCache::PkgFileIterator
    inline PkgFileIterator(pkgCache &Owner) : Owner(&Owner), File(Owner.PkgFileP) {};
    inline PkgFileIterator(pkgCache &Owner) : Owner(&Owner), File(Owner.PkgFileP) {};
    inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Owner(&Owner), File(Trg) {};
    inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Owner(&Owner), File(Trg) {};
 };
 };
-
-// Version File 
+									/*}}}*/
+// Version File								/*{{{*/
 class pkgCache::VerFileIterator
 class pkgCache::VerFileIterator
 {
 {
    pkgCache *Owner;
    pkgCache *Owner;
@@ -390,8 +390,8 @@ class pkgCache::VerFileIterator
    inline VerFileIterator() : Owner(0), FileP(0) {};
    inline VerFileIterator() : Owner(0), FileP(0) {};
    inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {};
    inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {};
 };
 };
-
-// Description File 
+									/*}}}*/
+// Description File							/*{{{*/
 class pkgCache::DescFileIterator
 class pkgCache::DescFileIterator
 {
 {
    pkgCache *Owner;
    pkgCache *Owner;
@@ -422,8 +422,8 @@ class pkgCache::DescFileIterator
    inline DescFileIterator() : Owner(0), FileP(0) {};
    inline DescFileIterator() : Owner(0), FileP(0) {};
    inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), FileP(Trg) {};
    inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), FileP(Trg) {};
 };
 };
-
-// Inlined Begin functions cant be in the class because of order problems
+									/*}}}*/
+// Inlined Begin functions cant be in the class because of order problems /*{{{*/
 inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
 inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
        {return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);};
        {return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);};
 inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const
 inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const
@@ -442,5 +442,5 @@ inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const
        {return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);};
        {return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);};
 inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
 inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const
        {return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);};
        {return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);};
-
+									/*}}}*/
 #endif
 #endif

+ 7 - 11
apt-pkg/cdrom.cc

@@ -160,7 +160,7 @@ bool pkgCdrom::FindPackages(string CD,
    
    
    return !_error->PendingError();
    return !_error->PendingError();
 }
 }
-
+									/*}}}*/
 // Score - We compute a 'score' for a path				/*{{{*/
 // Score - We compute a 'score' for a path				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Paths are scored based on how close they come to what I consider
 /* Paths are scored based on how close they come to what I consider
@@ -210,7 +210,6 @@ int pkgCdrom::Score(string Path)
 
 
    return Res;
    return Res;
 }
 }
-
 									/*}}}*/
 									/*}}}*/
 // DropBinaryArch - Dump dirs with a string like /binary-<foo>/		/*{{{*/
 // DropBinaryArch - Dump dirs with a string like /binary-<foo>/		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -248,8 +247,7 @@ bool pkgCdrom::DropBinaryArch(vector<string> &List)
    
    
    return true;
    return true;
 }
 }
-
-
+									/*}}}*/
 // DropRepeats - Drop repeated files resulting from symlinks		/*{{{*/
 // DropRepeats - Drop repeated files resulting from symlinks		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Here we go and stat every file that we found and strip dup inodes. */
 /* Here we go and stat every file that we found and strip dup inodes. */
@@ -304,7 +302,6 @@ bool pkgCdrom::DropRepeats(vector<string> &List,const char *Name)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // ReduceSourceList - Takes the path list and reduces it		/*{{{*/
 // ReduceSourceList - Takes the path list and reduces it		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This takes the list of source list expressed entires and collects
 /* This takes the list of source list expressed entires and collects
@@ -513,9 +510,8 @@ bool pkgCdrom::WriteSourceList(string Name,vector<string> &List,bool Source)
    
    
    return true;
    return true;
 }
 }
-
-
-bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)
+									/*}}}*/
+bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)		/*{{{*/
 {
 {
    stringstream msg;
    stringstream msg;
 
 
@@ -573,9 +569,8 @@ bool pkgCdrom::Ident(string &ident, pkgCdromStatus *log)
 
 
    return true;
    return true;
 }
 }
-
-
-bool pkgCdrom::Add(pkgCdromStatus *log)
+									/*}}}*/
+bool pkgCdrom::Add(pkgCdromStatus *log)					/*{{{*/
 {
 {
    stringstream msg;
    stringstream msg;
 
 
@@ -844,3 +839,4 @@ bool pkgCdrom::Add(pkgCdromStatus *log)
 
 
    return true;
    return true;
 }
 }
+									/*}}}*/

+ 4 - 5
apt-pkg/cdrom.h

@@ -8,7 +8,7 @@
 
 
 using namespace std;
 using namespace std;
 
 
-class pkgCdromStatus
+class pkgCdromStatus							/*{{{*/
 {
 {
  protected:
  protected:
    int totalSteps;
    int totalSteps;
@@ -29,8 +29,8 @@ class pkgCdromStatus
    // Progress indicator for the Index rewriter
    // Progress indicator for the Index rewriter
    virtual OpProgress* GetOpProgress() {return NULL; };
    virtual OpProgress* GetOpProgress() {return NULL; };
 };
 };
-
-class pkgCdrom 
+									/*}}}*/
+class pkgCdrom								/*{{{*/
 {
 {
  protected:
  protected:
    enum {
    enum {
@@ -65,7 +65,6 @@ class pkgCdrom
    bool Ident(string &ident, pkgCdromStatus *log);
    bool Ident(string &ident, pkgCdromStatus *log);
    bool Add(pkgCdromStatus *log);
    bool Add(pkgCdromStatus *log);
 };
 };
-
-
+									/*}}}*/
 
 
 #endif
 #endif

+ 0 - 1
apt-pkg/clean.cc

@@ -19,7 +19,6 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 									/*}}}*/
 									/*}}}*/
-
 // ArchiveCleaner::Go - Perform smart cleanup of the archive		/*{{{*/
 // ArchiveCleaner::Go - Perform smart cleanup of the archive		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Scan the directory for files to erase, we check the version information
 /* Scan the directory for files to erase, we check the version information

+ 7 - 6
apt-pkg/contrib/error.cc

@@ -84,17 +84,17 @@ bool GlobalError::Errno(const char *Function,const char *Description,...)
    char S[400];
    char S[400];
    vsnprintf(S,sizeof(S),Description,args);
    vsnprintf(S,sizeof(S),Description,args);
    snprintf(S + strlen(S),sizeof(S) - strlen(S),
    snprintf(S + strlen(S),sizeof(S) - strlen(S),
-	    " - %s (%i %s)",Function,errno,strerror(errno));
+	    " - %s (%i: %s)",Function,errno,strerror(errno));
 
 
    // Put it on the list
    // Put it on the list
    Item *Itm = new Item;
    Item *Itm = new Item;
    Itm->Text = S;
    Itm->Text = S;
    Itm->Error = true;
    Itm->Error = true;
    Insert(Itm);
    Insert(Itm);
-   
+
    PendingFlag = true;
    PendingFlag = true;
 
 
-   return false;   
+   return false;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // GlobalError::WarningE - Get part of the warn string from errno	/*{{{*/
 // GlobalError::WarningE - Get part of the warn string from errno	/*{{{*/
@@ -112,15 +112,16 @@ bool GlobalError::WarningE(const char *Function,const char *Description,...)
    // sprintf the description
    // sprintf the description
    char S[400];
    char S[400];
    vsnprintf(S,sizeof(S),Description,args);
    vsnprintf(S,sizeof(S),Description,args);
-   snprintf(S + strlen(S),sizeof(S) - strlen(S)," - %s (%i %s)",Function,errno,strerror(errno));
+   snprintf(S + strlen(S),sizeof(S) - strlen(S),
+	    " - %s (%i: %s)",Function,errno,strerror(errno));
 
 
    // Put it on the list
    // Put it on the list
    Item *Itm = new Item;
    Item *Itm = new Item;
    Itm->Text = S;
    Itm->Text = S;
    Itm->Error = false;
    Itm->Error = false;
    Insert(Itm);
    Insert(Itm);
-   
-   return false;   
+
+   return false;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // GlobalError::Error - Add an error to the list			/*{{{*/
 // GlobalError::Error - Add an error to the list			/*{{{*/

+ 4 - 7
apt-pkg/contrib/hashes.cc

@@ -34,7 +34,7 @@ HashString::HashString(string Type, string Hash) : Type(Type), Hash(Hash)
 {
 {
 }
 }
 
 
-HashString::HashString(string StringedHash)
+HashString::HashString(string StringedHash)				/*{{{*/
 {
 {
    // legacy: md5sum without "MD5Sum:" prefix
    // legacy: md5sum without "MD5Sum:" prefix
    if (StringedHash.find(":") == string::npos && StringedHash.size() == 32)
    if (StringedHash.find(":") == string::npos && StringedHash.size() == 32)
@@ -50,9 +50,8 @@ HashString::HashString(string StringedHash)
    if(_config->FindB("Debug::Hashes",false) == true)
    if(_config->FindB("Debug::Hashes",false) == true)
       std::clog << "HashString(string): " << Type << " : " << Hash << std::endl;
       std::clog << "HashString(string): " << Type << " : " << Hash << std::endl;
 }
 }
-
-
-bool HashString::VerifyFile(string filename) const
+									/*}}}*/
+bool HashString::VerifyFile(string filename) const			/*{{{*/
 {
 {
    FileFd fd;
    FileFd fd;
    MD5Summation MD5;
    MD5Summation MD5;
@@ -83,7 +82,7 @@ bool HashString::VerifyFile(string filename) const
 
 
    return (fileHash == Hash);
    return (fileHash == Hash);
 }
 }
-
+									/*}}}*/
 const char** HashString::SupportedHashes()
 const char** HashString::SupportedHashes()
 {
 {
    return _SupportedHashes;
    return _SupportedHashes;
@@ -94,13 +93,11 @@ bool HashString::empty() const
    return (Type.empty() || Hash.empty());
    return (Type.empty() || Hash.empty());
 }
 }
 
 
-
 string HashString::toStr() const
 string HashString::toStr() const
 {
 {
    return Type+string(":")+Hash;
    return Type+string(":")+Hash;
 }
 }
 
 
-
 // Hashes::AddFD - Add the contents of the FD				/*{{{*/
 // Hashes::AddFD - Add the contents of the FD				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 79 - 34
apt-pkg/contrib/mmap.cc

@@ -13,11 +13,6 @@
    libc6 generates warnings -- which should be errors, g++ isn't properly
    libc6 generates warnings -- which should be errors, g++ isn't properly
    strict.
    strict.
    
    
-   The configure test notes that some OS's have broken private mmap's
-   so on those OS's we can't use mmap. This means we have to use
-   configure to test mmap and can't rely on the POSIX
-   _POSIX_MAPPED_FILES test.
-   
    ##################################################################### */
    ##################################################################### */
 									/*}}}*/
 									/*}}}*/
 // Include Files							/*{{{*/
 // Include Files							/*{{{*/
@@ -31,6 +26,7 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <fcntl.h>
+#include <stdlib.h>
 
 
 #include <cstring>
 #include <cstring>
    									/*}}}*/
    									/*}}}*/
@@ -141,10 +137,11 @@ bool MMap::Sync(unsigned long Start,unsigned long Stop)
 }
 }
 									/*}}}*/
 									/*}}}*/
 
 
+									/*}}}*/
 // DynamicMMap::DynamicMMap - Constructor				/*{{{*/
 // DynamicMMap::DynamicMMap - Constructor				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace) : 
+DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace) :
              MMap(F,Flags | NoImmMap), Fd(&F), WorkSpace(WorkSpace)
              MMap(F,Flags | NoImmMap), Fd(&F), WorkSpace(WorkSpace)
 {
 {
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
@@ -166,15 +163,26 @@ DynamicMMap::DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace)
 									/*}}}*/
 									/*}}}*/
 // DynamicMMap::DynamicMMap - Constructor for a non-file backed map	/*{{{*/
 // DynamicMMap::DynamicMMap - Constructor for a non-file backed map	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
-/* This is just a fancy malloc really.. */
+/* We try here to use mmap to reserve some space - this is much more
+   cooler than the fallback solution to simply allocate a char array
+   and could come in handy later than we are able to grow such an mmap */
 DynamicMMap::DynamicMMap(unsigned long Flags,unsigned long WorkSpace) :
 DynamicMMap::DynamicMMap(unsigned long Flags,unsigned long WorkSpace) :
              MMap(Flags | NoImmMap | UnMapped), Fd(0), WorkSpace(WorkSpace)
              MMap(Flags | NoImmMap | UnMapped), Fd(0), WorkSpace(WorkSpace)
 {
 {
    if (_error->PendingError() == true)
    if (_error->PendingError() == true)
       return;
       return;
-   
+
+#ifdef _POSIX_MAPPED_FILES
+   // use anonymous mmap() to get the memory
+   Base = (unsigned char*) mmap(0, WorkSpace, PROT_READ|PROT_WRITE,
+                                MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+   if(Base == MAP_FAILED)
+      return;
+#else
+   // fallback to a static allocated space
    Base = new unsigned char[WorkSpace];
    Base = new unsigned char[WorkSpace];
    memset(Base,0,WorkSpace);
    memset(Base,0,WorkSpace);
+#endif
    iSize = 0;
    iSize = 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -185,7 +193,11 @@ DynamicMMap::~DynamicMMap()
 {
 {
    if (Fd == 0)
    if (Fd == 0)
    {
    {
+#ifdef _POSIX_MAPPED_FILES
+      if(munmap(Base, WorkSpace) < 0)
+#else
       delete [] (unsigned char *)Base;
       delete [] (unsigned char *)Base;
+#endif
       return;
       return;
    }
    }
    
    
@@ -204,17 +216,19 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
    unsigned long Result = iSize;
    unsigned long Result = iSize;
    if (Aln != 0)
    if (Aln != 0)
       Result += Aln - (iSize%Aln);
       Result += Aln - (iSize%Aln);
-   
+
    iSize = Result + Size;
    iSize = Result + Size;
-   
-   // Just in case error check
-   if (Result + Size > WorkSpace)
+
+   // try to grow the buffer
+   while(Result + Size > WorkSpace)
    {
    {
-	  _error->Error(_("Dynamic MMap ran out of room. Please increase the size "
-				  "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
-      return 0;
+      if(!Grow())
+      {
+	 _error->Error(_("Dynamic MMap ran out of room. Please increase the size "
+			 "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
+	 return 0;
+      }
    }
    }
-
    return Result;
    return Result;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -223,7 +237,7 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
 /* This allocates an Item of size ItemSize so that it is aligned to its
 /* This allocates an Item of size ItemSize so that it is aligned to its
    size in the file. */
    size in the file. */
 unsigned long DynamicMMap::Allocate(unsigned long ItemSize)
 unsigned long DynamicMMap::Allocate(unsigned long ItemSize)
-{   
+{
    // Look for a matching pool entry
    // Look for a matching pool entry
    Pool *I;
    Pool *I;
    Pool *Empty = 0;
    Pool *Empty = 0;
@@ -234,7 +248,6 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize)
       if (I->ItemSize == ItemSize)
       if (I->ItemSize == ItemSize)
 	 break;
 	 break;
    }
    }
-
    // No pool is allocated, use an unallocated one
    // No pool is allocated, use an unallocated one
    if (I == Pools + PoolCount)
    if (I == Pools + PoolCount)
    {
    {
@@ -249,17 +262,24 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize)
       I->ItemSize = ItemSize;
       I->ItemSize = ItemSize;
       I->Count = 0;
       I->Count = 0;
    }
    }
-   
+
+   unsigned long Result = 0;
    // Out of space, allocate some more
    // Out of space, allocate some more
    if (I->Count == 0)
    if (I->Count == 0)
    {
    {
-      I->Count = 20*1024/ItemSize;
-      I->Start = RawAllocate(I->Count*ItemSize,ItemSize);
-   }   
+      const unsigned long size = 20*1024;
+      I->Count = size/ItemSize;
+      Result = RawAllocate(size,ItemSize);
+      // Does the allocation failed ?
+      if (Result == 0 && _error->PendingError())
+	 return 0;
+      I->Start = Result;
+   }
+   else
+      Result = I->Start;
 
 
    I->Count--;
    I->Count--;
-   unsigned long Result = I->Start;
-   I->Start += ItemSize;  
+   I->Start += ItemSize;
    return Result/ItemSize;
    return Result/ItemSize;
 }
 }
 									/*}}}*/
 									/*}}}*/
@@ -269,20 +289,45 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize)
 unsigned long DynamicMMap::WriteString(const char *String,
 unsigned long DynamicMMap::WriteString(const char *String,
 				       unsigned long Len)
 				       unsigned long Len)
 {
 {
-   unsigned long Result = iSize;
-   // Just in case error check
-   if (Result + Len > WorkSpace)
-   {
-	  _error->Error(_("Dynamic MMap ran out of room. Please increase the size "
-				  "of APT::Cache-Limit. Current value: %lu. (man 5 apt.conf)"), WorkSpace);
-      return 0;
-   }   
-   
    if (Len == (unsigned long)-1)
    if (Len == (unsigned long)-1)
       Len = strlen(String);
       Len = strlen(String);
-   iSize += Len + 1;
+
+   unsigned long Result = RawAllocate(Len+1,0);
+
+   if (Result == 0 && _error->PendingError())
+      return 0;
+
    memcpy((char *)Base + Result,String,Len);
    memcpy((char *)Base + Result,String,Len);
    ((char *)Base)[Result + Len] = 0;
    ((char *)Base)[Result + Len] = 0;
    return Result;
    return Result;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// DynamicMMap::Grow - Grow the mmap					/*{{{*/
+// ---------------------------------------------------------------------
+/* This method will try to grow the mmap we currently use. This doesn't
+   work most of the time because we can't move the mmap around in the
+   memory for now as this would require to adjust quite a lot of pointers
+   but why we should not at least try to grow it before we give up? */
+bool DynamicMMap::Grow()
+{
+#ifdef _POSIX_MAPPED_FILES
+   unsigned long newSize = WorkSpace + 1024*1024;
+
+   if(Fd != 0)
+   {
+      Fd->Seek(newSize - 1);
+      char C = 0;
+      Fd->Write(&C,sizeof(C));
+   }
+
+   Base = mremap(Base, WorkSpace, newSize, 0);
+   if(Base == MAP_FAILED)
+      return false;
+
+   WorkSpace = newSize;
+   return true;
+#else
+   return false;
+#endif
+}
+									/*}}}*/

+ 2 - 0
apt-pkg/contrib/mmap.h

@@ -84,6 +84,8 @@ class DynamicMMap : public MMap
    unsigned long WorkSpace;
    unsigned long WorkSpace;
    Pool *Pools;
    Pool *Pools;
    unsigned int PoolCount;
    unsigned int PoolCount;
+
+   bool Grow();
    
    
    public:
    public:
 
 

+ 13 - 19
apt-pkg/contrib/sha256.cc

@@ -1,5 +1,5 @@
 /*
 /*
- * Cryptographic API.
+ * Cryptographic API.							{{{
  *
  *
  * SHA-256, as specified in
  * SHA-256, as specified in
  * http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf
  * http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf
@@ -17,7 +17,7 @@
  * Software Foundation; either version 2 of the License, or (at your option) 
  * Software Foundation; either version 2 of the License, or (at your option) 
  * any later version.
  * any later version.
  *
  *
- */
+ */									/*}}}*/
 
 
 #ifdef __GNUG__
 #ifdef __GNUG__
 #pragma implementation "apt-pkg/sha256.h"
 #pragma implementation "apt-pkg/sha256.h"
@@ -65,20 +65,20 @@ static inline u32 Maj(u32 x, u32 y, u32 z)
 #define H6         0x1f83d9ab
 #define H6         0x1f83d9ab
 #define H7         0x5be0cd19
 #define H7         0x5be0cd19
 
 
-static inline void LOAD_OP(int I, u32 *W, const u8 *input)
+static inline void LOAD_OP(int I, u32 *W, const u8 *input)		/*{{{*/
 {
 {
 	W[I] = (  ((u32) input[I * 4 + 0] << 24)
 	W[I] = (  ((u32) input[I * 4 + 0] << 24)
 		| ((u32) input[I * 4 + 1] << 16)
 		| ((u32) input[I * 4 + 1] << 16)
 		| ((u32) input[I * 4 + 2] << 8)
 		| ((u32) input[I * 4 + 2] << 8)
 		| ((u32) input[I * 4 + 3]));
 		| ((u32) input[I * 4 + 3]));
 }
 }
-
+									/*}}}*/
 static inline void BLEND_OP(int I, u32 *W)
 static inline void BLEND_OP(int I, u32 *W)
 {
 {
         W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];
         W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];
 }
 }
 
 
-static void sha256_transform(u32 *state, const u8 *input)
+static void sha256_transform(u32 *state, const u8 *input)		/*{{{*/
 {
 {
         u32 a, b, c, d, e, f, g, h, t1, t2;
         u32 a, b, c, d, e, f, g, h, t1, t2;
         u32 W[64];
         u32 W[64];
@@ -240,8 +240,8 @@ static void sha256_transform(u32 *state, const u8 *input)
         a = b = c = d = e = f = g = h = t1 = t2 = 0;
         a = b = c = d = e = f = g = h = t1 = t2 = 0;
         memset(W, 0, 64 * sizeof(u32));
         memset(W, 0, 64 * sizeof(u32));
 }
 }
-
-SHA256Summation::SHA256Summation()
+									/*}}}*/
+SHA256Summation::SHA256Summation()					/*{{{*/
 {
 {
         Sum.state[0] = H0;
         Sum.state[0] = H0;
         Sum.state[1] = H1;
         Sum.state[1] = H1;
@@ -255,8 +255,8 @@ SHA256Summation::SHA256Summation()
         memset(Sum.buf, 0, sizeof(Sum.buf));
         memset(Sum.buf, 0, sizeof(Sum.buf));
         Done = false;
         Done = false;
 }
 }
-
-bool SHA256Summation::Add(const u8 *data, unsigned long len)
+									/*}}}*/
+bool SHA256Summation::Add(const u8 *data, unsigned long len)		/*{{{*/
 {
 {
         struct sha256_ctx *sctx = &Sum;
         struct sha256_ctx *sctx = &Sum;
         unsigned int i, index, part_len;
         unsigned int i, index, part_len;
@@ -291,8 +291,8 @@ bool SHA256Summation::Add(const u8 *data, unsigned long len)
 
 
         return true;
         return true;
 }
 }
-
-SHA256SumValue SHA256Summation::Result()
+									/*}}}*/
+SHA256SumValue SHA256Summation::Result()				/*{{{*/
 {
 {
    struct sha256_ctx *sctx = &Sum;
    struct sha256_ctx *sctx = &Sum;
    if (!Done) {
    if (!Done) {
@@ -340,7 +340,7 @@ SHA256SumValue SHA256Summation::Result()
 
 
    return res;
    return res;
 }
 }
-
+									/*}}}*/
 // SHA256SumValue::SHA256SumValue - Constructs the sum from a string   /*{{{*/
 // SHA256SumValue::SHA256SumValue - Constructs the sum from a string   /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The string form of a SHA256 is a 64 character hex number */
 /* The string form of a SHA256 is a 64 character hex number */
@@ -349,7 +349,6 @@ SHA256SumValue::SHA256SumValue(string Str)
    memset(Sum,0,sizeof(Sum));
    memset(Sum,0,sizeof(Sum));
    Set(Str);
    Set(Str);
 }
 }
-
                                                                        /*}}}*/
                                                                        /*}}}*/
 // SHA256SumValue::SHA256SumValue - Default constructor                /*{{{*/
 // SHA256SumValue::SHA256SumValue - Default constructor                /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -358,7 +357,6 @@ SHA256SumValue::SHA256SumValue()
 {
 {
    memset(Sum,0,sizeof(Sum));
    memset(Sum,0,sizeof(Sum));
 }
 }
-
                                                                        /*}}}*/
                                                                        /*}}}*/
 // SHA256SumValue::Set - Set the sum from a string                     /*{{{*/
 // SHA256SumValue::Set - Set the sum from a string                     /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -391,9 +389,7 @@ string SHA256SumValue::Value() const
 
 
    return string(Result);
    return string(Result);
 }
 }
-
-
-
+									/*}}}*/
 // SHA256SumValue::operator == - Comparator                            /*{{{*/
 // SHA256SumValue::operator == - Comparator                            /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Call memcmp on the buffer */
 /* Call memcmp on the buffer */
@@ -402,8 +398,6 @@ bool SHA256SumValue::operator == (const SHA256SumValue & rhs) const
    return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
    return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
 }
 }
                                                                        /*}}}*/
                                                                        /*}}}*/
-
-
 // SHA256Summation::AddFD - Add content of file into the checksum      /*{{{*/
 // SHA256Summation::AddFD - Add content of file into the checksum      /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 70 - 51
apt-pkg/depcache.cc

@@ -27,8 +27,8 @@
 #include <sys/stat.h>
 #include <sys/stat.h>
 
 
 #include <apti18n.h>    
 #include <apti18n.h>    
-
-// helper for Install-Recommends-Sections and Never-MarkAuto-Sections
+									/*}}}*/
+// helper for Install-Recommends-Sections and Never-MarkAuto-Sections	/*{{{*/
 static bool 
 static bool 
 ConfigValueInSubTree(const char* SubTree, const char *needle)
 ConfigValueInSubTree(const char* SubTree, const char *needle)
 {
 {
@@ -47,8 +47,8 @@ ConfigValueInSubTree(const char* SubTree, const char *needle)
    }
    }
    return false;
    return false;
 }
 }
-
-pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :
+									/*}}}*/
+pkgDepCache::ActionGroup::ActionGroup(pkgDepCache &cache) :		/*{{{*/
   cache(cache), released(false)
   cache(cache), released(false)
 {
 {
   ++cache.group_level;
   ++cache.group_level;
@@ -76,7 +76,7 @@ pkgDepCache::ActionGroup::~ActionGroup()
 {
 {
   release();
   release();
 }
 }
-
+									/*}}}*/
 // DepCache::pkgDepCache - Constructors					/*{{{*/
 // DepCache::pkgDepCache - Constructors					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -161,8 +161,7 @@ bool pkgDepCache::Init(OpProgress *Prog)
    return true;
    return true;
 } 
 } 
 									/*}}}*/
 									/*}}}*/
-
-bool pkgDepCache::readStateFile(OpProgress *Prog)
+bool pkgDepCache::readStateFile(OpProgress *Prog)			/*{{{*/
 {
 {
    FileFd state_file;
    FileFd state_file;
    string state = _config->FindDir("Dir::State") + "extended_states";
    string state = _config->FindDir("Dir::State") + "extended_states";
@@ -200,8 +199,8 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
 
 
    return true;
    return true;
 }
 }
-
-bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)
+									/*}}}*/
+bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)	/*{{{*/
 {
 {
    if(_config->FindB("Debug::pkgAutoRemove",false))
    if(_config->FindB("Debug::pkgAutoRemove",false))
       std::clog << "pkgDepCache::writeStateFile()" << std::endl;
       std::clog << "pkgDepCache::writeStateFile()" << std::endl;
@@ -283,7 +282,7 @@ bool pkgDepCache::writeStateFile(OpProgress *prog, bool InstalledOnly)
 
 
    return true;
    return true;
 }
 }
-
+									/*}}}*/
 // DepCache::CheckDep - Checks a single dependency			/*{{{*/
 // DepCache::CheckDep - Checks a single dependency			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This first checks the dependency against the main target package and
 /* This first checks the dependency against the main target package and
@@ -701,9 +700,7 @@ void pkgDepCache::Update(PkgIterator const &Pkg)
 	   P.end() != true; P++)
 	   P.end() != true; P++)
 	 Update(P.ParentPkg().RevDependsList());
 	 Update(P.ParentPkg().RevDependsList());
 }
 }
-
 									/*}}}*/
 									/*}}}*/
-
 // DepCache::MarkKeep - Put the package in the keep state		/*{{{*/
 // DepCache::MarkKeep - Put the package in the keep state		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -750,7 +747,7 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
 #endif
 #endif
 
 
    if (DebugMarker == true)
    if (DebugMarker == true)
-      std::clog << OutputInDepth(Depth) << "MarkKeep " << Pkg << std::endl;
+      std::clog << OutputInDepth(Depth) << "MarkKeep " << Pkg << " FU=" << FromUser << std::endl;
 
 
    RemoveSizes(Pkg);
    RemoveSizes(Pkg);
    RemoveStates(Pkg);
    RemoveStates(Pkg);
@@ -772,7 +769,7 @@ void pkgDepCache::MarkKeep(PkgIterator const &Pkg, bool Soft, bool FromUser,
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
 void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
-                             unsigned long Depth)
+                             unsigned long Depth, bool FromUser)
 {
 {
    // Simplifies other routines.
    // Simplifies other routines.
    if (Pkg.end() == true)
    if (Pkg.end() == true)
@@ -794,8 +791,12 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
    if (Pkg->VersionList == 0)
    if (Pkg->VersionList == 0)
       return;
       return;
 
 
+   // check if we are allowed to install the package
+   if (IsDeleteOk(Pkg,rPurge,Depth,FromUser) == false)
+      return;
+
    if (DebugMarker == true)
    if (DebugMarker == true)
-      std::clog << OutputInDepth(Depth) << "MarkDelete " << Pkg << std::endl;
+      std::clog << OutputInDepth(Depth) << "MarkDelete " << Pkg << " FU=" << FromUser << std::endl;
 
 
    RemoveSizes(Pkg);
    RemoveSizes(Pkg);
    RemoveStates(Pkg);
    RemoveStates(Pkg);
@@ -811,6 +812,23 @@ void pkgDepCache::MarkDelete(PkgIterator const &Pkg, bool rPurge,
    AddSizes(Pkg);
    AddSizes(Pkg);
 }
 }
 									/*}}}*/
 									/*}}}*/
+// DepCache::IsDeleteOk - check if it is ok to remove this package	/*{{{*/
+// ---------------------------------------------------------------------
+/* The default implementation just honors dpkg hold
+   But an application using this library can override this method
+   to control the MarkDelete behaviour */
+bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge,
+			      unsigned long Depth, bool FromUser)
+{
+   if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold)
+   {
+      if (DebugMarker == true)
+	 std::clog << OutputInDepth(Depth) << "Hold prevents MarkDelete of " << Pkg << " FU=" << FromUser << std::endl;
+      return false;
+   }
+   return true;
+}
+									/*}}}*/
 // DepCache::MarkInstall - Put the package in the install state		/*{{{*/
 // DepCache::MarkInstall - Put the package in the install state		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -846,6 +864,11 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
    // We dont even try to install virtual packages..
    // We dont even try to install virtual packages..
    if (Pkg->VersionList == 0)
    if (Pkg->VersionList == 0)
       return;
       return;
+
+   // check if we are allowed to install the package
+   if (IsInstallOk(Pkg,AutoInst,Depth,FromUser) == false)
+      return;
+
    /* Target the candidate version and remove the autoflag. We reset the
    /* Target the candidate version and remove the autoflag. We reset the
       autoflag below if this was called recursively. Otherwise the user
       autoflag below if this was called recursively. Otherwise the user
       should have the ability to de-auto a package by changing its state */
       should have the ability to de-auto a package by changing its state */
@@ -874,12 +897,12 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
    AddStates(Pkg);
    AddStates(Pkg);
    Update(Pkg);
    Update(Pkg);
    AddSizes(Pkg);
    AddSizes(Pkg);
-   
+
    if (AutoInst == false)
    if (AutoInst == false)
       return;
       return;
 
 
    if (DebugMarker == true)
    if (DebugMarker == true)
-      std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << std::endl;
+      std::clog << OutputInDepth(Depth) << "MarkInstall " << Pkg << " FU=" << FromUser << std::endl;
 
 
    DepIterator Dep = P.InstVerIter(*this).DependsList();
    DepIterator Dep = P.InstVerIter(*this).DependsList();
    for (; Dep.end() != true;)
    for (; Dep.end() != true;)
@@ -1004,8 +1027,7 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	    }
 	    }
 	 }
 	 }
 	 
 	 
-	 if (InstPkg.end() == false &&
-	     AutoInstOk(InstPkg, (*this)[InstPkg].CandidateVerIter(*this), Start))
+	 if (InstPkg.end() == false)
 	 {
 	 {
 	    if(DebugAutoInstall == true)
 	    if(DebugAutoInstall == true)
 	       std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name()
 	       std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name()
@@ -1043,30 +1065,30 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
 	    PkgIterator Pkg = Ver.ParentPkg();
 	    PkgIterator Pkg = Ver.ParentPkg();
 
 
 	    if (Start->Type != Dep::DpkgBreaks)
 	    if (Start->Type != Dep::DpkgBreaks)
-	    {
-	       if(AutoInstOk(Pkg, VerIterator(*this), Start))
-		  MarkDelete(Pkg);
-	    }
-	    else
-	       if (PkgState[Pkg->ID].CandidateVer != *I &&
-		   AutoInstOk(Pkg, VerIterator(*this, PkgState[Pkg->ID].CandidateVer), Start))
-		  MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
+	       MarkDelete(Pkg,false,Depth + 1, false);
+	    else if (PkgState[Pkg->ID].CandidateVer != *I)
+	       MarkInstall(Pkg,true,Depth + 1, false, ForceImportantDeps);
 	 }
 	 }
 	 continue;
 	 continue;
       }      
       }      
    }
    }
 }
 }
-
-// DepCache::AutoInstOk - check if it is to install this package	/*{{{*/
+									/*}}}*/
+// DepCache::IsInstallOk - check if it is ok to install this package	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The default implementation just honors dpkg hold
 /* The default implementation just honors dpkg hold
-   But an application using this  library can override this method
+   But an application using this library can override this method
    to control the MarkInstall behaviour */
    to control the MarkInstall behaviour */
-bool pkgDepCache::AutoInstOk(const PkgIterator &Pkg, 
-                             const VerIterator &v,
-                             const DepIterator &d)
+bool pkgDepCache::IsInstallOk(PkgIterator const &Pkg,bool AutoInst,
+			      unsigned long Depth, bool FromUser)
 {
 {
-   return (Pkg->SelectedState != pkgCache::State::Hold);
+   if (FromUser == false && Pkg->SelectedState == pkgCache::State::Hold)
+   {
+      if (DebugMarker == true)
+	 std::clog << OutputInDepth(Depth) << "Hold prevents MarkInstall of " << Pkg << " FU=" << FromUser << std::endl;
+      return false;
+   }
+   return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // DepCache::SetReInstall - Set the reinstallation flag			/*{{{*/
 // DepCache::SetReInstall - Set the reinstallation flag			/*{{{*/
@@ -1168,7 +1190,6 @@ const char *pkgDepCache::StateCache::StripEpoch(const char *Ver)
    return Ver;
    return Ver;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // Policy::GetCandidateVer - Returns the Candidate install version	/*{{{*/
 // Policy::GetCandidateVer - Returns the Candidate install version	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The default just returns the highest available version that is not
 /* The default just returns the highest available version that is not
@@ -1205,7 +1226,6 @@ pkgCache::VerIterator pkgDepCache::Policy::GetCandidateVer(PkgIterator Pkg)
    return Last;
    return Last;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // Policy::IsImportantDep - True if the dependency is important		/*{{{*/
 // Policy::IsImportantDep - True if the dependency is important		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -1231,8 +1251,7 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator Dep)
    return false;
    return false;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc()
+pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc()			/*{{{*/
   : constructedSuccessfully(false)
   : constructedSuccessfully(false)
 {
 {
   Configuration::Item const *Opts;
   Configuration::Item const *Opts;
@@ -1261,8 +1280,8 @@ pkgDepCache::DefaultRootSetFunc::DefaultRootSetFunc()
 
 
   constructedSuccessfully = true;
   constructedSuccessfully = true;
 }
 }
-
-pkgDepCache::DefaultRootSetFunc::~DefaultRootSetFunc()
+									/*}}}*/
+pkgDepCache::DefaultRootSetFunc::~DefaultRootSetFunc()			/*{{{*/
 {
 {
   for(unsigned int i = 0; i < rootSetRegexp.size(); i++)
   for(unsigned int i = 0; i < rootSetRegexp.size(); i++)
     {
     {
@@ -1270,9 +1289,8 @@ pkgDepCache::DefaultRootSetFunc::~DefaultRootSetFunc()
       delete rootSetRegexp[i];
       delete rootSetRegexp[i];
     }
     }
 }
 }
-
-
-bool pkgDepCache::DefaultRootSetFunc::InRootSet(const pkgCache::PkgIterator &pkg)
+									/*}}}*/
+bool pkgDepCache::DefaultRootSetFunc::InRootSet(const pkgCache::PkgIterator &pkg) /*{{{*/
 {
 {
    for(unsigned int i = 0; i < rootSetRegexp.size(); i++)
    for(unsigned int i = 0; i < rootSetRegexp.size(); i++)
       if (regexec(rootSetRegexp[i], pkg.Name(), 0, 0, 0) == 0)
       if (regexec(rootSetRegexp[i], pkg.Name(), 0, 0, 0) == 0)
@@ -1280,8 +1298,8 @@ bool pkgDepCache::DefaultRootSetFunc::InRootSet(const pkgCache::PkgIterator &pkg
 
 
    return false;
    return false;
 }
 }
-
-pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc()
+									/*}}}*/
+pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc()		/*{{{*/
 {
 {
   DefaultRootSetFunc *f = new DefaultRootSetFunc;
   DefaultRootSetFunc *f = new DefaultRootSetFunc;
   if(f->wasConstructedSuccessfully())
   if(f->wasConstructedSuccessfully())
@@ -1292,7 +1310,7 @@ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc()
       return NULL;
       return NULL;
     }
     }
 }
 }
-
+									/*}}}*/
 bool pkgDepCache::MarkFollowsRecommends()
 bool pkgDepCache::MarkFollowsRecommends()
 {
 {
   return _config->FindB("APT::AutoRemove::RecommendsImportant", true);
   return _config->FindB("APT::AutoRemove::RecommendsImportant", true);
@@ -1303,7 +1321,7 @@ bool pkgDepCache::MarkFollowsSuggests()
   return _config->FindB("APT::AutoRemove::SuggestsImportant", false);
   return _config->FindB("APT::AutoRemove::SuggestsImportant", false);
 }
 }
 
 
-// the main mark algorithm
+// pkgDepCache::MarkRequired - the main mark algorithm			/*{{{*/
 bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc)
 bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc)
 {
 {
    bool follow_recommends;
    bool follow_recommends;
@@ -1348,8 +1366,8 @@ bool pkgDepCache::MarkRequired(InRootSetFunc &userFunc)
 
 
    return true;
    return true;
 }
 }
-
-// mark a single package in Mark-and-Sweep
+									/*}}}*/
+// MarkPackage - mark a single package in Mark-and-Sweep		/*{{{*/
 void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg,
 void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg,
 			      const pkgCache::VerIterator &ver,
 			      const pkgCache::VerIterator &ver,
 			      bool follow_recommends,
 			      bool follow_recommends,
@@ -1468,8 +1486,8 @@ void pkgDepCache::MarkPackage(const pkgCache::PkgIterator &pkg,
      }
      }
    }
    }
 }
 }
-
-bool pkgDepCache::Sweep()
+									/*}}}*/
+bool pkgDepCache::Sweep()						/*{{{*/
 {
 {
    // do the sweep
    // do the sweep
    for(PkgIterator p=PkgBegin(); !p.end(); ++p)
    for(PkgIterator p=PkgBegin(); !p.end(); ++p)
@@ -1492,3 +1510,4 @@ bool pkgDepCache::Sweep()
 
 
    return true;
    return true;
 }
 }
+									/*}}}*/

+ 40 - 16
apt-pkg/depcache.h

@@ -363,20 +363,6 @@ class pkgDepCache : protected pkgCache::Namespace
     */
     */
    virtual bool MarkFollowsSuggests();
    virtual bool MarkFollowsSuggests();
 
 
-   /** \return \b true if it's OK for MarkInstall to recursively
-    *  install the given version of the given package.
-    *
-    *  \param p  the package that MarkInstall wants to install.
-    *  \param v  the version being installed, or an end iterator
-    *            if p is being removed.
-    *  \param d  the dependency being fixed.
-    *
-    *  The default implementation unconditionally returns \b true.
-    */
-   virtual bool AutoInstOk(const PkgIterator &p,
-			   const VerIterator &v,
-			   const DepIterator &d);
-
    /** \brief Update the Marked and Garbage fields of all packages.
    /** \brief Update the Marked and Garbage fields of all packages.
     *
     *
     *  This routine is implicitly invoked after all state manipulators
     *  This routine is implicitly invoked after all state manipulators
@@ -406,7 +392,7 @@ class pkgDepCache : protected pkgCache::Namespace
    void MarkKeep(PkgIterator const &Pkg, bool Soft = false,
    void MarkKeep(PkgIterator const &Pkg, bool Soft = false,
 		 bool FromUser = true, unsigned long Depth = 0);
 		 bool FromUser = true, unsigned long Depth = 0);
    void MarkDelete(PkgIterator const &Pkg, bool Purge = false,
    void MarkDelete(PkgIterator const &Pkg, bool Purge = false,
-                   unsigned long Depth = 0);
+                   unsigned long Depth = 0, bool FromUser = true);
    void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
    void MarkInstall(PkgIterator const &Pkg,bool AutoInst = true,
 		    unsigned long Depth = 0, bool FromUser = true,
 		    unsigned long Depth = 0, bool FromUser = true,
 		    bool ForceImportantDeps = false);
 		    bool ForceImportantDeps = false);
@@ -417,7 +403,45 @@ class pkgDepCache : protected pkgCache::Namespace
    /** Set the "is automatically installed" flag of Pkg. */
    /** Set the "is automatically installed" flag of Pkg. */
    void MarkAuto(const PkgIterator &Pkg, bool Auto);
    void MarkAuto(const PkgIterator &Pkg, bool Auto);
    // @}
    // @}
-   
+
+   /** \return \b true if it's OK for MarkInstall to install
+    *  the given package.
+    *
+    *  See the default implementation for a simple example how this
+    *  method can be used.
+    *  Overriding implementations should use the hold-state-flag to cache
+    *  results from previous checks of this package - also it should
+    *  be used if the default resolver implementation is also used to
+    *  ensure that these packages are handled like "normal" dpkg holds.
+    *
+    *  The parameters are the same as in the calling MarkInstall:
+    *  \param Pkg       the package that MarkInstall wants to install.
+    *  \param AutoInst  needs a previous MarkInstall this package?
+    *  \param Depth     recursive deep of this Marker call
+    *  \param FromUser  was the install requested by the user?
+    */
+   virtual bool IsInstallOk(const PkgIterator &Pkg,bool AutoInst = true,
+			    unsigned long Depth = 0, bool FromUser = true);
+
+   /** \return \b true if it's OK for MarkDelete to remove
+    *  the given package.
+    *
+    *  See the default implementation for a simple example how this
+    *  method can be used.
+    *  Overriding implementations should use the hold-state-flag to cache
+    *  results from previous checks of this package - also it should
+    *  be used if the default resolver implementation is also used to
+    *  ensure that these packages are handled like "normal" dpkg holds.
+    *
+    *  The parameters are the same as in the calling MarkDelete:
+    *  \param Pkg       the package that MarkDelete wants to remove.
+    *  \param Purge     should we purge instead of "only" remove?
+    *  \param Depth     recursive deep of this Marker call
+    *  \param FromUser  was the remove requested by the user?
+    */
+   virtual bool IsDeleteOk(const PkgIterator &Pkg,bool Purge = false,
+			    unsigned long Depth = 0, bool FromUser = true);
+
    // This is for debuging
    // This is for debuging
    void Update(OpProgress *Prog = 0);
    void Update(OpProgress *Prog = 0);
 
 

+ 8 - 8
apt-pkg/indexcopy.cc

@@ -551,8 +551,8 @@ bool SigVerify::Verify(string prefix, string file, indexRecords *MetaIndex)
 
 
    return true;
    return true;
 }
 }
-
-bool SigVerify::CopyMetaIndex(string CDROM, string CDName, 
+									/*}}}*/
+bool SigVerify::CopyMetaIndex(string CDROM, string CDName,		/*{{{*/
 			      string prefix, string file)
 			      string prefix, string file)
 {
 {
       char S[400];
       char S[400];
@@ -572,8 +572,8 @@ bool SigVerify::CopyMetaIndex(string CDROM, string CDName,
    
    
       return true;
       return true;
 }
 }
-
-bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
+									/*}}}*/
+bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,	/*{{{*/
 			      vector<string> PkgList,vector<string> SrcList)
 			      vector<string> PkgList,vector<string> SrcList)
 {
 {
    if (SigList.size() == 0)
    if (SigList.size() == 0)
@@ -675,10 +675,9 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
 
 
    return true;
    return true;
 }
 }
-
-
-bool TranslationsCopy::CopyTranslations(string CDROM,string Name,vector<string> &List,
-			     pkgCdromStatus *log)
+									/*}}}*/
+bool TranslationsCopy::CopyTranslations(string CDROM,string Name,	/*{{{*/
+				vector<string> &List, pkgCdromStatus *log)
 {
 {
    OpProgress *Progress = NULL;
    OpProgress *Progress = NULL;
    if (List.size() == 0)
    if (List.size() == 0)
@@ -850,3 +849,4 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name,vector<string>
 
 
    return true;
    return true;
 }
 }
+									/*}}}*/

+ 10 - 12
apt-pkg/indexcopy.h

@@ -22,7 +22,7 @@ class FileFd;
 class indexRecords;
 class indexRecords;
 class pkgCdromStatus;
 class pkgCdromStatus;
 
 
-class IndexCopy
+class IndexCopy								/*{{{*/
 {
 {
    protected:
    protected:
    
    
@@ -45,8 +45,8 @@ class IndexCopy
 		     pkgCdromStatus *log);
 		     pkgCdromStatus *log);
    virtual ~IndexCopy() {};
    virtual ~IndexCopy() {};
 };
 };
-
-class PackageCopy : public IndexCopy
+									/*}}}*/
+class PackageCopy : public IndexCopy					/*{{{*/
 {
 {
    protected:
    protected:
    
    
@@ -57,8 +57,8 @@ class PackageCopy : public IndexCopy
    
    
    public:
    public:
 };
 };
-
-class SourceCopy : public IndexCopy
+									/*}}}*/
+class SourceCopy : public IndexCopy					/*{{{*/
 {
 {
    protected:
    protected:
    
    
@@ -69,8 +69,8 @@ class SourceCopy : public IndexCopy
    
    
    public:
    public:
 };
 };
-
-class TranslationsCopy
+									/*}}}*/
+class TranslationsCopy							/*{{{*/
 {
 {
    protected:
    protected:
    pkgTagSection *Section;
    pkgTagSection *Section;
@@ -79,9 +79,8 @@ class TranslationsCopy
    bool CopyTranslations(string CDROM,string Name,vector<string> &List,
    bool CopyTranslations(string CDROM,string Name,vector<string> &List,
 			 pkgCdromStatus *log);
 			 pkgCdromStatus *log);
 };
 };
-
-
-class SigVerify 
+									/*}}}*/
+class SigVerify								/*{{{*/
 {
 {
    bool Verify(string prefix,string file, indexRecords *records);
    bool Verify(string prefix,string file, indexRecords *records);
    bool CopyMetaIndex(string CDROM, string CDName, 
    bool CopyMetaIndex(string CDROM, string CDName, 
@@ -91,7 +90,6 @@ class SigVerify
    bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
    bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
 		      vector<string> PkgList,vector<string> SrcList);
 		      vector<string> PkgList,vector<string> SrcList);
 };
 };
-
-
+									/*}}}*/
 
 
 #endif
 #endif

+ 0 - 1
apt-pkg/indexfile.cc

@@ -41,7 +41,6 @@ pkgIndexFile::Type *pkgIndexFile::Type::GetType(const char *Type)
    return 0;
    return 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
-    
 // IndexFile::ArchiveInfo - Stub					/*{{{*/
 // IndexFile::ArchiveInfo - Stub					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */

+ 7 - 7
apt-pkg/indexrecords.cc

@@ -9,7 +9,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/strutl.h>
 #include <apti18n.h>
 #include <apti18n.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
-
+									/*}}}*/
 string indexRecords::GetDist() const
 string indexRecords::GetDist() const
 {
 {
    return this->Dist;
    return this->Dist;
@@ -31,7 +31,7 @@ const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey)
    return Entries[MetaKey];
    return Entries[MetaKey];
 }
 }
 
 
-bool indexRecords::Load(const string Filename)
+bool indexRecords::Load(const string Filename)				/*{{{*/
 {
 {
    FileFd Fd(Filename, FileFd::ReadOnly);
    FileFd Fd(Filename, FileFd::ReadOnly);
    pkgTagFile TagFile(&Fd, Fd.Size() + 256); // XXX
    pkgTagFile TagFile(&Fd, Fd.Size() + 256); // XXX
@@ -85,8 +85,8 @@ bool indexRecords::Load(const string Filename)
    string Strdate = Section.FindS("Date"); // FIXME: verify this somehow?
    string Strdate = Section.FindS("Date"); // FIXME: verify this somehow?
    return true;
    return true;
 }
 }
-
-vector<string> indexRecords::MetaKeys()
+									/*}}}*/
+vector<string> indexRecords::MetaKeys()					/*{{{*/
 {
 {
    std::vector<std::string> keys;
    std::vector<std::string> keys;
    std::map<string,checkSum *>::iterator I = Entries.begin();
    std::map<string,checkSum *>::iterator I = Entries.begin();
@@ -96,8 +96,8 @@ vector<string> indexRecords::MetaKeys()
    }
    }
    return keys;
    return keys;
 }
 }
-
-bool indexRecords::parseSumData(const char *&Start, const char *End,
+									/*}}}*/
+bool indexRecords::parseSumData(const char *&Start, const char *End,	/*{{{*/
 				   string &Name, string &Hash, size_t &Size)
 				   string &Name, string &Hash, size_t &Size)
 {
 {
    Name = "";
    Name = "";
@@ -154,7 +154,7 @@ bool indexRecords::parseSumData(const char *&Start, const char *End,
    Start = EntryEnd; //prepare for the next round
    Start = EntryEnd; //prepare for the next round
    return true;
    return true;
 }
 }
-
+									/*}}}*/
 indexRecords::indexRecords()
 indexRecords::indexRecords()
 {
 {
 }
 }

+ 12 - 5
apt-pkg/init.cc

@@ -81,19 +81,26 @@ bool pkgInitConfig(Configuration &Cnf)
    
    
    // Read an alternate config file
    // Read an alternate config file
    const char *Cfg = getenv("APT_CONFIG");
    const char *Cfg = getenv("APT_CONFIG");
-   if (Cfg != 0 && FileExists(Cfg) == true)
-      Res &= ReadConfigFile(Cnf,Cfg);
-   
+   if (Cfg != 0)
+   {
+      if (FileExists(Cfg) == true)
+	 Res &= ReadConfigFile(Cnf,Cfg);
+      else
+	 _error->WarningE("FileExists",_("Unable to read %s"),Cfg);
+   }
+
    // Read the configuration parts dir
    // Read the configuration parts dir
    string Parts = Cnf.FindDir("Dir::Etc::parts");
    string Parts = Cnf.FindDir("Dir::Etc::parts");
    if (FileExists(Parts) == true)
    if (FileExists(Parts) == true)
       Res &= ReadConfigDir(Cnf,Parts);
       Res &= ReadConfigDir(Cnf,Parts);
-      
+   else
+      _error->WarningE("FileExists",_("Unable to read %s"),Parts.c_str());
+
    // Read the main config file
    // Read the main config file
    string FName = Cnf.FindFile("Dir::Etc::main");
    string FName = Cnf.FindFile("Dir::Etc::main");
    if (FileExists(FName) == true)
    if (FileExists(FName) == true)
       Res &= ReadConfigFile(Cnf,FName);
       Res &= ReadConfigFile(Cnf,FName);
-   
+
    if (Res == false)
    if (Res == false)
       return false;
       return false;
    
    

+ 2 - 8
apt-pkg/orderlist.cc

@@ -129,7 +129,6 @@ bool pkgOrderList::IsMissing(PkgIterator Pkg)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // OrderList::DoRun - Does an order run					/*{{{*/
 // OrderList::DoRun - Does an order run					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The caller is expeted to have setup the desired probe state */
 /* The caller is expeted to have setup the desired probe state */
@@ -282,7 +281,6 @@ bool pkgOrderList::OrderConfigure()
    return DoRun();
    return DoRun();
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // OrderList::Score - Score the package for sorting			/*{{{*/
 // OrderList::Score - Score the package for sorting			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Higher scores order earlier */
 /* Higher scores order earlier */
@@ -433,7 +431,6 @@ int pkgOrderList::OrderCompareB(const void *a, const void *b)
    return strcmp(A.Name(),B.Name());
    return strcmp(A.Name(),B.Name());
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // OrderList::VisitDeps - Visit forward install dependencies		/*{{{*/
 // OrderList::VisitDeps - Visit forward install dependencies		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This calls the dependency function for the normal forwards dependencies
 /* This calls the dependency function for the normal forwards dependencies
@@ -590,7 +587,6 @@ bool pkgOrderList::VisitNode(PkgIterator Pkg)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // OrderList::DepUnPackCrit - Critical UnPacking ordering		/*{{{*/
 // OrderList::DepUnPackCrit - Critical UnPacking ordering		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Critical unpacking ordering strives to satisfy Conflicts: and 
 /* Critical unpacking ordering strives to satisfy Conflicts: and 
@@ -668,13 +664,12 @@ bool pkgOrderList::DepUnPackCrit(DepIterator D)
    }   
    }   
    return true;
    return true;
 }
 }
-
+									/*}}}*/
 // OrderList::DepUnPackPreD - Critical UnPacking ordering with depends	/*{{{*/
 // OrderList::DepUnPackPreD - Critical UnPacking ordering with depends	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Critical PreDepends (also configure immediate and essential) strives to
 /* Critical PreDepends (also configure immediate and essential) strives to
    ensure not only that all conflicts+predepends are met but that this
    ensure not only that all conflicts+predepends are met but that this
-   package will be immediately configurable when it is unpacked. 
-
+   package will be immediately configurable when it is unpacked.
    Loops are preprocessed and logged. */
    Loops are preprocessed and logged. */
 bool pkgOrderList::DepUnPackPreD(DepIterator D)
 bool pkgOrderList::DepUnPackPreD(DepIterator D)
 {
 {
@@ -892,7 +887,6 @@ bool pkgOrderList::DepRemove(DepIterator D)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // OrderList::AddLoop - Add a loop to the loop list			/*{{{*/
 // OrderList::AddLoop - Add a loop to the loop list			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* We record the loops. This is a relic since loop breaking is done 
 /* We record the loops. This is a relic since loop breaking is done 

+ 1 - 3
apt-pkg/packagemanager.cc

@@ -26,7 +26,7 @@
 #include <apti18n.h>    
 #include <apti18n.h>    
 #include <iostream>
 #include <iostream>
 #include <fcntl.h> 
 #include <fcntl.h> 
-
+									/*}}}*/
 using namespace std;
 using namespace std;
 
 
 // PM::PackageManager - Constructor					/*{{{*/
 // PM::PackageManager - Constructor					/*{{{*/
@@ -117,7 +117,6 @@ bool pkgPackageManager::FixMissing()
    return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;   
    return Resolve.ResolveByKeep() == true && Cache.BrokenCount() == 0;   
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // PM::ImmediateAdd - Add the immediate flag recursivly			/*{{{*/
 // PM::ImmediateAdd - Add the immediate flag recursivly			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This adds the immediate flag to the pkg and recursively to the
 /* This adds the immediate flag to the pkg and recursively to the
@@ -152,7 +151,6 @@ void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer)
    return;
    return;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // PM::CreateOrderList - Create the ordering class			/*{{{*/
 // PM::CreateOrderList - Create the ordering class			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This populates the ordering list with all the packages that are
 /* This populates the ordering list with all the packages that are

+ 24 - 24
apt-pkg/pkgcache.h

@@ -27,7 +27,7 @@
 using std::string;
 using std::string;
     
     
 class pkgVersioningSystem;
 class pkgVersioningSystem;
-class pkgCache
+class pkgCache								/*{{{*/
 {
 {
    public:
    public:
    // Cache element predeclarations
    // Cache element predeclarations
@@ -146,8 +146,8 @@ class pkgCache
    pkgCache(MMap *Map,bool DoMap = true);
    pkgCache(MMap *Map,bool DoMap = true);
    virtual ~pkgCache() {};
    virtual ~pkgCache() {};
 };
 };
-
-// Header structure
+									/*}}}*/
+// Header structure							/*{{{*/
 struct pkgCache::Header
 struct pkgCache::Header
 {
 {
    // Signature information
    // Signature information
@@ -195,8 +195,8 @@ struct pkgCache::Header
    bool CheckSizes(Header &Against) const;
    bool CheckSizes(Header &Against) const;
    Header();
    Header();
 };
 };
-
-struct pkgCache::Package
+									/*}}}*/
+struct pkgCache::Package						/*{{{*/
 {
 {
    // Pointers
    // Pointers
    map_ptrloc Name;              // Stringtable
    map_ptrloc Name;              // Stringtable
@@ -217,8 +217,8 @@ struct pkgCache::Package
    unsigned int ID;
    unsigned int ID;
    unsigned long Flags;
    unsigned long Flags;
 };
 };
-
-struct pkgCache::PackageFile
+									/*}}}*/
+struct pkgCache::PackageFile						/*{{{*/
 {
 {
    // Names
    // Names
    map_ptrloc FileName;        // Stringtable
    map_ptrloc FileName;        // Stringtable
@@ -239,24 +239,24 @@ struct pkgCache::PackageFile
    unsigned int ID;
    unsigned int ID;
    time_t mtime;                  // Modification time for the file
    time_t mtime;                  // Modification time for the file
 };
 };
-
-struct pkgCache::VerFile
+									/*}}}*/
+struct pkgCache::VerFile						/*{{{*/
 {
 {
    map_ptrloc File;           // PackageFile
    map_ptrloc File;           // PackageFile
    map_ptrloc NextFile;       // PkgVerFile
    map_ptrloc NextFile;       // PkgVerFile
    map_ptrloc Offset;         // File offset
    map_ptrloc Offset;         // File offset
    unsigned short Size;
    unsigned short Size;
 };
 };
-
-struct pkgCache::DescFile
+									/*}}}*/
+struct pkgCache::DescFile						/*{{{*/
 {
 {
    map_ptrloc File;           // PackageFile
    map_ptrloc File;           // PackageFile
    map_ptrloc NextFile;       // PkgVerFile
    map_ptrloc NextFile;       // PkgVerFile
    map_ptrloc Offset;         // File offset
    map_ptrloc Offset;         // File offset
    unsigned short Size;
    unsigned short Size;
 };
 };
-
-struct pkgCache::Version
+									/*}}}*/
+struct pkgCache::Version						/*{{{*/
 {
 {
    map_ptrloc VerStr;            // Stringtable
    map_ptrloc VerStr;            // Stringtable
    map_ptrloc Section;           // StringTable (StringItem)
    map_ptrloc Section;           // StringTable (StringItem)
@@ -276,8 +276,8 @@ struct pkgCache::Version
    unsigned int ID;
    unsigned int ID;
    unsigned char Priority;
    unsigned char Priority;
 };
 };
-
-struct pkgCache::Description
+									/*}}}*/
+struct pkgCache::Description						/*{{{*/
 {
 {
    // Language Code store the description translation language code. If
    // Language Code store the description translation language code. If
    // the value has a 0 lenght then this is readed using the Package
    // the value has a 0 lenght then this is readed using the Package
@@ -292,8 +292,8 @@ struct pkgCache::Description
 
 
    unsigned int ID;
    unsigned int ID;
 };
 };
-
-struct pkgCache::Dependency
+									/*}}}*/
+struct pkgCache::Dependency						/*{{{*/
 {
 {
    map_ptrloc Version;         // Stringtable
    map_ptrloc Version;         // Stringtable
    map_ptrloc Package;         // Package
    map_ptrloc Package;         // Package
@@ -306,8 +306,8 @@ struct pkgCache::Dependency
    unsigned char Type;
    unsigned char Type;
    unsigned char CompareOp;
    unsigned char CompareOp;
 };
 };
-
-struct pkgCache::Provides
+									/*}}}*/
+struct pkgCache::Provides						/*{{{*/
 {
 {
    map_ptrloc ParentPkg;        // Pacakge
    map_ptrloc ParentPkg;        // Pacakge
    map_ptrloc Version;          // Version
    map_ptrloc Version;          // Version
@@ -315,13 +315,13 @@ struct pkgCache::Provides
    map_ptrloc NextProvides;     // Provides
    map_ptrloc NextProvides;     // Provides
    map_ptrloc NextPkgProv;      // Provides
    map_ptrloc NextPkgProv;      // Provides
 };
 };
-
-struct pkgCache::StringItem
+									/*}}}*/
+struct pkgCache::StringItem						/*{{{*/
 {
 {
    map_ptrloc String;        // Stringtable
    map_ptrloc String;        // Stringtable
    map_ptrloc NextItem;      // StringItem
    map_ptrloc NextItem;      // StringItem
 };
 };
-
+									/*}}}*/
 #include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/cacheiterators.h>
 
 
 inline pkgCache::PkgIterator pkgCache::PkgBegin() 
 inline pkgCache::PkgIterator pkgCache::PkgBegin() 
@@ -334,7 +334,7 @@ inline pkgCache::PkgFileIterator pkgCache::FileEnd()
        {return PkgFileIterator(*this,PkgFileP);};
        {return PkgFileIterator(*this,PkgFileP);};
 
 
 // Oh I wish for Real Name Space Support
 // Oh I wish for Real Name Space Support
-class pkgCache::Namespace
+class pkgCache::Namespace						/*{{{*/
 {   
 {   
    public:
    public:
 
 
@@ -352,5 +352,5 @@ class pkgCache::Namespace
    typedef pkgCache::Dep Dep;
    typedef pkgCache::Dep Dep;
    typedef pkgCache::Flag Flag;
    typedef pkgCache::Flag Flag;
 };
 };
-
+									/*}}}*/
 #endif
 #endif

+ 25 - 21
apt-pkg/pkgcachegen.cc

@@ -53,14 +53,16 @@ pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) :
    {
    {
       // Setup the map interface..
       // Setup the map interface..
       Cache.HeaderP = (pkgCache::Header *)Map.Data();
       Cache.HeaderP = (pkgCache::Header *)Map.Data();
-      Map.RawAllocate(sizeof(pkgCache::Header));
+      if (Map.RawAllocate(sizeof(pkgCache::Header)) == 0 && _error->PendingError() == true)
+	 return;
+
       Map.UsePools(*Cache.HeaderP->Pools,sizeof(Cache.HeaderP->Pools)/sizeof(Cache.HeaderP->Pools[0]));
       Map.UsePools(*Cache.HeaderP->Pools,sizeof(Cache.HeaderP->Pools)/sizeof(Cache.HeaderP->Pools[0]));
-      
+
       // Starting header
       // Starting header
       *Cache.HeaderP = pkgCache::Header();
       *Cache.HeaderP = pkgCache::Header();
       Cache.HeaderP->VerSysName = Map.WriteString(_system->VS->Label);
       Cache.HeaderP->VerSysName = Map.WriteString(_system->VS->Label);
       Cache.HeaderP->Architecture = Map.WriteString(_config->Find("APT::Architecture"));
       Cache.HeaderP->Architecture = Map.WriteString(_config->Find("APT::Architecture"));
-      Cache.ReMap(); 
+      Cache.ReMap();
    }
    }
    else
    else
    {
    {
@@ -135,7 +137,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
  	 pkgCache::VerIterator Ver = Pkg.VersionList();
  	 pkgCache::VerIterator Ver = Pkg.VersionList();
  	 map_ptrloc *LastVer = &Pkg->VersionList;
  	 map_ptrloc *LastVer = &Pkg->VersionList;
 
 
-  	 for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) 
+	 for (; Ver != 0 && Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
  	 {
  	 {
  	    pkgCache::DescIterator Desc = Ver.DescriptionList();
  	    pkgCache::DescIterator Desc = Ver.DescriptionList();
  	    map_ptrloc *LastDesc = &Ver->DescriptionList;
  	    map_ptrloc *LastDesc = &Ver->DescriptionList;
@@ -143,7 +145,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
 
 
 	    // don't add a new description if we have one for the given
 	    // don't add a new description if we have one for the given
 	    // md5 && language
 	    // md5 && language
- 	    for ( ; Desc.end() == false; Desc++)
+	    for ( ; Desc != 0 && Desc.end() == false; Desc++)
 	       if (MD5SumValue(Desc.md5()) == CurMd5 && 
 	       if (MD5SumValue(Desc.md5()) == CurMd5 && 
 	           Desc.LanguageCode() == List.DescriptionLanguage())
 	           Desc.LanguageCode() == List.DescriptionLanguage())
 		  duplicate=true;
 		  duplicate=true;
@@ -151,7 +153,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
 	       continue;
 	       continue;
 	    
 	    
  	    for (Desc = Ver.DescriptionList();
  	    for (Desc = Ver.DescriptionList();
-		 Desc.end() == false; 
+		 Desc != 0 && Desc.end() == false;
 		 LastDesc = &Desc->NextDesc, Desc++)
 		 LastDesc = &Desc->NextDesc, Desc++)
 	    {
 	    {
  	       if (MD5SumValue(Desc.md5()) == CurMd5) 
  	       if (MD5SumValue(Desc.md5()) == CurMd5) 
@@ -160,7 +162,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
  		  *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc);
  		  *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc);
  		  Desc->ParentPkg = Pkg.Index();
  		  Desc->ParentPkg = Pkg.Index();
 		  
 		  
- 		  if (NewFileDesc(Desc,List) == false)
+		  if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
  		     return _error->Error(_("Error occurred while processing %s (NewFileDesc1)"),PackageName.c_str());
  		     return _error->Error(_("Error occurred while processing %s (NewFileDesc1)"),PackageName.c_str());
  		  break;
  		  break;
  	       }
  	       }
@@ -173,7 +175,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       pkgCache::VerIterator Ver = Pkg.VersionList();
       pkgCache::VerIterator Ver = Pkg.VersionList();
       map_ptrloc *LastVer = &Pkg->VersionList;
       map_ptrloc *LastVer = &Pkg->VersionList;
       int Res = 1;
       int Res = 1;
-      for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
+      for (; Ver != 0 && Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
       {
       {
 	 Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
 	 Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
 	 if (Res >= 0)
 	 if (Res >= 0)
@@ -207,7 +209,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       // Skip to the end of the same version set.
       // Skip to the end of the same version set.
       if (Res == 0)
       if (Res == 0)
       {
       {
-	 for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
+	 for (; Ver != 0 && Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
 	 {
 	 {
 	    Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
 	    Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
 	    if (Res != 0)
 	    if (Res != 0)
@@ -220,7 +222,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       Ver->ParentPkg = Pkg.Index();
       Ver->ParentPkg = Pkg.Index();
       Ver->Hash = Hash;
       Ver->Hash = Hash;
 
 
-      if (List.NewVersion(Ver) == false)
+      if ((*LastVer == 0 && _error->PendingError()) || List.NewVersion(Ver) == false)
 	 return _error->Error(_("Error occurred while processing %s (NewVersion1)"),
 	 return _error->Error(_("Error occurred while processing %s (NewVersion1)"),
 			      PackageName.c_str());
 			      PackageName.c_str());
 
 
@@ -246,13 +248,13 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       map_ptrloc *LastDesc = &Ver->DescriptionList;
       map_ptrloc *LastDesc = &Ver->DescriptionList;
       
       
       // Skip to the end of description set
       // Skip to the end of description set
-      for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++);
+      for (; Desc != 0 && Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++);
 
 
       // Add new description
       // Add new description
       *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), List.Description_md5(), *LastDesc);
       *LastDesc = NewDescription(Desc, List.DescriptionLanguage(), List.Description_md5(), *LastDesc);
       Desc->ParentPkg = Pkg.Index();
       Desc->ParentPkg = Pkg.Index();
 
 
-      if (NewFileDesc(Desc,List) == false)
+      if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
 	 return _error->Error(_("Error occurred while processing %s (NewFileDesc2)"),PackageName.c_str());
 	 return _error->Error(_("Error occurred while processing %s (NewFileDesc2)"),PackageName.c_str());
    }
    }
 
 
@@ -304,7 +306,7 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
 
 
       unsigned long Hash = List.VersionHash();
       unsigned long Hash = List.VersionHash();
       pkgCache::VerIterator Ver = Pkg.VersionList();
       pkgCache::VerIterator Ver = Pkg.VersionList();
-      for (; Ver.end() == false; Ver++)
+      for (; Ver != 0 && Ver.end() == false; Ver++)
       {
       {
 	 if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr())
 	 if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr())
 	 {
 	 {
@@ -370,7 +372,7 @@ bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver,
    
    
    // Link it to the end of the list
    // Link it to the end of the list
    map_ptrloc *Last = &Ver->FileList;
    map_ptrloc *Last = &Ver->FileList;
-   for (pkgCache::VerFileIterator V = Ver.FileList(); V.end() == false; V++)
+   for (pkgCache::VerFileIterator V = Ver.FileList(); V != 0 && V.end() == false; V++)
       Last = &V->NextFile;
       Last = &V->NextFile;
    VF->NextFile = *Last;
    VF->NextFile = *Last;
    *Last = VF.Index();
    *Last = VF.Index();
@@ -419,14 +421,14 @@ bool pkgCacheGenerator::NewFileDesc(pkgCache::DescIterator &Desc,
    // Get a structure
    // Get a structure
    unsigned long DescFile = Map.Allocate(sizeof(pkgCache::DescFile));
    unsigned long DescFile = Map.Allocate(sizeof(pkgCache::DescFile));
    if (DescFile == 0)
    if (DescFile == 0)
-      return 0;
+      return false;
 
 
    pkgCache::DescFileIterator DF(Cache,Cache.DescFileP + DescFile);
    pkgCache::DescFileIterator DF(Cache,Cache.DescFileP + DescFile);
    DF->File = CurrentFile - Cache.PkgFileP;
    DF->File = CurrentFile - Cache.PkgFileP;
 
 
    // Link it to the end of the list
    // Link it to the end of the list
    map_ptrloc *Last = &Desc->FileList;
    map_ptrloc *Last = &Desc->FileList;
-   for (pkgCache::DescFileIterator D = Desc.FileList(); D.end() == false; D++)
+   for (pkgCache::DescFileIterator D = Desc.FileList(); D != 0 && D.end() == false; D++)
       Last = &D->NextFile;
       Last = &D->NextFile;
 
 
    DF->NextFile = *Last;
    DF->NextFile = *Last;
@@ -460,6 +462,8 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
    Desc->ID = Cache.HeaderP->DescriptionCount++;
    Desc->ID = Cache.HeaderP->DescriptionCount++;
    Desc->language_code = Map.WriteString(Lang);
    Desc->language_code = Map.WriteString(Lang);
    Desc->md5sum = Map.WriteString(md5sum.Value());
    Desc->md5sum = Map.WriteString(md5sum.Value());
+   if (Desc->language_code == 0 || Desc->md5sum == 0)
+      return 0;
 
 
    return Description;
    return Description;
 }
 }
@@ -514,7 +518,7 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
    if (OldDepVer != Ver)
    if (OldDepVer != Ver)
    {
    {
       OldDepLast = &Ver->DependsList;
       OldDepLast = &Ver->DependsList;
-      for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
+      for (pkgCache::DepIterator D = Ver.DependsList(); D != 0 && D.end() == false; D++)
 	 OldDepLast = &D->NextDepends;
 	 OldDepLast = &D->NextDepends;
       OldDepVer = Ver;
       OldDepVer = Ver;
    }
    }
@@ -652,7 +656,6 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
    return ItemP->String;
    return ItemP->String;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // CheckValidity - Check that a cache is up-to-date			/*{{{*/
 // CheckValidity - Check that a cache is up-to-date			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This just verifies that each file in the list of index files exists,
 /* This just verifies that each file in the list of index files exists,
@@ -810,7 +813,7 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
    unsigned long EndOfSource = Files.size();
    unsigned long EndOfSource = Files.size();
    if (_system->AddStatusFiles(Files) == false)
    if (_system->AddStatusFiles(Files) == false)
       return false;
       return false;
-   
+
    // Decide if we can write to the files..
    // Decide if we can write to the files..
    string CacheFile = _config->FindFile("Dir::Cache::pkgcache");
    string CacheFile = _config->FindFile("Dir::Cache::pkgcache");
    string SrcCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
    string SrcCacheFile = _config->FindFile("Dir::Cache::srcpkgcache");
@@ -862,8 +865,9 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
    {
    {
       // Preload the map with the source cache
       // Preload the map with the source cache
       FileFd SCacheF(SrcCacheFile,FileFd::ReadOnly);
       FileFd SCacheF(SrcCacheFile,FileFd::ReadOnly);
-      if (SCacheF.Read((unsigned char *)Map->Data() + Map->RawAllocate(SCacheF.Size()),
-		       SCacheF.Size()) == false)
+      unsigned long alloc = Map->RawAllocate(SCacheF.Size());
+      if (alloc == 0 || SCacheF.Read((unsigned char *)Map->Data() + alloc,
+				     SCacheF.Size()) == false)
 	 return false;
 	 return false;
 
 
       TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end());
       TotalSize = ComputeSize(Files.begin()+EndOfSource,Files.end());

+ 4 - 4
apt-pkg/pkgcachegen.h

@@ -28,7 +28,7 @@ class OpProgress;
 class MMap;
 class MMap;
 class pkgIndexFile;
 class pkgIndexFile;
 
 
-class pkgCacheGenerator
+class pkgCacheGenerator							/*{{{*/
 {
 {
    private:
    private:
    
    
@@ -76,8 +76,8 @@ class pkgCacheGenerator
    pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
    pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
    ~pkgCacheGenerator();
    ~pkgCacheGenerator();
 };
 };
-
-// This is the abstract package list parser class.
+									/*}}}*/
+// This is the abstract package list parser class.			/*{{{*/
 class pkgCacheGenerator::ListParser
 class pkgCacheGenerator::ListParser
 {
 {
    pkgCacheGenerator *Owner;
    pkgCacheGenerator *Owner;
@@ -126,7 +126,7 @@ class pkgCacheGenerator::ListParser
    ListParser() : FoundFileDeps(false) {};
    ListParser() : FoundFileDeps(false) {};
    virtual ~ListParser() {};
    virtual ~ListParser() {};
 };
 };
-
+									/*}}}*/
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
 			MMap **OutMap = 0,bool AllowMem = false);
 			MMap **OutMap = 0,bool AllowMem = false);
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);

+ 4 - 4
apt-pkg/pkgrecords.h

@@ -22,7 +22,7 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/fileutl.h>
 #include <vector>
 #include <vector>
 
 
-class pkgRecords
+class pkgRecords							/*{{{*/
 {
 {
    public:
    public:
    class Parser;
    class Parser;
@@ -42,8 +42,8 @@ class pkgRecords
    pkgRecords(pkgCache &Cache);
    pkgRecords(pkgCache &Cache);
    ~pkgRecords();
    ~pkgRecords();
 };
 };
-
-class pkgRecords::Parser
+									/*}}}*/
+class pkgRecords::Parser						/*{{{*/
 {
 {
    protected:
    protected:
    
    
@@ -73,5 +73,5 @@ class pkgRecords::Parser
    
    
    virtual ~Parser() {};
    virtual ~Parser() {};
 };
 };
-
+									/*}}}*/
 #endif
 #endif

+ 28 - 10
apt-pkg/policy.cc

@@ -123,6 +123,14 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator Pkg)
    signed Max = GetPriority(Pkg);
    signed Max = GetPriority(Pkg);
    pkgCache::VerIterator Pref = GetMatch(Pkg);
    pkgCache::VerIterator Pref = GetMatch(Pkg);
 
 
+   // no package = no candidate version
+   if (Pkg.end() == true)
+      return Pref;
+
+   // packages with a pin lower than 0 have no newer candidate than the current version
+   if (Max < 0)
+      return Pkg.CurrentVer();
+
    /* Falling through to the default version.. Setting Max to zero
    /* Falling through to the default version.. Setting Max to zero
       effectively excludes everything <= 0 which are the non-automatic
       effectively excludes everything <= 0 which are the non-automatic
       priorities.. The status file is given a prio of 100 which will exclude
       priorities.. The status file is given a prio of 100 which will exclude
@@ -256,24 +264,35 @@ class PreferenceSection : public pkgTagSection
 	    Stop = (const char*) memchr(Stop,'\n',End-Stop);
 	    Stop = (const char*) memchr(Stop,'\n',End-Stop);
    }
    }
 };
 };
-
-
+									/*}}}*/
+// ReadPinDir - Load the pin files from this dir into a Policy		/*{{{*/
+// ---------------------------------------------------------------------
+/* This will load each pin file in the given dir into a Policy. If the
+   given dir is empty the dir set in Dir::Etc::PreferencesParts is used.
+   Note also that this method will issue a warning if the dir does not
+   exists but it will return true in this case! */
 bool ReadPinDir(pkgPolicy &Plcy,string Dir)
 bool ReadPinDir(pkgPolicy &Plcy,string Dir)
 {
 {
    if (Dir.empty() == true)
    if (Dir.empty() == true)
       Dir = _config->FindDir("Dir::Etc::PreferencesParts");
       Dir = _config->FindDir("Dir::Etc::PreferencesParts");
 
 
+   if (FileExists(Dir) == false)
+   {
+      _error->WarningE("FileExists",_("Unable to read %s"),Dir.c_str());
+      return true;
+   }
+
    DIR *D = opendir(Dir.c_str());
    DIR *D = opendir(Dir.c_str());
    if (D == 0)
    if (D == 0)
       return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
       return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
 
 
    vector<string> List;
    vector<string> List;
-   
+
    for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D))
    for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D))
    {
    {
       if (Ent->d_name[0] == '.')
       if (Ent->d_name[0] == '.')
 	 continue;
 	 continue;
-      
+
       // Skip bad file names ala run-parts
       // Skip bad file names ala run-parts
       const char *C = Ent->d_name;
       const char *C = Ent->d_name;
       for (; *C != 0; C++)
       for (; *C != 0; C++)
@@ -281,17 +300,17 @@ bool ReadPinDir(pkgPolicy &Plcy,string Dir)
 	    break;
 	    break;
       if (*C != 0)
       if (*C != 0)
 	 continue;
 	 continue;
-      
+
       // Make sure it is a file and not something else
       // Make sure it is a file and not something else
       string File = flCombine(Dir,Ent->d_name);
       string File = flCombine(Dir,Ent->d_name);
       struct stat St;
       struct stat St;
       if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
       if (stat(File.c_str(),&St) != 0 || S_ISREG(St.st_mode) == 0)
 	 continue;
 	 continue;
-      
-      List.push_back(File);      
-   }   
+
+      List.push_back(File);
+   }
    closedir(D);
    closedir(D);
-   
+
    sort(List.begin(),List.end());
    sort(List.begin(),List.end());
 
 
    // Read the files
    // Read the files
@@ -300,7 +319,6 @@ bool ReadPinDir(pkgPolicy &Plcy,string Dir)
 	 return false;
 	 return false;
    return true;
    return true;
 }
 }
-   
 									/*}}}*/
 									/*}}}*/
 // ReadPinFile - Load the pin file into a Policy			/*{{{*/
 // ReadPinFile - Load the pin file into a Policy			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------

+ 6 - 2
apt-pkg/sourcelist.cc

@@ -158,12 +158,16 @@ bool pkgSourceList::ReadMainList()
    //                  entries in sources.list.d.
    //                  entries in sources.list.d.
    string Main = _config->FindFile("Dir::Etc::sourcelist");
    string Main = _config->FindFile("Dir::Etc::sourcelist");
    if (FileExists(Main) == true)
    if (FileExists(Main) == true)
-      Res &= ReadAppend(Main);   
+      Res &= ReadAppend(Main);
+   else
+      _error->WarningE("FileExists",_("Unable to read %s"),Main.c_str());
 
 
    string Parts = _config->FindDir("Dir::Etc::sourceparts");
    string Parts = _config->FindDir("Dir::Etc::sourceparts");
    if (FileExists(Parts) == true)
    if (FileExists(Parts) == true)
       Res &= ReadSourceDir(Parts);
       Res &= ReadSourceDir(Parts);
-   
+   else
+      _error->WarningE("FileExists",_("Unable to read %s"),Parts.c_str());
+
    return Res;
    return Res;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 10 - 9
apt-pkg/vendorlist.cc

@@ -10,7 +10,7 @@ pkgVendorList::~pkgVendorList()
       delete *I;
       delete *I;
 }
 }
 
 
-// pkgVendorList::ReadMainList - Read list of known package vendors		/*{{{*/
+// pkgVendorList::ReadMainList - Read list of known package vendors	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This also scans a directory of vendor files similar to apt.conf.d 
 /* This also scans a directory of vendor files similar to apt.conf.d 
    which can contain the usual suspects of distribution provided data.
    which can contain the usual suspects of distribution provided data.
@@ -31,8 +31,8 @@ bool pkgVendorList::ReadMainList()
 
 
    return CreateList(Cnf);
    return CreateList(Cnf);
 }
 }
-
-bool pkgVendorList::Read(string File)
+									/*}}}*/
+bool pkgVendorList::Read(string File)					/*{{{*/
 {
 {
    Configuration Cnf;
    Configuration Cnf;
    if (ReadConfigFile(Cnf,File,true) == false)
    if (ReadConfigFile(Cnf,File,true) == false)
@@ -40,8 +40,8 @@ bool pkgVendorList::Read(string File)
 
 
    return CreateList(Cnf);
    return CreateList(Cnf);
 }
 }
-
-bool pkgVendorList::CreateList(Configuration& Cnf)
+									/*}}}*/
+bool pkgVendorList::CreateList(Configuration& Cnf)			/*{{{*/
 {
 {
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
 	I != VendorList.end(); I++)
 	I != VendorList.end(); I++)
@@ -110,8 +110,8 @@ bool pkgVendorList::CreateList(Configuration& Cnf)
    
    
    return !_error->PendingError();
    return !_error->PendingError();
 }
 }
-
-const Vendor* pkgVendorList::LookupFingerprint(string Fingerprint)
+									/*}}}*/
+const Vendor* pkgVendorList::LookupFingerprint(string Fingerprint)	/*{{{*/
 {
 {
    for (const_iterator I = VendorList.begin(); I != VendorList.end(); ++I)
    for (const_iterator I = VendorList.begin(); I != VendorList.end(); ++I)
    {
    {
@@ -121,8 +121,8 @@ const Vendor* pkgVendorList::LookupFingerprint(string Fingerprint)
 
 
    return NULL;
    return NULL;
 }
 }
-
-const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput)
+									/*}}}*/
+const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput)	/*{{{*/
 {
 {
    for (std::vector<string>::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); I++)
    for (std::vector<string>::const_iterator I = GPGVOutput.begin(); I != GPGVOutput.end(); I++)
    {
    {
@@ -142,3 +142,4 @@ const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput)
 
 
    return NULL;
    return NULL;
 }
 }
+									/*}}}*/

+ 7 - 12
cmdline/apt-cache.cc

@@ -626,7 +626,7 @@ bool Depends(CommandLine &CmdL)
    
    
    return true;
    return true;
 }
 }
-
+									/*}}}*/
 // RDepends - Print out a reverse dependency tree - mbc			/*{{{*/
 // RDepends - Print out a reverse dependency tree - mbc			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -714,10 +714,7 @@ bool RDepends(CommandLine &CmdL)
    
    
    return true;
    return true;
 }
 }
-
 									/*}}}*/
 									/*}}}*/
-
-
 // xvcg - Generate a graph for xvcg					/*{{{*/
 // xvcg - Generate a graph for xvcg					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
 // Code contributed from Junichi Uekawa <dancer@debian.org> on 20 June 2002.
@@ -937,8 +934,6 @@ bool XVcg(CommandLine &CmdL)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-
 // Dotty - Generate a graph for Dotty					/*{{{*/
 // Dotty - Generate a graph for Dotty					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Dotty is the graphvis program for generating graphs. It is a fairly
 /* Dotty is the graphvis program for generating graphs. It is a fairly
@@ -1274,15 +1269,16 @@ bool DisplayRecord(pkgCache::VerIterator V)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// Search - Perform a search						/*{{{*/
-// ---------------------------------------------------------------------
-/* This searches the package names and package descriptions for a pattern */
+
 struct ExDescFile
 struct ExDescFile
 {
 {
    pkgCache::DescFile *Df;
    pkgCache::DescFile *Df;
    bool NameMatch;
    bool NameMatch;
 };
 };
 
 
+// Search - Perform a search						/*{{{*/
+// ---------------------------------------------------------------------
+/* This searches the package names and package descriptions for a pattern */
 bool Search(CommandLine &CmdL)
 bool Search(CommandLine &CmdL)
 {
 {
    pkgCache &Cache = *GCache;
    pkgCache &Cache = *GCache;
@@ -1696,7 +1692,6 @@ bool Madison(CommandLine &CmdL)
 
 
    return true;
    return true;
 }
 }
-
 									/*}}}*/
 									/*}}}*/
 // GenCaches - Call the main cache generator				/*{{{*/
 // GenCaches - Call the main cache generator				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
@@ -1770,8 +1765,7 @@ void CacheInitialize()
    _config->Set("help",false);
    _config->Set("help",false);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])					/*{{{*/
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
@@ -1878,3 +1872,4 @@ int main(int argc,const char *argv[])
           
           
    return 0;
    return 0;
 }
 }
+									/*}}}*/

+ 3 - 7
cmdline/apt-cdrom.cc

@@ -40,8 +40,7 @@
 
 
 using namespace std;
 using namespace std;
 
 
-                                                                        /*{{{*/
-class pkgCdromTextStatus : public pkgCdromStatus
+class pkgCdromTextStatus : public pkgCdromStatus			/*{{{*/
 {
 {
 protected:
 protected:
    OpTextProgress Progress;
    OpTextProgress Progress;
@@ -98,9 +97,7 @@ OpProgress* pkgCdromTextStatus::GetOpProgress()
 { 
 { 
    return &Progress; 
    return &Progress; 
 };
 };
-
 									/*}}}*/
 									/*}}}*/
-
 // DoAdd - Add a new CDROM						/*{{{*/
 // DoAdd - Add a new CDROM						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This does the main add bit.. We show some status and things. The
 /* This does the main add bit.. We show some status and things. The
@@ -129,7 +126,6 @@ bool DoIdent(CommandLine &)
    return cdrom.Ident(ident, &log);
    return cdrom.Ident(ident, &log);
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // ShowHelp - Show the help screen					/*{{{*/
 // ShowHelp - Show the help screen					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -164,8 +160,7 @@ int ShowHelp()
    return 0;
    return 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])					/*{{{*/
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
@@ -222,3 +217,4 @@ int main(int argc,const char *argv[])
    
    
    return 0;
    return 0;
 }
 }
+									/*}}}*/

+ 2 - 2
cmdline/apt-config.cc

@@ -88,8 +88,7 @@ int ShowHelp()
    return 0;
    return 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])					/*{{{*/
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
@@ -133,3 +132,4 @@ int main(int argc,const char *argv[])
    
    
    return 0;
    return 0;
 }
 }
+									/*}}}*/

+ 2 - 2
cmdline/apt-extracttemplates.cc

@@ -348,8 +348,7 @@ bool Go(CommandLine &CmdL)
 	return !_error->PendingError();
 	return !_error->PendingError();
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-int main(int argc, const char **argv)
+int main(int argc, const char **argv)					/*{{{*/
 {
 {
 	CommandLine::Args Args[] = {
 	CommandLine::Args Args[] = {
 		{'h',"help","help",0},
 		{'h',"help","help",0},
@@ -391,3 +390,4 @@ int main(int argc, const char **argv)
 	
 	
 	return 0;
 	return 0;
 }
 }
+									/*}}}*/

+ 14 - 15
cmdline/apt-get.cc

@@ -597,7 +597,6 @@ void Stats(ostream &out,pkgDepCache &Dep)
 	       Dep.BadCount());
 	       Dep.BadCount());
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // CacheFile::NameComp - QSort compare by name				/*{{{*/
 // CacheFile::NameComp - QSort compare by name				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -690,7 +689,10 @@ bool CacheFile::CheckDeps(bool AllowBroken)
       
       
    return true;
    return true;
 }
 }
-
+									/*}}}*/
+// CheckAuth - check if each download comes form a trusted source	/*{{{*/
+// ---------------------------------------------------------------------
+/* */
 static bool CheckAuth(pkgAcquire& Fetcher)
 static bool CheckAuth(pkgAcquire& Fetcher)
 {
 {
    string UntrustedList;
    string UntrustedList;
@@ -731,10 +733,7 @@ static bool CheckAuth(pkgAcquire& Fetcher)
 
 
    return _error->Error(_("There are problems and -y was used without --force-yes"));
    return _error->Error(_("There are problems and -y was used without --force-yes"));
 }
 }
-
-
 									/*}}}*/
 									/*}}}*/
-
 // InstallPackages - Actually download and install the packages		/*{{{*/
 // InstallPackages - Actually download and install the packages		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This displays the informative messages describing what is going to 
 /* This displays the informative messages describing what is going to 
@@ -1338,7 +1337,6 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
    return Last;
    return Last;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // DoUpdate - Update the package lists					/*{{{*/
 // DoUpdate - Update the package lists					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -1460,7 +1458,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
    }
    }
    return true;
    return true;
 }
 }
-
+									/*}}}*/
 // DoUpgrade - Upgrade all packages					/*{{{*/
 // DoUpgrade - Upgrade all packages					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Upgrade all packages without installing new packages or erasing old
 /* Upgrade all packages without installing new packages or erasing old
@@ -1535,7 +1533,7 @@ bool TryInstallTask(pkgDepCache &Cache, pkgProblemResolver &Fix,
    regfree(&Pattern);
    regfree(&Pattern);
    return res;
    return res;
 }
 }
-
+									/*}}}*/
 // DoInstall - Install packages from the command line			/*{{{*/
 // DoInstall - Install packages from the command line			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Install named packages */
 /* Install named packages */
@@ -2702,8 +2700,7 @@ void SigWinch(int)
 #endif
 #endif
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])					/*{{{*/
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
@@ -2796,11 +2793,12 @@ int main(int argc,const char *argv[])
    // simulate user-friendly if apt-get has no root privileges
    // simulate user-friendly if apt-get has no root privileges
    if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true)
    if (getuid() != 0 && _config->FindB("APT::Get::Simulate") == true)
    {
    {
-      cout << _("NOTE: This is only a simulation!\n"
-        "      apt-get needs root privileges for real execution.\n"
-        "      Keep also in mind that locking is deactivated,\n"
-        "      so don't depend on the relevance to the real current situation!"
-        ) << std::endl;
+      if (_config->FindB("APT::Get::Show-User-Simulation-Note",true) == true)
+	 cout << _("NOTE: This is only a simulation!\n"
+	    "      apt-get needs root privileges for real execution.\n"
+	    "      Keep also in mind that locking is deactivated,\n"
+	    "      so don't depend on the relevance to the real current situation!"
+	 ) << std::endl;
       _config->Set("Debug::NoLocking",true);
       _config->Set("Debug::NoLocking",true);
    }
    }
 
 
@@ -2835,3 +2833,4 @@ int main(int argc,const char *argv[])
    
    
    return 0;   
    return 0;   
 }
 }
+									/*}}}*/

+ 4 - 4
cmdline/apt-sortpkgs.cc

@@ -31,7 +31,7 @@
 
 
 using namespace std;
 using namespace std;
 
 
-struct PkgName
+struct PkgName								/*{{{*/
 {
 {
    string Name;
    string Name;
    string Ver;
    string Ver;
@@ -55,7 +55,7 @@ struct PkgName
    bool operator >(const PkgName &x) const {return Compare3(x) > 0;};
    bool operator >(const PkgName &x) const {return Compare3(x) > 0;};
    bool operator ==(const PkgName &x) const {return Compare3(x) == 0;};
    bool operator ==(const PkgName &x) const {return Compare3(x) == 0;};
 };
 };
-
+									/*}}}*/
 // DoIt - Sort a single file						/*{{{*/
 // DoIt - Sort a single file						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -161,8 +161,7 @@ int ShowHelp()
    return 0;
    return 0;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
-int main(int argc,const char *argv[])
+int main(int argc,const char *argv[])					/*{{{*/
 {
 {
    CommandLine::Args Args[] = {
    CommandLine::Args Args[] = {
       {'h',"help","help",0},
       {'h',"help","help",0},
@@ -206,3 +205,4 @@ int main(int argc,const char *argv[])
    
    
    return 0;   
    return 0;   
 }
 }
+									/*}}}*/

+ 11 - 5
debian/changelog

@@ -1,5 +1,7 @@
 apt (0.7.22) UNRELEASED; urgency=low
 apt (0.7.22) UNRELEASED; urgency=low
 
 
+  The 'not dead yet' release
+  
   [ Christian Perrier ]
   [ Christian Perrier ]
   * Documentation translations:
   * Documentation translations:
     - Fix a typo in apt-get(8) French translation. Closes: #525043
     - Fix a typo in apt-get(8) French translation. Closes: #525043
@@ -32,13 +34,19 @@ apt (0.7.22) UNRELEASED; urgency=low
   * add Debug::pkgProblemResolver::ShowScores and make the scores
   * add Debug::pkgProblemResolver::ShowScores and make the scores
     adjustable
     adjustable
   * do not write state file in simulate mode (closes: #433007)
   * do not write state file in simulate mode (closes: #433007)
-  * add hook for auto-install (closes: #470035)
-  * support IsAutoInstallOk in the resolver too
+  * add hook for MarkInstall and MarkDelete (closes: #470035)
   * fix typo in apt-pkg/acquire.cc which prevents Dl-Limit to work
   * fix typo in apt-pkg/acquire.cc which prevents Dl-Limit to work
     correctly when downloading from multiple sites (Closes: #534752)
     correctly when downloading from multiple sites (Closes: #534752)
+  * add the various foldmarkers in apt-pkg & cmdline (no code change)
+  * versions with a pin of -1 shouldn't be a candidate (Closes: #355237)
+  * prefer mmap as memory allocator in MMap instead of a static char
+    array which can (at least in theory) grow dynamic
+  * eliminate (hopefully all) segfaults in pkgcachegen.cc and mmap.cc
+    which can arise if cache doesn't fit into the mmap (Closes: #535218)
+  * display warnings instead of errors if the parts dirs doesn't exist
 
 
   [ Michael Vogt ]
   [ Michael Vogt ]
-  * honor the dpkg hold state in AutoInstOk (closes: #64141)
+  * honor the dpkg hold state in new Marker hooks (closes: #64141)
   * debian/apt.cron.daily:
   * debian/apt.cron.daily:
     - if the timestamp is too far in the future, delete it
     - if the timestamp is too far in the future, delete it
   * apt-pkg/acquire.cc:
   * apt-pkg/acquire.cc:
@@ -109,8 +117,6 @@ apt (0.7.22) UNRELEASED; urgency=low
   * apt-ftparchive might write corrupt Release files (LP: #46439)
   * apt-ftparchive might write corrupt Release files (LP: #46439)
   * Apply --important option to apt-cache depends (LP: #16947) 
   * Apply --important option to apt-cache depends (LP: #16947) 
 
 
-
-
  -- Julian Andres Klode <jak@debian.org>  Fri, 03 Jul 2009 08:27:35 +0200
  -- Julian Andres Klode <jak@debian.org>  Fri, 03 Jul 2009 08:27:35 +0200
 
 
 apt (0.7.21) unstable; urgency=low
 apt (0.7.21) unstable; urgency=low

+ 2 - 1
doc/apt-get.8.xml

@@ -364,7 +364,8 @@
      Configuration Item: <literal>APT::Get::Simulate</literal>.</para>
      Configuration Item: <literal>APT::Get::Simulate</literal>.</para>
 
 
      <para>Simulation run as user will deactivate locking (<literal>Debug::NoLocking</literal>)
      <para>Simulation run as user will deactivate locking (<literal>Debug::NoLocking</literal>)
-     automatical and display a notice indicating that this is only a simulation.
+     automatical. Also a notice will be displayed indicating that this is only a simulation,
+     if the option <literal>APT::Get::Show-User-Simulation-Note</literal> is set (Default: true)
      Neigther NoLocking nor the notice will be triggered if run as root (root should know what
      Neigther NoLocking nor the notice will be triggered if run as root (root should know what
      he is doing without further warnings by <literal>apt-get</literal>).</para>
      he is doing without further warnings by <literal>apt-get</literal>).</para>
 
 

+ 1 - 0
doc/examples/configure-index

@@ -55,6 +55,7 @@ APT
      Diff-Only "false";
      Diff-Only "false";
      Tar-Only "false";
      Tar-Only "false";
      Build-Dep-Automatic "true";
      Build-Dep-Automatic "true";
+     Show-User-Simulation-Note "true";
   };
   };
 
 
   Cache 
   Cache