Просмотр исходного кода

* updated to apt--mvo

Patches applied:

 * bubulle@debian.org--2005/apt--main--0--patch-132
   Completed Simplified Chinese translation

 * bubulle@debian.org--2005/apt--main--0--patch-133
   Merge with Michael AND update PO files

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-94
   * pkgDirStream has (slightly) better extract support now

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-95
   * merge fix for #339533

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-96
   * merged with bubulle

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-97
   * some more debug output

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-98
   * ABI change: merged more flexible pkgAcquireFile code

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-99
   * merged http download limit for apt (#146877)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-100
   * applied parts of the string speedup patch from debian #319377 (ABI change)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-101
   * fix for #340448

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-102
   * finalized this release

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-103
   * changelog updates

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-104
   * build-depend on libdb4.3 now, fix for kFreeBSD (#317718)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-105
   * fix mailaddress

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-106
   * fix a string (thanks to bubulle)

 * michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-107
   * merged with bubulle
Michael Vogt лет назад: 20
Родитель
Сommit
bc03039d0f
60 измененных файлов с 6943 добавлено и 7950 удалено
  1. 16 0
      apt-inst/dirstream.cc
  2. 15 12
      apt-pkg/acquire-item.cc
  3. 8 3
      apt-pkg/acquire-item.h
  4. 5 1
      apt-pkg/acquire.cc
  5. 1 1
      apt-pkg/cacheiterators.h
  6. 13 13
      apt-pkg/contrib/configuration.cc
  7. 15 13
      apt-pkg/contrib/configuration.h
  8. 1 0
      apt-pkg/contrib/md5.h
  9. 1 1
      apt-pkg/contrib/mmap.h
  10. 2 2
      apt-pkg/contrib/progress.cc
  11. 2 2
      apt-pkg/contrib/progress.h
  12. 32 35
      apt-pkg/contrib/strutl.cc
  13. 13 13
      apt-pkg/contrib/strutl.h
  14. 2 2
      apt-pkg/deb/deblistparser.cc
  15. 1 1
      apt-pkg/makefile
  16. 1 1
      apt-pkg/packagemanager.cc
  17. 2 2
      apt-pkg/pkgcache.cc
  18. 3 3
      apt-pkg/pkgcache.h
  19. 8 8
      apt-pkg/pkgcachegen.cc
  20. 9 8
      apt-pkg/pkgcachegen.h
  21. 1 1
      apt-pkg/sourcelist.cc
  22. 1 1
      configure.in
  23. 21 4
      debian/changelog
  24. 1 1
      debian/control
  25. 1 0
      doc/examples/configure-index
  26. 47 4
      methods/http.cc
  27. 5 0
      methods/http.h
  28. 10 0
      po/ChangeLog
  29. 177 200
      po/apt-all.pot
  30. 181 205
      po/bs.po
  31. 181 207
      po/ca.po
  32. 181 206
      po/cs.po
  33. 318 179
      po/cy.po
  34. 220 250
      po/da.po
  35. 183 208
      po/de.po
  36. 181 206
      po/el.po
  37. 177 200
      po/en_GB.po
  38. 181 208
      po/es.po
  39. 229 447
      po/eu.po
  40. 181 206
      po/fi.po
  41. 259 528
      po/fr.po
  42. 177 200
      po/he.po
  43. 181 206
      po/hu.po
  44. 231 258
      po/it.po
  45. 181 206
      po/ja.po
  46. 181 206
      po/ko.po
  47. 181 206
      po/nb.po
  48. 181 206
      po/nl.po
  49. 181 206
      po/nn.po
  50. 181 206
      po/pl.po
  51. 181 206
      po/pt.po
  52. 181 206
      po/pt_BR.po
  53. 306 336
      po/ro.po
  54. 242 277
      po/ru.po
  55. 181 206
      po/sk.po
  56. 181 206
      po/sl.po
  57. 269 304
      po/sv.po
  58. 420 443
      po/tl.po
  59. 240 278
      po/zh_CN.po
  60. 181 206
      po/zh_TW.po

+ 16 - 0
apt-inst/dirstream.cc

@@ -61,6 +61,22 @@ bool pkgDirStream::DoItem(Item &Itm,int &Fd)
       case Item::CharDevice:
       case Item::CharDevice:
       case Item::BlockDevice:
       case Item::BlockDevice:
       case Item::Directory:
       case Item::Directory:
+      {
+	 struct stat Buf;
+	 // check if the dir is already there, if so return true
+	 if (stat(Itm.Name,&Buf) == 0)
+	 {
+	    if(S_ISDIR(Buf.st_mode))
+	       return true;
+	    // something else is there already, return false
+	    return false;
+	 }
+	 // nothing here, create the dir
+	 if(mkdir(Itm.Name,Itm.Mode) < 0)
+	    return false;
+	 return true;
+	 break;
+      }
       case Item::FIFO:
       case Item::FIFO:
       break;
       break;
    }
    }

+ 15 - 12
apt-pkg/acquire-item.cc

@@ -184,7 +184,7 @@ string pkgAcqIndex::Custom600Headers()
 void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
 {
 {
    // no .bz2 found, retry with .gz
    // no .bz2 found, retry with .gz
-   if(Desc.URI.substr(Desc.URI.size()-3,Desc.URI.size()-1) == "bz2") {
+   if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
       Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz"; 
       Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz"; 
 
 
       // retry with a gzip one 
       // retry with a gzip one 
@@ -290,7 +290,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
    else
    else
       Local = true;
       Local = true;
    
    
-   string compExt = Desc.URI.substr(Desc.URI.size()-3,Desc.URI.size()-1);
+   string compExt = Desc.URI.substr(Desc.URI.size()-3);
    char *decompProg;
    char *decompProg;
    if(compExt == "bz2") 
    if(compExt == "bz2") 
       decompProg = "bzip2";
       decompProg = "bzip2";
@@ -315,10 +315,9 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
 			     const vector<IndexTarget*>* IndexTargets,
 			     const vector<IndexTarget*>* IndexTargets,
 			     indexRecords* MetaIndexParser) :
 			     indexRecords* MetaIndexParser) :
    Item(Owner), RealURI(URI), MetaIndexURI(MetaIndexURI),
    Item(Owner), RealURI(URI), MetaIndexURI(MetaIndexURI),
-   MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc)
+   MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc),
+   MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
 {
 {
-   this->MetaIndexParser = MetaIndexParser;
-   this->IndexTargets = IndexTargets;
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(URI);
    DestFile += URItoFileName(URI);
 
 
@@ -430,11 +429,9 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,
 				 string SigFile,
 				 string SigFile,
 				 const vector<struct IndexTarget*>* IndexTargets,
 				 const vector<struct IndexTarget*>* IndexTargets,
 				 indexRecords* MetaIndexParser) :
 				 indexRecords* MetaIndexParser) :
-  Item(Owner), RealURI(URI), SigFile(SigFile)
+   Item(Owner), RealURI(URI), SigFile(SigFile), AuthPass(false),
+   MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
 {
 {
-   this->AuthPass = false;
-   this->MetaIndexParser = MetaIndexParser;
-   this->IndexTargets = IndexTargets;
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(URI);
    DestFile += URItoFileName(URI);
 
 
@@ -1008,13 +1005,19 @@ void pkgAcqArchive::Finished()
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The file is added to the queue */
 /* The file is added to the queue */
 pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
 pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
-		       unsigned long Size,string Dsc,string ShortDesc) :
+		       unsigned long Size,string Dsc,string ShortDesc,
+		       const string &DestDir, const string &DestFilename) :
                        Item(Owner), Md5Hash(MD5)
                        Item(Owner), Md5Hash(MD5)
 {
 {
    Retries = _config->FindI("Acquire::Retries",0);
    Retries = _config->FindI("Acquire::Retries",0);
    
    
-   DestFile = flNotDir(URI);
-   
+   if(!DestFilename.empty())
+      DestFile = DestFilename;
+   else if(!DestDir.empty())
+      DestFile = DestDir + "/" + flNotDir(URI);
+   else
+      DestFile = flNotDir(URI);
+
    // Create the item
    // Create the item
    Desc.URI = URI;
    Desc.URI = URI;
    Desc.Description = Dsc;
    Desc.Description = Dsc;

+ 8 - 3
apt-pkg/acquire-item.h

@@ -224,9 +224,14 @@ class pkgAcqFile : public pkgAcquire::Item
 		     pkgAcquire::MethodConfig *Cnf);
 		     pkgAcquire::MethodConfig *Cnf);
    virtual string MD5Sum() {return Md5Hash;};
    virtual string MD5Sum() {return Md5Hash;};
    virtual string DescURI() {return Desc.URI;};
    virtual string DescURI() {return Desc.URI;};
-   
-   pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,unsigned long Size,
-		  string Desc,string ShortDesc);
+
+   // If DestFilename is empty, download to DestDir/<basename> if
+   // DestDir is non-empty, $CWD/<basename> otherwise.  If
+   // DestFilename is NOT empty, DestDir is ignored and DestFilename
+   // is the absolute name to which the file should be downloaded.
+   pkgAcqFile(pkgAcquire *Owner, string URI, string MD5, unsigned long Size,
+	      string Desc, string ShortDesc,
+	      const string &DestDir="", const string &DestFilename="");
 };
 };
 
 
 #endif
 #endif

+ 5 - 1
apt-pkg/acquire.cc

@@ -266,7 +266,11 @@ pkgAcquire::MethodConfig *pkgAcquire::GetConfig(string Access)
    Worker Work(Conf);
    Worker Work(Conf);
    if (Work.Start() == false)
    if (Work.Start() == false)
       return 0;
       return 0;
-   
+
+   /* if a method uses DownloadLimit, we switch to SingleInstance mode */
+   if(_config->FindI("Acquire::"+Access+"::DlLimit",0) > 0)
+      Conf->SingleInstance = true;
+    
    return Conf;
    return Conf;
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 1 - 1
apt-pkg/cacheiterators.h

@@ -107,7 +107,7 @@ class pkgCache::VerIterator
    // Iteration
    // Iteration
    void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver->NextVer;};
    void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver->NextVer;};
    inline void operator ++() {operator ++(0);};
    inline void operator ++() {operator ++(0);};
-   inline bool end() const {return Ver == Owner->VerP?true:false;};
+   inline bool end() const {return Owner == NULL || (Ver == Owner->VerP?true:false);};
    inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Owner;};
    inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Owner;};
    
    
    // Comparison
    // Comparison

+ 13 - 13
apt-pkg/contrib/configuration.cc

@@ -110,7 +110,7 @@ Configuration::Item *Configuration::Lookup(Item *Head,const char *S,
       return 0;
       return 0;
    
    
    I = new Item;
    I = new Item;
-   I->Tag = string(S,Len);
+   I->Tag.assign(S,Len);
    I->Next = *Last;
    I->Next = *Last;
    I->Parent = Head;
    I->Parent = Head;
    *Last = I;
    *Last = I;
@@ -161,7 +161,7 @@ string Configuration::Find(const char *Name,const char *Default) const
    if (Itm == 0 || Itm->Value.empty() == true)
    if (Itm == 0 || Itm->Value.empty() == true)
    {
    {
       if (Default == 0)
       if (Default == 0)
-	 return string();
+	 return "";
       else
       else
 	 return Default;
 	 return Default;
    }
    }
@@ -180,7 +180,7 @@ string Configuration::FindFile(const char *Name,const char *Default) const
    if (Itm == 0 || Itm->Value.empty() == true)
    if (Itm == 0 || Itm->Value.empty() == true)
    {
    {
       if (Default == 0)
       if (Default == 0)
-	 return string();
+	 return "";
       else
       else
 	 return Default;
 	 return Default;
    }
    }
@@ -294,7 +294,7 @@ string Configuration::FindAny(const char *Name,const char *Default) const
 // Configuration::CndSet - Conditinal Set a value			/*{{{*/
 // Configuration::CndSet - Conditinal Set a value			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This will not overwrite */
 /* This will not overwrite */
-void Configuration::CndSet(const char *Name,string Value)
+void Configuration::CndSet(const char *Name,const string &Value)
 {
 {
    Item *Itm = Lookup(Name,true);
    Item *Itm = Lookup(Name,true);
    if (Itm == 0)
    if (Itm == 0)
@@ -306,7 +306,7 @@ void Configuration::CndSet(const char *Name,string Value)
 // Configuration::Set - Set a value					/*{{{*/
 // Configuration::Set - Set a value					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void Configuration::Set(const char *Name,string Value)
+void Configuration::Set(const char *Name,const string &Value)
 {
 {
    Item *Itm = Lookup(Name,true);
    Item *Itm = Lookup(Name,true);
    if (Itm == 0)
    if (Itm == 0)
@@ -330,7 +330,7 @@ void Configuration::Set(const char *Name,int Value)
 // Configuration::Clear - Clear an single value from a list	        /*{{{*/
 // Configuration::Clear - Clear an single value from a list	        /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void Configuration::Clear(string Name, int Value)
+void Configuration::Clear(const string Name, int Value)
 {
 {
    char S[300];
    char S[300];
    snprintf(S,sizeof(S),"%i",Value);
    snprintf(S,sizeof(S),"%i",Value);
@@ -340,7 +340,7 @@ void Configuration::Clear(string Name, int Value)
 // Configuration::Clear - Clear an single value from a list	        /*{{{*/
 // Configuration::Clear - Clear an single value from a list	        /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void Configuration::Clear(string Name, string Value)
+void Configuration::Clear(const string Name, string Value)
 {
 {
    Item *Top = Lookup(Name.c_str(),false);
    Item *Top = Lookup(Name.c_str(),false);
    if (Top == 0 || Top->Child == 0)
    if (Top == 0 || Top->Child == 0)
@@ -377,7 +377,7 @@ void Configuration::Clear(string Name)
    if (Top == 0) 
    if (Top == 0) 
       return;
       return;
 
 
-   Top->Value = string();
+   Top->Value.clear();
    Item *Stop = Top;
    Item *Stop = Top;
    Top = Top->Child;
    Top = Top->Child;
    Stop->Child = 0;
    Stop->Child = 0;
@@ -485,7 +485,7 @@ string Configuration::Item::FullTag(const Item *Stop) const
    sections like 'zone "foo.org" { .. };' This causes each section to be
    sections like 'zone "foo.org" { .. };' This causes each section to be
    added in with a tag like "zone::foo.org" instead of being split 
    added in with a tag like "zone::foo.org" instead of being split 
    tag/value. AsSectional enables Sectional parsing.*/
    tag/value. AsSectional enables Sectional parsing.*/
-bool ReadConfigFile(Configuration &Conf,string FName,bool AsSectional,
+bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
 		    unsigned Depth)
 		    unsigned Depth)
 {   
 {   
    // Open the stream for reading
    // Open the stream for reading
@@ -711,13 +711,13 @@ bool ReadConfigFile(Configuration &Conf,string FName,bool AsSectional,
 	    }
 	    }
 	    
 	    
 	    // Empty the buffer
 	    // Empty the buffer
-	    LineBuffer = string();
+	    LineBuffer.clear();
 	    
 	    
 	    // Move up a tag, but only if there is no bit to parse
 	    // Move up a tag, but only if there is no bit to parse
 	    if (TermChar == '}')
 	    if (TermChar == '}')
 	    {
 	    {
 	       if (StackPos == 0)
 	       if (StackPos == 0)
-		  ParentTag = string();
+		  ParentTag.clear();
 	       else
 	       else
 		  ParentTag = Stack[--StackPos];
 		  ParentTag = Stack[--StackPos];
 	    }
 	    }
@@ -742,8 +742,8 @@ bool ReadConfigFile(Configuration &Conf,string FName,bool AsSectional,
 // ReadConfigDir - Read a directory of config files			/*{{{*/
 // ReadConfigDir - Read a directory of config files			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-bool ReadConfigDir(Configuration &Conf,string Dir,bool AsSectional,
-		    unsigned Depth)
+bool ReadConfigDir(Configuration &Conf,const string &Dir,bool AsSectional,
+		   unsigned Depth)
 {   
 {   
    DIR *D = opendir(Dir.c_str());
    DIR *D = opendir(Dir.c_str());
    if (D == 0)
    if (D == 0)

+ 15 - 13
apt-pkg/contrib/configuration.h

@@ -69,30 +69,30 @@ class Configuration
    public:
    public:
 
 
    string Find(const char *Name,const char *Default = 0) const;
    string Find(const char *Name,const char *Default = 0) const;
-   string Find(string Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
+   string Find(const string Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
    string FindFile(const char *Name,const char *Default = 0) const;
    string FindFile(const char *Name,const char *Default = 0) const;
    string FindDir(const char *Name,const char *Default = 0) const;
    string FindDir(const char *Name,const char *Default = 0) const;
    int FindI(const char *Name,int Default = 0) const;
    int FindI(const char *Name,int Default = 0) const;
-   int FindI(string Name,int Default = 0) const {return FindI(Name.c_str(),Default);};
+   int FindI(const string Name,int Default = 0) const {return FindI(Name.c_str(),Default);};
    bool FindB(const char *Name,bool Default = false) const;
    bool FindB(const char *Name,bool Default = false) const;
-   bool FindB(string Name,bool Default = false) const {return FindB(Name.c_str(),Default);};
+   bool FindB(const string Name,bool Default = false) const {return FindB(Name.c_str(),Default);};
    string FindAny(const char *Name,const char *Default = 0) const;
    string FindAny(const char *Name,const char *Default = 0) const;
 	      
 	      
-   inline void Set(string Name,string Value) {Set(Name.c_str(),Value);};
-   void CndSet(const char *Name,string Value);
-   void Set(const char *Name,string Value);
+   inline void Set(const string Name,string Value) {Set(Name.c_str(),Value);};
+   void CndSet(const char *Name,const string &Value);
+   void Set(const char *Name,const string &Value);
    void Set(const char *Name,int Value);   
    void Set(const char *Name,int Value);   
    
    
-   inline bool Exists(string Name) const {return Exists(Name.c_str());};
+   inline bool Exists(const string Name) const {return Exists(Name.c_str());};
    bool Exists(const char *Name) const;
    bool Exists(const char *Name) const;
    bool ExistsAny(const char *Name) const;
    bool ExistsAny(const char *Name) const;
 
 
    // clear a whole tree
    // clear a whole tree
-   void Clear(string Name);
+   void Clear(const string Name);
 
 
    // remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
    // remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
-   void Clear(string List, string Value);
-   void Clear(string List, int Value);
+   void Clear(const string List, string Value);
+   void Clear(const string List, int Value);
 
 
    inline const Item *Tree(const char *Name) const {return Lookup(Name);};
    inline const Item *Tree(const char *Name) const {return Lookup(Name);};
 
 
@@ -106,10 +106,12 @@ class Configuration
 
 
 extern Configuration *_config;
 extern Configuration *_config;
 
 
-bool ReadConfigFile(Configuration &Conf,string FName,bool AsSectional = false,
+bool ReadConfigFile(Configuration &Conf,const string &FName,
+		    bool AsSectional = false,
 		    unsigned Depth = 0);
 		    unsigned Depth = 0);
 
 
-bool ReadConfigDir(Configuration &Conf,string Dir,bool AsSectional = false,
-		    unsigned Depth = 0);
+bool ReadConfigDir(Configuration &Conf,const string &Dir,
+		   bool AsSectional = false,
+		   unsigned Depth = 0);
 
 
 #endif
 #endif

+ 1 - 0
apt-pkg/contrib/md5.h

@@ -29,6 +29,7 @@
 
 
 #include <string>
 #include <string>
 #include <algorithm>
 #include <algorithm>
+#include <stdint.h>
 
 
 using std::string;
 using std::string;
 using std::min;
 using std::min;

+ 1 - 1
apt-pkg/contrib/mmap.h

@@ -94,7 +94,7 @@ class DynamicMMap : public MMap
    unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
    unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
    unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
-   inline unsigned long WriteString(string S) {return WriteString(S.c_str(),S.length());};
+   inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};
    void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count;};
    void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count;};
    
    
    DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace = 2*1024*1024);
    DynamicMMap(FileFd &F,unsigned long Flags,unsigned long WorkSpace = 2*1024*1024);

+ 2 - 2
apt-pkg/contrib/progress.cc

@@ -50,7 +50,7 @@ void OpProgress::Progress(unsigned long Cur)
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
 void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
-	  			 unsigned long Size,string Op)
+	  			 unsigned long Size,const string &Op)
 {
 {
    this->Current = Current;
    this->Current = Current;
    this->Total = Total;
    this->Total = Total;
@@ -67,7 +67,7 @@ void OpProgress::OverallProgress(unsigned long Current, unsigned long Total,
 // OpProgress::SubProgress - Set the sub progress state			/*{{{*/
 // OpProgress::SubProgress - Set the sub progress state			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-void OpProgress::SubProgress(unsigned long SubTotal,string Op)
+void OpProgress::SubProgress(unsigned long SubTotal,const string &Op)
 {
 {
    this->SubTotal = SubTotal;
    this->SubTotal = SubTotal;
    SubOp = Op;
    SubOp = Op;

+ 2 - 2
apt-pkg/contrib/progress.h

@@ -59,9 +59,9 @@ class OpProgress
    
    
    void Progress(unsigned long Current);
    void Progress(unsigned long Current);
    void SubProgress(unsigned long SubTotal);
    void SubProgress(unsigned long SubTotal);
-   void SubProgress(unsigned long SubTotal,string Op);
+   void SubProgress(unsigned long SubTotal,const string &Op);
    void OverallProgress(unsigned long Current,unsigned long Total,
    void OverallProgress(unsigned long Current,unsigned long Total,
-			unsigned long Size,string Op);
+			unsigned long Size,const string &Op);
    virtual void Done() {};
    virtual void Done() {};
    
    
    OpProgress();
    OpProgress();

+ 32 - 35
apt-pkg/contrib/strutl.cc

@@ -199,10 +199,10 @@ bool ParseCWord(const char *&String,string &Res)
 // QuoteString - Convert a string into quoted from			/*{{{*/
 // QuoteString - Convert a string into quoted from			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-string QuoteString(string Str,const char *Bad)
+string QuoteString(const string &Str, const char *Bad)
 {
 {
    string Res;
    string Res;
-   for (string::iterator I = Str.begin(); I != Str.end(); I++)
+   for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
    {
    {
       if (strchr(Bad,*I) != 0 || isprint(*I) == 0 || 
       if (strchr(Bad,*I) != 0 || isprint(*I) == 0 || 
 	  *I <= 0x20 || *I >= 0x7F)
 	  *I <= 0x20 || *I >= 0x7F)
@@ -220,7 +220,7 @@ string QuoteString(string Str,const char *Bad)
 // DeQuoteString - Convert a string from quoted from                    /*{{{*/
 // DeQuoteString - Convert a string from quoted from                    /*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This undoes QuoteString */
 /* This undoes QuoteString */
-string DeQuoteString(string Str)
+string DeQuoteString(const string &Str)
 {
 {
    string Res;
    string Res;
    for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
    for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
@@ -317,7 +317,7 @@ string TimeToStr(unsigned long Sec)
 // SubstVar - Substitute a string for another string			/*{{{*/
 // SubstVar - Substitute a string for another string			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This replaces all occurances of Subst with Contents in Str. */
 /* This replaces all occurances of Subst with Contents in Str. */
-string SubstVar(string Str,string Subst,string Contents)
+string SubstVar(const string &Str,const string &Subst,const string &Contents)
 {
 {
    string::size_type Pos = 0;
    string::size_type Pos = 0;
    string::size_type OldPos = 0;
    string::size_type OldPos = 0;
@@ -348,21 +348,18 @@ string SubstVar(string Str,const struct SubstVar *Vars)
 /* This converts a URI into a safe filename. It quotes all unsafe characters
 /* This converts a URI into a safe filename. It quotes all unsafe characters
    and converts / to _ and removes the scheme identifier. The resulting
    and converts / to _ and removes the scheme identifier. The resulting
    file name should be unique and never occur again for a different file */
    file name should be unique and never occur again for a different file */
-string URItoFileName(string URI)
+string URItoFileName(const string &URI)
 {
 {
    // Nuke 'sensitive' items
    // Nuke 'sensitive' items
    ::URI U(URI);
    ::URI U(URI);
-   U.User = string();
-   U.Password = string();
-   U.Access = "";
+   U.User.clear();
+   U.Password.clear();
+   U.Access.clear();
    
    
    // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF";
    // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF";
-   URI = QuoteString(U,"\\|{}[]<>\"^~_=!@#$%^&*");
-   string::iterator J = URI.begin();
-   for (; J != URI.end(); J++)
-      if (*J == '/') 
-	 *J = '_';
-   return URI;
+   string NewURI = QuoteString(U,"\\|{}[]<>\"^~_=!@#$%^&*");
+   replace(NewURI.begin(),NewURI.end(),'/','_');
+   return NewURI;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // Base64Encode - Base64 Encoding routine for short strings		/*{{{*/
 // Base64Encode - Base64 Encoding routine for short strings		/*{{{*/
@@ -371,7 +368,7 @@ string URItoFileName(string URI)
    from wget and then patched and bug fixed.
    from wget and then patched and bug fixed.
  
  
    This spec can be found in rfc2045 */
    This spec can be found in rfc2045 */
-string Base64Encode(string S)
+string Base64Encode(const string &S)
 {
 {
    // Conversion table.
    // Conversion table.
    static char tbl[64] = {'A','B','C','D','E','F','G','H',
    static char tbl[64] = {'A','B','C','D','E','F','G','H',
@@ -540,17 +537,17 @@ int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The format is like those used in package files and the method 
 /* The format is like those used in package files and the method 
    communication system */
    communication system */
-string LookupTag(string Message,const char *Tag,const char *Default)
+string LookupTag(const string &Message,const char *Tag,const char *Default)
 {
 {
    // Look for a matching tag.
    // Look for a matching tag.
    int Length = strlen(Tag);
    int Length = strlen(Tag);
-   for (string::iterator I = Message.begin(); I + Length < Message.end(); I++)
+   for (string::const_iterator I = Message.begin(); I + Length < Message.end(); I++)
    {
    {
       // Found the tag
       // Found the tag
       if (I[Length] == ':' && stringcasecmp(I,I+Length,Tag) == 0)
       if (I[Length] == ':' && stringcasecmp(I,I+Length,Tag) == 0)
       {
       {
 	 // Find the end of line and strip the leading/trailing spaces
 	 // Find the end of line and strip the leading/trailing spaces
-	 string::iterator J;
+	 string::const_iterator J;
 	 I += Length + 1;
 	 I += Length + 1;
 	 for (; isspace(*I) != 0 && I < Message.end(); I++);
 	 for (; isspace(*I) != 0 && I < Message.end(); I++);
 	 for (J = I; *J != '\n' && J < Message.end(); J++);
 	 for (J = I; *J != '\n' && J < Message.end(); J++);
@@ -572,7 +569,7 @@ string LookupTag(string Message,const char *Tag,const char *Default)
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This inspects the string to see if it is true or if it is false and
 /* This inspects the string to see if it is true or if it is false and
    then returns the result. Several varients on true/false are checked. */
    then returns the result. Several varients on true/false are checked. */
-int StringToBool(string Text,int Default)
+int StringToBool(const string &Text,int Default)
 {
 {
    char *End;
    char *End;
    int Res = strtol(Text.c_str(),&End,0);   
    int Res = strtol(Text.c_str(),&End,0);   
@@ -738,7 +735,7 @@ static time_t timegm(struct tm *t)
    'timegm' to convert a struct tm in UTC to a time_t. For some bizzar
    'timegm' to convert a struct tm in UTC to a time_t. For some bizzar
    reason the C library does not provide any such function :< This also
    reason the C library does not provide any such function :< This also
    handles the weird, but unambiguous FTP time format*/
    handles the weird, but unambiguous FTP time format*/
-bool StrToTime(string Val,time_t &Result)
+bool StrToTime(const string &Val,time_t &Result)
 {
 {
    struct tm Tm;
    struct tm Tm;
    char Month[10];
    char Month[10];
@@ -825,7 +822,7 @@ static int HexDigit(int c)
 // Hex2Num - Convert a long hex number into a buffer			/*{{{*/
 // Hex2Num - Convert a long hex number into a buffer			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The length of the buffer must be exactly 1/2 the length of the string. */
 /* The length of the buffer must be exactly 1/2 the length of the string. */
-bool Hex2Num(string Str,unsigned char *Num,unsigned int Length)
+bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length)
 {
 {
    if (Str.length() != Length*2)
    if (Str.length() != Length*2)
       return false;
       return false;
@@ -986,7 +983,7 @@ char *safe_snprintf(char *Buffer,char *End,const char *Format,...)
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* The domain list is a comma seperate list of domains that are suffix
 /* The domain list is a comma seperate list of domains that are suffix
    matched against the argument */
    matched against the argument */
-bool CheckDomainList(string Host,string List)
+bool CheckDomainList(const string &Host,const string &List)
 {
 {
    string::const_iterator Start = List.begin();
    string::const_iterator Start = List.begin();
    for (string::const_iterator Cur = List.begin(); Cur <= List.end(); Cur++)
    for (string::const_iterator Cur = List.begin(); Cur <= List.end(); Cur++)
@@ -1009,7 +1006,7 @@ bool CheckDomainList(string Host,string List)
 // URI::CopyFrom - Copy from an object					/*{{{*/
 // URI::CopyFrom - Copy from an object					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This parses the URI into all of its components */
 /* This parses the URI into all of its components */
-void URI::CopyFrom(string U)
+void URI::CopyFrom(const string &U)
 {
 {
    string::const_iterator I = U.begin();
    string::const_iterator I = U.begin();
 
 
@@ -1038,9 +1035,9 @@ void URI::CopyFrom(string U)
       SingleSlash = U.end();
       SingleSlash = U.end();
 
 
    // We can now write the access and path specifiers
    // We can now write the access and path specifiers
-   Access = string(U,0,FirstColon - U.begin());
+   Access.assign(U.begin(),FirstColon);
    if (SingleSlash != U.end())
    if (SingleSlash != U.end())
-      Path = string(U,SingleSlash - U.begin());
+      Path.assign(SingleSlash,U.end());
    if (Path.empty() == true)
    if (Path.empty() == true)
       Path = "/";
       Path = "/";
 
 
@@ -1070,14 +1067,14 @@ void URI::CopyFrom(string U)
    if (At == SingleSlash)
    if (At == SingleSlash)
    {
    {
       if (FirstColon < SingleSlash)
       if (FirstColon < SingleSlash)
-	 Host = string(U,FirstColon - U.begin(),SingleSlash - FirstColon);
+	 Host.assign(FirstColon,SingleSlash);
    }
    }
    else
    else
    {
    {
-      Host = string(U,At - U.begin() + 1,SingleSlash - At - 1);
-      User = string(U,FirstColon - U.begin(),SecondColon - FirstColon);
+      Host.assign(At+1,SingleSlash);
+      User.assign(FirstColon,SecondColon);
       if (SecondColon < At)
       if (SecondColon < At)
-	 Password = string(U,SecondColon - U.begin() + 1,At - SecondColon - 1);
+	 Password.assign(SecondColon+1,At);
    }   
    }   
    
    
    // Now we parse the RFC 2732 [] hostnames.
    // Now we parse the RFC 2732 [] hostnames.
@@ -1105,7 +1102,7 @@ void URI::CopyFrom(string U)
    // Tsk, weird.
    // Tsk, weird.
    if (InBracket == true)
    if (InBracket == true)
    {
    {
-      Host = string();
+      Host.clear();
       return;
       return;
    }
    }
    
    
@@ -1116,7 +1113,7 @@ void URI::CopyFrom(string U)
       return;
       return;
    
    
    Port = atoi(string(Host,Pos+1).c_str());
    Port = atoi(string(Host,Pos+1).c_str());
-   Host = string(Host,0,Pos);
+   Host.assign(Host,0,Pos);
 }
 }
 									/*}}}*/
 									/*}}}*/
 // URI::operator string - Convert the URI to a string			/*{{{*/
 // URI::operator string - Convert the URI to a string			/*{{{*/
@@ -1171,12 +1168,12 @@ URI::operator string()
 // URI::SiteOnly - Return the schema and site for the URI		/*{{{*/
 // URI::SiteOnly - Return the schema and site for the URI		/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
-string URI::SiteOnly(string URI)
+string URI::SiteOnly(const string &URI)
 {
 {
    ::URI U(URI);
    ::URI U(URI);
-   U.User = string();
-   U.Password = string();
-   U.Path = string();
+   U.User.clear();
+   U.Password.clear();
+   U.Path.clear();
    U.Port = 0;
    U.Port = 0;
    return U;
    return U;
 }
 }

+ 13 - 13
apt-pkg/contrib/strutl.h

@@ -43,24 +43,24 @@ char *_strstrip(char *String);
 char *_strtabexpand(char *String,size_t Len);
 char *_strtabexpand(char *String,size_t Len);
 bool ParseQuoteWord(const char *&String,string &Res);
 bool ParseQuoteWord(const char *&String,string &Res);
 bool ParseCWord(const char *&String,string &Res);
 bool ParseCWord(const char *&String,string &Res);
-string QuoteString(string Str,const char *Bad);
-string DeQuoteString(string Str);
+string QuoteString(const string &Str,const char *Bad);
+string DeQuoteString(const string &Str);
 string SizeToStr(double Bytes);
 string SizeToStr(double Bytes);
 string TimeToStr(unsigned long Sec);
 string TimeToStr(unsigned long Sec);
-string Base64Encode(string Str);
-string URItoFileName(string URI);
+string Base64Encode(const string &Str);
+string URItoFileName(const string &URI);
 string TimeRFC1123(time_t Date);
 string TimeRFC1123(time_t Date);
-bool StrToTime(string Val,time_t &Result);
-string LookupTag(string Message,const char *Tag,const char *Default = 0);
-int StringToBool(string Text,int Default = -1);
+bool StrToTime(const string &Val,time_t &Result);
+string LookupTag(const string &Message,const char *Tag,const char *Default = 0);
+int StringToBool(const string &Text,int Default = -1);
 bool ReadMessages(int Fd, vector<string> &List);
 bool ReadMessages(int Fd, vector<string> &List);
 bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
 bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
-bool Hex2Num(string Str,unsigned char *Num,unsigned int Length);
+bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
 bool TokSplitString(char Tok,char *Input,char **List,
 bool TokSplitString(char Tok,char *Input,char **List,
 		    unsigned long ListMax);
 		    unsigned long ListMax);
 void ioprintf(ostream &out,const char *format,...) APT_FORMAT2;
 void ioprintf(ostream &out,const char *format,...) APT_FORMAT2;
 char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3;
 char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3;
-bool CheckDomainList(string Host,string List);
+bool CheckDomainList(const string &Host, const string &List);
 
 
 #define APT_MKSTRCMP(name,func) \
 #define APT_MKSTRCMP(name,func) \
 inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
 inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
@@ -101,7 +101,7 @@ inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);};
 
 
 class URI
 class URI
 {
 {
-   void CopyFrom(string From);
+   void CopyFrom(const string &From);
 		 
 		 
    public:
    public:
    
    
@@ -113,9 +113,9 @@ class URI
    unsigned int Port;
    unsigned int Port;
    
    
    operator string();
    operator string();
-   inline void operator =(string From) {CopyFrom(From);};
+   inline void operator =(const string &From) {CopyFrom(From);};
    inline bool empty() {return Access.empty();};
    inline bool empty() {return Access.empty();};
-   static string SiteOnly(string URI);
+   static string SiteOnly(const string &URI);
    
    
    URI(string Path) {CopyFrom(Path);};
    URI(string Path) {CopyFrom(Path);};
    URI() : Port(0) {};
    URI() : Port(0) {};
@@ -127,7 +127,7 @@ struct SubstVar
    const string *Contents;
    const string *Contents;
 };
 };
 string SubstVar(string Str,const struct SubstVar *Vars);
 string SubstVar(string Str,const struct SubstVar *Vars);
-string SubstVar(string Str,string Subst,string Contents);
+string SubstVar(const string &Str,const string &Subst,const string &Contents);
 
 
 struct RxChoiceList
 struct RxChoiceList
 {
 {

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

@@ -377,12 +377,12 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
       const char *End = I;
       const char *End = I;
       for (; End > Start && isspace(End[-1]); End--);
       for (; End > Start && isspace(End[-1]); End--);
       
       
-      Ver = string(Start,End-Start);
+      Ver.assign(Start,End-Start);
       I++;
       I++;
    }
    }
    else
    else
    {
    {
-      Ver = string();
+      Ver.clear();
       Op = pkgCache::Dep::NoOp;
       Op = pkgCache::Dep::NoOp;
    }
    }
    
    

+ 1 - 1
apt-pkg/makefile

@@ -13,7 +13,7 @@ include ../buildlib/defaults.mak
 # methods/makefile - FIXME
 # methods/makefile - FIXME
 LIBRARY=apt-pkg
 LIBRARY=apt-pkg
 LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
 LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
-MAJOR=3.11
+MAJOR=3.12
 MINOR=0
 MINOR=0
 SLIBS=$(PTHREADLIB) $(INTLLIBS)
 SLIBS=$(PTHREADLIB) $(INTLLIBS)
 APT_DOMAIN:=libapt-pkg$(MAJOR)
 APT_DOMAIN:=libapt-pkg$(MAJOR)

+ 1 - 1
apt-pkg/packagemanager.cc

@@ -593,7 +593,7 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall()
 	  Pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
 	  Pkg.State() == pkgCache::PkgIterator::NeedsNothing &&
 	  (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)
 	  (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)
       {
       {
-	 _error->Error("Internal Error, trying to manipulate a kept package");
+	 _error->Error("Internal Error, trying to manipulate a kept package (%s)",Pkg.Name());
 	 return Failed;
 	 return Failed;
       }
       }
       
       

+ 2 - 2
apt-pkg/pkgcache.cc

@@ -153,7 +153,7 @@ bool pkgCache::ReMap()
 /* This is used to generate the hash entries for the HashTable. With my
 /* This is used to generate the hash entries for the HashTable. With my
    package list from bo this function gets 94% table usage on a 512 item
    package list from bo this function gets 94% table usage on a 512 item
    table (480 used items) */
    table (480 used items) */
-unsigned long pkgCache::sHash(string Str) const
+unsigned long pkgCache::sHash(const string &Str) const
 {
 {
    unsigned long Hash = 0;
    unsigned long Hash = 0;
    for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
    for (string::const_iterator I = Str.begin(); I != Str.end(); I++)
@@ -173,7 +173,7 @@ unsigned long pkgCache::sHash(const char *Str) const
 // Cache::FindPkg - Locate a package by name				/*{{{*/
 // Cache::FindPkg - Locate a package by name				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Returns 0 on error, pointer to the package otherwise */
 /* Returns 0 on error, pointer to the package otherwise */
-pkgCache::PkgIterator pkgCache::FindPkg(string Name)
+pkgCache::PkgIterator pkgCache::FindPkg(const string &Name)
 {
 {
    // Look at the hash bucket
    // Look at the hash bucket
    Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];
    Package *Pkg = PkgP + HeaderP->HashTable[Hash(Name)];

+ 3 - 3
apt-pkg/pkgcache.h

@@ -89,7 +89,7 @@ class pkgCache
    string CacheFile;
    string CacheFile;
    MMap &Map;
    MMap &Map;
 
 
-   unsigned long sHash(string S) const;
+   unsigned long sHash(const string &S) const;
    unsigned long sHash(const char *S) const;
    unsigned long sHash(const char *S) const;
    
    
    public:
    public:
@@ -111,14 +111,14 @@ class pkgCache
    inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();};
    inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();};
       
       
    // String hashing function (512 range)
    // String hashing function (512 range)
-   inline unsigned long Hash(string S) const {return sHash(S);};
+   inline unsigned long Hash(const string &S) const {return sHash(S);};
    inline unsigned long Hash(const char *S) const {return sHash(S);};
    inline unsigned long Hash(const char *S) const {return sHash(S);};
 
 
    // Usefull transformation things
    // Usefull transformation things
    const char *Priority(unsigned char Priority);
    const char *Priority(unsigned char Priority);
    
    
    // Accessors
    // Accessors
-   PkgIterator FindPkg(string Name);
+   PkgIterator FindPkg(const string &Name);
    Header &Head() {return *HeaderP;};
    Header &Head() {return *HeaderP;};
    inline PkgIterator PkgBegin();
    inline PkgIterator PkgBegin();
    inline PkgIterator PkgEnd();
    inline PkgIterator PkgEnd();

+ 8 - 8
apt-pkg/pkgcachegen.cc

@@ -268,7 +268,7 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
 // CacheGenerator::NewPackage - Add a new package			/*{{{*/
 // CacheGenerator::NewPackage - Add a new package			/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This creates a new package structure and adds it to the hash table */
 /* This creates a new package structure and adds it to the hash table */
-bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,string Name)
+bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name)
 {
 {
    Pkg = Cache.FindPkg(Name);
    Pkg = Cache.FindPkg(Name);
    if (Pkg.end() == false)
    if (Pkg.end() == false)
@@ -332,7 +332,7 @@ bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver,
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This puts a version structure in the linked list */
 /* This puts a version structure in the linked list */
 unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
 unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
-					    string VerStr,
+					    const string &VerStr,
 					    unsigned long Next)
 					    unsigned long Next)
 {
 {
    // Get a structure
    // Get a structure
@@ -356,8 +356,8 @@ unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
 /* This creates a dependency element in the tree. It is linked to the
 /* This creates a dependency element in the tree. It is linked to the
    version and to the package that it is pointing to. */
    version and to the package that it is pointing to. */
 bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
 bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
-					       string PackageName,
-					       string Version,
+					       const string &PackageName,
+					       const string &Version,
 					       unsigned int Op,
 					       unsigned int Op,
 					       unsigned int Type)
 					       unsigned int Type)
 {
 {
@@ -421,8 +421,8 @@ bool pkgCacheGenerator::ListParser::NewDepends(pkgCache::VerIterator Ver,
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
 bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
 bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
-					        string PackageName,
-						string Version)
+					        const string &PackageName,
+						const string &Version)
 {
 {
    pkgCache &Cache = Owner->Cache;
    pkgCache &Cache = Owner->Cache;
 
 
@@ -461,7 +461,7 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator Ver,
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This is used to select which file is to be associated with all newly
 /* This is used to select which file is to be associated with all newly
    added versions. The caller is responsible for setting the IMS fields. */
    added versions. The caller is responsible for setting the IMS fields. */
-bool pkgCacheGenerator::SelectFile(string File,string Site,
+bool pkgCacheGenerator::SelectFile(const string &File,const string &Site,
 				   const pkgIndexFile &Index,
 				   const pkgIndexFile &Index,
 				   unsigned long Flags)
 				   unsigned long Flags)
 {
 {
@@ -545,7 +545,7 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
 /* 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,
    has matching attributes with the cache and the cache does not have
    has matching attributes with the cache and the cache does not have
    any extra files. */
    any extra files. */
-static bool CheckValidity(string CacheFile, FileIterator Start, 
+static bool CheckValidity(const string &CacheFile, FileIterator Start, 
                           FileIterator End,MMap **OutMap = 0)
                           FileIterator End,MMap **OutMap = 0)
 {
 {
    // No file, certainly invalid
    // No file, certainly invalid

+ 9 - 8
apt-pkg/pkgcachegen.h

@@ -53,17 +53,17 @@ class pkgCacheGenerator
    // Flag file dependencies
    // Flag file dependencies
    bool FoundFileDeps;
    bool FoundFileDeps;
    
    
-   bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
+   bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Pkg);
    bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
    bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
-   unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next);
+   unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next);
 
 
    public:
    public:
 
 
    unsigned long WriteUniqString(const char *S,unsigned int Size);
    unsigned long WriteUniqString(const char *S,unsigned int Size);
-   inline unsigned long WriteUniqString(string S) {return WriteUniqString(S.c_str(),S.length());};
+   inline unsigned long WriteUniqString(const string &S) {return WriteUniqString(S.c_str(),S.length());};
 
 
    void DropProgress() {Progress = 0;};
    void DropProgress() {Progress = 0;};
-   bool SelectFile(string File,string Site,pkgIndexFile const &Index,
+   bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index,
 		   unsigned long Flags = 0);
 		   unsigned long Flags = 0);
    bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
    bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
    inline pkgCache &GetCache() {return Cache;};
    inline pkgCache &GetCache() {return Cache;};
@@ -94,12 +94,13 @@ class pkgCacheGenerator::ListParser
 
 
    inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
    inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
    inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
    inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
-   inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
+   inline unsigned long WriteString(const string &S) {return Owner->Map.WriteString(S);};
    inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
    inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
-   bool NewDepends(pkgCache::VerIterator Ver,string Package,
-		   string Version,unsigned int Op,
+   bool NewDepends(pkgCache::VerIterator Ver,const string &Package,
+		   const string &Version,unsigned int Op,
 		   unsigned int Type);
 		   unsigned int Type);
-   bool NewProvides(pkgCache::VerIterator Ver,string Package,string Version);
+   bool NewProvides(pkgCache::VerIterator Ver,const string &Package,
+		    const string &Version);
    
    
    public:
    public:
    
    

+ 1 - 1
apt-pkg/sourcelist.cc

@@ -241,7 +241,7 @@ bool pkgSourceList::ReadAppend(string File)
 
 
       Type *Parse = Type::GetType(LineType.c_str());
       Type *Parse = Type::GetType(LineType.c_str());
       if (Parse == 0)
       if (Parse == 0)
-	 return _error->Error(_("Type '%s' is not known in on line %u in source list %s"),LineType.c_str(),CurLine,File.c_str());
+	 return _error->Error(_("Type '%s' is not known on line %u in source list %s"),LineType.c_str(),CurLine,File.c_str());
       
       
       // Vendor name specified
       // Vendor name specified
       if (C[0] == '[')
       if (C[0] == '[')

+ 1 - 1
configure.in

@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
 
 
 dnl -- SET THIS TO THE RELEASE VERSION --
 dnl -- SET THIS TO THE RELEASE VERSION --
-AC_DEFINE_UNQUOTED(VERSION,"0.6.42.4")
+AC_DEFINE_UNQUOTED(VERSION,"0.6.43")
 PACKAGE="apt"
 PACKAGE="apt"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_SUBST(PACKAGE)
 AC_SUBST(PACKAGE)

+ 21 - 4
debian/changelog

@@ -1,12 +1,29 @@
-apt (0.6.42.4) unstable; urgency=low
+apt (0.6.43.1) unstable; urgency=low
 
 
-  * Merge bubulle@debian.org--2005/apt--main--0 up to patch-131:  
-    * zh_CN.po: Completed to 507 strings(Closes: #338267)
+  * Merge bubulle@debian.org--2005/apt--main--0 up to patch-133:
+    * fr.po: Completed to 510 strings
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 30 Nov 2005 10:14:02 +0100
+
+apt (0.6.43) unstable; urgency=medium
+
+  * Merge bubulle@debian.org--2005/apt--main--0 up to patch-132:  
+    * zh_CN.po: Completed to 510 strings(Closes: #338267)
     * gl.po: Completed to 510 strings (Closes: #338356)
     * gl.po: Completed to 510 strings (Closes: #338356)
   * added support for "/etc/apt/sources.list.d" directory 
   * added support for "/etc/apt/sources.list.d" directory 
     (closes: #66325)
     (closes: #66325)
+  * make pkgDirStream (a bit) more complete
+  * fix bug in pkgCache::VerIterator::end() (thanks to Daniel Burrows)
+    (closes: #339533)
+  * pkgAcqFile is more flexible now (closes: #57091)
+  * support a download rate limit for http (closes: #146877)
+  * included lots of the speedup changes from #319377
+  * add stdint.h to contrib/md5.h (closes: #340448)
+  * ABI change, library name changed (closes: #339147)
+  * Fix GNU/kFreeBSD crash on non-existing server file (closes: #317718)
+  * switch to libdb4.3 in build-depends
   
   
- -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 16 Nov 2005 17:13:05 +0100
+ -- Michael Vogt <mvo@debian.org>  Tue, 29 Nov 2005 00:17:07 +0100
 
 
 apt (0.6.42.3) unstable; urgency=low
 apt (0.6.42.3) unstable; urgency=low
 
 

+ 1 - 1
debian/control

@@ -4,7 +4,7 @@ Priority: important
 Maintainer: APT Development Team <deity@lists.debian.org>
 Maintainer: APT Development Team <deity@lists.debian.org>
 Uploaders: Jason Gunthorpe <jgg@debian.org>, Adam Heath <doogie@debian.org>, Matt Zimmerman <mdz@debian.org>, Michael Vogt <mvo@debian.org>
 Uploaders: Jason Gunthorpe <jgg@debian.org>, Adam Heath <doogie@debian.org>, Matt Zimmerman <mdz@debian.org>, Michael Vogt <mvo@debian.org>
 Standards-Version: 3.6.1
 Standards-Version: 3.6.1
-Build-Depends: debhelper (>= 4.1.62), libdb4.2-dev, gettext (>= 0.12)
+Build-Depends: debhelper (>= 4.1.62), libdb4.3-dev, gettext (>= 0.12)
 Build-Depends-Indep: debiandoc-sgml, docbook-utils (>= 0.6.12-1)
 Build-Depends-Indep: debiandoc-sgml, docbook-utils (>= 0.6.12-1)
 
 
 Package: apt
 Package: apt

+ 1 - 0
doc/examples/configure-index

@@ -121,6 +121,7 @@ Acquire
     No-Cache "false";
     No-Cache "false";
     Max-Age "86400";     // 1 Day age on index files
     Max-Age "86400";     // 1 Day age on index files
     No-Store "false";    // Prevent the cache from storing archives    
     No-Store "false";    // Prevent the cache from storing archives    
+    Dl-Limit "7";        // 7Kb/sec maximum download rate
   };
   };
 
 
   ftp
   ftp

+ 47 - 4
methods/http.cc

@@ -58,6 +58,12 @@ unsigned long PipelineDepth = 10;
 unsigned long TimeOut = 120;
 unsigned long TimeOut = 120;
 bool Debug = false;
 bool Debug = false;
 
 
+
+unsigned long CircleBuf::BwReadLimit=0;
+unsigned long CircleBuf::BwTickReadData=0;
+struct timeval CircleBuf::BwReadTick={0,0};
+const unsigned int CircleBuf::BW_HZ=10;
+  
 // CircleBuf::CircleBuf - Circular input buffer				/*{{{*/
 // CircleBuf::CircleBuf - Circular input buffer				/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */
@@ -65,6 +71,8 @@ CircleBuf::CircleBuf(unsigned long Size) : Size(Size), Hash(0)
 {
 {
    Buf = new unsigned char[Size];
    Buf = new unsigned char[Size];
    Reset();
    Reset();
+
+   CircleBuf::BwReadLimit = _config->FindI("Acquire::http::Dl-Limit",0)*1024;
 }
 }
 									/*}}}*/
 									/*}}}*/
 // CircleBuf::Reset - Reset to the default state			/*{{{*/
 // CircleBuf::Reset - Reset to the default state			/*{{{*/
@@ -90,16 +98,45 @@ void CircleBuf::Reset()
    is non-blocking.. */
    is non-blocking.. */
 bool CircleBuf::Read(int Fd)
 bool CircleBuf::Read(int Fd)
 {
 {
+   unsigned long BwReadMax;
+
    while (1)
    while (1)
    {
    {
       // Woops, buffer is full
       // Woops, buffer is full
       if (InP - OutP == Size)
       if (InP - OutP == Size)
 	 return true;
 	 return true;
-      
+
+      // what's left to read in this tick
+      BwReadMax = CircleBuf::BwReadLimit/BW_HZ;
+
+      if(CircleBuf::BwReadLimit) {
+	 struct timeval now;
+	 gettimeofday(&now,0);
+
+	 unsigned long d = (now.tv_sec-CircleBuf::BwReadTick.tv_sec)*1000000 +
+	    now.tv_usec-CircleBuf::BwReadTick.tv_usec;
+	 if(d > 1000000/BW_HZ) {
+	    CircleBuf::BwReadTick = now;
+	    CircleBuf::BwTickReadData = 0;
+	 } 
+	 
+	 if(CircleBuf::BwTickReadData >= BwReadMax) {
+	    usleep(1000000/BW_HZ);
+	    return true;
+	 }
+      }
+
       // Write the buffer segment
       // Write the buffer segment
       int Res;
       int Res;
-      Res = read(Fd,Buf + (InP%Size),LeftRead());
+      if(CircleBuf::BwReadLimit) {
+	 Res = read(Fd,Buf + (InP%Size), 
+		    BwReadMax > LeftRead() ? LeftRead() : BwReadMax);
+      } else
+	 Res = read(Fd,Buf + (InP%Size),LeftRead());
       
       
+      if(Res > 0 && BwReadLimit > 0) 
+	 CircleBuf::BwTickReadData += Res;
+    
       if (Res == 0)
       if (Res == 0)
 	 return false;
 	 return false;
       if (Res < 0)
       if (Res < 0)
@@ -787,7 +824,10 @@ bool HttpMethod::Flush(ServerState *Srv)
 {
 {
    if (File != 0)
    if (File != 0)
    {
    {
-      SetNonBlock(File->Fd(),false);
+      // on GNU/kFreeBSD, apt dies on /dev/null because non-blocking
+      // can't be set
+      if (File->Name() != "/dev/null")
+	 SetNonBlock(File->Fd(),false);
       if (Srv->In.WriteSpace() == false)
       if (Srv->In.WriteSpace() == false)
 	 return true;
 	 return true;
       
       
@@ -815,7 +855,10 @@ bool HttpMethod::ServerDie(ServerState *Srv)
    // Dump the buffer to the file
    // Dump the buffer to the file
    if (Srv->State == ServerState::Data)
    if (Srv->State == ServerState::Data)
    {
    {
-      SetNonBlock(File->Fd(),false);
+      // on GNU/kFreeBSD, apt dies on /dev/null because non-blocking
+      // can't be set
+      if (File->Name() != "/dev/null")
+	 SetNonBlock(File->Fd(),false);
       while (Srv->In.WriteSpace() == true)
       while (Srv->In.WriteSpace() == true)
       {
       {
 	 if (Srv->In.Write(File->Fd()) == false)
 	 if (Srv->In.Write(File->Fd()) == false)

+ 5 - 0
methods/http.h

@@ -31,6 +31,11 @@ class CircleBuf
    unsigned long MaxGet;
    unsigned long MaxGet;
    struct timeval Start;
    struct timeval Start;
    
    
+   static unsigned long BwReadLimit;
+   static unsigned long BwTickReadData;
+   static struct timeval BwReadTick;
+   static const unsigned int BW_HZ;
+
    unsigned long LeftRead()
    unsigned long LeftRead()
    {
    {
       unsigned long Sz = Size - (InP - OutP);
       unsigned long Sz = Size - (InP - OutP);

+ 10 - 0
po/ChangeLog

@@ -1,3 +1,13 @@
+2005-11-29   Christian Perrier  <bubulle@debian.org>
+
+	* fr.po: Completed to 510 strings
+	* *.po : Synced with the POT files
+
+2005-11-14   Kov Tchai  <tchaikov@sjtu.edu.cn>
+
+	* zh_CN.po: Completed to 510 strings
+	         Definitely Closes: #338267
+
 2005-11-13   Kov Tchai  <tchaikov@sjtu.edu.cn>
 2005-11-13   Kov Tchai  <tchaikov@sjtu.edu.cn>
 
 
 	* zh_CN.po: Completed to 507 strings
 	* zh_CN.po: Completed to 507 strings

Разница между файлами не показана из-за своего большого размера
+ 177 - 200
po/apt-all.pot


Разница между файлами не показана из-за своего большого размера
+ 181 - 205
po/bs.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 207
po/ca.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/cs.po


Разница между файлами не показана из-за своего большого размера
+ 318 - 179
po/cy.po


Разница между файлами не показана из-за своего большого размера
+ 220 - 250
po/da.po


Разница между файлами не показана из-за своего большого размера
+ 183 - 208
po/de.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/el.po


Разница между файлами не показана из-за своего большого размера
+ 177 - 200
po/en_GB.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 208
po/es.po


Разница между файлами не показана из-за своего большого размера
+ 229 - 447
po/eu.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/fi.po


Разница между файлами не показана из-за своего большого размера
+ 259 - 528
po/fr.po


Разница между файлами не показана из-за своего большого размера
+ 177 - 200
po/he.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/hu.po


Разница между файлами не показана из-за своего большого размера
+ 231 - 258
po/it.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/ja.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/ko.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/nb.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/nl.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/nn.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/pl.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/pt.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/pt_BR.po


Разница между файлами не показана из-за своего большого размера
+ 306 - 336
po/ro.po


Разница между файлами не показана из-за своего большого размера
+ 242 - 277
po/ru.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/sk.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/sl.po


Разница между файлами не показана из-за своего большого размера
+ 269 - 304
po/sv.po


Разница между файлами не показана из-за своего большого размера
+ 420 - 443
po/tl.po


Разница между файлами не показана из-за своего большого размера
+ 240 - 278
po/zh_CN.po


Разница между файлами не показана из-за своего большого размера
+ 181 - 206
po/zh_TW.po