]> git.saurik.com Git - apt.git/commitdiff
merged lp:~donkult/apt/experimental
authorMichael Vogt <egon@debian-devbox>
Fri, 14 Oct 2011 11:55:50 +0000 (13:55 +0200)
committerMichael Vogt <egon@debian-devbox>
Fri, 14 Oct 2011 11:55:50 +0000 (13:55 +0200)
159 files changed:
apt-inst/contrib/arfile.cc
apt-inst/contrib/arfile.h
apt-inst/contrib/extracttar.cc
apt-inst/contrib/extracttar.h
apt-inst/database.cc
apt-inst/database.h
apt-inst/deb/debfile.cc
apt-inst/deb/debfile.h
apt-inst/deb/dpkgdb.cc
apt-inst/deb/dpkgdb.h
apt-inst/extract.cc
apt-inst/extract.h
apt-inst/filelist.h
apt-pkg/acquire-item.cc
apt-pkg/acquire-item.h
apt-pkg/acquire-method.h
apt-pkg/acquire-worker.h
apt-pkg/acquire.h
apt-pkg/algorithms.cc
apt-pkg/algorithms.h
apt-pkg/aptconfiguration.cc
apt-pkg/cachefile.cc
apt-pkg/cachefile.h
apt-pkg/cacheiterators.h
apt-pkg/cacheset.cc
apt-pkg/cacheset.h
apt-pkg/cdrom.cc
apt-pkg/cdrom.h
apt-pkg/clean.cc
apt-pkg/clean.h
apt-pkg/contrib/cdromutl.cc
apt-pkg/contrib/cdromutl.h
apt-pkg/contrib/cmndline.cc
apt-pkg/contrib/cmndline.h
apt-pkg/contrib/configuration.h
apt-pkg/contrib/fileutl.h
apt-pkg/contrib/hashes.cc
apt-pkg/contrib/hashes.h
apt-pkg/contrib/hashsum.cc
apt-pkg/contrib/hashsum_template.h
apt-pkg/contrib/md5.h
apt-pkg/contrib/mmap.cc
apt-pkg/contrib/mmap.h
apt-pkg/contrib/netrc.cc
apt-pkg/contrib/netrc.h
apt-pkg/contrib/progress.h
apt-pkg/contrib/sha1.h
apt-pkg/contrib/strutl.h
apt-pkg/deb/debindexfile.h
apt-pkg/deb/deblistparser.cc
apt-pkg/deb/deblistparser.h
apt-pkg/deb/debmetaindex.cc
apt-pkg/deb/debmetaindex.h
apt-pkg/deb/debrecords.cc
apt-pkg/deb/debrecords.h
apt-pkg/deb/debsrcrecords.cc
apt-pkg/deb/debsrcrecords.h
apt-pkg/deb/debsystem.cc
apt-pkg/deb/debsystem.h
apt-pkg/deb/debversion.cc
apt-pkg/deb/debversion.h
apt-pkg/deb/dpkgpm.cc
apt-pkg/deb/dpkgpm.h
apt-pkg/depcache.cc
apt-pkg/depcache.h
apt-pkg/edsp.cc
apt-pkg/edsp.h
apt-pkg/edsp/edspindexfile.cc
apt-pkg/edsp/edspindexfile.h
apt-pkg/edsp/edsplistparser.cc
apt-pkg/edsp/edsplistparser.h
apt-pkg/edsp/edspsystem.cc
apt-pkg/indexcopy.h
apt-pkg/indexfile.cc
apt-pkg/indexfile.h
apt-pkg/indexrecords.cc
apt-pkg/indexrecords.h
apt-pkg/init.cc
apt-pkg/init.h
apt-pkg/metaindex.h
apt-pkg/orderlist.h
apt-pkg/packagemanager.cc
apt-pkg/packagemanager.h
apt-pkg/pkgcache.cc
apt-pkg/pkgcache.h
apt-pkg/pkgcachegen.cc
apt-pkg/pkgcachegen.h
apt-pkg/pkgrecords.cc
apt-pkg/pkgrecords.h
apt-pkg/pkgsystem.h
apt-pkg/policy.h
apt-pkg/sourcelist.cc
apt-pkg/sourcelist.h
apt-pkg/srcrecords.cc
apt-pkg/srcrecords.h
apt-pkg/tagfile.cc
apt-pkg/tagfile.h
apt-pkg/vendor.cc
apt-pkg/vendor.h
apt-pkg/vendorlist.cc
apt-pkg/vendorlist.h
apt-pkg/version.h
apt-pkg/versionmatch.cc
apt-pkg/versionmatch.h
cmdline/acqprogress.h
cmdline/apt-cache.cc
cmdline/apt-cdrom.cc
cmdline/apt-config.cc
cmdline/apt-dump-solver.cc
cmdline/apt-extracttemplates.cc
cmdline/apt-get.cc
cmdline/apt-internal-solver.cc
cmdline/apt-mark.cc
cmdline/apt-sortpkgs.cc
debian/changelog
ftparchive/cachedb.cc
ftparchive/cachedb.h
ftparchive/contents.cc
ftparchive/contents.h
ftparchive/multicompress.h
ftparchive/writer.h
methods/bzip2.cc
methods/cdrom.cc
methods/connect.cc
methods/connect.h
methods/copy.cc
methods/file.cc
methods/ftp.cc
methods/ftp.h
methods/gpgv.cc
methods/gzip.cc
methods/http.cc
methods/http.h
methods/https.cc
methods/https.h
methods/mirror.cc
methods/mirror.h
methods/rred.cc
methods/rsh.cc
methods/rsh.h
test/integration/framework
test/integration/test-apt-get-download
test/integration/test-bug-590041-prefer-non-virtual-packages
test/integration/test-bug-595691-empty-and-broken-archive-files
test/integration/test-bug-601016-description-translation
test/integration/test-bug-612099-multiarch-conflicts
test/integration/test-bug-624218-Translation-file-handling [new file with mode: 0755]
test/integration/test-disappearing-packages
test/integration/test-ubuntu-bug-761175-remove-purge
test/interactive-helper/extract-control.cc
test/interactive-helper/test_udevcdrom.cc
test/interactive-helper/testextract.cc
test/libapt/assert.h
test/libapt/getlanguages_test.cc
test/libapt/getlistoffilesindir_test.cc
test/libapt/hashsums_test.cc
test/libapt/parsedepends_test.cc
test/libapt/run-tests
test/libapt/strutil_test.cc

index 533c563f9a05ff5418353570e0ca6f803e8169e4..2dee1a40d88ac149b1409733a97dba55a8f03a6a 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <apt-pkg/arfile.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 
 #include <stdlib.h>
@@ -115,7 +116,7 @@ bool ARArchive::LoadHeaders()
       {
         unsigned int I = sizeof(Head.Name) - 1;
         for (; Head.Name[I] == ' ' || Head.Name[I] == '/'; I--);
-        Memb->Name = string(Head.Name,I+1);
+        Memb->Name = std::string(Head.Name,I+1);
       }
 
       // Account for the AR header alignment 
index e2063cd716a6430c9eb3acc7919df05c9f7cb29e..2be1323d1d97ffd375f99d94ce6ae93c60efc390 100644 (file)
@@ -17,7 +17,8 @@
 
 
 #include <string>
-#include <apt-pkg/fileutl.h>
+
+class FileFd;
 
 class ARArchive
 {
@@ -49,7 +50,7 @@ class ARArchive
 struct ARArchive::Member
 {
    // Fields from the header
-   string Name;
+   std::string Name;
    unsigned long MTime;
    unsigned long UID;
    unsigned long GID;
index 487027c3daccf16bcba2291f89a53adef758764a..12919a7cd8bc9800fa6418cffb00a41e9e9671f3 100644 (file)
@@ -18,6 +18,7 @@
 // Include Files                                                       /*{{{*/
 #include<config.h>
 
+#include <apt-pkg/dirstream.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
index 42f8ef5346f7057c5b406b850cc5f60796ed04dc..8754e8dcc0166399c438dc2af20dcb3aaef929a4 100644 (file)
 #define PKGLIB_EXTRACTTAR_H
 
 #include <apt-pkg/fileutl.h>
-#include <apt-pkg/dirstream.h>
 
-#include <algorithm>
+#include <string>
 
-using std::min;
+class pkgDirStream;
 
 class ExtractTar
 {
@@ -38,7 +37,7 @@ class ExtractTar
    int GZPid;
    FileFd InFd;
    bool Eof;
-   string DecompressProg;
+   std::string DecompressProg;
    
    // Fork and reap gzip
    bool StartGzip();
@@ -48,7 +47,7 @@ class ExtractTar
 
    bool Go(pkgDirStream &Stream);
    
-   ExtractTar(FileFd &Fd,unsigned long Max,string DecompressionProgram);
+   ExtractTar(FileFd &Fd,unsigned long Max,std::string DecompressionProgram);
    virtual ~ExtractTar();
 };
 
index 0647959a9ffc2f1566b1c20cf3c66a5f1260599b..da7613491105eb9b9e11904d4f9872c56bc3add5 100644 (file)
 #include<config.h>
 
 #include <apt-pkg/database.h>
+#include <apt-pkg/filelist.h>
+#include <apt-pkg/pkgcachegen.h>
                                                                        /*}}}*/
 
 // DataBase::GetMetaTmp - Get the temp dir                             /*{{{*/
 // ---------------------------------------------------------------------
 /* This re-initializes the meta temporary directory if it hasn't yet 
    been inited for this cycle. The flag is the emptyness of MetaDir */
-bool pkgDataBase::GetMetaTmp(string &Dir)
+bool pkgDataBase::GetMetaTmp(std::string &Dir)
 {
    if (MetaDir.empty() == true)
       if (InitMetaTmp(MetaDir) == false)
@@ -26,3 +28,8 @@ bool pkgDataBase::GetMetaTmp(string &Dir)
    return true;
 }
                                                                        /*}}}*/
+pkgDataBase::~pkgDataBase()
+{
+   delete Cache;
+   delete FList;
+}
index ef45bc2d6a1b41b6b6d895b1d59400aeba82437a..ccfee3797a134c2a115c8439e7102a2e9e98bace 100644 (file)
 #ifndef PKGLIB_DATABASE_H
 #define PKGLIB_DATABASE_H
 
-#include <apt-pkg/filelist.h>
 #include <apt-pkg/pkgcachegen.h>
 
+#include <string>
+
+class pkgFLCache;
+class OpProgress;
+
 class pkgDataBase
 {
    protected:
    
    pkgCacheGenerator *Cache;
    pkgFLCache *FList;
-   string MetaDir;
-   virtual bool InitMetaTmp(string &Dir) = 0;
+   std::string MetaDir;
+   virtual bool InitMetaTmp(std::string &Dir) = 0;
    
    public:
 
@@ -40,13 +44,13 @@ class pkgDataBase
    inline pkgFLCache &GetFLCache() {return *FList;};
    inline pkgCacheGenerator &GetGenerator() {return *Cache;};
    
-   bool GetMetaTmp(string &Dir);
+   bool GetMetaTmp(std::string &Dir);
    virtual bool ReadyFileList(OpProgress &Progress) = 0;
    virtual bool ReadyPkgCache(OpProgress &Progress) = 0;
    virtual bool LoadChanges() = 0;
 
    pkgDataBase() : Cache(0), FList(0) {};
-   virtual ~pkgDataBase() {delete Cache; delete FList;};
+   virtual ~pkgDataBase();
 };
 
 #endif
index e80d8c73581a664c54e9a1414b69f0b6a69f2317..4bd065cf8aa0dbb6f7a939b3034851529ef63c0a 100644 (file)
@@ -18,6 +18,7 @@
 // Include Files                                                       /*{{{*/
 #include<config.h>
 
+#include <apt-pkg/database.h>
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/extracttar.h>
 #include <apt-pkg/error.h>
@@ -107,8 +108,8 @@ bool debDebFile::ExtractControl(pkgDataBase &DB)
       return false;
    
    // Get into the temporary directory
-   string Cwd = SafeGetCWD();
-   string Tmp;
+   std::string Cwd = SafeGetCWD();
+   std::string Tmp;
    if (DB.GetMetaTmp(Tmp) == false)
       return false;
    if (chdir(Tmp.c_str()) != 0)
@@ -174,7 +175,7 @@ bool debDebFile::ExtractArchive(pkgDirStream &Stream)
 pkgCache::VerIterator debDebFile::MergeControl(pkgDataBase &DB)
 {
    // Open the control file
-   string Tmp;
+   std::string Tmp;
    if (DB.GetMetaTmp(Tmp) == false)
       return pkgCache::VerIterator(DB.GetCache());
    FileFd Fd(Tmp + "control",FileFd::ReadOnly);
index 6b9f8ffc84772a23c6d4276119a8904b36433626..2c4734f9ed47ea3ed3be06b7cad10a98672ceb67 100644 (file)
 
 
 #include <apt-pkg/arfile.h>
-#include <apt-pkg/database.h>
 #include <apt-pkg/dirstream.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/pkgcache.h>
+
+class FileFd;
+class pkgDataBase;
 
 class debDebFile
 {
@@ -68,7 +71,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
    char *Control;
    pkgTagSection Section;
    unsigned long Length;
-   string Member;
+   std::string Member;
    
    // Members from DirStream
    virtual bool DoItem(Item &Itm,int &Fd);
@@ -81,7 +84,7 @@ class debDebFile::MemControlExtract : public pkgDirStream
    bool TakeControl(const void *Data,unsigned long Size);
       
    MemControlExtract() : IsControl(false), Control(0), Length(0), Member("control") {};
-   MemControlExtract(string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
+   MemControlExtract(std::string Member) : IsControl(false), Control(0), Length(0), Member(Member) {};
    ~MemControlExtract() {delete [] Control;};   
 };
                                                                        /*}}}*/
index 3112acdbd22c201e72239cc25708859b9896059d..819c123f67170cb61cda8181daf1b21ce40afc31 100644 (file)
@@ -21,6 +21,8 @@
 #include <apt-pkg/progress.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/filelist.h>
 
 #include <stdio.h>
 #include <errno.h>
index 125845f9640da18bbe3b926856a83f7781d8eee7..f28563a934133af66a4b542b44285bbb464c74ca 100644 (file)
 
 #include <apt-pkg/database.h>
 
+#include <string>
+
+class DynamicMMap;
+class OpProgress;
+
 class debDpkgDB : public pkgDataBase
 {
    protected:
-   
-   string AdminDir;
+
+   std::string AdminDir;
    DynamicMMap *CacheMap;
    DynamicMMap *FileMap;
    unsigned long DiverInode;
    signed long DiverTime;
-   
-   virtual bool InitMetaTmp(string &Dir);
+
+   virtual bool InitMetaTmp(std::string &Dir);
    bool ReadFList(OpProgress &Progress);
    bool ReadDiversions();
    bool ReadConfFiles();
index d48ff63ac3a40271a56f19b498876fe4556fa3bc..29e1630284f67a4a4f337df99e6f04fae8086da8 100644 (file)
@@ -49,6 +49,7 @@
 #include <apt-pkg/extract.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/debversion.h>
+#include <apt-pkg/fileutl.h>
 
 #include <sys/stat.h>
 #include <stdio.h>
index 71222983cdfcb62295ab52c002e18b91c5aa6647..7143fa40933aa235614c8e900c6617f606acddf7 100644 (file)
@@ -33,7 +33,7 @@ class pkgExtract : public pkgDirStream
    
    bool HandleOverwrites(pkgFLCache::NodeIterator Nde,
                         bool DiverCheck = false);
-   bool CheckDirReplace(string Dir,unsigned int Depth = 0);
+   bool CheckDirReplace(std::string Dir,unsigned int Depth = 0);
    
    public:
    
index c74a310e47c29d1b21aed6703019edcfff897dcf..0405d61dfca7e875a4071f3856cacfa0f69debe9 100644 (file)
 #ifndef PKGLIB_FILELIST_H
 #define PKGLIB_FILELIST_H
 
+#include <apt-pkg/mmap.h>
 
 #include <cstring>
-#include <apt-pkg/mmap.h>
+#include <string>
 
 class pkgFLCache
 {
@@ -48,7 +49,7 @@ class pkgFLCache
    class DiverIterator;
    
    protected:
-   string CacheFile;
+   std::string CacheFile;
    DynamicMMap &Map;
    map_ptrloc LastTreeLookup;
    unsigned long LastLookupSize;
index b46489f87d7bd92df7723a420c99fedfdf0e9880..453fce1093bd297e27fdf59b609f539cd852aea2 100644 (file)
@@ -25,6 +25,8 @@
 #include <apt-pkg/md5.h>
 #include <apt-pkg/sha1.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/indexrecords.h>
+#include <apt-pkg/metaindex.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
index 6c8341b624a21f2a91025bc9ebfa1e8ea0ae651c..27b8e887bba7a4d4440930321a7546a53675227b 100644 (file)
 #define PKGLIB_ACQUIRE_ITEM_H
 
 #include <apt-pkg/acquire.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/vendor.h>
-#include <apt-pkg/sourcelist.h>
-#include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexrecords.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/weakptr.h>
+#include <apt-pkg/pkgcache.h>
 
 /** \addtogroup acquire
  *  @{
  *  \file acquire-item.h
  */
 
+class indexRecords;
+class pkgRecords;
+class pkgSourceList;
+
 /** \brief Represents the process by which a pkgAcquire object should  {{{
  *  retrieve a file or a collection of files.
  *
@@ -74,7 +74,7 @@ class pkgAcquire::Item : public WeakPointable
     *  \param To The new name of #From.  If #To exists it will be
     *  overwritten.
     */
-   void Rename(string From,string To);
+   void Rename(std::string From,std::string To);
    
    public:
 
@@ -109,7 +109,7 @@ class pkgAcquire::Item : public WeakPointable
    /** \brief Contains a textual description of the error encountered
     *  if #Status is #StatError or #StatAuthError.
     */
-   string ErrorText;
+   std::string ErrorText;
 
    /** \brief The size of the object to fetch. */
    unsigned long long FileSize;
@@ -143,7 +143,7 @@ class pkgAcquire::Item : public WeakPointable
     *  download progress indicator's overall statistics.
     */
    bool Local;
-   string UsedMirror;
+   std::string UsedMirror;
 
    /** \brief The number of fetch queues into which this item has been
     *  inserted.
@@ -158,7 +158,7 @@ class pkgAcquire::Item : public WeakPointable
    /** \brief The name of the file into which the retrieved object
     *  will be written.
     */
-   string DestFile;
+   std::string DestFile;
 
    /** \brief Invoked by the acquire worker when the object couldn't
     *  be fetched.
@@ -173,7 +173,7 @@ class pkgAcquire::Item : public WeakPointable
     *
     *  \sa pkgAcqMethod
     */
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 
    /** \brief Invoked by the acquire worker when the object was
     *  fetched successfully.
@@ -194,7 +194,7 @@ class pkgAcquire::Item : public WeakPointable
     *
     *  \sa pkgAcqMethod
     */
-   virtual void Done(string Message,unsigned long long Size,string Hash,
+   virtual void Done(std::string Message,unsigned long long Size,std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
 
    /** \brief Invoked when the worker starts to fetch this object.
@@ -206,7 +206,7 @@ class pkgAcquire::Item : public WeakPointable
     *
     *  \sa pkgAcqMethod
     */
-   virtual void Start(string Message,unsigned long long Size);
+   virtual void Start(std::string Message,unsigned long long Size);
 
    /** \brief Custom headers to be sent to the fetch process.
     *
@@ -216,18 +216,18 @@ class pkgAcquire::Item : public WeakPointable
     *  line, so they should (if nonempty) have a leading newline and
     *  no trailing newline.
     */
-   virtual string Custom600Headers() {return string();};
+   virtual std::string Custom600Headers() {return std::string();};
 
    /** \brief A "descriptive" URI-like string.
     *
     *  \return a URI that should be used to describe what is being fetched.
     */
-   virtual string DescURI() = 0;
+   virtual std::string DescURI() = 0;
    /** \brief Short item description.
     *
     *  \return a brief description of the object being fetched.
     */
-   virtual string ShortDesc() {return DescURI();}
+   virtual std::string ShortDesc() {return DescURI();}
 
    /** \brief Invoked by the worker when the download is completely done. */
    virtual void Finished() {};
@@ -237,7 +237,7 @@ class pkgAcquire::Item : public WeakPointable
     *  \return the HashSum of this object, if applicable; otherwise, an
     *  empty string.
     */
-   virtual string HashSum() {return string();};
+   virtual std::string HashSum() {return std::string();};
 
    /** \return the acquire process with which this item is associated. */
    pkgAcquire *GetOwner() {return Owner;};
@@ -253,7 +253,7 @@ class pkgAcquire::Item : public WeakPointable
     * 
     *  \param FailCode A short failure string that is send
     */
-   void ReportMirrorFailure(string FailCode);
+   void ReportMirrorFailure(std::string FailCode);
 
 
    /** \brief Initialize an item.
@@ -278,10 +278,10 @@ class pkgAcquire::Item : public WeakPointable
 /** \brief Information about an index patch (aka diff). */             /*{{{*/
 struct DiffInfo {
    /** The filename of the diff. */
-   string file;
+   std::string file;
 
    /** The sha1 hash of the diff. */
-   string sha1;
+   std::string sha1;
 
    /** The size of the diff. */
    unsigned long size;
@@ -308,12 +308,12 @@ class pkgAcqSubIndex : public pkgAcquire::Item
 
  public:
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return Desc.URI;};
-   virtual string Custom600Headers();
-   virtual bool ParseIndex(string const &IndexFile);
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string Custom600Headers();
+   virtual bool ParseIndex(std::string const &IndexFile);
 
    /** \brief Create a new pkgAcqSubIndex.
     *
@@ -327,8 +327,8 @@ class pkgAcqSubIndex : public pkgAcquire::Item
     *
     *  \param ExpectedHash The list file's MD5 signature.
     */
-   pkgAcqSubIndex(pkgAcquire *Owner, string const &URI,string const &URIDesc,
-                  string const &ShortDesc, HashString const &ExpectedHash);
+   pkgAcqSubIndex(pkgAcquire *Owner, std::string const &URI,std::string const &URIDesc,
+                  std::string const &ShortDesc, HashString const &ExpectedHash);
 };
                                                                        /*}}}*/
 /** \brief An item that is responsible for fetching an index file of   {{{
@@ -352,7 +352,7 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
    /** \brief The URI of the index file to recreate at our end (either
     *  by downloading it or by applying partial patches).
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The Hash that the real index file should have after
     *  all patches have been applied.
@@ -362,20 +362,20 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
    /** \brief The index file which will be patched to generate the new
     *  file.
     */
-   string CurrentPackagesFile;
+   std::string CurrentPackagesFile;
 
    /** \brief A description of the Packages file (stored in
     *  pkgAcquire::ItemDesc::Description).
     */
-   string Description;
+   std::string Description;
 
  public:
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return RealURI + "Index";};
-   virtual string Custom600Headers();
+   virtual std::string DescURI() {return RealURI + "Index";};
+   virtual std::string Custom600Headers();
 
    /** \brief Parse the Index file for a set of Packages diffs.
     *
@@ -387,7 +387,7 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
     *  \return \b true if the Index file was successfully parsed, \b
     *  false otherwise.
     */
-   bool ParseDiffIndex(string IndexDiffFile);
+   bool ParseDiffIndex(std::string IndexDiffFile);
    
 
    /** \brief Create a new pkgAcqDiffIndex.
@@ -402,8 +402,8 @@ class pkgAcqDiffIndex : public pkgAcquire::Item
     *
     *  \param ExpectedHash The list file's MD5 signature.
     */
-   pkgAcqDiffIndex(pkgAcquire *Owner,string URI,string URIDesc,
-                  string ShortDesc, HashString ExpectedHash);
+   pkgAcqDiffIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+                  std::string ShortDesc, HashString ExpectedHash);
 };
                                                                        /*}}}*/
 /** \brief An item that is responsible for fetching all the patches    {{{
@@ -460,7 +460,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
    /** \brief The URI of the package index file that is being
     *  reconstructed.
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The HashSum of the package index file that is being
     *  reconstructed.
@@ -468,7 +468,7 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
    HashString ExpectedHash;
 
    /** A description of the file being downloaded. */
-   string Description;
+   std::string Description;
 
    /** The patches that remain to be downloaded, including the patch
     *  being downloaded right now.  This list should be ordered so
@@ -478,10 +478,10 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
     *  dictionary instead of relying on ordering and stripping them
     *  off the front?
     */
-   vector<DiffInfo> available_patches;
+   std::vector<DiffInfo> available_patches;
 
    /** Stop applying patches when reaching that sha1 */
-   string ServerSha1;
+   std::string ServerSha1;
 
    /** The current status of this patch. */
    enum DiffState
@@ -506,11 +506,11 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
     *  This method will fall back to downloading the whole index file
     *  outright; its arguments are ignored.
     */
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
 
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return RealURI + "Index";};
+   virtual std::string DescURI() {return RealURI + "Index";};
 
    /** \brief Create an index diff item.
     *
@@ -534,10 +534,10 @@ class pkgAcqIndexDiffs : public pkgAcquire::Item
     *  should be ordered so that each diff appears before any diff
     *  that depends on it.
     */
-   pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
-                   string ShortDesc, HashString ExpectedHash,
-                   string ServerSha1,
-                   vector<DiffInfo> diffs=vector<DiffInfo>());
+   pkgAcqIndexDiffs(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+                   std::string ShortDesc, HashString ExpectedHash,
+                   std::string ServerSha1,
+                   std::vector<DiffInfo> diffs=std::vector<DiffInfo>());
 };
                                                                        /*}}}*/
 /** \brief An acquire item that is responsible for fetching an index   {{{
@@ -577,7 +577,7 @@ class pkgAcqIndex : public pkgAcquire::Item
    /** \brief The object that is actually being fetched (minus any
     *  compression-related extensions).
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The expected hashsum of the decompressed index file. */
    HashString ExpectedHash;
@@ -585,17 +585,17 @@ class pkgAcqIndex : public pkgAcquire::Item
    /** \brief The compression-related file extensions that are being
     *  added to the downloaded file one by one if first fails (e.g., "gz bz2").
     */
-   string CompressionExtension;
+   std::string CompressionExtension;
 
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
-   virtual string DescURI() {return Desc.URI;};
-   virtual string HashSum() {return ExpectedHash.toStr(); };
+   virtual std::string Custom600Headers();
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string HashSum() {return ExpectedHash.toStr(); };
 
    /** \brief Create a pkgAcqIndex.
     *
@@ -616,12 +616,12 @@ class pkgAcqIndex : public pkgAcquire::Item
     *  default is ".lzma" or ".bz2" (if the needed binaries are present)
     *  fallback is ".gz" or none.
     */
-   pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
-              string ShortDesc, HashString ExpectedHash, 
-              string compressExt="");
+   pkgAcqIndex(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+              std::string ShortDesc, HashString ExpectedHash, 
+              std::string compressExt="");
    pkgAcqIndex(pkgAcquire *Owner, struct IndexTarget const * const Target,
                         HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
-   void Init(string const &URI, string const &URIDesc, string const &ShortDesc);
+   void Init(std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc);
 };
                                                                        /*}}}*/
 /** \brief An acquire item that is responsible for fetching a          {{{
@@ -635,8 +635,8 @@ class pkgAcqIndexTrans : public pkgAcqIndex
 {
    public:
   
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual std::string Custom600Headers();
 
    /** \brief Create a pkgAcqIndexTrans.
     *
@@ -649,8 +649,8 @@ class pkgAcqIndexTrans : public pkgAcqIndex
     *
     *  \param ShortDesc A brief description of this index file.
     */
-   pkgAcqIndexTrans(pkgAcquire *Owner,string URI,string URIDesc,
-                   string ShortDesc);
+   pkgAcqIndexTrans(pkgAcquire *Owner,std::string URI,std::string URIDesc,
+                   std::string ShortDesc);
    pkgAcqIndexTrans(pkgAcquire *Owner, struct IndexTarget const * const Target,
                    HashString const &ExpectedHash, indexRecords const *MetaIndexParser);
 };
@@ -660,18 +660,18 @@ class IndexTarget
 {
  public:
    /** \brief A URI from which the index file can be downloaded. */
-   string URI;
+   std::string URI;
 
    /** \brief A description of the index file. */
-   string Description;
+   std::string Description;
 
    /** \brief A shorter description of the index file. */
-   string ShortDesc;
+   std::string ShortDesc;
 
    /** \brief The key by which this index file should be
     *  looked up within the meta signature file.
     */
-   string MetaKey;
+   std::string MetaKey;
 
    virtual bool IsOptional() const {
       return false;
@@ -718,7 +718,7 @@ class pkgAcqMetaSig : public pkgAcquire::Item
 {
    protected:
    /** \brief The last good signature file */
-   string LastGoodSig;
+   std::string LastGoodSig;
 
    /** \brief The fetch request that is currently being processed. */
    pkgAcquire::ItemDesc Desc;
@@ -727,20 +727,20 @@ class pkgAcqMetaSig : public pkgAcquire::Item
     *  never modified; it is used to determine the file that is being
     *  downloaded.
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The URI of the meta-index file to be fetched after the signature. */
-   string MetaIndexURI;
+   std::string MetaIndexURI;
 
    /** \brief A "URI-style" description of the meta-index file to be
     *  fetched after the signature.
     */
-   string MetaIndexURIDesc;
+   std::string MetaIndexURIDesc;
 
    /** \brief A brief description of the meta-index file to be fetched
     *  after the signature.
     */
-   string MetaIndexShortDesc;
+   std::string MetaIndexShortDesc;
 
    /** \brief A package-system-specific parser for the meta-index file. */
    indexRecords* MetaIndexParser;
@@ -750,21 +750,21 @@ class pkgAcqMetaSig : public pkgAcquire::Item
     *
     *  \todo Why a list of pointers instead of a list of structs?
     */
-   const vector<struct IndexTarget*>* IndexTargets;
+   const std::vector<struct IndexTarget*>* IndexTargets;
 
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Md5Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Md5Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
-   virtual string DescURI() {return RealURI; };
+   virtual std::string Custom600Headers();
+   virtual std::string DescURI() {return RealURI; };
 
    /** \brief Create a new pkgAcqMetaSig. */
-   pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc,
-                string MetaIndexURI, string MetaIndexURIDesc, string MetaIndexShortDesc,
-                const vector<struct IndexTarget*>* IndexTargets,
+   pkgAcqMetaSig(pkgAcquire *Owner,std::string URI,std::string URIDesc, std::string ShortDesc,
+                std::string MetaIndexURI, std::string MetaIndexURIDesc, std::string MetaIndexShortDesc,
+                const std::vector<struct IndexTarget*>* IndexTargets,
                 indexRecords* MetaIndexParser);
 };
                                                                        /*}}}*/
@@ -787,17 +787,17 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
    /** \brief The URI that is actually being downloaded; never
     *  modified by pkgAcqMetaIndex.
     */
-   string RealURI;
+   std::string RealURI;
 
    /** \brief The file in which the signature for this index was stored.
     *
     *  If empty, the signature and the md5sums of the individual
     *  indices will not be checked.
     */
-   string SigFile;
+   std::string SigFile;
 
    /** \brief The index files to download. */
-   const vector<struct IndexTarget*>* IndexTargets;
+   const std::vector<struct IndexTarget*>* IndexTargets;
 
    /** \brief The parser for the meta-index file. */
    indexRecords* MetaIndexParser;
@@ -813,7 +813,7 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
     *
     *  \return \b true if no fatal errors were encountered.
     */
-   bool VerifyVendor(string Message);
+   bool VerifyVendor(std::string Message);
 
    /** \brief Called when a file is finished being retrieved.
     *
@@ -824,7 +824,7 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
     *  \param Message The message block received from the fetch
     *  subprocess.
     */
-   void RetrievalDone(string Message);
+   void RetrievalDone(std::string Message);
 
    /** \brief Called when authentication succeeded.
     *
@@ -835,7 +835,7 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
     *  \param Message The message block received from the fetch
     *  subprocess.
     */
-   void AuthDone(string Message);
+   void AuthDone(std::string Message);
 
    /** \brief Starts downloading the individual index files.
     *
@@ -850,17 +850,17 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size, string Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size, std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
-   virtual string DescURI() {return RealURI; };
+   virtual std::string Custom600Headers();
+   virtual std::string DescURI() {return RealURI; };
 
    /** \brief Create a new pkgAcqMetaIndex. */
    pkgAcqMetaIndex(pkgAcquire *Owner,
-                  string URI,string URIDesc, string ShortDesc,
-                  string SigFile,
-                  const vector<struct IndexTarget*>* IndexTargets,
+                  std::string URI,std::string URIDesc, std::string ShortDesc,
+                  std::string SigFile,
+                  const std::vector<struct IndexTarget*>* IndexTargets,
                   indexRecords* MetaIndexParser);
 };
                                                                        /*}}}*/
@@ -868,33 +868,33 @@ class pkgAcqMetaIndex : public pkgAcquire::Item
 class pkgAcqMetaClearSig : public pkgAcqMetaIndex
 {
    /** \brief The URI of the meta-index file for the detached signature */
-   string MetaIndexURI;
+   std::string MetaIndexURI;
 
    /** \brief A "URI-style" description of the meta-index file */
-   string MetaIndexURIDesc;
+   std::string MetaIndexURIDesc;
 
    /** \brief A brief description of the meta-index file */
-   string MetaIndexShortDesc;
+   std::string MetaIndexShortDesc;
 
    /** \brief The URI of the detached meta-signature file if the clearsigned one failed. */
-   string MetaSigURI;
+   std::string MetaSigURI;
 
    /** \brief A "URI-style" description of the meta-signature file */
-   string MetaSigURIDesc;
+   std::string MetaSigURIDesc;
 
    /** \brief A brief description of the meta-signature file */
-   string MetaSigShortDesc;
+   std::string MetaSigShortDesc;
 
 public:
-   void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual string Custom600Headers();
+   void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual std::string Custom600Headers();
 
    /** \brief Create a new pkgAcqMetaClearSig. */
    pkgAcqMetaClearSig(pkgAcquire *Owner,
-               string const &URI, string const &URIDesc, string const &ShortDesc,
-               string const &MetaIndexURI, string const &MetaIndexURIDesc, string const &MetaIndexShortDesc,
-               string const &MetaSigURI, string const &MetaSigURIDesc, string const &MetaSigShortDesc,
-               const vector<struct IndexTarget*>* IndexTargets,
+               std::string const &URI, std::string const &URIDesc, std::string const &ShortDesc,
+               std::string const &MetaIndexURI, std::string const &MetaIndexURIDesc, std::string const &MetaIndexShortDesc,
+               std::string const &MetaSigURI, std::string const &MetaSigURIDesc, std::string const &MetaSigShortDesc,
+               const std::vector<struct IndexTarget*>* IndexTargets,
                indexRecords* MetaIndexParser);
 };
                                                                        /*}}}*/
@@ -928,7 +928,7 @@ class pkgAcqArchive : public pkgAcquire::Item
    /** \brief A location in which the actual filename of the package
     *  should be stored.
     */
-   string &StoreFilename;
+   std::string &StoreFilename;
 
    /** \brief The next file for this version to try to download. */
    pkgCache::VerFileIterator Vf;
@@ -950,13 +950,13 @@ class pkgAcqArchive : public pkgAcquire::Item
    
    public:
    
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string Hash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string Hash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return Desc.URI;};
-   virtual string ShortDesc() {return Desc.ShortDesc;};
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string ShortDesc() {return Desc.ShortDesc;};
    virtual void Finished();
-   virtual string HashSum() {return ExpectedHash.toStr(); };
+   virtual std::string HashSum() {return ExpectedHash.toStr(); };
    virtual bool IsTrusted();
    
    /** \brief Create a new pkgAcqArchive.
@@ -979,7 +979,7 @@ class pkgAcqArchive : public pkgAcquire::Item
     */
    pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
                 pkgRecords *Recs,pkgCache::VerIterator const &Version,
-                string &StoreFilename);
+                std::string &StoreFilename);
 };
                                                                        /*}}}*/
 /** \brief Retrieve an arbitrary file to the current directory.                {{{
@@ -1007,12 +1007,12 @@ class pkgAcqFile : public pkgAcquire::Item
    public:
    
    // Specialized action members
-   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
-   virtual void Done(string Message,unsigned long long Size,string CalcHash,
+   virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
+   virtual void Done(std::string Message,unsigned long long Size,std::string CalcHash,
                     pkgAcquire::MethodConfig *Cnf);
-   virtual string DescURI() {return Desc.URI;};
-   virtual string HashSum() {return ExpectedHash.toStr(); };
-   virtual string Custom600Headers();
+   virtual std::string DescURI() {return Desc.URI;};
+   virtual std::string HashSum() {return ExpectedHash.toStr(); };
+   virtual std::string Custom600Headers();
 
    /** \brief Create a new pkgAcqFile object.
     *
@@ -1045,9 +1045,9 @@ class pkgAcqFile : public pkgAcquire::Item
     * is the absolute name to which the file should be downloaded.
     */
 
-   pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long long Size,
-             string Desc, string ShortDesc,
-             const string &DestDir="", const string &DestFilename="",
+   pkgAcqFile(pkgAcquire *Owner, std::string URI, std::string Hash, unsigned long long Size,
+             std::string Desc, std::string ShortDesc,
+             const std::string &DestDir="", const std::string &DestFilename="",
              bool IsIndexFile=false);
 };
                                                                        /*}}}*/
index 6551170c4b943008f84453aa1bfd8e57f7509c76..c3f042ee061d999efb786fbfb7a064efd4aee8bf 100644 (file)
 #ifndef PKGLIB_ACQUIRE_METHOD_H
 #define PKGLIB_ACQUIRE_METHOD_H
 
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/strutl.h>
-
 #include <stdarg.h>
 
+#include <string>
+#include <vector>
+
 class Hashes;
 class pkgAcqMethod
 {
@@ -34,8 +34,8 @@ class pkgAcqMethod
    {
       FetchItem *Next;
 
-      string Uri;
-      string DestFile;
+      std::string Uri;
+      std::string DestFile;
       time_t LastModified;
       bool IndexFile;
       bool FailIgnore;
@@ -43,14 +43,14 @@ class pkgAcqMethod
    
    struct FetchResult
    {
-      string MD5Sum;
-      string SHA1Sum;
-      string SHA256Sum;
-      string SHA512Sum;
-      vector<string> GPGVOutput;
+      std::string MD5Sum;
+      std::string SHA1Sum;
+      std::string SHA256Sum;
+      std::string SHA512Sum;
+      std::vector<std::string> GPGVOutput;
       time_t LastModified;
       bool IMSHit;
-      string Filename;
+      std::string Filename;
       unsigned long long Size;
       unsigned long long ResumePoint;
       
@@ -59,25 +59,25 @@ class pkgAcqMethod
    };
 
    // State
-   vector<string> Messages;
+   std::vector<std::string> Messages;
    FetchItem *Queue;
    FetchItem *QueueBack;
-   string FailReason;
-   string UsedMirror;
-   string IP;
+   std::string FailReason;
+   std::string UsedMirror;
+   std::string IP;
    
    // Handlers for messages
-   virtual bool Configuration(string Message);
+   virtual bool Configuration(std::string Message);
    virtual bool Fetch(FetchItem * /*Item*/) {return true;};
    
    // Outgoing messages
    void Fail(bool Transient = false);
-   inline void Fail(const char *Why, bool Transient = false) {Fail(string(Why),Transient);};
-   virtual void Fail(string Why, bool Transient = false);
+   inline void Fail(const char *Why, bool Transient = false) {Fail(std::string(Why),Transient);};
+   virtual void Fail(std::string Why, bool Transient = false);
    virtual void URIStart(FetchResult &Res);
    virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
 
-   bool MediaFail(string Required,string Drive);
+   bool MediaFail(std::string Required,std::string Drive);
    virtual void Exit() {};
 
    void PrintStatus(char const * const header, const char* Format, va_list &args) const;
@@ -91,11 +91,11 @@ class pkgAcqMethod
    void Log(const char *Format,...);
    void Status(const char *Format,...);
    
-   void Redirect(const string &NewURI);
+   void Redirect(const std::string &NewURI);
  
    int Run(bool Single = false);
-   inline void SetFailReason(string Msg) {FailReason = Msg;};
-   inline void SetIP(string aIP) {IP = aIP;};
+   inline void SetFailReason(std::string Msg) {FailReason = Msg;};
+   inline void SetIP(std::string aIP) {IP = aIP;};
    
    pkgAcqMethod(const char *Ver,unsigned long Flags = 0);
    virtual ~pkgAcqMethod() {};
index ce19091e431ea8f12eb20812bb19fc582974228f..848a6bad7d748dd87d012f0ea31a8c45982a44f7 100644 (file)
@@ -79,7 +79,7 @@ class pkgAcquire::Worker : public WeakPointable
     *
     *  \todo Doesn't this duplicate Config->Access?
     */
-   string Access;
+   std::string Access;
 
    /** \brief The PID of the subprocess. */
    pid_t Process;
@@ -118,13 +118,13 @@ class pkgAcquire::Worker : public WeakPointable
    /** \brief The raw text values of messages received from the
     *  worker, in sequence.
     */
-   vector<string> MessageQueue;
+   std::vector<std::string> MessageQueue;
 
    /** \brief Buffers pending writes to the subprocess.
     *
     *  \todo Wouldn't a std::dequeue be more appropriate?
     */
-   string OutQueue;
+   std::string OutQueue;
    
    /** \brief Common code for the constructor.
     *
@@ -183,7 +183,7 @@ class pkgAcquire::Worker : public WeakPointable
     *
     *  \return \b true.
     */
-   bool Capabilities(string Message);
+   bool Capabilities(std::string Message);
 
    /** \brief Send a 601 Configuration message (containing the APT
     *  configuration) to the subprocess.
@@ -214,7 +214,7 @@ class pkgAcquire::Worker : public WeakPointable
     *  603 Media Changed, with the Failed field set to \b true if the
     *  user cancelled the media change).
     */
-   bool MediaChange(string Message);
+   bool MediaChange(std::string Message);
    
    /** \brief Invoked when the worked process dies unexpectedly.
     *
@@ -242,7 +242,7 @@ class pkgAcquire::Worker : public WeakPointable
    /** \brief The most recent status string received from the
     *  subprocess.
     */
-   string Status;
+   std::string Status;
 
    /** \brief How many bytes of the file have been downloaded.  Zero
     *  if the current progress of the file cannot be determined.
index ae555df2206df439e2b42e88277abd913f8526b4..93772403d5c37e8b369698d3ef05e726636fd261 100644 (file)
 #include <vector>
 #include <string>
 
-using std::vector;
-using std::string;
-
-
 #include <sys/time.h>
 #include <unistd.h>
 
@@ -107,8 +103,8 @@ class pkgAcquire
    friend class Item;
    friend class Queue;
 
-   typedef vector<Item *>::iterator ItemIterator;
-   typedef vector<Item *>::const_iterator ItemCIterator;
+   typedef std::vector<Item *>::iterator ItemIterator;
+   typedef std::vector<Item *>::const_iterator ItemCIterator;
 
    protected:
    
@@ -117,7 +113,7 @@ class pkgAcquire
     *  This is built monotonically as items are created and only
     *  emptied when the download shuts down.
     */
-   vector<Item *> Items;
+   std::vector<Item *> Items;
    
    /** \brief The head of the list of active queues.
     *
@@ -202,7 +198,7 @@ class pkgAcquire
     *  \return the string-name of the queue in which a fetch request
     *  for the given URI should be placed.
     */
-   string QueueName(string URI,MethodConfig const *&Config);
+   std::string QueueName(std::string URI,MethodConfig const *&Config);
 
    /** \brief Build up the set of file descriptors upon which select() should
     *  block.
@@ -248,7 +244,7 @@ class pkgAcquire
     *
     *  \return the method whose name is Access, or \b NULL if no such method exists.
     */
-   MethodConfig *GetConfig(string Access);
+   MethodConfig *GetConfig(std::string Access);
 
    /** \brief Provides information on how a download terminated. */
    enum RunResult {
@@ -319,7 +315,7 @@ class pkgAcquire
     *
     *  \return \b true if the directory exists and is readable.
     */
-   bool Clean(string Dir);
+   bool Clean(std::string Dir);
 
    /** \return the total size in bytes of all the items included in
     *  this download.
@@ -347,7 +343,7 @@ class pkgAcquire
     *  only one Acquire class is in action at the time or an empty string
     *  if no lock file should be used.
     */
-   bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
+   bool Setup(pkgAcquireStatus *Progress = NULL, std::string const &Lock = "");
 
    void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
 
@@ -372,11 +368,11 @@ class pkgAcquire
 struct pkgAcquire::ItemDesc : public WeakPointable
 {
    /** \brief The URI from which to download this item. */
-   string URI;
+   std::string URI;
    /** brief A description of this item. */
-   string Description;
+   std::string Description;
    /** brief A shorter description of this item. */
-   string ShortDesc;
+   std::string ShortDesc;
    /** brief The underlying item which is to be downloaded. */
    Item *Owner;
 };
@@ -420,7 +416,7 @@ class pkgAcquire::Queue
    };
    
    /** \brief The name of this queue. */
-   string Name;
+   std::string Name;
 
    /** \brief The head of the list of items contained in this queue.
     *
@@ -475,7 +471,7 @@ class pkgAcquire::Queue
     *  \return the first item in the queue whose URI is #URI and that
     *  is being downloaded by #Owner.
     */
-   QItem *FindItem(string URI,pkgAcquire::Worker *Owner);
+   QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner);
 
    /** Presumably this should start downloading an item?
     *
@@ -538,7 +534,7 @@ class pkgAcquire::Queue
     *  \param Name The name of the new queue.
     *  \param Owner The download process that owns the new queue.
     */
-   Queue(string Name,pkgAcquire *Owner);
+   Queue(std::string Name,pkgAcquire *Owner);
 
    /** Shut down all the worker processes associated with this queue
     *  and empty the queue.
@@ -603,10 +599,10 @@ struct pkgAcquire::MethodConfig
    MethodConfig *Next;
    
    /** \brief The name of this acquire method (e.g., http). */
-   string Access;
+   std::string Access;
 
    /** \brief The implementation version of this acquire method. */
-   string Version;
+   std::string Version;
 
    /** \brief If \b true, only one download queue should be created for this
     *  method.
@@ -748,7 +744,7 @@ class pkgAcquireStatus
     *  \todo This is a horrible blocking monster; it should be CPSed
     *  with prejudice.
     */
-   virtual bool MediaChange(string Media,string Drive) = 0;
+   virtual bool MediaChange(std::string Media,std::string Drive) = 0;
    
    /** \brief Invoked when an item is confirmed to be up-to-date.
 
index 40368c91f1dc2e49b08571b9a3458f91dbfbb3fe..4c2ea0f2da9e89501a66832e4ac670e4cc789e5e 100644 (file)
@@ -23,6 +23,9 @@
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/edsp.h>
+#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
 
 #include <sys/types.h>
 #include <cstdlib>
@@ -1032,7 +1035,7 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
                     if (BrokenFix == false || DoUpgrade(I) == false)
                     {
                        // Consider other options
-                       if (InOr == false)
+                       if (InOr == false || Cache[I].Garbage == true)
                        {
                           if (Debug == true)
                              clog << "  Removing " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl;
@@ -1206,7 +1209,6 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
    return true;
 }
                                                                        /*}}}*/
-
 // ProblemResolver::BreaksInstOrPolicy - Check if the given pkg is broken/*{{{*/
 // ---------------------------------------------------------------------
 /* This checks if the given package is broken either by a hard dependency
@@ -1230,7 +1232,7 @@ bool pkgProblemResolver::InstOrNewPolicyBroken(pkgCache::PkgIterator I)
        
    return false;
 }
-
+                                                                       /*}}}*/
 // ProblemResolver::ResolveByKeep - Resolve problems using keep                /*{{{*/
 // ---------------------------------------------------------------------
 /* This is the work horse of the soft upgrade routine. It is very gental 
@@ -1436,7 +1438,7 @@ void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List)
    qsort(List,Count,sizeof(*List),PrioComp);
 }
                                                                        /*}}}*/
-// CacheFile::ListUpdate - update the cache files                      /*{{{*/
+// ListUpdate - update the cache files                                 /*{{{*/
 // ---------------------------------------------------------------------
 /* This is a simple wrapper to update the cache. it will fetch stuff
  * from the network (or any other sources defined in sources.list)
index 86d5fbd5309d28439680524258fb0167b52aaf56..948fe110312689e06d05130a5e1e849a388d5692 100644 (file)
 
 #include <apt-pkg/packagemanager.h>
 #include <apt-pkg/depcache.h>
-#include <apt-pkg/acquire.h>
 
 #include <iostream>
 
-using std::ostream;
+class pkgAcquireStatus;
 
 class pkgSimulate : public pkgPackageManager                           /*{{{*/
 {
@@ -63,13 +62,13 @@ class pkgSimulate : public pkgPackageManager                                /*{{{*/
    pkgDepCache::ActionGroup group;
    
    // The Actuall installation implementation
-   virtual bool Install(PkgIterator Pkg,string File);
+   virtual bool Install(PkgIterator Pkg,std::string File);
    virtual bool Configure(PkgIterator Pkg);
    virtual bool Remove(PkgIterator Pkg,bool Purge);
 
 private:
    void ShortBreaks();
-   void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate);
+   void Describe(PkgIterator iPkg,std::ostream &out,bool Current,bool Candidate);
    
    public:
 
index e1bc94f31302230051edd4986274a9c8d4da78e6..7441b452c9537d01472a500e7f2c7165b10e93da 100644 (file)
@@ -59,10 +59,10 @@ const Configuration::getCompressionTypes(bool const &Cached) {
                if ((*o).empty() == true)
                        continue;
                // ignore types we have no method ready to use
-               if (_config->Exists(string("Acquire::CompressionTypes::").append(*o)) == false)
+               if (_config->Exists(std::string("Acquire::CompressionTypes::").append(*o)) == false)
                        continue;
                // ignore types we have no app ready to use
-               string const appsetting = string("Dir::Bin::").append(*o);
+               std::string const appsetting = std::string("Dir::Bin::").append(*o);
                if (_config->Exists(appsetting) == true) {
                        std::string const app = _config->FindFile(appsetting.c_str(), "");
                        if (app.empty() == false && FileExists(app) == false)
@@ -83,7 +83,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
                if (std::find(types.begin(),types.end(),Types->Tag) != types.end())
                        continue;
                // ignore types we have no app ready to use
-               string const appsetting = string("Dir::Bin::").append(Types->Value);
+               std::string const appsetting = std::string("Dir::Bin::").append(Types->Value);
                if (appsetting.empty() == false && _config->Exists(appsetting) == true) {
                        std::string const app = _config->FindFile(appsetting.c_str(), "");
                        if (app.empty() == false && FileExists(app) == false)
@@ -95,7 +95,7 @@ const Configuration::getCompressionTypes(bool const &Cached) {
        // add the special "uncompressed" type
        if (std::find(types.begin(), types.end(), "uncompressed") == types.end())
        {
-               string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
+               std::string const uncompr = _config->FindFile("Dir::Bin::uncompressed", "");
                if (uncompr.empty() == true || FileExists(uncompr) == true)
                        types.push_back("uncompressed");
        }
@@ -142,7 +142,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
                for (struct dirent *Ent = readdir(D); Ent != 0; Ent = readdir(D)) {
                        string const name = Ent->d_name;
                        size_t const foundDash = name.rfind("-");
-                       size_t const foundUnderscore = name.rfind("_");
+                       size_t const foundUnderscore = name.rfind("_", foundDash);
                        if (foundDash == string::npos || foundUnderscore == string::npos ||
                            foundDash <= foundUnderscore ||
                            name.substr(foundUnderscore+1, foundDash-(foundUnderscore+1)) != "Translation")
@@ -153,7 +153,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
                        // Skip unusual files, like backups or that alike
                        string::const_iterator s = c.begin();
                        for (;s != c.end(); ++s) {
-                               if (isalpha(*s) == 0)
+                               if (isalpha(*s) == 0 && *s != '_')
                                        break;
                        }
                        if (s != c.end())
@@ -234,6 +234,8 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
                        codes = environment;
                } else if (forceLang != "none")
                        codes.push_back(forceLang);
+               else //if (forceLang == "none")
+                       builtin.clear();
                allCodes = codes;
                for (std::vector<string>::const_iterator b = builtin.begin();
                     b != builtin.end(); ++b)
@@ -441,7 +443,7 @@ Configuration::Compressor::Compressor(char const *name, char const *extension,
                                      char const *binary,
                                      char const *compressArg, char const *uncompressArg,
                                      unsigned short const cost) {
-       std::string const config = string("APT:Compressor::").append(name).append("::");
+       std::string const config = std::string("APT:Compressor::").append(name).append("::");
        Name = _config->Find(std::string(config).append("Name"), name);
        Extension = _config->Find(std::string(config).append("Extension"), extension);
        Binary = _config->Find(std::string(config).append("Binary"), binary);
index f38dfc58199e5e1ce6359c8a4784005cff0917ec..1b8d91a44951b31c37c1d9fcb112c8c77af437b9 100644 (file)
@@ -23,6 +23,7 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
index 243061f0fb24caf5a57acd4e403ed04d5678b92f..b56e4285563729516967c93b72d810f174efb791 100644 (file)
 #ifndef PKGLIB_CACHEFILE_H
 #define PKGLIB_CACHEFILE_H
 
-
 #include <apt-pkg/depcache.h>
-#include <apt-pkg/acquire.h>
-#include <apt-pkg/policy.h>
-#include <apt-pkg/sourcelist.h>
+#include <apt-pkg/macros.h>
+
+class pkgPolicy;
+class pkgSourceList;
+class OpProgress;
 
 class pkgCacheFile
 {
index b97a1a5894888b530fab5ed3165023d852bad4e3..5382f3838a0475f77537326d36f147bfc78e7b3b 100644 (file)
@@ -32,6 +32,7 @@
 #include<iterator>
 
 #include<string.h>
+
 // abstract Iterator template                                          /*{{{*/
 /* This template provides the very basic iterator methods we
    need to have for doing some walk-over-the-cache magic */
@@ -111,7 +112,7 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
 
        inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;};
        inline PkgIterator PackageList() const;
-       PkgIterator FindPkg(string Arch = "any") const;
+       PkgIterator FindPkg(std::string Arch = "any") const;
        /** \brief find the package with the "best" architecture
 
            The best architecture is either the "native" or the first
@@ -219,7 +220,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
        inline VerFileIterator FileList() const;
        bool Downloadable() const;
        inline const char *PriorityType() const {return Owner->Priority(S->Priority);};
-       string RelStr() const;
+       std::string RelStr() const;
 
        bool Automatic() const;
        VerFileIterator NewestFile() const;
@@ -365,7 +366,7 @@ class pkgCache::PkgFileIterator : public Iterator<PackageFile, PkgFileIterator>
        inline const char *IndexType() const {return S->IndexType == 0?0:Owner->StrP + S->IndexType;};
 
        bool IsOk();
-       string RelStr();
+       std::string RelStr();
 
        // Constructors
        inline PkgFileIterator() : Iterator<PackageFile, PkgFileIterator>() {};
index 386ecfb5fad83f4f7106348c6c79a7ba2e3dfec0..6b95eab709c3b9234d6acb600fef9b46165cfb35 100644 (file)
 #include <config.h>
 
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/cachefile.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/versionmatch.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/policy.h>
 
 #include <vector>
 
@@ -298,7 +301,7 @@ APT::VersionSet VersionSet::FromString(pkgCacheFile &Cache, std::string pkg,
        std::string ver;
        bool verIsRel = false;
        size_t const vertag = pkg.find_last_of("/=");
-       if (vertag != string::npos) {
+       if (vertag != std::string::npos) {
                ver = pkg.substr(vertag+1);
                verIsRel = (pkg[vertag] == '/');
                pkg.erase(vertag);
@@ -316,7 +319,7 @@ APT::VersionSet VersionSet::FromString(pkgCacheFile &Cache, std::string pkg,
                errors = helper.showErrors(false);
        for (PackageSet::const_iterator P = pkgset.begin();
             P != pkgset.end(); ++P) {
-               if (vertag == string::npos) {
+               if (vertag == std::string::npos) {
                        verset.insert(VersionSet::FromPackage(Cache, P, fallback, helper));
                        continue;
                }
index 061d0a2f49583e7944237aff12992da33de56f50..3b1118bdca181b9f39cf9785d06c82f7dc524da8 100644 (file)
 #include <set>
 #include <string>
 
-#include <apt-pkg/cachefile.h>
+#include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
                                                                        /*}}}*/
+
+class pkgCacheFile;
+
 namespace APT {
 class PackageSet;
 class VersionSet;
@@ -37,10 +40,10 @@ public:                                                                     /*{{{*/
                        ShowError(ShowError), ErrorType(ErrorType) {};
        virtual ~CacheSetHelper() {};
 
-       virtual void showTaskSelection(PackageSet const &pkgset, string const &pattern) {};
-       virtual void showRegExSelection(PackageSet const &pkgset, string const &pattern) {};
+       virtual void showTaskSelection(PackageSet const &pkgset, std::string const &pattern) {};
+       virtual void showRegExSelection(PackageSet const &pkgset, std::string const &pattern) {};
        virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
-                                string const &ver, bool const &verIsRel) {};
+                                std::string const &ver, bool const &verIsRel) {};
 
        virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str);
        virtual PackageSet canNotFindTask(pkgCacheFile &Cache, std::string pattern);
@@ -265,7 +268,7 @@ public:                                                                     /*{{{*/
                inline pkgCache::VerFileIterator FileList() const { return (**this).FileList(); };
                inline bool Downloadable() const { return (**this).Downloadable(); };
                inline const char *PriorityType() const { return (**this).PriorityType(); };
-               inline string RelStr() const { return (**this).RelStr(); };
+               inline std::string RelStr() const { return (**this).RelStr(); };
                inline bool Automatic() const { return (**this).Automatic(); };
                inline pkgCache::VerFileIterator NewestFile() const { return (**this).NewestFile(); };
        };
index 392cd890e648d0d520741277f886ffc05ff0419a..a9c63fd214386624dfcd75f3b3caa8808f104658 100644 (file)
@@ -8,6 +8,8 @@
 #include<apt-pkg/strutl.h>
 #include<apt-pkg/cdrom.h>
 #include<apt-pkg/aptconfiguration.h>
+#include<apt-pkg/configuration.h>
+#include<apt-pkg/fileutl.h>
 
 #include<sstream>
 #include<fstream>
index 614062cbb3293787de26f6fa6be2e530b82f991f..319254fd0b212983361226d85a8fc7fe8623ce7f 100644 (file)
@@ -1,12 +1,11 @@
 #ifndef PKGLIB_CDROM_H
 #define PKGLIB_CDROM_H
 
-#include<apt-pkg/init.h>
 #include<string>
 #include<vector>
 
-
-using namespace std;
+class Configuration;
+class OpProgress;
 
 class pkgCdromStatus                                                   /*{{{*/
 {
@@ -20,12 +19,12 @@ class pkgCdromStatus                                                        /*{{{*/
    // total steps
    virtual void SetTotal(int total) { totalSteps = total; };
    // update steps, will be called regularly as a "pulse"
-   virtual void Update(string text="", int current=0) = 0;
+   virtual void Update(std::string text="", int current=0) = 0;
    
    // ask for cdrom insert
    virtual bool ChangeCdrom() = 0;
    // ask for cdrom name
-   virtual bool AskCdromName(string &Name) = 0;
+   virtual bool AskCdromName(std::string &Name) = 0;
    // Progress indicator for the Index rewriter
    virtual OpProgress* GetOpProgress() {return NULL; };
 };
@@ -47,22 +46,22 @@ class pkgCdrom                                                              /*{{{*/
    };
 
 
-   bool FindPackages(string CD,
-                    vector<string> &List,
-                    vector<string> &SList, 
-                    vector<string> &SigList,
-                    vector<string> &TransList,
-                    string &InfoDir, pkgCdromStatus *log,
+   bool FindPackages(std::string CD,
+                    std::vector<std::string> &List,
+                    std::vector<std::string> &SList, 
+                    std::vector<std::string> &SigList,
+                    std::vector<std::string> &TransList,
+                    std::string &InfoDir, pkgCdromStatus *log,
                     unsigned int Depth = 0);
-   bool DropBinaryArch(vector<string> &List);
-   bool DropRepeats(vector<string> &List,const char *Name);
-   void ReduceSourcelist(string CD,vector<string> &List);
+   bool DropBinaryArch(std::vector<std::string> &List);
+   bool DropRepeats(std::vector<std::string> &List,const char *Name);
+   void ReduceSourcelist(std::string CD,std::vector<std::string> &List);
    bool WriteDatabase(Configuration &Cnf);
-   bool WriteSourceList(string Name,vector<string> &List,bool Source);
-   int Score(string Path);
+   bool WriteSourceList(std::string Name,std::vector<std::string> &List,bool Source);
+   int Score(std::string Path);
 
  public:
-   bool Ident(string &ident, pkgCdromStatus *log);
+   bool Ident(std::string &ident, pkgCdromStatus *log);
    bool Add(pkgCdromStatus *log);
 };
                                                                        /*}}}*/
@@ -71,9 +70,9 @@ class pkgCdrom                                                                /*{{{*/
 // class that uses libudev to find cdrom/removable devices dynamically
 struct CdromDevice                                                     /*{{{*/
 {
-   string DeviceName;
+   std::string DeviceName;
    bool Mounted;
-   string MountPath;
+   std::string MountPath;
 };
                                                                        /*}}}*/
 class pkgUdevCdromDevices                                              /*{{{*/
@@ -104,9 +103,9 @@ class pkgUdevCdromDevices                                           /*{{{*/
 
    // convenience interface, this will just call ScanForRemovable
    // with "APT::cdrom::CdromOnly"
-   vector<CdromDevice> Scan();
+   std::vector<CdromDevice> Scan();
 
-   vector<CdromDevice> ScanForRemovable(bool CdromOnly);
+   std::vector<CdromDevice> ScanForRemovable(bool CdromOnly);
 };
                                                                        /*}}}*/
 
index 1f96e941b22ef4e333ad240ba5f4f8bbc961892b..ed8fa1aa9c8dabac4ee5080b11cd2c901a275065 100644 (file)
@@ -15,6 +15,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/fileutl.h>
 
 #include <dirent.h>
 #include <sys/stat.h>
@@ -26,7 +27,7 @@
 // ---------------------------------------------------------------------
 /* Scan the directory for files to erase, we check the version information
    against our database to see if it is interesting */
-bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
+bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache)
 {
    bool CleanInstalled = _config->FindB("APT::Clean-Installed",true);
       
@@ -34,7 +35,7 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
    if (D == 0)
       return _error->Errno("opendir",_("Unable to read %s"),Dir.c_str());
 
-   string StartDir = SafeGetCWD();
+   std::string StartDir = SafeGetCWD();
    if (chdir(Dir.c_str()) != 0)
    {
       closedir(D);
@@ -63,21 +64,21 @@ bool pkgArchiveCleaner::Go(string Dir,pkgCache &Cache)
       for (; *I != 0 && *I != '_';I++);
       if (*I != '_')
         continue;
-      string Pkg = DeQuoteString(string(Dir->d_name,I-Dir->d_name));
+      std::string Pkg = DeQuoteString(std::string(Dir->d_name,I-Dir->d_name));
 
       // Grab the version
       const char *Start = I + 1;
       for (I = Start; *I != 0 && *I != '_';I++);
       if (*I != '_')
         continue;
-      string Ver = DeQuoteString(string(Start,I-Start));
+      std::string Ver = DeQuoteString(std::string(Start,I-Start));
   
       // Grab the arch
       Start = I + 1;
       for (I = Start; *I != 0 && *I != '.' ;I++);
       if (*I != '.')
         continue;
-      string const Arch = DeQuoteString(string(Start,I-Start));
+      std::string const Arch = DeQuoteString(std::string(Start,I-Start));
       
       if (APT::Configuration::checkArchitecture(Arch) == false)
         continue;
index 1ebf68dc94d91fab50a46d3f43457daa45e9735d..ad4049e839e67cef1624d2ca60a9cde290d4998c 100644 (file)
@@ -20,11 +20,11 @@ class pkgArchiveCleaner
 
    protected:
    
-   virtual void Erase(const char * /*File*/,string /*Pkg*/,string /*Ver*/,struct stat & /*St*/) {};
+   virtual void Erase(const char * /*File*/,std::string /*Pkg*/,std::string /*Ver*/,struct stat & /*St*/) {};
 
    public:   
    
-   bool Go(string Dir,pkgCache &Cache);
+   bool Go(std::string Dir,pkgCache &Cache);
    virtual ~pkgArchiveCleaner() {};
 };
 
index 9de795b60d92e25a212fa2e0bf5ac5bfac6b4d6e..187f6bd5997eb96af56a0b050137094d0d881d69 100644 (file)
@@ -30,6 +30,8 @@
 #include <apti18n.h>
                                                                        /*}}}*/
 
+using std::string;
+
 // IsMounted - Returns true if the mount point is mounted              /*{{{*/
 // ---------------------------------------------------------------------
 /* This is a simple algorithm that should always work, we stat the mount point
index 38ed2996ee79d0a3a4b8815c37a525bcaae39476..2c6afac0fbe7f97841d941a8b56a41478b5bb9bf 100644 (file)
 
 #include <string>
 
-using std::string;
-
 // mount cdrom, DeviceName (e.g. /dev/sr0) is optional
-bool MountCdrom(string Path, string DeviceName="");
-bool UnmountCdrom(string Path);
-bool IdentCdrom(string CD,string &Res,unsigned int Version = 2);
-bool IsMounted(string &Path);
-string FindMountPointForDevice(const char *device);
+bool MountCdrom(std::string Path, std::string DeviceName="");
+bool UnmountCdrom(std::string Path);
+bool IdentCdrom(std::string CD,std::string &Res,unsigned int Version = 2);
+bool IsMounted(std::string &Path);
+std::string FindMountPointForDevice(const char *device);
 
 #endif
index 34e90da207c0578cf02d4368f4de066f0b4fa33e..997f26bc7541b61a2d106256658c94d82c0a69e8 100644 (file)
@@ -13,6 +13,7 @@
 // Include files                                                       /*{{{*/
 #include<config.h>
 
+#include <apt-pkg/configuration.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
index 7c0c71aa7b83abef8b962fc4e679fe720c64da81..b201d98550d62aaffad9941b7fc5f5cd9cdda4c8 100644 (file)
@@ -44,9 +44,7 @@
 #ifndef PKGLIB_CMNDLINE_H
 #define PKGLIB_CMNDLINE_H
 
-
-
-#include <apt-pkg/configuration.h>
+class Configuration;
 
 class CommandLine
 {
index 2844ec0977c7b9478384accf2d3a49ee03c59697..f6f2a3c1d7e5a46c19b90b23e1c141c40903874e 100644 (file)
 #include <vector>
 #include <iostream>
 
-using std::string;
-
 class Configuration
 {
    public:
    
    struct Item
    {
-      string Value;
-      string Tag;
+      std::string Value;
+      std::string Tag;
       Item *Parent;
       Item *Child;
       Item *Next;
       
-      string FullTag(const Item *Stop = 0) const;
+      std::string FullTag(const Item *Stop = 0) const;
       
       Item() : Parent(0), Child(0), Next(0) {};
    };
@@ -67,35 +65,35 @@ class Configuration
    
    public:
 
-   string Find(const char *Name,const char *Default = 0) const;
-   string Find(string const &Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
-   string Find(string const &Name, string const &Default) const {return Find(Name.c_str(),Default.c_str());};
-   string FindFile(const char *Name,const char *Default = 0) const;
-   string FindDir(const char *Name,const char *Default = 0) const;
-   std::vector<string> FindVector(const char *Name) const;
-   std::vector<string> FindVector(string const &Name) const { return FindVector(Name.c_str()); };
+   std::string Find(const char *Name,const char *Default = 0) const;
+   std::string Find(std::string const &Name,const char *Default = 0) const {return Find(Name.c_str(),Default);};
+   std::string Find(std::string const &Name, std::string const &Default) const {return Find(Name.c_str(),Default.c_str());};
+   std::string FindFile(const char *Name,const char *Default = 0) const;
+   std::string FindDir(const char *Name,const char *Default = 0) const;
+   std::vector<std::string> FindVector(const char *Name) const;
+   std::vector<std::string> FindVector(std::string const &Name) const { return FindVector(Name.c_str()); };
    int FindI(const char *Name,int const &Default = 0) const;
-   int FindI(string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
+   int FindI(std::string const &Name,int const &Default = 0) const {return FindI(Name.c_str(),Default);};
    bool FindB(const char *Name,bool const &Default = false) const;
-   bool FindB(string const &Name,bool const &Default = false) const {return FindB(Name.c_str(),Default);};
-   string FindAny(const char *Name,const char *Default = 0) const;
+   bool FindB(std::string const &Name,bool const &Default = false) const {return FindB(Name.c_str(),Default);};
+   std::string FindAny(const char *Name,const char *Default = 0) const;
              
-   inline void Set(const string &Name,const string &Value) {Set(Name.c_str(),Value);};
-   void CndSet(const char *Name,const string &Value);
+   inline void Set(const std::string &Name,const std::string &Value) {Set(Name.c_str(),Value);};
+   void CndSet(const char *Name,const std::string &Value);
    void CndSet(const char *Name,const int Value);
-   void Set(const char *Name,const string &Value);
+   void Set(const char *Name,const std::string &Value);
    void Set(const char *Name,const int &Value);
    
-   inline bool Exists(const string &Name) const {return Exists(Name.c_str());};
+   inline bool Exists(const std::string &Name) const {return Exists(Name.c_str());};
    bool Exists(const char *Name) const;
    bool ExistsAny(const char *Name) const;
 
    // clear a whole tree
-   void Clear(const string &Name);
+   void Clear(const std::string &Name);
 
    // remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
-   void Clear(string const &List, string const &Value);
-   void Clear(string const &List, int const &Value);
+   void Clear(std::string const &List, std::string const &Value);
+   void Clear(std::string const &List, int const &Value);
 
    inline const Item *Tree(const char *Name) const {return Lookup(Name);};
 
@@ -127,11 +125,11 @@ class Configuration
 
 extern Configuration *_config;
 
-bool ReadConfigFile(Configuration &Conf,const string &FName,
+bool ReadConfigFile(Configuration &Conf,const std::string &FName,
                    bool const &AsSectional = false,
                    unsigned const &Depth = 0);
 
-bool ReadConfigDir(Configuration &Conf,const string &Dir,
+bool ReadConfigDir(Configuration &Conf,const std::string &Dir,
                   bool const &AsSectional = false,
                   unsigned const &Depth = 0);
 
index 973a38cff6841cf22834c4a7243df74bb8565086..0d0451a460d856abd396aff6ccc3f930d7528dbe 100644 (file)
@@ -31,8 +31,6 @@
 /* Define this for python-apt */
 #define APT_HAS_GZIP 1
 
-using std::string;
-
 class FileFd
 {
    protected:
@@ -41,8 +39,8 @@ class FileFd
    enum LocalFlags {AutoClose = (1<<0),Fail = (1<<1),DelOnFail = (1<<2),
                     HitEof = (1<<3), Replace = (1<<4) };
    unsigned long Flags;
-   string FileName;
-   string TemporaryFileName;
+   std::string FileName;
+   std::string TemporaryFileName;
    gzFile gz;
 
    public:
@@ -79,7 +77,7 @@ class FileFd
        return T;
    }
 
-   bool Open(string FileName,OpenMode Mode,unsigned long Perms = 0666);
+   bool Open(std::string FileName,OpenMode Mode,unsigned long Perms = 0666);
    bool OpenDescriptor(int Fd, OpenMode Mode, bool AutoClose=false);
    bool Close();
    bool Sync();
@@ -93,9 +91,9 @@ class FileFd
    inline void EraseOnFailure() {Flags |= DelOnFail;};
    inline void OpFail() {Flags |= Fail;};
    inline bool Eof() {return (Flags & HitEof) == HitEof;};
-   inline string &Name() {return FileName;};
+   inline std::string &Name() {return FileName;};
    
-   FileFd(string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1), 
+   FileFd(std::string FileName,OpenMode Mode,unsigned long Perms = 0666) : iFd(-1), 
             Flags(0), gz(NULL)
    {
       Open(FileName,Mode,Perms);
@@ -107,12 +105,12 @@ class FileFd
 
 bool RunScripts(const char *Cnf);
 bool CopyFile(FileFd &From,FileFd &To);
-int GetLock(string File,bool Errors = true);
-bool FileExists(string File);
-bool RealFileExists(string File);
-bool DirectoryExists(string const &Path) __attrib_const;
-bool CreateDirectory(string const &Parent, string const &Path);
-time_t GetModificationTime(string const &Path);
+int GetLock(std::string File,bool Errors = true);
+bool FileExists(std::string File);
+bool RealFileExists(std::string File);
+bool DirectoryExists(std::string const &Path) __attrib_const;
+bool CreateDirectory(std::string const &Parent, std::string const &Path);
+time_t GetModificationTime(std::string const &Path);
 
 /** \brief Ensure the existence of the given Path
  *
@@ -120,13 +118,13 @@ time_t GetModificationTime(string const &Path);
  *  /apt/ will be removed before CreateDirectory call.
  *  \param Path which should exist after (successful) call
  */
-bool CreateAPTDirectoryIfNeeded(string const &Parent, string const &Path);
+bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path);
 
-std::vector<string> GetListOfFilesInDir(string const &Dir, string const &Ext,
+std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::string const &Ext,
                                        bool const &SortList, bool const &AllowNoExt=false);
-std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> const &Ext,
+std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::vector<std::string> const &Ext,
                                        bool const &SortList);
-string SafeGetCWD();
+std::string SafeGetCWD();
 void SetCloseExec(int Fd,bool Close);
 void SetNonBlock(int Fd,bool Block);
 bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
@@ -134,10 +132,10 @@ pid_t ExecFork();
 bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
 
 // File string manipulators
-string flNotDir(string File);
-string flNotFile(string File);
-string flNoLink(string File);
-string flExtension(string File);
-string flCombine(string Dir,string File);
+std::string flNotDir(std::string File);
+std::string flNotFile(std::string File);
+std::string flNoLink(std::string File);
+std::string flExtension(std::string File);
+std::string flCombine(std::string Dir,std::string File);
 
 #endif
index fd76bf22998c44e764b78306d1fa17d8140da42e..05001f042102a3bdb4f1f645b7a73f9e1614fe4d 100644 (file)
@@ -32,20 +32,20 @@ HashString::HashString()
 {
 }
 
-HashString::HashString(string Type, string Hash) : Type(Type), Hash(Hash)
+HashString::HashString(std::string Type, std::string Hash) : Type(Type), Hash(Hash)
 {
 }
 
-HashString::HashString(string StringedHash)                            /*{{{*/
+HashString::HashString(std::string StringedHash)                       /*{{{*/
 {
    // legacy: md5sum without "MD5Sum:" prefix
-   if (StringedHash.find(":") == string::npos && StringedHash.size() == 32)
+   if (StringedHash.find(":") == std::string::npos && StringedHash.size() == 32)
    {
       Type = "MD5Sum";
       Hash = StringedHash;
       return;
    }
-   string::size_type pos = StringedHash.find(":");
+   std::string::size_type pos = StringedHash.find(":");
    Type = StringedHash.substr(0,pos);
    Hash = StringedHash.substr(pos+1, StringedHash.size() - pos);
 
@@ -53,34 +53,34 @@ HashString::HashString(string StringedHash)                         /*{{{*/
       std::clog << "HashString(string): " << Type << " : " << Hash << std::endl;
 }
                                                                        /*}}}*/
-bool HashString::VerifyFile(string filename) const                     /*{{{*/
+bool HashString::VerifyFile(std::string filename) const                        /*{{{*/
 {
-   string fileHash;
+   std::string fileHash;
 
    FileFd Fd(filename, FileFd::ReadOnly);
    if(Type == "MD5Sum")
    {
       MD5Summation MD5;
       MD5.AddFD(Fd.Fd(), Fd.Size());
-      fileHash = (string)MD5.Result();
+      fileHash = (std::string)MD5.Result();
    }
    else if (Type == "SHA1")
    {
       SHA1Summation SHA1;
       SHA1.AddFD(Fd.Fd(), Fd.Size());
-      fileHash = (string)SHA1.Result();
+      fileHash = (std::string)SHA1.Result();
    }
    else if (Type == "SHA256")
    {
       SHA256Summation SHA256;
       SHA256.AddFD(Fd.Fd(), Fd.Size());
-      fileHash = (string)SHA256.Result();
+      fileHash = (std::string)SHA256.Result();
    }
    else if (Type == "SHA512")
    {
       SHA512Summation SHA512;
       SHA512.AddFD(Fd.Fd(), Fd.Size());
-      fileHash = (string)SHA512.Result();
+      fileHash = (std::string)SHA512.Result();
    }
    Fd.Close();
 
@@ -100,9 +100,9 @@ bool HashString::empty() const
    return (Type.empty() || Hash.empty());
 }
 
-string HashString::toStr() const
+std::string HashString::toStr() const
 {
-   return Type+string(":")+Hash;
+   return Type + std::string(":") + Hash;
 }
 
 // Hashes::AddFD - Add the contents of the FD                          /*{{{*/
@@ -117,7 +117,7 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
    while (Size != 0 || ToEOF)
    {
       unsigned long long n = sizeof(Buf);
-      if (!ToEOF) n = min(Size, n);
+      if (!ToEOF) n = std::min(Size, n);
       Res = read(Fd,Buf,n);
       if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
         return false;
index 40c2ad064f5b286d5cd95c99a050579ef55599e5..81851dedeb2d3b0f47c6de3a9f06ccedf24394c4 100644 (file)
 #include <vector>
 #include <cstring>
 
-using std::min;
-using std::vector;
-
 // helper class that contains hash function name
 // and hash
 class HashString
 {
  protected:
-   string Type;
-   string Hash;
+   std::string Type;
+   std::string Hash;
    static const char * _SupportedHashes[10];
 
  public:
-   HashString(string Type, string Hash);
-   HashString(string StringedHashString);  // init from str as "type:hash"
+   HashString(std::string Type, std::string Hash);
+   HashString(std::string StringedHashString);  // init from str as "type:hash"
    HashString();
 
    // get hash type used
-   string HashType() { return Type; };
+   std::string HashType() { return Type; };
 
    // verify the given filename against the currently loaded hash
-   bool VerifyFile(string filename) const;
+   bool VerifyFile(std::string filename) const;
 
    // helper
-   string toStr() const;                    // convert to str as "type:hash"
+   std::string toStr() const;                    // convert to str as "type:hash"
    bool empty() const;
 
    // return the list of hashes we support
index 0edcbb3643acb50bd1d5e03289dc77520c654223..ff3b112bbff98f02df871d1c0e55f40387d43831 100644 (file)
@@ -14,7 +14,7 @@ bool SummationImplementation::AddFD(int const Fd, unsigned long long Size) {
    while (Size != 0 || ToEOF)
    {
       unsigned long long n = sizeof(Buf);
-      if (!ToEOF) n = min(Size, n);
+      if (!ToEOF) n = std::min(Size, n);
       Res = read(Fd, Buf, n);
       if (Res < 0 || (!ToEOF && Res != (ssize_t) n)) // error, or short read
         return false;
index 9157754e36fe26916b4a73f2ea4d09fadde10b16..27d192b82ad92e61c3226bd2b00d30961ed928ad 100644 (file)
@@ -15,9 +15,6 @@
 #include <algorithm>
 #include <stdint.h>
 
-using std::string;
-using std::min;
-
 template<int N>
 class HashSumValue
 {
@@ -29,9 +26,13 @@ class HashSumValue
    bool operator ==(const HashSumValue &rhs) const
    {
       return memcmp(Sum,rhs.Sum,sizeof(Sum)) == 0;
-   }; 
+   };
+   bool operator !=(const HashSumValue &rhs) const
+   {
+      return memcmp(Sum,rhs.Sum,sizeof(Sum)) != 0;
+   };
 
-   string Value() const
+   std::string Value() const
    {
       char Conv[16] =
       { '0','1','2','3','4','5','6','7','8','9','a','b',
@@ -48,7 +49,7 @@ class HashSumValue
          Result[I] = Conv[Sum[J] >> 4];
          Result[I + 1] = Conv[Sum[J] & 0xF];
       }
-      return string(Result);
+      return std::string(Result);
    };
    
    inline void Value(unsigned char S[N/8])
@@ -57,12 +58,12 @@ class HashSumValue
          S[I] = Sum[I];
    };
 
-   inline operator string() const 
+   inline operator std::string() const 
    {
       return Value();
    };
 
-   bool Set(string Str) 
+   bool Set(std::string Str) 
    {
       return Hex2Num(Str,Sum,sizeof(Sum));
    };
@@ -73,7 +74,7 @@ class HashSumValue
          Sum[I] = S[I];
    };
 
-   HashSumValue(string Str) 
+   HashSumValue(std::string Str) 
    {
          memset(Sum,0,sizeof(Sum));
          Set(Str);
index 305cdb20df2018c293b2e705738c58f52e77a7e3..a207da4e4f8d6615379549cf900f1d8ea4cfbe8e 100644 (file)
@@ -29,9 +29,6 @@
 #include <algorithm>
 #include <stdint.h>
 
-using std::string;
-using std::min;
-
 #include "hashsum_template.h"
 
 typedef HashSumValue<128> MD5SumValue;
index a110a70195cd39783705f2f6096dbd69645f609f..f76169a92dea39e5c341eb3583942b20bd5856fc 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <apt-pkg/mmap.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
 
 #include <sys/mman.h>
 #include <sys/stat.h>
index e0ff8db95049f494299a5a835c1caba9cd9463cc..2ed4a95f8be576335b30cdc796911b3ebd3a9c90 100644 (file)
@@ -27,9 +27,8 @@
 
 
 #include <string>
-#include <apt-pkg/fileutl.h>
 
-using std::string;
+class FileFd;
 
 /* This should be a 32 bit type, larger tyes use too much ram and smaller
    types are too small. Where ever possible 'unsigned long' should be used
@@ -102,7 +101,7 @@ class DynamicMMap : public MMap
    unsigned long RawAllocate(unsigned long long Size,unsigned long Aln = 0);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long WriteString(const char *String,unsigned long Len = (unsigned long)-1);
-   inline unsigned long WriteString(const string &S) {return WriteString(S.c_str(),S.length());};
+   inline unsigned long WriteString(const std::string &S) {return WriteString(S.c_str(),S.length());};
    void UsePools(Pool &P,unsigned int Count) {Pools = &P; PoolCount = Count;};
    
    DynamicMMap(FileFd &F,unsigned long Flags,unsigned long const &WorkSpace = 2*1024*1024,
index b9d0749e2b8dc9c5baddb080f1f660d6eda9bec0..cb7d36088c5d46b57502adcfb35c996d61577ea6 100644 (file)
@@ -14,7 +14,9 @@
 #include <config.h>
 
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
+
 #include <iostream>
 #include <stdio.h>
 #include <stdlib.h>
@@ -24,6 +26,7 @@
 
 #include "netrc.h"
 
+using std::string;
 
 /* Get user and password from .netrc when given a machine name */
 
index 02a5eb09f480c03dc3580984ecf59a4f2796fd4a..7b94eba88a4c5dc7b5c6380305e2ae8e808a636c 100644 (file)
 #ifndef NETRC_H
 #define NETRC_H
 
-#include <apt-pkg/strutl.h>
+#include <string>
 
 #define DOT_CHAR "."
 #define DIR_CHAR "/"
 
+class URI;
+
 // Assume: password[0]=0, host[0] != 0.
 // If login[0] = 0, search for login and password within a machine section
 // in the netrc.
 // If login[0] != 0, search for password within machine and login.
 int parsenetrc (char *host, char *login, char *password, char *filename);
 
-void maybe_add_auth (URI &Uri, string NetRCFile);
+void maybe_add_auth (URI &Uri, std::string NetRCFile);
 #endif
index 5344323f6379e3953d3eebf682c03c34bad960fe..7635719bc348a4a08d8eb5d64d9a87c6f287c784 100644 (file)
@@ -25,8 +25,6 @@
 #include <string>
 #include <sys/time.h>
 
-using std::string;
-
 class Configuration;
 class OpProgress
 {
@@ -38,13 +36,13 @@ class OpProgress
    
    // Change reduction code
    struct timeval LastTime;
-   string LastOp;
-   string LastSubOp;
+   std::string LastOp;
+   std::string LastSubOp;
    
    protected:
    
-   string Op;
-   string SubOp;
+   std::string Op;
+   std::string SubOp;
    float Percent;
    
    bool MajorChange;
@@ -55,9 +53,9 @@ class OpProgress
    public:
    
    void Progress(unsigned long long Current);
-   void SubProgress(unsigned long long SubTotal, const string &Op = "", float const Percent = -1);
+   void SubProgress(unsigned long long SubTotal, const std::string &Op = "", float const Percent = -1);
    void OverallProgress(unsigned long long Current,unsigned long long Total,
-                       unsigned long long Size,const string &Op);
+                       unsigned long long Size,const std::string &Op);
    virtual void Done() {};
    
    OpProgress();
@@ -67,8 +65,8 @@ class OpProgress
 class OpTextProgress : public OpProgress
 {
    protected:
-   
-   string OldOp;
+
+   std::string OldOp;
    bool NoUpdate;
    bool NoDisplay;
    unsigned long LastLen;
index 916faec1bca5cd9e5d3b9adf968ae0a62e44becf..b4b139a222bdf2194b69a15356e257842aa3e072 100644 (file)
@@ -18,9 +18,6 @@
 #include <cstring>
 #include <algorithm>
 
-using std::string;
-using std::min;
-
 #include "hashsum_template.h"
 
 typedef  HashSumValue<160> SHA1SumValue;
index ab4b547225676252de0c1f2e47a52658a7afe0df..93f4bef4f383cb04e923199cbaaa969607de0910 100644 (file)
 
 #include "macros.h"
 
-using std::string;
-using std::vector;
-using std::ostream;
-
-bool UTF8ToCodeset(const char *codeset, const string &orig, string *dest);
+bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
 char *_strstrip(char *String);
 char *_strtabexpand(char *String,size_t Len);
-bool ParseQuoteWord(const char *&String,string &Res);
-bool ParseCWord(const char *&String,string &Res);
-string QuoteString(const string &Str,const char *Bad);
-string DeQuoteString(const string &Str);
-string DeQuoteString(string::const_iterator const &begin, string::const_iterator const &end);
+bool ParseQuoteWord(const char *&String,std::string &Res);
+bool ParseCWord(const char *&String,std::string &Res);
+std::string QuoteString(const std::string &Str,const char *Bad);
+std::string DeQuoteString(const std::string &Str);
+std::string DeQuoteString(std::string::const_iterator const &begin, std::string::const_iterator const &end);
 
 // unescape (\0XX and \xXX) from a string
-string DeEscapeString(const string &input);
-
-string SizeToStr(double Bytes);
-string TimeToStr(unsigned long Sec);
-string Base64Encode(const string &Str);
-string OutputInDepth(const unsigned long Depth, const char* Separator="  ");
-string URItoFileName(const string &URI);
-string TimeRFC1123(time_t Date);
+std::string DeEscapeString(const std::string &input);
+
+std::string SizeToStr(double Bytes);
+std::string TimeToStr(unsigned long Sec);
+std::string Base64Encode(const std::string &Str);
+std::string OutputInDepth(const unsigned long Depth, const char* Separator="  ");
+std::string URItoFileName(const std::string &URI);
+std::string TimeRFC1123(time_t Date);
 bool RFC1123StrToTime(const char* const str,time_t &time) __must_check;
 bool FTPMDTMStrToTime(const char* const str,time_t &time) __must_check;
-__deprecated 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);
+__deprecated bool StrToTime(const std::string &Val,time_t &Result);
+std::string LookupTag(const std::string &Message,const char *Tag,const char *Default = 0);
+int StringToBool(const std::string &Text,int Default = -1);
+bool ReadMessages(int Fd, std::vector<std::string> &List);
 bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base = 0);
 bool StrToNum(const char *Str,unsigned long long &Res,unsigned Len,unsigned Base = 0);
 bool Base256ToNum(const char *Str,unsigned long &Res,unsigned int Len);
-bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
+bool Hex2Num(const std::string &Str,unsigned char *Num,unsigned int Length);
 bool TokSplitString(char Tok,char *Input,char **List,
                    unsigned long ListMax);
-vector<string> VectorizeString(string const &haystack, char const &split) __attrib_const;
-void ioprintf(ostream &out,const char *format,...) __like_printf(2);
-void strprintf(string &out,const char *format,...) __like_printf(2);
+std::vector<std::string> VectorizeString(std::string const &haystack, char const &split) __attrib_const;
+void ioprintf(std::ostream &out,const char *format,...) __like_printf(2);
+void strprintf(std::string &out,const char *format,...) __like_printf(2);
 char *safe_snprintf(char *Buffer,char *End,const char *Format,...) __like_printf(3);
-bool CheckDomainList(const string &Host, const string &List);
+bool CheckDomainList(const std::string &Host, const std::string &List);
 int tolower_ascii(int const c) __attrib_const __hot;
-string StripEpoch(const string &VerStr);
+std::string StripEpoch(const std::string &VerStr);
 
 #define APT_MKSTRCMP(name,func) \
 inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));}; \
 inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));}; \
-inline int name(const string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
-inline int name(const string& A,const string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
-inline int name(const string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
+inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));}; \
+inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());}; \
+inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);};
 
 #define APT_MKSTRCMP2(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 string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
-inline int name(const string& A,const string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
-inline int name(const string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
+inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));}; \
+inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());}; \
+inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);};
 
 int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
 int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd);
@@ -89,17 +85,17 @@ int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd)
    case the definition of string::const_iterator is not the same as
    const char * and we need these extra functions */
 #if __GNUC__ >= 3
-int stringcmp(string::const_iterator A,string::const_iterator AEnd,
+int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd,
              const char *B,const char *BEnd);
-int stringcmp(string::const_iterator A,string::const_iterator AEnd,
-             string::const_iterator B,string::const_iterator BEnd);
-int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
+int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd,
+             std::string::const_iterator B,std::string::const_iterator BEnd);
+int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
                  const char *B,const char *BEnd);
-int stringcasecmp(string::const_iterator A,string::const_iterator AEnd,
-                  string::const_iterator B,string::const_iterator BEnd);
+int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd,
+                  std::string::const_iterator B,std::string::const_iterator BEnd);
 
-inline int stringcmp(string::const_iterator A,string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
-inline int stringcasecmp(string::const_iterator A,string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
+inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));};
+inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));};
 #endif
 
 APT_MKSTRCMP2(stringcmp,stringcmp);
@@ -109,34 +105,34 @@ inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);};
 
 class URI
 {
-   void CopyFrom(const string &From);
+   void CopyFrom(const std::string &From);
                 
    public:
    
-   string Access;
-   string User;
-   string Password;
-   string Host;
-   string Path;
+   std::string Access;
+   std::string User;
+   std::string Password;
+   std::string Host;
+   std::string Path;
    unsigned int Port;
    
-   operator string();
-   inline void operator =(const string &From) {CopyFrom(From);};
+   operator std::string();
+   inline void operator =(const std::string &From) {CopyFrom(From);};
    inline bool empty() {return Access.empty();};
-   static string SiteOnly(const string &URI);
-   static string NoUserPassword(const string &URI);
+   static std::string SiteOnly(const std::string &URI);
+   static std::string NoUserPassword(const std::string &URI);
    
-   URI(string Path) {CopyFrom(Path);};
+   URI(std::string Path) {CopyFrom(Path);};
    URI() : Port(0) {};
 };
 
 struct SubstVar
 {
    const char *Subst;
-   const string *Contents;
+   const std::string *Contents;
 };
-string SubstVar(string Str,const struct SubstVar *Vars);
-string SubstVar(const string &Str,const string &Subst,const string &Contents);
+std::string SubstVar(std::string Str,const struct SubstVar *Vars);
+std::string SubstVar(const std::string &Str,const std::string &Subst,const std::string &Contents);
 
 struct RxChoiceList
 {
index 678c22473253f7415709891ef4ce4091f0609dc0..9e64d44769562c090640b1e7769fbfdef7ccc915 100644 (file)
@@ -26,14 +26,14 @@ class debStatusIndex : public pkgIndexFile
    void *d;
 
    protected:
-   string File;
+   std::string File;
 
    public:
 
    virtual const Type *GetType() const;
    
    // Interface for acquire
-   virtual string Describe(bool Short) const {return File;};
+   virtual std::string Describe(bool Short) const {return File;};
    
    // Interface for the Cache Generator
    virtual bool Exists() const;
@@ -43,7 +43,7 @@ class debStatusIndex : public pkgIndexFile
    bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog, unsigned long const Flag) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
-   debStatusIndex(string File);
+   debStatusIndex(std::string File);
    virtual ~debStatusIndex() {};
 };
     
@@ -52,25 +52,25 @@ class debPackagesIndex : public pkgIndexFile
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;
 
-   string URI;
-   string Dist;
-   string Section;
-   string Architecture;
+   std::string URI;
+   std::string Dist;
+   std::string Section;
+   std::string Architecture;
 
-   string Info(const char *Type) const;
-   string IndexFile(const char *Type) const;
-   string IndexURI(const char *Type) const;
+   std::string Info(const char *Type) const;
+   std::string IndexFile(const char *Type) const;
+   std::string IndexURI(const char *Type) const;
    
    public:
    
    virtual const Type *GetType() const;
 
    // Stuff for accessing files on remote items
-   virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
-   virtual string ArchiveURI(string File) const {return URI + File;};
+   virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
+   virtual std::string ArchiveURI(std::string File) const {return URI + File;};
    
    // Interface for acquire
-   virtual string Describe(bool Short) const;   
+   virtual std::string Describe(bool Short) const;   
    
    // Interface for the Cache Generator
    virtual bool Exists() const;
@@ -79,8 +79,8 @@ class debPackagesIndex : public pkgIndexFile
    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
-   debPackagesIndex(string const &URI, string const &Dist, string const &Section,
-                       bool const &Trusted, string const &Arch = "native");
+   debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section,
+                       bool const &Trusted, std::string const &Arch = "native");
    virtual ~debPackagesIndex() {};
 };
 
@@ -89,23 +89,23 @@ class debTranslationsIndex : public pkgIndexFile
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;
 
-   string URI;
-   string Dist;
-   string Section;
+   std::string URI;
+   std::string Dist;
+   std::string Section;
    const char * const Language;
    
-   string Info(const char *Type) const;
-   string IndexFile(const char *Type) const;
-   string IndexURI(const char *Type) const;
+   std::string Info(const char *Type) const;
+   std::string IndexFile(const char *Type) const;
+   std::string IndexURI(const char *Type) const;
 
-   inline string TranslationFile() const {return string("Translation-").append(Language);};
+   inline std::string TranslationFile() const {return std::string("Translation-").append(Language);};
 
    public:
    
    virtual const Type *GetType() const;
 
    // Interface for acquire
-   virtual string Describe(bool Short) const;   
+   virtual std::string Describe(bool Short) const;   
    virtual bool GetIndexes(pkgAcquire *Owner) const;
    
    // Interface for the Cache Generator
@@ -115,7 +115,7 @@ class debTranslationsIndex : public pkgIndexFile
    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
    virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const;
 
-   debTranslationsIndex(string URI,string Dist,string Section, char const * const Language);
+   debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language);
    virtual ~debTranslationsIndex() {};
 };
 
@@ -124,25 +124,25 @@ class debSourcesIndex : public pkgIndexFile
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;
 
-   string URI;
-   string Dist;
-   string Section;
+   std::string URI;
+   std::string Dist;
+   std::string Section;
 
-   string Info(const char *Type) const;
-   string IndexFile(const char *Type) const;
-   string IndexURI(const char *Type) const;
+   std::string Info(const char *Type) const;
+   std::string IndexFile(const char *Type) const;
+   std::string IndexURI(const char *Type) const;
    
    public:
 
    virtual const Type *GetType() const;
 
    // Stuff for accessing files on remote items
-   virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
+   virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
                             pkgSrcRecords::File const &File) const;
-   virtual string ArchiveURI(string File) const {return URI + File;};
+   virtual std::string ArchiveURI(std::string File) const {return URI + File;};
    
    // Interface for acquire
-   virtual string Describe(bool Short) const;   
+   virtual std::string Describe(bool Short) const;   
 
    // Interface for the record parsers
    virtual pkgSrcRecords::Parser *CreateSrcParser() const;
@@ -152,7 +152,7 @@ class debSourcesIndex : public pkgIndexFile
    virtual bool HasPackages() const {return false;};
    virtual unsigned long Size() const;
    
-   debSourcesIndex(string URI,string Dist,string Section,bool Trusted);
+   debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted);
    virtual ~debSourcesIndex() {};
 };
 
index 6c8bc838bdc60f064c381ee75ac720fd65a8176b..a36857cb5cba7e695557cd781b5ced6e280879ff 100644 (file)
@@ -17,6 +17,7 @@
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/crc-16.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/macros.h>
@@ -25,6 +26,8 @@
 #include <ctype.h>
                                                                        /*}}}*/
 
+using std::string;
+
 static debListParser::WordList PrioList[] = {{"important",pkgCache::State::Important},
                        {"required",pkgCache::State::Required},
                        {"standard",pkgCache::State::Standard},
@@ -71,10 +74,7 @@ string debListParser::Package() {
 // ---------------------------------------------------------------------
 /* This will return the Architecture of the package this section describes */
 string debListParser::Architecture() {
-   std::string const Arch = Section.FindS("Architecture");
-   if (Arch.empty() == true)
-      return _config->Find("APT::Architecture");
-   return Arch;
+   return Section.FindS("Architecture");
 }
                                                                        /*}}}*/
 // ListParser::ArchitectureAll                                         /*{{{*/
index 41d712fbfac6b194af4b9983a17f95e6a6c61852..9519d9711e42c7bf1cd7bb913dd17068943f222c 100644 (file)
@@ -12,7 +12,6 @@
 #define PKGLIB_DEBLISTPARSER_H
 
 #include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/indexfile.h>
 #include <apt-pkg/tagfile.h>
 
 class debListParser : public pkgCacheGenerator::ListParser
@@ -34,7 +33,7 @@ class debListParser : public pkgCacheGenerator::ListParser
    pkgTagFile Tags;
    pkgTagSection Section;
    unsigned long iOffset;
-   string Arch;
+   std::string Arch;
    std::vector<std::string> Architectures;
    bool MultiArchEnabled;
 
@@ -43,21 +42,21 @@ class debListParser : public pkgCacheGenerator::ListParser
    bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
                     unsigned int Type);
    bool ParseProvides(pkgCache::VerIterator &Ver);
-   bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version);
-   static bool GrabWord(string Word,WordList *List,unsigned char &Out);
+   bool NewProvidesAllArch(pkgCache::VerIterator &Ver, std::string const &Package, std::string const &Version);
+   static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
    
    public:
 
-   static unsigned char GetPrio(string Str);
+   static unsigned char GetPrio(std::string Str);
       
    // These all operate against the current section
-   virtual string Package();
-   virtual string Architecture();
+   virtual std::string Package();
+   virtual std::string Architecture();
    virtual bool ArchitectureAll();
-   virtual string Version();
+   virtual std::string Version();
    virtual bool NewVersion(pkgCache::VerIterator &Ver);
-   virtual string Description();
-   virtual string DescriptionLanguage();
+   virtual std::string Description();
+   virtual std::string DescriptionLanguage();
    virtual MD5SumValue Description_md5();
    virtual unsigned short VersionHash();
    virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
@@ -68,15 +67,15 @@ class debListParser : public pkgCacheGenerator::ListParser
    virtual bool Step();
    
    bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
-                       string section);
+                       std::string section);
    
    static const char *ParseDepends(const char *Start,const char *Stop,
-                           string &Package,string &Ver,unsigned int &Op,
+                           std::string &Package,std::string &Ver,unsigned int &Op,
                            bool const &ParseArchFlags = false,
                            bool const &StripMultiArch = true);
    static const char *ConvertRelation(const char *I,unsigned int &Op);
 
-   debListParser(FileFd *File, string const &Arch = "");
+   debListParser(FileFd *File, std::string const &Arch = "");
    virtual ~debListParser() {};
 };
 
index f24e3afef4555699879a31bfdcc4a71df1ced450..5d3a80aa56cc114c82ef0717637965512de3c59c 100644 (file)
@@ -4,12 +4,16 @@
 #include <apt-pkg/debmetaindex.h>
 #include <apt-pkg/debindexfile.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/indexrecords.h>
+#include <apt-pkg/sourcelist.h>
 #include <apt-pkg/error.h>
 
 #include <set>
+#include <algorithm>
 
 using namespace std;
 
@@ -198,7 +202,11 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
                }
        }
 
-       std::vector<std::string> const lang = APT::Configuration::getLanguages(true);
+       std::vector<std::string> lang = APT::Configuration::getLanguages(true);
+       std::vector<std::string>::iterator lend = std::remove(lang.begin(), lang.end(), "none");
+       if (lend != lang.end())
+               lang.erase(lend);
+
        if (lang.empty() == true)
                return IndexTargets;
 
@@ -210,7 +218,6 @@ vector <struct IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const {
                     s != sections.end(); ++s) {
                        for (std::vector<std::string>::const_iterator l = lang.begin();
                             l != lang.end(); ++l) {
-                               if (*l == "none") continue;
                                IndexTarget * Target = new OptionalIndexTarget();
                                Target->ShortDesc = "Translation-" + *l;
                                Target->MetaKey = TranslationIndexURISuffix(l->c_str(), *s);
index 695cfa7cc35d6880e64f30de1387ca46cb19538e..0cba2d8a8f0484e8b352d758604cd27b2c994166 100644 (file)
@@ -3,9 +3,10 @@
 #define PKGLIB_DEBMETAINDEX_H
 
 #include <apt-pkg/metaindex.h>
-#include <apt-pkg/sourcelist.h>
 
 #include <map>
+#include <string>
+#include <vector>
 
 class debReleaseIndex : public metaIndex {
    public:
@@ -13,43 +14,43 @@ class debReleaseIndex : public metaIndex {
    class debSectionEntry
    {
       public:
-      debSectionEntry (string const &Section, bool const &IsSrc);
-      string const Section;
+      debSectionEntry (std::string const &Section, bool const &IsSrc);
+      std::string const Section;
       bool const IsSrc;
    };
 
    private:
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;
-   std::map<string, vector<debSectionEntry const*> > ArchEntries;
+   std::map<std::string, std::vector<debSectionEntry const*> > ArchEntries;
    enum { ALWAYS_TRUSTED, NEVER_TRUSTED, CHECK_TRUST } Trusted;
 
    public:
 
-   debReleaseIndex(string const &URI, string const &Dist);
-   debReleaseIndex(string const &URI, string const &Dist, bool const Trusted);
+   debReleaseIndex(std::string const &URI, std::string const &Dist);
+   debReleaseIndex(std::string const &URI, std::string const &Dist, bool const Trusted);
    virtual ~debReleaseIndex();
 
-   virtual string ArchiveURI(string const &File) const {return URI + File;};
+   virtual std::string ArchiveURI(std::string const &File) const {return URI + File;};
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const;
-   vector <struct IndexTarget *>* ComputeIndexTargets() const;
-   string Info(const char *Type, string const &Section, string const &Arch="") const;
-   string MetaIndexInfo(const char *Type) const;
-   string MetaIndexFile(const char *Types) const;
-   string MetaIndexURI(const char *Type) const;
-   string IndexURI(const char *Type, string const &Section, string const &Arch="native") const;
-   string IndexURISuffix(const char *Type, string const &Section, string const &Arch="native") const;
-   string SourceIndexURI(const char *Type, const string &Section) const;
-   string SourceIndexURISuffix(const char *Type, const string &Section) const;
-   string TranslationIndexURI(const char *Type, const string &Section) const;
-   string TranslationIndexURISuffix(const char *Type, const string &Section) const;
-   virtual vector <pkgIndexFile *> *GetIndexFiles();
+   std::vector <struct IndexTarget *>* ComputeIndexTargets() const;
+   std::string Info(const char *Type, std::string const &Section, std::string const &Arch="") const;
+   std::string MetaIndexInfo(const char *Type) const;
+   std::string MetaIndexFile(const char *Types) const;
+   std::string MetaIndexURI(const char *Type) const;
+   std::string IndexURI(const char *Type, std::string const &Section, std::string const &Arch="native") const;
+   std::string IndexURISuffix(const char *Type, std::string const &Section, std::string const &Arch="native") const;
+   std::string SourceIndexURI(const char *Type, const std::string &Section) const;
+   std::string SourceIndexURISuffix(const char *Type, const std::string &Section) const;
+   std::string TranslationIndexURI(const char *Type, const std::string &Section) const;
+   std::string TranslationIndexURISuffix(const char *Type, const std::string &Section) const;
+   virtual std::vector <pkgIndexFile *> *GetIndexFiles();
 
    void SetTrusted(bool const Trusted);
    virtual bool IsTrusted() const;
 
-   void PushSectionEntry(vector<string> const &Archs, const debSectionEntry *Entry);
-   void PushSectionEntry(string const &Arch, const debSectionEntry *Entry);
+   void PushSectionEntry(std::vector<std::string> const &Archs, const debSectionEntry *Entry);
+   void PushSectionEntry(std::string const &Arch, const debSectionEntry *Entry);
    void PushSectionEntry(const debSectionEntry *Entry);
 };
 
index 4dfc8b56a8a5103fd6a30a8314b7ce3e5b519647..1afa7b74deef56ead984475330725e3eb3c1335d 100644 (file)
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/fileutl.h>
+
 #include <langinfo.h>
                                                                        /*}}}*/
 
+using std::string;
+
 // RecordParser::debRecordParser - Constructor                         /*{{{*/
 // ---------------------------------------------------------------------
 /* */
@@ -135,8 +139,8 @@ string debRecordParser::LongDesc()
      orig = Section.FindS("Description").c_str();
   else
   {
-     vector<string> const lang = APT::Configuration::getLanguages();
-     for (vector<string>::const_iterator l = lang.begin();
+     std::vector<string> const lang = APT::Configuration::getLanguages();
+     for (std::vector<string>::const_iterator l = lang.begin();
          orig.empty() && l != lang.end(); ++l)
        orig = Section.FindS(string("Description-").append(*l).c_str());
   }
index 7868bfa3d5410b3f6f65ebb2ff2612a9489249e0..9c7ea6b486c8e5803d0d8a6db3623030def2d19a 100644 (file)
@@ -15,8 +15,8 @@
 #define PKGLIB_DEBRECORDS_H
 
 #include <apt-pkg/pkgrecords.h>
-#include <apt-pkg/indexfile.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
 
 class debRecordParser : public pkgRecords::Parser
 {
@@ -35,27 +35,27 @@ class debRecordParser : public pkgRecords::Parser
    public:
 
    // These refer to the archive file for the Version
-   virtual string FileName();
-   virtual string MD5Hash();
-   virtual string SHA1Hash();
-   virtual string SHA256Hash();
-   virtual string SHA512Hash();
-   virtual string SourcePkg();
-   virtual string SourceVer();
+   virtual std::string FileName();
+   virtual std::string MD5Hash();
+   virtual std::string SHA1Hash();
+   virtual std::string SHA256Hash();
+   virtual std::string SHA512Hash();
+   virtual std::string SourcePkg();
+   virtual std::string SourceVer();
    
    // These are some general stats about the package
-   virtual string Maintainer();
-   virtual string ShortDesc();
-   virtual string LongDesc();
-   virtual string Name();
-   virtual string Homepage();
+   virtual std::string Maintainer();
+   virtual std::string ShortDesc();
+   virtual std::string LongDesc();
+   virtual std::string Name();
+   virtual std::string Homepage();
 
    // An arbitrary custom field
-   virtual string RecordField(const char *fieldName);
+   virtual std::string RecordField(const char *fieldName);
 
    virtual void GetRec(const char *&Start,const char *&Stop);
    
-   debRecordParser(string FileName,pkgCache &Cache);
+   debRecordParser(std::string FileName,pkgCache &Cache);
    virtual ~debRecordParser() {};
 };
 
index c9c20267b8ed7ee9998e0022a84446003909dab0..ce55ccd1f03e298b8f9e1fba8a3130bc5e22f61b 100644 (file)
@@ -21,6 +21,8 @@
 using std::max;
                                                                        /*}}}*/
 
+using std::string;
+
 // SrcRecordParser::Binaries - Return the binaries field               /*{{{*/
 // ---------------------------------------------------------------------
 /* This member parses the binaries field into a pair of class arrays and
@@ -30,25 +32,32 @@ using std::max;
    used during scanning to find the right package */
 const char **debSrcRecordParser::Binaries()
 {
-   // This should use Start/Stop too, it is supposed to be efficient after all.
-   string Bins = Sect.FindS("Binary");
-   if (Bins.empty() == true || Bins.length() >= 102400)
-      return 0;
-   
-   if (Bins.length() >= BufSize)
-   {
-      delete [] Buffer;
-      // allocate new size based on buffer (but never smaller than 4000)
-      BufSize = max((unsigned int)4000, max((unsigned int)Bins.length()+1,2*BufSize));
-      Buffer = new char[BufSize];
-   }
+   const char *Start, *End;
+   if (Sect.Find("Binary", Start, End) == false)
+      return NULL;
+   for (; isspace(*Start) != 0; ++Start);
+   if (Start >= End)
+      return NULL;
+
+   StaticBinList.clear();
+   free(Buffer);
+   Buffer = strndup(Start, End - Start);
 
-   strcpy(Buffer,Bins.c_str());
-   if (TokSplitString(',',Buffer,StaticBinList,
-                     sizeof(StaticBinList)/sizeof(StaticBinList[0])) == false)
-      return 0;
+   char* bin = Buffer;
+   do {
+      char* binStartNext = strchrnul(bin, ',');
+      char* binEnd = binStartNext - 1;
+      for (; isspace(*binEnd) != 0; --binEnd)
+        binEnd = '\0';
+      StaticBinList.push_back(bin);
+      if (*binStartNext != ',')
+        break;
+      *binStartNext = '\0';
+      for (bin = binStartNext + 1; isspace(*bin) != 0; ++bin);
+   } while (*bin != '\0');
+   StaticBinList.push_back(NULL);
 
-   return (const char **)StaticBinList;
+   return (const char **) &StaticBinList[0];
 }
                                                                        /*}}}*/
 // SrcRecordParser::BuildDepends - Return the Build-Depends information        /*{{{*/
@@ -57,7 +66,7 @@ const char **debSrcRecordParser::Binaries()
    package/version records representing the build dependency. The returned 
    array need not be freed and will be reused by the next call to this 
    function */
-bool debSrcRecordParser::BuildDepends(vector<pkgSrcRecords::Parser::BuildDepRec> &BuildDeps,
+bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDepRec> &BuildDeps,
                                        bool const &ArchOnly, bool const &StripMultiArch)
 {
    unsigned int I;
@@ -102,7 +111,7 @@ bool debSrcRecordParser::BuildDepends(vector<pkgSrcRecords::Parser::BuildDepRec>
 // ---------------------------------------------------------------------
 /* This parses the list of files and returns it, each file is required to have
    a complete source package */
-bool debSrcRecordParser::Files(vector<pkgSrcRecords::File> &List)
+bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
 {
    List.erase(List.begin(),List.end());
    
index aa859b0e6378f088b4200637be5ff2245107192c..4c8d03224b8c821fb57b3113e01df48d96558985 100644 (file)
@@ -24,10 +24,9 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    FileFd Fd;
    pkgTagFile Tags;
    pkgTagSection Sect;
-   char *StaticBinList[400];
+   std::vector<const char*> StaticBinList;
    unsigned long iOffset;
    char *Buffer;
-   unsigned int BufSize;
    
    public:
 
@@ -35,24 +34,24 @@ class debSrcRecordParser : public pkgSrcRecords::Parser
    virtual bool Step() {iOffset = Tags.Offset(); return Tags.Step(Sect);};
    virtual bool Jump(unsigned long const &Off) {iOffset = Off; return Tags.Jump(Sect,Off);};
 
-   virtual string Package() const {return Sect.FindS("Package");};
-   virtual string Version() const {return Sect.FindS("Version");};
-   virtual string Maintainer() const {return Sect.FindS("Maintainer");};
-   virtual string Section() const {return Sect.FindS("Section");};
+   virtual std::string Package() const {return Sect.FindS("Package");};
+   virtual std::string Version() const {return Sect.FindS("Version");};
+   virtual std::string Maintainer() const {return Sect.FindS("Maintainer");};
+   virtual std::string Section() const {return Sect.FindS("Section");};
    virtual const char **Binaries();
-   virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
+   virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true);
    virtual unsigned long Offset() {return iOffset;};
-   virtual string AsStr() 
+   virtual std::string AsStr() 
    {
       const char *Start=0,*Stop=0;
       Sect.GetSection(Start,Stop);
-      return string(Start,Stop);
+      return std::string(Start,Stop);
    };
-   virtual bool Files(vector<pkgSrcRecords::File> &F);
+   virtual bool Files(std::vector<pkgSrcRecords::File> &F);
 
-   debSrcRecordParser(string const &File,pkgIndexFile const *Index) 
+   debSrcRecordParser(std::string const &File,pkgIndexFile const *Index) 
       : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), 
-        Buffer(0), BufSize(0) {}
+        Buffer(NULL) {}
    virtual ~debSrcRecordParser();
 };
 
index 080af5659d778ed61ce932df3eb0680c59e0fb55..7ed6936c3395f570e66958145524d2599242b892 100644 (file)
@@ -27,6 +27,8 @@
 #include <apti18n.h>
                                                                        /*}}}*/
 
+using std::string;
+
 debSystem debSys;
 
 class debSystemPrivate {
@@ -219,7 +221,7 @@ signed debSystem::Score(Configuration const &Cnf)
 // System::AddStatusFiles - Register the status files                  /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool debSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
+bool debSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List)
 {
    if (d->StatusFile == 0)
       d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status"));
index 23215525675761dbdb81552bb276e34efb374786..85512351639ecfaa4c10e50feca364c149416715 100644 (file)
 #define PKGLIB_DEBSYSTEM_H
 
 #include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/pkgcache.h>
 
 class debSystemPrivate;
-
 class debStatusIndex;
+class pkgDepCache;
+
 class debSystem : public pkgSystem
 {
    // private d-pointer
index ba32b2dd4d0757d482889d0f6f8f675b929bb9bb..bc9e13d92958f93754a2e1160babcd85869fe27a 100644 (file)
@@ -10,7 +10,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#define APT_COMPATIBILITY 986
 #include <config.h>
 
 #include <apt-pkg/debversion.h>
@@ -263,7 +262,7 @@ bool debVersioningSystem::CheckDep(const char *PkgVer,
 // debVS::UpstreamVersion - Return the upstream version string         /*{{{*/
 // ---------------------------------------------------------------------
 /* This strips all the debian specific information from the version number */
-string debVersioningSystem::UpstreamVersion(const char *Ver)
+std::string debVersioningSystem::UpstreamVersion(const char *Ver)
 {
    // Strip off the bit before the first colon
    const char *I = Ver;
@@ -278,6 +277,6 @@ string debVersioningSystem::UpstreamVersion(const char *Ver)
       if (*I == '-')
         Last = I - Ver;
    
-   return string(Ver,Last);
+   return std::string(Ver,Last);
 }
                                                                        /*}}}*/
index 56fb67887857416b94637807fcfe02a4f2b6eb4f..f1d6f3cc55df54fb25836190de6c89d84e1331d6 100644 (file)
@@ -32,39 +32,11 @@ class debVersioningSystem : public pkgVersioningSystem
    {
       return DoCmpVersion(A,Aend,B,Bend);
    }   
-   virtual string UpstreamVersion(const char *A);
+   virtual std::string UpstreamVersion(const char *A);
 
    debVersioningSystem();
 };
 
 extern debVersioningSystem debVS;
 
-#ifdef APT_COMPATIBILITY
-#if APT_COMPATIBILITY != 986
-#warning "Using APT_COMPATIBILITY"
-#endif
-
-inline int pkgVersionCompare(const char *A, const char *B)
-{
-   return debVS.CmpVersion(A,B);
-}
-inline int pkgVersionCompare(const char *A, const char *AEnd, 
-                            const char *B, const char *BEnd)
-{
-   return debVS.DoCmpVersion(A,AEnd,B,BEnd);
-}
-inline int pkgVersionCompare(string A,string B)
-{
-   return debVS.CmpVersion(A,B);
-}
-inline bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op)
-{
-   return debVS.CheckDep(PkgVer,Op,DepVer);
-}
-inline string pkgBaseVersion(const char *Ver)
-{
-   return debVS.UpstreamVersion(Ver);
-}
-#endif
-
 #endif
index 0cc21f322003d35413e7ec8fa530511a72e3133a..5eb6406c6fbaf5e5ec3898262defd7160b17419d 100644 (file)
@@ -905,6 +905,28 @@ bool pkgDPkgPM::Go(int OutStatusFd)
    // create log
    OpenLog();
 
+   // Generate the base argument list for dpkg
+   std::vector<const char *> Args;
+   unsigned long StartSize = 0;
+   string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
+   Args.push_back(Tmp.c_str());
+   StartSize += Tmp.length();
+
+   // Stick in any custom dpkg options
+   Configuration::Item const *Opts = _config->Tree("DPkg::Options");
+   if (Opts != 0)
+   {
+      Opts = Opts->Child;
+      for (; Opts != 0; Opts = Opts->Next)
+      {
+        if (Opts->Value.empty() == true)
+           continue;
+        Args.push_back(Opts->Value.c_str());
+        StartSize += Opts->Value.length();
+      }
+   }
+   size_t const BaseArgs = Args.size();
+
    // this loop is runs once per operation
    for (vector<Item>::const_iterator I = List.begin(); I != List.end();)
    {
@@ -926,11 +948,12 @@ bool pkgDPkgPM::Go(int OutStatusFd)
         for (; J != List.end() && J->Op == I->Op; ++J)
            /* nothing */;
 
-      // Generate the argument list
-      const char *Args[MaxArgs + 50];
       // keep track of allocated strings for multiarch package names
-      char *Packages[MaxArgs + 50];
-      unsigned int pkgcount = 0;
+      std::vector<char *> Packages;
+
+      // start with the baseset of arguments
+      unsigned long Size = StartSize;
+      Args.erase(Args.begin() + BaseArgs, Args.end());
 
       // Now check if we are within the MaxArgs limit
       //
@@ -940,93 +963,69 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       // - with the split they may now be configured in different
       //   runs, using Immediate-Configure-All can help prevent this.
       if (J - I > (signed)MaxArgs)
+      {
         J = I + MaxArgs;
-      
-      unsigned int n = 0;
-      unsigned long Size = 0;
-      string const Tmp = _config->Find("Dir::Bin::dpkg","dpkg");
-      Args[n++] = Tmp.c_str();
-      Size += strlen(Args[n-1]);
-      
-      // Stick in any custom dpkg options
-      Configuration::Item const *Opts = _config->Tree("DPkg::Options");
-      if (Opts != 0)
+        Args.reserve(MaxArgs + 10);
+      }
+      else
       {
-        Opts = Opts->Child;
-        for (; Opts != 0; Opts = Opts->Next)
-        {
-           if (Opts->Value.empty() == true)
-              continue;
-           Args[n++] = Opts->Value.c_str();
-           Size += Opts->Value.length();
-        }       
+        Args.reserve((J - I) + 10);
       }
+
       
-      char status_fd_buf[20];
       int fd[2];
       pipe(fd);
-      
-      Args[n++] = "--status-fd";
-      Size += strlen(Args[n-1]);
+
+#define ADDARG(X) Args.push_back(X); Size += strlen(X)
+#define ADDARGC(X) Args.push_back(X); Size += sizeof(X) - 1
+
+      ADDARGC("--status-fd");
+      char status_fd_buf[20];
       snprintf(status_fd_buf,sizeof(status_fd_buf),"%i", fd[1]);
-      Args[n++] = status_fd_buf;
-      Size += strlen(Args[n-1]);
-      
+      ADDARG(status_fd_buf);
+
       unsigned long const Op = I->Op;
 
       switch (I->Op)
       {
         case Item::Remove:
-        Args[n++] = "--force-depends";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--force-remove-essential";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--remove";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--force-depends");
+        ADDARGC("--force-remove-essential");
+        ADDARGC("--remove");
         break;
         
         case Item::Purge:
-        Args[n++] = "--force-depends";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--force-remove-essential";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--purge";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--force-depends");
+        ADDARGC("--force-remove-essential");
+        ADDARGC("--purge");
         break;
         
         case Item::Configure:
-        Args[n++] = "--configure";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--configure");
         break;
 
         case Item::ConfigurePending:
-        Args[n++] = "--configure";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--pending";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--configure");
+        ADDARGC("--pending");
         break;
 
         case Item::TriggersPending:
-        Args[n++] = "--triggers-only";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--pending";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--triggers-only");
+        ADDARGC("--pending");
         break;
 
         case Item::Install:
-        Args[n++] = "--unpack";
-        Size += strlen(Args[n-1]);
-        Args[n++] = "--auto-deconfigure";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--unpack");
+        ADDARGC("--auto-deconfigure");
         break;
       }
 
       if (NoTriggers == true && I->Op != Item::TriggersPending &&
          I->Op != Item::ConfigurePending)
       {
-        Args[n++] = "--no-triggers";
-        Size += strlen(Args[n-1]);
+        ADDARGC("--no-triggers");
       }
+#undef ADDARGC
 
       // Write in the file or package names
       if (I->Op == Item::Install)
@@ -1035,10 +1034,10 @@ bool pkgDPkgPM::Go(int OutStatusFd)
         {
            if (I->File[0] != '/')
               return _error->Error("Internal Error, Pathname to install is not absolute '%s'",I->File.c_str());
-           Args[n++] = I->File.c_str();
-           Size += strlen(Args[n-1]);
+           Args.push_back(I->File.c_str());
+           Size += I->File.length();
         }
-      }      
+      }
       else
       {
         string const nativeArch = _config->Find("APT::Architecture");
@@ -1050,29 +1049,35 @@ bool pkgDPkgPM::Go(int OutStatusFd)
            if (I->Op == Item::Configure && disappearedPkgs.find(I->Pkg.Name()) != disappearedPkgs.end())
               continue;
            if (I->Pkg.Arch() == nativeArch || !strcmp(I->Pkg.Arch(), "all"))
-              Args[n++] = I->Pkg.Name();
+           {
+              char const * const name = I->Pkg.Name();
+              ADDARG(name);
+           }
            else
            {
-              Packages[pkgcount] = strdup(I->Pkg.FullName(false).c_str());
-              Args[n++] = Packages[pkgcount++];
+              char * const fullname = strdup(I->Pkg.FullName(false).c_str());
+              Packages.push_back(fullname);
+              ADDARG(fullname);
            }
-           Size += strlen(Args[n-1]);
         }
         // skip configure action if all sheduled packages disappeared
         if (oldSize == Size)
            continue;
       }
-      Args[n] = 0;
+#undef ADDARG
+
       J = I;
       
       if (_config->FindB("Debug::pkgDPkgPM",false) == true)
       {
-        for (unsigned int k = 0; k != n; k++)
-           clog << Args[k] << ' ';
+        for (std::vector<const char *>::const_iterator a = Args.begin();
+             a != Args.end(); ++a)
+           clog << *a << ' ';
         clog << endl;
         continue;
       }
-      
+      Args.push_back(NULL);
+
       cout << flush;
       clog << flush;
       cerr << flush;
@@ -1186,7 +1191,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
         /* No Job Control Stop Env is a magic dpkg var that prevents it
            from using sigstop */
         putenv((char *)"DPKG_NO_TSTP=yes");
-        execvp(Args[0],(char **)Args);
+        execvp(Args[0], (char**) &Args[0]);
         cerr << "Could not exec dpkg!" << endl;
         _exit(100);
       }      
@@ -1212,10 +1217,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       sigemptyset(&sigmask);
       sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask);
 
-      /* clean up the temporary allocation for multiarch package names in
-         the parent, so we don't leak memory when we return. */
-      for (unsigned int i = 0; i < pkgcount; i++)
-        free(Packages[i]);
+      /* free vectors (and therefore memory) as we don't need the included data anymore */
+      for (std::vector<char *>::const_iterator p = Packages.begin();
+          p != Packages.end(); ++p)
+        free(*p);
+      Packages.clear();
 
       // the result of the waitpid call
       int res;
index 3f95c51dc9cd37f72806c21708f99b97ec87bc1d..6b62360b7a14797a440eab7054b11153aed00c80 100644 (file)
@@ -15,9 +15,6 @@
 #include <map>
 #include <stdio.h>
 
-using std::vector;
-using std::map;
-
 class pkgDPkgPMPrivate;
 
 class pkgDPkgPM : public pkgPackageManager
@@ -38,7 +35,7 @@ class pkgDPkgPM : public pkgPackageManager
       needs to declare a Replaces on the disappeared package.
       \param pkgname Name of the package that disappeared
    */
-   void handleDisappearAction(string const &pkgname);
+   void handleDisappearAction(std::string const &pkgname);
 
    protected:
    int pkgFailures;
@@ -53,11 +50,11 @@ class pkgDPkgPM : public pkgPackageManager
    // the dpkg states that the pkg will run through, the string is 
    // the package, the vector contains the dpkg states that the package
    // will go through
-   map<string,vector<struct DpkgState> > PackageOps;
+   std::map<std::string,std::vector<struct DpkgState> > PackageOps;
    // the dpkg states that are already done; the string is the package
    // the int is the state that is already done (e.g. a package that is
    // going to be install is already in state "half-installed")
-   map<string,unsigned int> PackageOpsDone;
+   std::map<std::string,unsigned int> PackageOpsDone;
 
    // progress reporting
    unsigned int PackagesDone;
@@ -66,19 +63,19 @@ class pkgDPkgPM : public pkgPackageManager
    struct Item
    {
       enum Ops {Install, Configure, Remove, Purge, ConfigurePending, TriggersPending} Op;
-      string File;
+      std::string File;
       PkgIterator Pkg;
-      Item(Ops Op,PkgIterator Pkg,string File = "") : Op(Op),
+      Item(Ops Op,PkgIterator Pkg,std::string File = "") : Op(Op),
             File(File), Pkg(Pkg) {};
       Item() {};
       
    };
-   vector<Item> List;
+   std::vector<Item> List;
 
    // Helpers
    bool RunScriptsWithPkgs(const char *Cnf);
    bool SendV2Pkgs(FILE *F);
-   void WriteHistoryTag(string const &tag, string value);
+   void WriteHistoryTag(std::string const &tag, std::string value);
 
    // apport integration
    void WriteApportReport(const char *pkgpath, const char *errormsg);
@@ -94,7 +91,7 @@ class pkgDPkgPM : public pkgPackageManager
    void ProcessDpkgStatusLine(int OutStatusFd, char *line);
 
    // The Actuall installation implementation
-   virtual bool Install(PkgIterator Pkg,string File);
+   virtual bool Install(PkgIterator Pkg,std::string File);
    virtual bool Configure(PkgIterator Pkg);
    virtual bool Remove(PkgIterator Pkg,bool Purge = false);
    virtual bool Go(int StatusFd=-1);
index f816630aef900a0a4b4813175e733d2b2e9e4e92..529e9240dd5f566f2e741274b6e7ed85d83b12b9 100644 (file)
 #include <apt-pkg/error.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/algorithms.h>
-
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/progress.h>
 
 #include <iostream>
 #include <sstream>
@@ -32,6 +32,9 @@
 
 #include <apti18n.h>
                                                                        /*}}}*/
+
+using std::string;
+
 // helper for Install-Recommends-Sections and Never-MarkAuto-Sections  /*{{{*/
 static bool 
 ConfigValueInSubTree(const char* SubTree, const char *needle)
index 66cb7dbababebcf43bfe678adb5d3ec79557a1a5..f6e6c0afc5aa9ebccffc1b74d293dd3ef0d7e322 100644 (file)
 
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/progress.h>
-#include <apt-pkg/error.h>
 
 #include <vector>
 #include <memory>
 #include <set>
+#include <list>
+
+class OpProgress;
 
 class pkgDepCache : protected pkgCache::Namespace
 {
@@ -338,9 +339,9 @@ class pkgDepCache : protected pkgCache::Namespace
    inline Header &Head() {return *Cache->HeaderP;};
    inline GrpIterator GrpBegin() {return Cache->GrpBegin();};
    inline PkgIterator PkgBegin() {return Cache->PkgBegin();};
-   inline GrpIterator FindGrp(string const &Name) {return Cache->FindGrp(Name);};
-   inline PkgIterator FindPkg(string const &Name) {return Cache->FindPkg(Name);};
-   inline PkgIterator FindPkg(string const &Name, string const &Arch) {return Cache->FindPkg(Name, Arch);};
+   inline GrpIterator FindGrp(std::string const &Name) {return Cache->FindGrp(Name);};
+   inline PkgIterator FindPkg(std::string const &Name) {return Cache->FindPkg(Name);};
+   inline PkgIterator FindPkg(std::string const &Name, std::string const &Arch) {return Cache->FindPkg(Name, Arch);};
 
    inline pkgCache &GetCache() {return *Cache;};
    inline pkgVersioningSystem &VS() {return *Cache->VS;};
index 44f7dbfd68bb9cb3f8ef53a7e7ae09407cfeb543..791aac72f416364f149d133074e4fbf1747e93fb 100644 (file)
@@ -9,17 +9,24 @@
 
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/cacheset.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/policy.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/progress.h>
 
 #include <limits>
 #include <stdio.h>
 
+#include <string>
+
 #include <apti18n.h>
                                                                        /*}}}*/
 
+using std::string;
+
 // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
 const char * const EDSP::PrioMap[] = {0, "important", "required", "standard",
                                      "optional", "extra"};
@@ -279,7 +286,7 @@ bool EDSP::ReadResponse(int const input, pkgDepCache &Cache, OpProgress *Progres
                        std::string msg = SubstVar(SubstVar(section.FindS("Message"), "\n .\n", "\n\n"), "\n ", "\n");
                        if (msg.empty() == true) {
                                msg = _("External solver failed without a proper error message");
-                               _error->Error(msg.c_str());
+                               _error->Error("%s", msg.c_str());
                        } else
                                _error->Error("External solver failed with: %s", msg.substr(0,msg.find('\n')).c_str());
                        if (Progress != NULL)
index 743c3f5d1dc52404ed35379a3b91bd7f5985be64..c143094222d0a5972b05d2f64d859fe7c0f98593 100644 (file)
@@ -9,12 +9,17 @@
 #ifndef PKGLIB_EDSP_H
 #define PKGLIB_EDSP_H
 
-#include <apt-pkg/depcache.h>
-#include <apt-pkg/cacheset.h>
-#include <apt-pkg/progress.h>
+#include <apt-pkg/pkgcache.h>
 
+#include <list>
 #include <string>
 
+namespace APT {
+       class PackageSet;
+};
+class pkgDepCache;
+class OpProgress;
+
 class EDSP                                                             /*{{{*/
 {
        // we could use pkgCache::DepType and ::Priority, but these would be localized strings…
index b417a75626df01a42b120eec4d8299c0946ede9d..058cef63689ba80356187fa9e90b69a7b9a4f358 100644 (file)
@@ -15,6 +15,7 @@
 #include <apt-pkg/progress.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-item.h>
 
 #include <sys/stat.h>
index 0053388eb8d790a227d0cc80108fdf992dd6f2ea..9670c4837d6c540bff1ef3e85c820ccc64b41c80 100644 (file)
@@ -8,7 +8,6 @@
 #ifndef PKGLIB_EDSPINDEXFILE_H
 #define PKGLIB_EDSPINDEXFILE_H
 
-#include <apt-pkg/indexfile.h>
 #include <apt-pkg/debindexfile.h>
 
 class edspIndex : public debStatusIndex
@@ -22,7 +21,7 @@ class edspIndex : public debStatusIndex
 
    virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const;
 
-   edspIndex(string File);
+   edspIndex(std::string File);
 };
 
 #endif
index e00abdbcc3852ab4977a58ff777624d6143113e9..bcfdb10176397fa0e1c910c6dff9d76d61b97b26 100644 (file)
@@ -20,7 +20,7 @@
                                                                        /*}}}*/
 
 // ListParser::edspListParser - Constructor                            /*{{{*/
-edspListParser::edspListParser(FileFd *File, string const &Arch) : debListParser(File, Arch)
+edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch)
 {}
                                                                        /*}}}*/
 // ListParser::NewVersion - Fill in the version structure              /*{{{*/
@@ -33,11 +33,11 @@ bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
 // ListParser::Description - Return the description string             /*{{{*/
 // ---------------------------------------------------------------------
 /* Sorry, no description for the resolvers… */
-string edspListParser::Description()
+std::string edspListParser::Description()
 {
    return "";
 }
-string edspListParser::DescriptionLanguage()
+std::string edspListParser::DescriptionLanguage()
 {
    return "";
 }
@@ -85,7 +85,7 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
                                                                        /*}}}*/
 // ListParser::LoadReleaseInfo - Load the release information          /*{{{*/
 bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
-                                   FileFd &File, string component)
+                                   FileFd &File, std::string component)
 {
    return true;
 }
index ec9f09905cabd881f1103ea85c0bd4256081538e..5d82716c7b02613c83223552874c47d6c1ecbfa6 100644 (file)
 #define PKGLIB_EDSPLISTPARSER_H
 
 #include <apt-pkg/deblistparser.h>
-#include <apt-pkg/pkgcachegen.h>
-#include <apt-pkg/indexfile.h>
-#include <apt-pkg/tagfile.h>
+
+class FileFd;
 
 class edspListParser : public debListParser
 {
    public:
    virtual bool NewVersion(pkgCache::VerIterator &Ver);
-   virtual string Description();
-   virtual string DescriptionLanguage();
+   virtual std::string Description();
+   virtual std::string DescriptionLanguage();
    virtual MD5SumValue Description_md5();
    virtual unsigned short VersionHash();
 
    bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File,
-                       string section);
+                       std::string section);
 
-   edspListParser(FileFd *File, string const &Arch = "");
+   edspListParser(FileFd *File, std::string const &Arch = "");
 
    protected:
    virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver);
index 10d75771a50a10d62af3f664cc01b176310cdccb..6b9207451b3d2a7e7fe19823bdcaf7e1989927d5 100644 (file)
@@ -97,7 +97,7 @@ signed edspSystem::Score(Configuration const &Cnf)
 }
                                                                        /*}}}*/
 // System::AddStatusFiles - Register the status files                  /*{{{*/
-bool edspSystem::AddStatusFiles(vector<pkgIndexFile *> &List)
+bool edspSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List)
 {
    if (StatusFile == 0)
    {
index 60c90dd4a2d9fdc1eb1de72f0476fbd517e93ad0..21294ae7ed29ee49ded2a6089c1477b03c6a0da6 100644 (file)
@@ -14,9 +14,6 @@
 #include <string>
 #include <stdio.h>
 
-using std::string;
-using std::vector;
-
 class pkgTagSection;
 class FileFd;
 class indexRecords;
@@ -31,20 +28,20 @@ class IndexCopy                                                             /*{{{*/
    
    pkgTagSection *Section;
    
-   string ChopDirs(string Path,unsigned int Depth);
-   bool ReconstructPrefix(string &Prefix,string OrigPath,string CD,
-                         string File);
-   bool ReconstructChop(unsigned long &Chop,string Dir,string File);
-   void ConvertToSourceList(string CD,string &Path);
-   bool GrabFirst(string Path,string &To,unsigned int Depth);
-   virtual bool GetFile(string &Filename,unsigned long long &Size) = 0;
-   virtual bool RewriteEntry(FILE *Target,string File) = 0;
+   std::string ChopDirs(std::string Path,unsigned int Depth);
+   bool ReconstructPrefix(std::string &Prefix,std::string OrigPath,std::string CD,
+                         std::string File);
+   bool ReconstructChop(unsigned long &Chop,std::string Dir,std::string File);
+   void ConvertToSourceList(std::string CD,std::string &Path);
+   bool GrabFirst(std::string Path,std::string &To,unsigned int Depth);
+   virtual bool GetFile(std::string &Filename,unsigned long long &Size) = 0;
+   virtual bool RewriteEntry(FILE *Target,std::string File) = 0;
    virtual const char *GetFileName() = 0;
    virtual const char *Type() = 0;
    
    public:
 
-   bool CopyPackages(string CDROM,string Name,vector<string> &List,
+   bool CopyPackages(std::string CDROM,std::string Name,std::vector<std::string> &List,
                     pkgCdromStatus *log);
    virtual ~IndexCopy() {};
 };
@@ -53,8 +50,8 @@ class PackageCopy : public IndexCopy                                  /*{{{*/
 {
    protected:
    
-   virtual bool GetFile(string &Filename,unsigned long long &Size);
-   virtual bool RewriteEntry(FILE *Target,string File);
+   virtual bool GetFile(std::string &Filename,unsigned long long &Size);
+   virtual bool RewriteEntry(FILE *Target,std::string File);
    virtual const char *GetFileName() {return "Packages";};
    virtual const char *Type() {return "Package";};
    
@@ -64,8 +61,8 @@ class SourceCopy : public IndexCopy                                   /*{{{*/
 {
    protected:
    
-   virtual bool GetFile(string &Filename,unsigned long long &Size);
-   virtual bool RewriteEntry(FILE *Target,string File);
+   virtual bool GetFile(std::string &Filename,unsigned long long &Size);
+   virtual bool RewriteEntry(FILE *Target,std::string File);
    virtual const char *GetFileName() {return "Sources";};
    virtual const char *Type() {return "Source";};
    
@@ -77,7 +74,7 @@ class TranslationsCopy                                                        /*{{{*/
    pkgTagSection *Section;
 
    public:
-   bool CopyTranslations(string CDROM,string Name,vector<string> &List,
+   bool CopyTranslations(std::string CDROM,std::string Name,std::vector<std::string> &List,
                         pkgCdromStatus *log);
 };
                                                                        /*}}}*/
@@ -86,13 +83,13 @@ class SigVerify                                                             /*{{{*/
    /** \brief dpointer placeholder (for later in case we need it) */
    void *d;
 
-   bool Verify(string prefix,string file, indexRecords *records);
-   bool CopyMetaIndex(string CDROM, string CDName, 
-                     string prefix, string file);
+   bool Verify(std::string prefix,std::string file, indexRecords *records);
+   bool CopyMetaIndex(std::string CDROM, std::string CDName, 
+                     std::string prefix, std::string file);
 
  public:
-   bool CopyAndVerify(string CDROM,string Name,vector<string> &SigList,
-                     vector<string> PkgList,vector<string> SrcList);
+   bool CopyAndVerify(std::string CDROM,std::string Name,std::vector<std::string> &SigList,
+                     std::vector<std::string> PkgList,std::vector<std::string> SrcList);
 
    /** \brief generates and run the command to verify a file with gpgv */
    static bool RunGPGV(std::string const &File, std::string const &FileOut,
index 68e9df4c8bf2142edfa2f2f9819bf3ada9a81dd3..642a750d41d201835e68aa59b5338353da2e373a 100644 (file)
@@ -47,9 +47,9 @@ pkgIndexFile::Type *pkgIndexFile::Type::GetType(const char *Type)
 // IndexFile::ArchiveInfo - Stub                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-string pkgIndexFile::ArchiveInfo(pkgCache::VerIterator Ver) const
+std::string pkgIndexFile::ArchiveInfo(pkgCache::VerIterator Ver) const
 {
-   return string();
+   return std::string();
 }
                                                                        /*}}}*/
 // IndexFile::FindInCache - Stub                                       /*{{{*/
@@ -63,10 +63,10 @@ pkgCache::PkgFileIterator pkgIndexFile::FindInCache(pkgCache &Cache) const
 // IndexFile::SourceIndex - Stub                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-string pkgIndexFile::SourceInfo(pkgSrcRecords::Parser const &Record,
+std::string pkgIndexFile::SourceInfo(pkgSrcRecords::Parser const &Record,
                                pkgSrcRecords::File const &File) const
 {
-   return string();
+   return std::string();
 }
                                                                        /*}}}*/
 // IndexFile::TranslationsAvailable - Check if will use Translation    /*{{{*/
@@ -98,7 +98,7 @@ __attribute__ ((deprecated)) bool pkgIndexFile::CheckLanguageCode(const char *La
 /* As we have now possibly more than one LanguageCode this method is
    supersided by a) private classmembers or b) getLanguages().
    TODO: Remove method with next API break */
-__attribute__ ((deprecated)) string pkgIndexFile::LanguageCode() {
+__attribute__ ((deprecated)) std::string pkgIndexFile::LanguageCode() {
        if (TranslationsAvailable() == false)
                return "";
        return APT::Configuration::getLanguages()[0];
index 2b5ae63427f8d28428c64f36ac6ad5202d701cb9..5e162a846847e1e020f643e55177e9bb7cc72d1d 100644 (file)
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/pkgrecords.h>
-    
-using std::string;
+#include <apt-pkg/macros.h>
 
 class pkgAcquire;
 class pkgCacheGenerator;
 class OpProgress;
+
 class pkgIndexFile
 {
    protected:
@@ -59,13 +59,13 @@ class pkgIndexFile
    virtual const Type *GetType() const = 0;
    
    // Return descriptive strings of various sorts
-   virtual string ArchiveInfo(pkgCache::VerIterator Ver) const;
-   virtual string SourceInfo(pkgSrcRecords::Parser const &Record,
+   virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const;
+   virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record,
                             pkgSrcRecords::File const &File) const;
-   virtual string Describe(bool Short = false) const = 0;   
+   virtual std::string Describe(bool Short = false) const = 0;   
 
    // Interface for acquire
-   virtual string ArchiveURI(string /*File*/) const {return string();};
+   virtual std::string ArchiveURI(std::string /*File*/) const {return std::string();};
 
    // Interface for the record parsers
    virtual pkgSrcRecords::Parser *CreateSrcParser() const {return 0;};
@@ -84,7 +84,7 @@ class pkgIndexFile
 
    static bool TranslationsAvailable();
    static bool CheckLanguageCode(const char *Lang);
-   static string LanguageCode();
+   static std::string LanguageCode();
 
    bool IsTrusted() const { return Trusted; };
    
index 448a76c27eea7dd1945bd28a490aeac9d586f1a8..cdb9250e821f9567d88bc3e5476f40629c06f072 100644 (file)
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
+
 #include <sys/stat.h>
 #include <clocale>
 
 #include <apti18n.h>
                                                                        /*}}}*/
+
+using std::string;
+
 string indexRecords::GetDist() const
 {
    return this->Dist;
@@ -146,7 +152,7 @@ bool indexRecords::Load(const string Filename)                              /*{{{*/
    return true;
 }
                                                                        /*}}}*/
-vector<string> indexRecords::MetaKeys()                                        /*{{{*/
+std::vector<string> indexRecords::MetaKeys()                           /*{{{*/
 {
    std::vector<std::string> keys;
    std::map<string,checkSum *>::iterator I = Entries.begin();
index 0f933b93caa75d0f8ce7fcff19d58566428db56d..fa60a08479991d53047baffcf3f2afce271925ed 100644 (file)
@@ -7,7 +7,6 @@
 
 
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/fileutl.h>
 #include <apt-pkg/hashes.h>
 
 #include <map>
 
 class indexRecords
 {
-   bool parseSumData(const char *&Start, const char *End, string &Name,
-                    string &Hash, unsigned long long &Size);
+   bool parseSumData(const char *&Start, const char *End, std::string &Name,
+                    std::string &Hash, unsigned long long &Size);
    public:
    struct checkSum;
-   string ErrorText;
+   std::string ErrorText;
    
    protected:
-   string Dist;
-   string Suite;
-   string ExpectedDist;
+   std::string Dist;
+   std::string Suite;
+   std::string ExpectedDist;
    time_t ValidUntil;
 
-   std::map<string,checkSum *> Entries;
+   std::map<std::string,checkSum *> Entries;
 
    public:
 
    indexRecords();
-   indexRecords(const string ExpectedDist);
+   indexRecords(const std::string ExpectedDist);
 
    // Lookup function
-   virtual const checkSum *Lookup(const string MetaKey);
+   virtual const checkSum *Lookup(const std::string MetaKey);
    /** \brief tests if a checksum for this file is available */
-   bool Exists(string const &MetaKey) const;
+   bool Exists(std::string const &MetaKey) const;
    std::vector<std::string> MetaKeys();
 
-   virtual bool Load(string Filename);
-   string GetDist() const;
+   virtual bool Load(std::string Filename);
+   std::string GetDist() const;
    time_t GetValidUntil() const;
-   virtual bool CheckDist(const string MaybeDist) const;
-   string GetExpectedDist() const;
+   virtual bool CheckDist(const std::string MaybeDist) const;
+   std::string GetExpectedDist() const;
    virtual ~indexRecords(){};
 };
 
 struct indexRecords::checkSum
 {
-   string MetaKeyFilename;
+   std::string MetaKeyFilename;
    HashString Hash;
    unsigned long long Size;
 };
index 97a39e96e8831318a7c189ed6979558749249d32..2a709dd36eeb7e3a008463d869b227dce2360266 100644 (file)
@@ -13,6 +13,8 @@
 #include <apt-pkg/init.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/configuration.h>
 
 #include <cstdlib>
 #include <sys/stat.h>
@@ -108,14 +110,14 @@ bool pkgInitConfig(Configuration &Cnf)
    }
 
    // Read the configuration parts dir
-   string Parts = Cnf.FindDir("Dir::Etc::parts");
+   std::string Parts = Cnf.FindDir("Dir::Etc::parts");
    if (DirectoryExists(Parts) == true)
       Res &= ReadConfigDir(Cnf,Parts);
    else
       _error->WarningE("DirectoryExists",_("Unable to read %s"),Parts.c_str());
 
    // Read the main config file
-   string FName = Cnf.FindFile("Dir::Etc::main");
+   std::string FName = Cnf.FindFile("Dir::Etc::main");
    if (RealFileExists(FName) == true)
       Res &= ReadConfigFile(Cnf,FName);
 
@@ -142,7 +144,7 @@ bool pkgInitConfig(Configuration &Cnf)
 bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys)
 {
    Sys = 0;
-   string Label = Cnf.Find("Apt::System","");
+   std::string Label = Cnf.Find("Apt::System","");
    if (Label.empty() == false)
    {
       Sys = pkgSystem::GetSystem(Label.c_str());
index 4cee1001a6b94b32fdf863fa5d86bf834cae3bbd..0c1c7ae5a8b0d4ee9d780805be7176dc6fea56e6 100644 (file)
@@ -13,8 +13,8 @@
 #ifndef PKGLIB_INIT_H
 #define PKGLIB_INIT_H
 
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/pkgsystem.h>
+class pkgSystem;
+class Configuration;
 
 // These lines are extracted by the makefiles and the buildsystem
 // Increasing MAJOR or MINOR results in the need of recompiling all
@@ -31,15 +31,4 @@ extern const char *pkgLibVersion;
 bool pkgInitConfig(Configuration &Cnf);
 bool pkgInitSystem(Configuration &Cnf,pkgSystem *&Sys);
 
-#ifdef APT_COMPATIBILITY
-#if APT_COMPATIBILITY != 986
-#warning "Using APT_COMPATIBILITY"
-#endif
-
-inline bool pkgInitialize(Configuration &Cnf) 
-{
-   return pkgInitConfig(Cnf) && pkgInitSystem(Cnf,_system);
-};
-#endif
-
 #endif
index f60235a5d161384da4c7c362d27cb812e50850d3..9cc79a7a62a43f0e041d6803361ce2d7eecaf1df 100644 (file)
@@ -4,12 +4,7 @@
 
 #include <string>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/srcrecords.h>
-#include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/indexfile.h>
-#include <apt-pkg/vendor.h>
-    
-using std::string;
 
 class pkgAcquire;
 class pkgCacheGenerator;
@@ -18,35 +13,35 @@ class OpProgress;
 class metaIndex
 {
    protected:
-   vector <pkgIndexFile *> *Indexes;
+   std::vector <pkgIndexFile *> *Indexes;
    const char *Type;
-   string URI;
-   string Dist;
+   std::string URI;
+   std::string Dist;
    bool Trusted;
 
    public:
 
    
    // Various accessors
-   virtual string GetURI() const {return URI;}
-   virtual string GetDist() const {return Dist;}
+   virtual std::string GetURI() const {return URI;}
+   virtual std::string GetDist() const {return Dist;}
    virtual const char* GetType() const {return Type;}
 
    // Interface for acquire
-   virtual string ArchiveURI(string const& /*File*/) const = 0;
+   virtual std::string ArchiveURI(std::string const& /*File*/) const = 0;
    virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const = 0;
    
-   virtual vector<pkgIndexFile *> *GetIndexFiles() = 0; 
+   virtual std::vector<pkgIndexFile *> *GetIndexFiles() = 0; 
    virtual bool IsTrusted() const = 0;
 
-   metaIndex(string const &URI, string const &Dist, char const * const Type) :
+   metaIndex(std::string const &URI, std::string const &Dist, char const * const Type) :
                Indexes(NULL), Type(Type), URI(URI), Dist(Dist) {
    }
 
    virtual ~metaIndex() {
       if (Indexes == 0)
         return;
-      for (vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
+      for (std::vector<pkgIndexFile *>::iterator I = (*Indexes).begin(); I != (*Indexes).end(); ++I)
         delete *I;
       delete Indexes;
    }
index 9588d30a57a58be117559899af3b874c7b8626d4..a2d7b321b18abcf61b4489f4a98f3bf69aa2e087 100644 (file)
@@ -38,7 +38,7 @@ class pkgOrderList : protected pkgCache::Namespace
    Package **End;
    Package **List;
    Package **AfterEnd;
-   string *FileList;
+   std::string *FileList;
    DepIterator Loops[20];
    int LoopCount;
    int Depth;
@@ -102,7 +102,7 @@ class pkgOrderList : protected pkgCache::Namespace
    inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;};
    bool IsMissing(PkgIterator Pkg);
    void WipeFlags(unsigned long F);
-   void SetFileList(string *FileList) {this->FileList = FileList;};
+   void SetFileList(std::string *FileList) {this->FileList = FileList;};
 
    // Accessors
    inline iterator begin() {return List;};
@@ -115,7 +115,7 @@ class pkgOrderList : protected pkgCache::Namespace
    
    // Ordering modes
    bool OrderCritical();
-   bool OrderUnpack(string *FileList = 0);
+   bool OrderUnpack(std::string *FileList = 0);
    bool OrderConfigure();
 
    int Score(PkgIterator Pkg);
index 3cd9f6f0009bb3c9996ae9b7c473440d129de0b4..b9ef0f5d7c2644a258f1986ce82bb7bc4113a5c2 100644 (file)
@@ -439,7 +439,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
    static bool const ConfigurePkgs = (conf == "all" || conf == "smart");
 
    if (List->IsFlag(Pkg,pkgOrderList::Configured)) 
-      return _error->Error("Internal configure error on '%s'. ",Pkg.Name(),1);
+      return _error->Error("Internal configure error on '%s'.", Pkg.Name());
 
    if (ConfigurePkgs == true && Configure(Pkg) == false)
       return false;
index 96dc5f236cd007dcb521e1258ca968aaea1736b2..d4989a6e04e3ef4ad6e11163a697c427571e1b07 100644 (file)
 #ifndef PKGLIB_PACKAGEMANAGER_H
 #define PKGLIB_PACKAGEMANAGER_H
 
+#include <apt-pkg/pkgcache.h>
 
 #include <string>
 #include <iostream>
-#include <apt-pkg/pkgcache.h>
-#include <apt-pkg/depcache.h>
 #include <set>
 
-using std::string;
-
 class pkgAcquire;
 class pkgDepCache;
 class pkgSourceList;
@@ -45,7 +42,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    static bool SigINTStop;
    
    protected:
-   string *FileNames;
+   std::string *FileNames;
    pkgDepCache &Cache;
    pkgOrderList *List;
    bool Debug;
@@ -78,7 +75,7 @@ class pkgPackageManager : protected pkgCache::Namespace
    bool EarlyRemove(PkgIterator Pkg);  
    
    // The Actual installation implementation
-   virtual bool Install(PkgIterator /*Pkg*/,string /*File*/) {return false;};
+   virtual bool Install(PkgIterator /*Pkg*/,std::string /*File*/) {return false;};
    virtual bool Configure(PkgIterator /*Pkg*/) {return false;};
    virtual bool Remove(PkgIterator /*Pkg*/,bool /*Purge*/=false) {return false;};
    virtual bool Go(int statusFd=-1) {return true;};
index 0896482718ded11540ea3f33cb8ea53fad41d562..c854249e444d437fcc2341ba6c5849d40c022047 100644 (file)
@@ -490,7 +490,7 @@ pkgCache::PkgIterator::CurVersion() const
    if they provide no new information (e.g. there is no newer version than candidate)
    If no version and/or section can be found "none" is used. */
 std::ostream& 
-operator<<(ostream& out, pkgCache::PkgIterator Pkg) 
+operator<<(std::ostream& out, pkgCache::PkgIterator Pkg) 
 {
    if (Pkg.end() == true)
       return out << "invalid package";
@@ -685,7 +685,7 @@ void pkgCache::DepIterator::GlobOr(DepIterator &Start,DepIterator &End)
 // ostream operator to handle string representation of a dependecy     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-std::ostream& operator<<(ostream& out, pkgCache::DepIterator D)
+std::ostream& operator<<(std::ostream& out, pkgCache::DepIterator D)
 {
    if (D.end() == true)
       return out << "invalid dependency";
@@ -894,11 +894,22 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
    {
       pkgCache::DescIterator Desc = DescriptionList();
       for (; Desc.end() == false; ++Desc)
-        if (*l == Desc.LanguageCode() ||
-            (*l == "en" && strcmp(Desc.LanguageCode(),"") == 0))
+        if (*l == Desc.LanguageCode())
            break;
       if (Desc.end() == true)
-        continue;
+      {
+        if (*l == "en")
+        {
+           Desc = DescriptionList();
+           for (; Desc.end() == false; ++Desc)
+              if (strcmp(Desc.LanguageCode(), "") == 0)
+                 break;
+           if (Desc.end() == true)
+              continue;
+        }
+        else
+           continue;
+      }
       return Desc;
    }
    for (pkgCache::DescIterator Desc = DescriptionList();
index 87912aead18ee59ad8114793c819a3dfdd5bc3d1..7e32a3a9692818e2e411272c8ab2e5fd0c3f2247 100644 (file)
@@ -79,8 +79,6 @@
 #include <time.h>
 #include <apt-pkg/mmap.h>
 
-using std::string;
-    
 class pkgVersioningSystem;
 class pkgCache                                                         /*{{{*/
 {
@@ -152,10 +150,10 @@ class pkgCache                                                            /*{{{*/
    protected:
    
    // Memory mapped cache file
-   string CacheFile;
+   std::string CacheFile;
    MMap &Map;
 
-   unsigned long sHash(const string &S) const;
+   unsigned long sHash(const std::string &S) const;
    unsigned long sHash(const char *S) const;
    
    public:
@@ -180,16 +178,16 @@ class pkgCache                                                            /*{{{*/
    inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();};
       
    // String hashing function (512 range)
-   inline unsigned long Hash(const string &S) const {return sHash(S);};
+   inline unsigned long Hash(const std::string &S) const {return sHash(S);};
    inline unsigned long Hash(const char *S) const {return sHash(S);};
 
    // Useful transformation things
    const char *Priority(unsigned char Priority);
    
    // Accessors
-   GrpIterator FindGrp(const string &Name);
-   PkgIterator FindPkg(const string &Name);
-   PkgIterator FindPkg(const string &Name, const string &Arch);
+   GrpIterator FindGrp(const std::string &Name);
+   PkgIterator FindPkg(const std::string &Name);
+   PkgIterator FindPkg(const std::string &Name, const std::string &Arch);
 
    Header &Head() {return *HeaderP;};
    inline GrpIterator GrpBegin();
@@ -214,7 +212,7 @@ class pkgCache                                                              /*{{{*/
 
 private:
    bool MultiArchEnabled;
-   PkgIterator SingleArchFindPkg(const string &Name);
+   PkgIterator SingleArchFindPkg(const std::string &Name);
    inline char const * const NativeArch() const;
 };
                                                                        /*}}}*/
index a39aa9f5969b929110976ac1eff7ec5876735dca..9f999c41b43b05ac8b95e93d4417a45ae17fa4ba 100644 (file)
@@ -10,7 +10,6 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#define APT_COMPATIBILITY 986
 #include <config.h>
 
 #include <apt-pkg/pkgcachegen.h>
@@ -25,6 +24,8 @@
 #include <apt-pkg/pkgsystem.h>
 #include <apt-pkg/macros.h>
 #include <apt-pkg/tagfile.h>
+#include <apt-pkg/metaindex.h>
+#include <apt-pkg/fileutl.h>
 
 #include <vector>
 #include <sys/stat.h>
@@ -37,6 +38,9 @@
 typedef vector<pkgIndexFile *>::iterator FileIterator;
 template <typename Iter> std::vector<Iter*> pkgCacheGenerator::Dynamic<Iter>::toReMap;
 
+bool IsDuplicateDescription(pkgCache::DescIterator Desc,
+                           MD5SumValue const &CurMd5, std::string const &CurLang);
+
 // CacheGenerator::pkgCacheGenerator - Constructor                     /*{{{*/
 // ---------------------------------------------------------------------
 /* We set the dirty flag and make sure that is written to the disk */
@@ -181,82 +185,154 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       if (PackageName.empty() == true)
         return false;
 
-      string const Arch = List.Architecture();
+      Counter++;
+      if (Counter % 100 == 0 && Progress != 0)
+        Progress->Progress(List.Offset());
+
+      string Arch = List.Architecture();
+      string const Version = List.Version();
+      if (Version.empty() == true && Arch.empty() == true)
+      {
+        if (MergeListGroup(List, PackageName) == false)
+           return false;
+      }
+
+      if (Arch.empty() == true)
+        Arch = _config->Find("APT::Architecture");
+
       // Get a pointer to the package structure
       pkgCache::PkgIterator Pkg;
       Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
       if (NewPackage(Pkg, PackageName, Arch) == false)
-        return _error->Error(_("Error occurred while processing %s (NewPackage)"),PackageName.c_str());
-      Counter++;
-      if (Counter % 100 == 0 && Progress != 0)
-        Progress->Progress(List.Offset());
+        // TRANSLATOR: The first placeholder is a package name,
+        // the other two should be copied verbatim as they include debug info
+        return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                             PackageName.c_str(), "NewPackage", 1);
+
 
-      /* Get a pointer to the version structure. We know the list is sorted
-         so we use that fact in the search. Insertion of new versions is
-        done with correct sorting */
-      string Version = List.Version();
       if (Version.empty() == true)
       {
-        // we first process the package, then the descriptions
-        // (this has the bonus that we get MMap error when we run out
-        //  of MMap space)
-        pkgCache::VerIterator Ver(Cache);
-        Dynamic<pkgCache::VerIterator> DynVer(Ver);
-        if (List.UsePackage(Pkg, Ver) == false)
-           return _error->Error(_("Error occurred while processing %s (UsePackage1)"),
-                                PackageName.c_str());
-
-        // Find the right version to write the description
-        MD5SumValue CurMd5 = List.Description_md5();
-        Ver = Pkg.VersionList();
-
-        for (; Ver.end() == false; ++Ver)
-        {
-           pkgCache::DescIterator Desc = Ver.DescriptionList();
-           Dynamic<pkgCache::DescIterator> DynDesc(Desc);
-           map_ptrloc *LastDesc = &Ver->DescriptionList;
-           bool duplicate=false;
-
-           // don't add a new description if we have one for the given
-           // md5 && language
-           for ( ; Desc.end() == false; ++Desc)
-              if (MD5SumValue(Desc.md5()) == CurMd5 && 
-                  Desc.LanguageCode() == List.DescriptionLanguage())
-                 duplicate=true;
-           if(duplicate)
-              continue;
-           
-           for (Desc = Ver.DescriptionList();
-                Desc.end() == false;
-                LastDesc = &Desc->NextDesc, ++Desc)
-           {
-              if (MD5SumValue(Desc.md5()) == CurMd5) 
-               {
-                 // Add new description
-                 void const * const oldMap = Map.Data();
-                 map_ptrloc const descindex = NewDescription(Desc, List.DescriptionLanguage(), CurMd5, *LastDesc);
-                 if (oldMap != Map.Data())
-                    LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
-                 *LastDesc = descindex;
-                 Desc->ParentPkg = Pkg.Index();
-                 
-                 if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
-                    return _error->Error(_("Error occurred while processing %s (NewFileDesc1)"),PackageName.c_str());
-                 break;
-              }
-           }
-        }
+        if (MergeListPackage(List, Pkg) == false)
+           return false;
+      }
+      else
+      {
+        if (MergeListVersion(List, Pkg, Version, OutVer) == false)
+           return false;
+      }
 
-        continue;
+      if (OutVer != 0)
+      {
+        FoundFileDeps |= List.HasFileDeps();
+        return true;
       }
+   }
 
-      pkgCache::VerIterator Ver = Pkg.VersionList();
-      Dynamic<pkgCache::VerIterator> DynVer(Ver);
-      map_ptrloc *LastVer = &Pkg->VersionList;
-      void const * oldMap = Map.Data();
+   if (Cache.HeaderP->PackageCount >= (1ULL<<sizeof(Cache.PkgP->ID)*8)-1)
+      return _error->Error(_("Wow, you exceeded the number of package "
+                            "names this APT is capable of."));
+   if (Cache.HeaderP->VersionCount >= (1ULL<<(sizeof(Cache.VerP->ID)*8))-1)
+      return _error->Error(_("Wow, you exceeded the number of versions "
+                            "this APT is capable of."));
+   if (Cache.HeaderP->DescriptionCount >= (1ULL<<(sizeof(Cache.DescP->ID)*8))-1)
+      return _error->Error(_("Wow, you exceeded the number of descriptions "
+                            "this APT is capable of."));
+   if (Cache.HeaderP->DependsCount >= (1ULL<<(sizeof(Cache.DepP->ID)*8))-1ULL)
+      return _error->Error(_("Wow, you exceeded the number of dependencies "
+                            "this APT is capable of."));
+
+   FoundFileDeps |= List.HasFileDeps();
+   return true;
+}
+// CacheGenerator::MergeListGroup                                      /*{{{*/
+bool pkgCacheGenerator::MergeListGroup(ListParser &List, std::string const &GrpName)
+{
+   pkgCache::GrpIterator Grp = Cache.FindGrp(GrpName);
+   // a group has no data on it's own, only packages have it but these
+   // stanzas like this come from Translation- files to add descriptions,
+   // but without a version we don't need a description for it…
+   if (Grp.end() == true)
+      return true;
+   Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
+
+   pkgCache::PkgIterator Pkg;
+   Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
+   for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+      if (MergeListPackage(List, Pkg) == false)
+        return false;
+
+   return true;
+}
+                                                                       /*}}}*/
+// CacheGenerator::MergeListPackage                                    /*{{{*/
+bool pkgCacheGenerator::MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg)
+{
+   // we first process the package, then the descriptions
+   // (for deb this package processing is in fact a no-op)
+   pkgCache::VerIterator Ver(Cache);
+   Dynamic<pkgCache::VerIterator> DynVer(Ver);
+   if (List.UsePackage(Pkg, Ver) == false)
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "UsePackage", 1);
+
+   // Find the right version to write the description
+   MD5SumValue CurMd5 = List.Description_md5();
+   std::string CurLang = List.DescriptionLanguage();
+
+   for (Ver = Pkg.VersionList(); Ver.end() == false; ++Ver)
+   {
+      pkgCache::DescIterator Desc = Ver.DescriptionList();
+
+      // a version can only have one md5 describing it
+      if (MD5SumValue(Desc.md5()) != CurMd5)
+        continue;
+
+      // don't add a new description if we have one for the given
+      // md5 && language
+      if (IsDuplicateDescription(Desc, CurMd5, CurLang) == true)
+        continue;
+
+      Dynamic<pkgCache::DescIterator> DynDesc(Desc);
+      // we add at the end, so that the start is constant as we need
+      // that to be able to efficiently share these lists
+      map_ptrloc *LastDesc = &Ver->DescriptionList;
+      for (;Desc.end() == false && Desc->NextDesc != 0; ++Desc);
+      if (Desc.end() == false)
+        LastDesc = &Desc->NextDesc;
+
+      void const * const oldMap = Map.Data();
+      map_ptrloc const descindex = NewDescription(Desc, CurLang, CurMd5, *LastDesc);
+      if (oldMap != Map.Data())
+        LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+      *LastDesc = descindex;
+      Desc->ParentPkg = Pkg.Index();
+
+      if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
+        return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                             Pkg.Name(), "NewFileDesc", 1);
+
+      // we can stop here as all "same" versions will share the description
+      break;
+   }
+
+   return true;
+}
+                                                                       /*}}}*/
+// CacheGenerator::MergeListVersion                                    /*{{{*/
+bool pkgCacheGenerator::MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
+                                        std::string const &Version, pkgCache::VerIterator* &OutVer)
+{
+   pkgCache::VerIterator Ver = Pkg.VersionList();
+   Dynamic<pkgCache::VerIterator> DynVer(Ver);
+   map_ptrloc *LastVer = &Pkg->VersionList;
+   void const * oldMap = Map.Data();
+
+   unsigned long const Hash = List.VersionHash();
+   if (Ver.end() == false)
+   {
+      /* We know the list is sorted so we use that fact in the search.
+         Insertion of new versions is done with correct sorting */
       int Res = 1;
-      unsigned long const Hash = List.VersionHash();
       for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
       {
         Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
@@ -274,94 +350,123 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       if (Res == 0 && Ver.end() == false && Ver->Hash == Hash)
       {
         if (List.UsePackage(Pkg,Ver) == false)
-           return _error->Error(_("Error occurred while processing %s (UsePackage2)"),
-                                PackageName.c_str());
+           return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                                Pkg.Name(), "UsePackage", 2);
 
         if (NewFileVer(Ver,List) == false)
-           return _error->Error(_("Error occurred while processing %s (NewFileVer1)"),
-                                PackageName.c_str());
-        
+           return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                                Pkg.Name(), "NewFileVer", 1);
+
         // Read only a single record and return
         if (OutVer != 0)
         {
            *OutVer = Ver;
-           FoundFileDeps |= List.HasFileDeps();
            return true;
         }
-        
-        continue;
+
+        return true;
       }
+   }
 
-      // Add a new version
-      map_ptrloc const verindex = NewVersion(Ver,Version,*LastVer);
-      if (verindex == 0 && _error->PendingError())
-        return _error->Error(_("Error occurred while processing %s (NewVersion%d)"),
-                             PackageName.c_str(), 1);
+   // Add a new version
+   map_ptrloc const verindex = NewVersion(Ver,Version,*LastVer);
+   if (verindex == 0 && _error->PendingError())
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "NewVersion", 1);
 
-      if (oldMap != Map.Data())
+   if (oldMap != Map.Data())
         LastVer += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
-      *LastVer = verindex;
-      Ver->ParentPkg = Pkg.Index();
-      Ver->Hash = Hash;
+   *LastVer = verindex;
+   Ver->ParentPkg = Pkg.Index();
+   Ver->Hash = Hash;
 
-      if (List.NewVersion(Ver) == false)
-        return _error->Error(_("Error occurred while processing %s (NewVersion%d)"),
-                             PackageName.c_str(), 2);
+   if (unlikely(List.NewVersion(Ver) == false))
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "NewVersion", 2);
 
-      if (List.UsePackage(Pkg,Ver) == false)
-        return _error->Error(_("Error occurred while processing %s (UsePackage3)"),
-                             PackageName.c_str());
-      
-      if (NewFileVer(Ver,List) == false)
-        return _error->Error(_("Error occurred while processing %s (NewVersion%d)"),
-                             PackageName.c_str(), 3);
+   if (unlikely(List.UsePackage(Pkg,Ver) == false))
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "UsePackage", 3);
 
-      // Read only a single record and return
-      if (OutVer != 0)
-      {
-        *OutVer = Ver;
-        FoundFileDeps |= List.HasFileDeps();
-        return true;
-      }      
+   if (unlikely(NewFileVer(Ver,List) == false))
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "NewFileVer", 2);
 
-      /* Record the Description data. Description data always exist in
-        Packages and Translation-* files. */
-      pkgCache::DescIterator Desc = Ver.DescriptionList();
-      Dynamic<pkgCache::DescIterator> DynDesc(Desc);
-      map_ptrloc *LastDesc = &Ver->DescriptionList;
+   pkgCache::GrpIterator Grp = Pkg.Group();
+   Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
 
-      // Skip to the end of description set
-      for (; Desc.end() == false; LastDesc = &Desc->NextDesc, Desc++);
+   /* If it is the first version of this package we need to add implicit
+      Multi-Arch dependencies to all other package versions in the group now -
+      otherwise we just add them for this new version */
+   if (Pkg.VersionList()->NextVer == 0)
+   {
+      pkgCache::PkgIterator P = Grp.PackageList();
+      Dynamic<pkgCache::PkgIterator> DynP(P);
+      for (; P.end() != true; P = Grp.NextPkg(P))
+      {
+        if (P->ID == Pkg->ID)
+           continue;
+        pkgCache::VerIterator V = P.VersionList();
+        Dynamic<pkgCache::VerIterator> DynV(V);
+        for (; V.end() != true; ++V)
+           if (unlikely(AddImplicitDepends(V, Pkg) == false))
+              return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                                   Pkg.Name(), "AddImplicitDepends", 1);
+      }
+   }
+   if (unlikely(AddImplicitDepends(Grp, Pkg, Ver) == false))
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "AddImplicitDepends", 2);
 
-      // Add new description
-      oldMap = Map.Data();
-      map_ptrloc const descindex = NewDescription(Desc, List.DescriptionLanguage(), List.Description_md5(), *LastDesc);
-      if (oldMap != Map.Data())
-        LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
-      *LastDesc = descindex;
-      Desc->ParentPkg = Pkg.Index();
+   // Read only a single record and return
+   if (OutVer != 0)
+   {
+      *OutVer = Ver;
+      return true;
+   }
 
-      if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
-        return _error->Error(_("Error occurred while processing %s (NewFileDesc2)"),PackageName.c_str());
+   /* Record the Description (it is not translated) */
+   MD5SumValue CurMd5 = List.Description_md5();
+   if (CurMd5.Value().empty() == true)
+      return true;
+   std::string CurLang = List.DescriptionLanguage();
+
+   /* Before we add a new description we first search in the group for
+      a version with a description of the same MD5 - if so we reuse this
+      description group instead of creating our own for this version */
+   for (pkgCache::PkgIterator P = Grp.PackageList();
+       P.end() == false; P = Grp.NextPkg(P))
+   {
+      for (pkgCache::VerIterator V = P.VersionList();
+          V.end() == false; ++V)
+      {
+        if (IsDuplicateDescription(V.DescriptionList(), CurMd5, "") == false)
+           continue;
+        Ver->DescriptionList = V->DescriptionList;
+        return true;
+      }
    }
 
-   FoundFileDeps |= List.HasFileDeps();
+   // We haven't found reusable descriptions, so add the first description
+   pkgCache::DescIterator Desc = Ver.DescriptionList();
+   Dynamic<pkgCache::DescIterator> DynDesc(Desc);
+   map_ptrloc *LastDesc = &Ver->DescriptionList;
+
+   oldMap = Map.Data();
+   map_ptrloc const descindex = NewDescription(Desc, CurLang, CurMd5, *LastDesc);
+   if (oldMap != Map.Data())
+       LastDesc += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+   *LastDesc = descindex;
+   Desc->ParentPkg = Pkg.Index();
+
+   if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false)
+      return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                          Pkg.Name(), "NewFileDesc", 2);
 
-   if (Cache.HeaderP->PackageCount >= (1ULL<<sizeof(Cache.PkgP->ID)*8)-1)
-      return _error->Error(_("Wow, you exceeded the number of package "
-                            "names this APT is capable of."));
-   if (Cache.HeaderP->VersionCount >= (1ULL<<(sizeof(Cache.VerP->ID)*8))-1)
-      return _error->Error(_("Wow, you exceeded the number of versions "
-                            "this APT is capable of."));
-   if (Cache.HeaderP->DescriptionCount >= (1ULL<<(sizeof(Cache.DescP->ID)*8))-1)
-      return _error->Error(_("Wow, you exceeded the number of descriptions "
-                            "this APT is capable of."));
-   if (Cache.HeaderP->DependsCount >= (1ULL<<(sizeof(Cache.DepP->ID)*8))-1ULL)
-      return _error->Error(_("Wow, you exceeded the number of dependencies "
-                            "this APT is capable of."));
    return true;
 }
                                                                        /*}}}*/
+                                                                       /*}}}*/
 // CacheGenerator::MergeFileProvides - Merge file provides             /*{{{*/
 // ---------------------------------------------------------------------
 /* If we found any file depends while parsing the main list we need to 
@@ -386,8 +491,8 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
       pkgCache::PkgIterator Pkg = Cache.FindPkg(PackageName);
       Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
       if (Pkg.end() == true)
-        return _error->Error(_("Error occurred while processing %s (FindPkg)"),
-                               PackageName.c_str());
+        return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                               PackageName.c_str(), "FindPkg", 1);
       Counter++;
       if (Counter % 100 == 0 && Progress != 0)
         Progress->Progress(List.Offset());
@@ -400,7 +505,8 @@ bool pkgCacheGenerator::MergeFileProvides(ListParser &List)
         if (Ver->Hash == Hash && Version.c_str() == Ver.VerStr())
         {
            if (List.CollectFileProvides(Cache,Ver) == false)
-              return _error->Error(_("Error occurred while processing %s (CollectFileProvides)"),PackageName.c_str());
+              return _error->Error(_("Error occurred while processing %s (%s%d)"),
+                                   PackageName.c_str(), "CollectFileProvides", 1);
            break;
         }
       }
@@ -491,6 +597,75 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
 
    return true;
 }
+                                                                       /*}}}*/
+// CacheGenerator::AddImplicitDepends                                  /*{{{*/
+bool pkgCacheGenerator::AddImplicitDepends(pkgCache::GrpIterator &G,
+                                          pkgCache::PkgIterator &P,
+                                          pkgCache::VerIterator &V)
+{
+   // copy P.Arch() into a string here as a cache remap
+   // in NewDepends() later may alter the pointer location
+   string Arch = P.Arch() == NULL ? "" : P.Arch();
+   map_ptrloc *OldDepLast = NULL;
+   /* MultiArch handling introduces a lot of implicit Dependencies:
+      - MultiArch: same → Co-Installable if they have the same version
+      - All others conflict with all other group members */
+   bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
+   pkgCache::PkgIterator D = G.PackageList();
+   Dynamic<pkgCache::PkgIterator> DynD(D);
+   for (; D.end() != true; D = G.NextPkg(D))
+   {
+      if (Arch == D.Arch() || D->VersionList == 0)
+        continue;
+      /* We allow only one installed arch at the time
+        per group, therefore each group member conflicts
+        with all other group members */
+      if (coInstall == true)
+      {
+        // Replaces: ${self}:other ( << ${binary:Version})
+        NewDepends(D, V, V.VerStr(),
+                   pkgCache::Dep::Less, pkgCache::Dep::Replaces,
+                   OldDepLast);
+        // Breaks: ${self}:other (!= ${binary:Version})
+        NewDepends(D, V, V.VerStr(),
+                   pkgCache::Dep::NotEquals, pkgCache::Dep::DpkgBreaks,
+                   OldDepLast);
+      } else {
+        // Conflicts: ${self}:other
+        NewDepends(D, V, "",
+                   pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+                   OldDepLast);
+      }
+   }
+   return true;
+}
+bool pkgCacheGenerator::AddImplicitDepends(pkgCache::VerIterator &V,
+                                          pkgCache::PkgIterator &D)
+{
+   /* MultiArch handling introduces a lot of implicit Dependencies:
+      - MultiArch: same → Co-Installable if they have the same version
+      - All others conflict with all other group members */
+   map_ptrloc *OldDepLast = NULL;
+   bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
+   if (coInstall == true)
+   {
+      // Replaces: ${self}:other ( << ${binary:Version})
+      NewDepends(D, V, V.VerStr(),
+                pkgCache::Dep::Less, pkgCache::Dep::Replaces,
+                OldDepLast);
+      // Breaks: ${self}:other (!= ${binary:Version})
+      NewDepends(D, V, V.VerStr(),
+                pkgCache::Dep::NotEquals, pkgCache::Dep::DpkgBreaks,
+                OldDepLast);
+   } else {
+      // Conflicts: ${self}:other
+      NewDepends(D, V, "",
+                pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
+                OldDepLast);
+   }
+   return true;
+}
+
                                                                        /*}}}*/
 // CacheGenerator::NewFileVer - Create a new File<->Version association        /*{{{*/
 // ---------------------------------------------------------------------
@@ -610,76 +785,6 @@ map_ptrloc pkgCacheGenerator::NewDescription(pkgCache::DescIterator &Desc,
    return Description;
 }
                                                                        /*}}}*/
-// CacheGenerator::FinishCache - do various finish operations          /*{{{*/
-// ---------------------------------------------------------------------
-/* This prepares the Cache for delivery */
-bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
-{
-   // FIXME: add progress reporting for this operation
-   // Do we have different architectures in your groups ?
-   vector<string> archs = APT::Configuration::getArchitectures();
-   if (archs.size() > 1)
-   {
-      // Create Conflicts in between the group
-      pkgCache::GrpIterator G = GetCache().GrpBegin();
-      Dynamic<pkgCache::GrpIterator> DynG(G);
-      for (; G.end() != true; ++G)
-      {
-        string const PkgName = G.Name();
-        pkgCache::PkgIterator P = G.PackageList();
-        Dynamic<pkgCache::PkgIterator> DynP(P);
-        for (; P.end() != true; P = G.NextPkg(P))
-        {
-           pkgCache::PkgIterator allPkg;
-           Dynamic<pkgCache::PkgIterator> DynallPkg(allPkg);
-           pkgCache::VerIterator V = P.VersionList();
-           Dynamic<pkgCache::VerIterator> DynV(V);
-           for (; V.end() != true; ++V)
-           {
-               // copy P.Arch() into a string here as a cache remap
-               // in NewDepends() later may alter the pointer location
-              string Arch = P.Arch() == NULL ? "" : P.Arch();
-              map_ptrloc *OldDepLast = NULL;
-              /* MultiArch handling introduces a lot of implicit Dependencies:
-               - MultiArch: same → Co-Installable if they have the same version
-               - Architecture: all → Need to be Co-Installable for internal reasons
-               - All others conflict with all other group members */
-              bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same);
-              for (vector<string>::const_iterator A = archs.begin(); A != archs.end(); ++A)
-              {
-                 if (*A == Arch)
-                    continue;
-                 /* We allow only one installed arch at the time
-                    per group, therefore each group member conflicts
-                    with all other group members */
-                 pkgCache::PkgIterator D = G.FindPkg(*A);
-                 Dynamic<pkgCache::PkgIterator> DynD(D);
-                 if (D.end() == true)
-                    continue;
-                 if (coInstall == true)
-                 {
-                    // Replaces: ${self}:other ( << ${binary:Version})
-                    NewDepends(D, V, V.VerStr(),
-                               pkgCache::Dep::Less, pkgCache::Dep::Replaces,
-                               OldDepLast);
-                    // Breaks: ${self}:other (!= ${binary:Version})
-                    NewDepends(D, V, V.VerStr(),
-                               pkgCache::Dep::NotEquals, pkgCache::Dep::DpkgBreaks,
-                               OldDepLast);
-                 } else {
-                       // Conflicts: ${self}:other
-                       NewDepends(D, V, "",
-                                  pkgCache::Dep::NoOp, pkgCache::Dep::Conflicts,
-                                  OldDepLast);
-                 }
-              }
-           }
-        }
-      }
-   }
-   return true;
-}
-                                                                       /*}}}*/
 // CacheGenerator::NewDepends - Create a dependency element            /*{{{*/
 // ---------------------------------------------------------------------
 /* This creates a dependency element in the tree. It is linked to the
@@ -1242,9 +1347,6 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
       if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
                     Files.begin()+EndOfSource,Files.end()) == false)
         return false;
-
-      // FIXME: move me to a better place
-      Gen.FinishCache(Progress);
    }
    else
    {
@@ -1287,9 +1389,6 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress
       if (BuildCache(Gen,Progress,CurrentSize,TotalSize,
                     Files.begin()+EndOfSource,Files.end()) == false)
         return false;
-
-      // FIXME: move me to a better place
-      Gen.FinishCache(Progress);
    }
    if (Debug == true)
       std::clog << "Caches are ready for shipping" << std::endl;
@@ -1340,9 +1439,6 @@ bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **O
                  Files.begin()+EndOfSource,Files.end()) == false)
       return false;
 
-   // FIXME: move me to a better place
-   Gen.FinishCache(Progress);
-
    if (_error->PendingError() == true)
       return false;
    *OutMap = Map.UnGuard();
@@ -1350,3 +1446,22 @@ bool pkgCacheGenerator::MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **O
    return true;
 }
                                                                        /*}}}*/
+// IsDuplicateDescription                                              /*{{{*/
+bool IsDuplicateDescription(pkgCache::DescIterator Desc,
+                           MD5SumValue const &CurMd5, std::string const &CurLang)
+{
+   // Descriptions in the same link-list have all the same md5
+   if (MD5SumValue(Desc.md5()) != CurMd5)
+      return false;
+   for (; Desc.end() == false; ++Desc)
+      if (Desc.LanguageCode() == CurLang)
+        return true;
+   return false;
+}
+                                                                       /*}}}*/
+// CacheGenerator::FinishCache                                         /*{{{*/
+bool pkgCacheGenerator::FinishCache(OpProgress *Progress)
+{
+   return true;
+}
+                                                                       /*}}}*/
index c260511826ab36dc94472aedc3b66d713d982712..b6259b43383bc09e05f8f5028784322961467f70 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/md5.h>
+#include <apt-pkg/macros.h>
 
 #include <vector>
 
@@ -63,29 +64,29 @@ class pkgCacheGenerator                                                     /*{{{*/
    pkgCache Cache;
    OpProgress *Progress;
    
-   string PkgFileName;
+   std::string PkgFileName;
    pkgCache::PackageFile *CurrentFile;
 
    // Flag file dependencies
    bool FoundFileDeps;
    
-   bool NewGroup(pkgCache::GrpIterator &Grp,const string &Name);
-   bool NewPackage(pkgCache::PkgIterator &Pkg,const string &Name, const string &Arch);
+   bool NewGroup(pkgCache::GrpIterator &Grp,const std::string &Name);
+   bool NewPackage(pkgCache::PkgIterator &Pkg,const std::string &Name, const std::string &Arch);
    bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
    bool NewFileDesc(pkgCache::DescIterator &Desc,ListParser &List);
    bool NewDepends(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver,
-                  string const &Version, unsigned int const &Op,
+                  std::string const &Version, unsigned int const &Op,
                   unsigned int const &Type, map_ptrloc* &OldDepLast);
-   unsigned long NewVersion(pkgCache::VerIterator &Ver,const string &VerStr,unsigned long Next);
-   map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const string &Lang,const MD5SumValue &md5sum,map_ptrloc Next);
+   unsigned long NewVersion(pkgCache::VerIterator &Ver,const std::string &VerStr,unsigned long Next);
+   map_ptrloc NewDescription(pkgCache::DescIterator &Desc,const std::string &Lang,const MD5SumValue &md5sum,map_ptrloc Next);
 
    public:
 
    unsigned long WriteUniqString(const char *S,unsigned int Size);
-   inline unsigned long WriteUniqString(const string &S) {return WriteUniqString(S.c_str(),S.length());};
+   inline unsigned long WriteUniqString(const std::string &S) {return WriteUniqString(S.c_str(),S.length());};
 
    void DropProgress() {Progress = 0;};
-   bool SelectFile(const string &File,const string &Site,pkgIndexFile const &Index,
+   bool SelectFile(const std::string &File,const std::string &Site,pkgIndexFile const &Index,
                   unsigned long Flags = 0);
    bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0);
    inline pkgCache &GetCache() {return Cache;};
@@ -94,7 +95,7 @@ class pkgCacheGenerator                                                       /*{{{*/
 
    bool HasFileDeps() {return FoundFileDeps;};
    bool MergeFileProvides(ListParser &List);
-   bool FinishCache(OpProgress *Progress);
+   __deprecated bool FinishCache(OpProgress *Progress);
 
    static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress,
                        MMap **OutMap = 0,bool AllowMem = false);
@@ -105,6 +106,16 @@ class pkgCacheGenerator                                                    /*{{{*/
 
    pkgCacheGenerator(DynamicMMap *Map,OpProgress *Progress);
    ~pkgCacheGenerator();
+
+   private:
+   bool MergeListGroup(ListParser &List, std::string const &GrpName);
+   bool MergeListPackage(ListParser &List, pkgCache::PkgIterator &Pkg);
+   bool MergeListVersion(ListParser &List, pkgCache::PkgIterator &Pkg,
+                        std::string const &Version, pkgCache::VerIterator* &OutVer);
+
+   bool AddImplicitDepends(pkgCache::GrpIterator &G, pkgCache::PkgIterator &P,
+                          pkgCache::VerIterator &V);
+   bool AddImplicitDepends(pkgCache::VerIterator &V, pkgCache::PkgIterator &D);
 };
                                                                        /*}}}*/
 // This is the abstract package list parser class.                     /*{{{*/
@@ -122,26 +133,26 @@ class pkgCacheGenerator::ListParser
       
    protected:
 
-   inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
+   inline unsigned long WriteUniqString(std::string S) {return Owner->WriteUniqString(S);};
    inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
-   inline unsigned long WriteString(const string &S) {return Owner->WriteStringInMap(S);};
+   inline unsigned long WriteString(const std::string &S) {return Owner->WriteStringInMap(S);};
    inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->WriteStringInMap(S,Size);};
-   bool NewDepends(pkgCache::VerIterator &Ver,const string &Package, const string &Arch,
-                  const string &Version,unsigned int Op,
+   bool NewDepends(pkgCache::VerIterator &Ver,const std::string &Package, const std::string &Arch,
+                  const std::string &Version,unsigned int Op,
                   unsigned int Type);
-   bool NewProvides(pkgCache::VerIterator &Ver,const string &PkgName,
-                   const string &PkgArch, const string &Version);
+   bool NewProvides(pkgCache::VerIterator &Ver,const std::string &PkgName,
+                   const std::string &PkgArch, const std::string &Version);
    
    public:
    
    // These all operate against the current section
-   virtual string Package() = 0;
-   virtual string Architecture() = 0;
+   virtual std::string Package() = 0;
+   virtual std::string Architecture() = 0;
    virtual bool ArchitectureAll() = 0;
-   virtual string Version() = 0;
+   virtual std::string Version() = 0;
    virtual bool NewVersion(pkgCache::VerIterator &Ver) = 0;
-   virtual string Description() = 0;
-   virtual string DescriptionLanguage() = 0;
+   virtual std::string Description() = 0;
+   virtual std::string DescriptionLanguage() = 0;
    virtual MD5SumValue Description_md5() = 0;
    virtual unsigned short VersionHash() = 0;
    virtual bool UsePackage(pkgCache::PkgIterator &Pkg,
@@ -164,18 +175,4 @@ bool pkgMakeStatusCache(pkgSourceList &List,OpProgress &Progress,
                        MMap **OutMap = 0,bool AllowMem = false);
 bool pkgMakeOnlyStatusCache(OpProgress &Progress,DynamicMMap **OutMap);
 
-
-#ifdef APT_COMPATIBILITY
-#if APT_COMPATIBILITY != 986
-#warning "Using APT_COMPATIBILITY"
-#endif
-MMap *pkgMakeStatusCacheMem(pkgSourceList &List,OpProgress &Progress)
-{
-   MMap *Map = 0;
-   if (pkgCacheGenerator::MakeStatusCache(List,&Progress,&Map,true) == false)
-      return 0;
-   return Map;
-}
-#endif
-
 #endif
index 7709f133a9148f1d672144ef35fff249bcb33286..c5b3bebd70ba5e2f3f6a4782c60eec3d2717889d 100644 (file)
@@ -46,7 +46,7 @@ pkgRecords::pkgRecords(pkgCache &Cache) : Cache(Cache),
 /* */
 pkgRecords::~pkgRecords()
 {
-   for ( vector<Parser*>::iterator it = Files.begin();
+   for ( std::vector<Parser*>::iterator it = Files.begin();
      it != Files.end();
      ++it)
    {
index 8741533b99dcc0ebeca9db63d5894037cfdd546b..3658435e85cd688768970d3d245c8a560f8b2379 100644 (file)
@@ -54,23 +54,23 @@ class pkgRecords::Parser                                            /*{{{*/
    friend class pkgRecords;
    
    // These refer to the archive file for the Version
-   virtual string FileName() {return string();};
-   virtual string MD5Hash() {return string();};
-   virtual string SHA1Hash() {return string();};
-   virtual string SHA256Hash() {return string();};
-   virtual string SHA512Hash() {return string();};
-   virtual string SourcePkg() {return string();};
-   virtual string SourceVer() {return string();};
+   virtual std::string FileName() {return std::string();};
+   virtual std::string MD5Hash() {return std::string();};
+   virtual std::string SHA1Hash() {return std::string();};
+   virtual std::string SHA256Hash() {return std::string();};
+   virtual std::string SHA512Hash() {return std::string();};
+   virtual std::string SourcePkg() {return std::string();};
+   virtual std::string SourceVer() {return std::string();};
 
    // These are some general stats about the package
-   virtual string Maintainer() {return string();};
-   virtual string ShortDesc() {return string();};
-   virtual string LongDesc() {return string();};
-   virtual string Name() {return string();};
-   virtual string Homepage() {return string();}
+   virtual std::string Maintainer() {return std::string();};
+   virtual std::string ShortDesc() {return std::string();};
+   virtual std::string LongDesc() {return std::string();};
+   virtual std::string Name() {return std::string();};
+   virtual std::string Homepage() {return std::string();}
 
    // An arbitrary custom field
-   virtual string RecordField(const char *fieldName) { return string();};
+   virtual std::string RecordField(const char *fieldName) { return std::string();};
 
    // The record in binary form
    virtual void GetRec(const char *&Start,const char *&Stop) {Start = Stop = 0;};
index 246762e0bf34f60c8aa4f4bd8c12b694522877a7..211fd0d5616a5a2ae632f9ee41ff1bd3b02cf2ce 100644 (file)
 #ifndef PKGLIB_PKGSYSTEM_H
 #define PKGLIB_PKGSYSTEM_H
 
+#include <apt-pkg/pkgcache.h>
 
-#include <apt-pkg/depcache.h>
 #include <vector>
-    
+
+class pkgDepCache;
 class pkgPackageManager;
 class pkgVersioningSystem;
 class Configuration;
 class pkgIndexFile;
+class PkgFileIterator;
 
 class pkgSystem
 {   
index 92d32728f7a27392b99f4d90b9ea89e88f954eeb..3c8246e3b179efc3884924678401b4d70a7a2394 100644 (file)
@@ -38,8 +38,6 @@
 #include <apt-pkg/versionmatch.h>
 #include <vector>
 
-using std::vector;
-
 class pkgPolicy : public pkgDepCache::Policy
 {
    protected:
@@ -47,29 +45,29 @@ class pkgPolicy : public pkgDepCache::Policy
    struct Pin
    {
       pkgVersionMatch::MatchType Type;
-      string Data;
+      std::string Data;
       signed short Priority;
       Pin() : Type(pkgVersionMatch::None), Priority(0) {};
    };
 
    struct PkgPin : Pin
    {
-      string Pkg;
-      PkgPin(string const &Pkg) : Pin(), Pkg(Pkg) {};
+      std::string Pkg;
+      PkgPin(std::string const &Pkg) : Pin(), Pkg(Pkg) {};
    };
    
    Pin *Pins;
    signed short *PFPriority;
-   vector<Pin> Defaults;
-   vector<PkgPin> Unmatched;
+   std::vector<Pin> Defaults;
+   std::vector<PkgPin> Unmatched;
    pkgCache *Cache;
    bool StatusOverride;
    
    public:
 
    // Things for manipulating pins
-   void CreatePin(pkgVersionMatch::MatchType Type,string Pkg,
-                 string Data,signed short Priority);
+   void CreatePin(pkgVersionMatch::MatchType Type,std::string Pkg,
+                 std::string Data,signed short Priority);
    pkgCache::VerIterator GetMatch(pkgCache::PkgIterator const &Pkg);
 
    // Things for the cache interface.
@@ -83,7 +81,7 @@ class pkgPolicy : public pkgDepCache::Policy
    virtual ~pkgPolicy() {delete [] PFPriority; delete [] Pins;};
 };
 
-bool ReadPinFile(pkgPolicy &Plcy,string File = "");
-bool ReadPinDir(pkgPolicy &Plcy,string Dir = "");
+bool ReadPinFile(pkgPolicy &Plcy, std::string File = "");
+bool ReadPinDir(pkgPolicy &Plcy, std::string Dir = "");
 
 #endif
index e20ec4704fff8a7387dd9e9c1db3e50d6bf4a25f..46025fc7487d58fb49666cee42be0e086d4b3e97 100644 (file)
@@ -15,6 +15,8 @@
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/metaindex.h>
+#include <apt-pkg/indexfile.h>
 
 #include <fstream>
 
index 7b473ee64b453187a4f72a91267bfb5f586b7451..4509e54b9bbc7afde6e6a0c2c0e79e3c437fd99f 100644 (file)
 #include <vector>
 #include <map>
 #include <apt-pkg/pkgcache.h>
-#include <apt-pkg/metaindex.h>
 
 using std::string;
 using std::vector;
     
 
-class pkgAquire;
+class pkgAcquire;
+class pkgIndexFile;
+class metaIndex;
+
 class pkgSourceList
 {
    public:
index 8c1de2ea5da1a3e7d25860713c3b803b5a5fe949..f6d2d515802299a44d4d94d3b83f5fa5c817f1e3 100644 (file)
@@ -17,6 +17,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/metaindex.h>
 
 #include <apti18n.h>
                                                                        /*}}}*/
index 8a78d77112258eaddf567ab45c377973313d67ae..a55bc74fa2cd2c94d63c2958a21bdb05d371514e 100644 (file)
 
 
 #include <string>
-#include <vector>    
-
-using std::string;
-using std::vector;
+#include <vector>
 
 class pkgSourceList;
 class pkgIndexFile;
@@ -29,10 +26,10 @@ class pkgSrcRecords
    // Describes a single file
    struct File
    {
-      string MD5Hash;
+      std::string MD5Hash;
       unsigned long Size;
-      string Path;
-      string Type;
+      std::string Path;
+      std::string Type;
    };
    
    // Abstract parser for each source record
@@ -49,8 +46,8 @@ class pkgSrcRecords
 
       struct BuildDepRec 
       {
-         string Package;
-        string Version;
+        std::string Package;
+        std::string Version;
         unsigned int Op;
         unsigned char Type;
       };
@@ -61,18 +58,18 @@ class pkgSrcRecords
       virtual bool Step() = 0;
       virtual bool Jump(unsigned long const &Off) = 0;
       virtual unsigned long Offset() = 0;
-      virtual string AsStr() = 0;
+      virtual std::string AsStr() = 0;
       
-      virtual string Package() const = 0;
-      virtual string Version() const = 0;
-      virtual string Maintainer() const = 0;
-      virtual string Section() const = 0;
+      virtual std::string Package() const = 0;
+      virtual std::string Version() const = 0;
+      virtual std::string Maintainer() const = 0;
+      virtual std::string Section() const = 0;
       virtual const char **Binaries() = 0;   // Ownership does not transfer
 
-      virtual bool BuildDepends(vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0;
+      virtual bool BuildDepends(std::vector<BuildDepRec> &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0;
       static const char *BuildDepType(unsigned char const &Type);
 
-      virtual bool Files(vector<pkgSrcRecords::File> &F) = 0;
+      virtual bool Files(std::vector<pkgSrcRecords::File> &F) = 0;
       
       Parser(const pkgIndexFile *Index) : iIndex(Index) {};
       virtual ~Parser() {};
@@ -83,8 +80,8 @@ class pkgSrcRecords
    void *d;
    
    // The list of files and the current parser pointer
-   vector<Parser*> Files;
-   vector<Parser *>::iterator Current;
+   std::vector<Parser*> Files;
+   std::vector<Parser *>::iterator Current;
    
    public:
 
index 418e6bed81569d4e10e536d6d0bc0fd5c719587a..ec86173df5fffb3db66117ebb6167e98086bb69b 100644 (file)
@@ -16,6 +16,7 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 
 #include <string>
 #include <stdio.h>
index 28f7fcc243e0cd4c9f3f77e33a8c13889fc9d90f..a5bf5ac90914ec86f0b937508437cc81483e54d8 100644 (file)
 #ifndef PKGLIB_TAGFILE_H
 #define PKGLIB_TAGFILE_H
 
-
-#include <apt-pkg/fileutl.h>
 #include <stdio.h>
 
+#include <string>
+
+class FileFd;
+
 class pkgTagSection
 {
    const char *Section;
@@ -54,7 +56,7 @@ class pkgTagSection
    
    bool Find(const char *Tag,const char *&Start, const char *&End) const;
    bool Find(const char *Tag,unsigned &Pos) const;
-   string FindS(const char *Tag) const;
+   std::string FindS(const char *Tag) const;
    signed int FindI(const char *Tag,signed long Default = 0) const ;
    unsigned long long FindULL(const char *Tag, unsigned long long const &Default = 0) const;
    bool FindFlag(const char *Tag,unsigned long &Flags,
index eab6d448fc3ece7e793636c95984a8affbda6381..36fc2595714c6171c004e8bc9f5a19b2e762d06a 100644 (file)
@@ -22,16 +22,16 @@ Vendor::Vendor(std::string VendorID,
    delete FingerprintList;
 }
 
-const string Vendor::LookupFingerprint(string Print) const
+const std::string Vendor::LookupFingerprint(std::string Print) const
 {
-   std::map<string,string>::const_iterator Elt = Fingerprints.find(Print);
+   std::map<std::string,std::string>::const_iterator Elt = Fingerprints.find(Print);
    if (Elt == Fingerprints.end())
       return "";
    else
       return (*Elt).second;
 }
 
-bool Vendor::CheckDist(string Dist)
+bool Vendor::CheckDist(std::string Dist)
 {
    return true;
 }
index df229737a1c58f2aa3329828a9fb23df39f27853..9b157378cc47d63c2d4f8fe269ecc7cb27fb0810 100644 (file)
@@ -6,29 +6,27 @@
 
 #include <apt-pkg/macros.h>
 
-using std::string;
-
-// A class representing a particular software provider. 
+// A class representing a particular software provider.
 class __deprecated Vendor
 {
    public:
    struct Fingerprint
    {
-      string Print;
-      string Description;
+      std::string Print;
+      std::string Description;
    };
 
    protected:
-   string VendorID;
-   string Origin;
-   std::map<string, string> Fingerprints;
+   std::string VendorID;
+   std::string Origin;
+   std::map<std::string, std::string> Fingerprints;
 
    public:
-   Vendor(string VendorID, string Origin,
+   Vendor(std::string VendorID, std::string Origin,
           std::vector<struct Fingerprint *> *FingerprintList);
-   virtual const string& GetVendorID() const { return VendorID; };
-   virtual const string LookupFingerprint(string Print) const;
-   virtual bool CheckDist(string Dist);
+   virtual const std::string& GetVendorID() const { return VendorID; };
+   virtual const std::string LookupFingerprint(std::string Print) const;
+   virtual bool CheckDist(std::string Dist);
    virtual ~Vendor(){};
 };
 
index 731f11acf52a43bc27c15ff43fca71953e5de517..ecfc7db878aa46c291933714d0103a15e494574c 100644 (file)
@@ -2,14 +2,19 @@
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/configuration.h>
 #include <apti18n.h>
 
 #if __GNUC__ >= 4
        #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 #endif
 
+#include <apt-pkg/vendor.h>
 #include <apt-pkg/vendorlist.h>
 
+using std::string;
+using std::vector;
+
 pkgVendorList::~pkgVendorList()
 {
    for (vector<const Vendor *>::const_iterator I = VendorList.begin(); 
index eaeecb173b36b005883e99ae11fd427f2db4f222..733d23a320ac239e12d242ee8dd69c5b1e144df8 100644 (file)
 
 #include <string>
 #include <vector>
-#include <apt-pkg/vendor.h>
-#include <apt-pkg/configuration.h>
 #include <apt-pkg/macros.h>
 
-using std::string;
-using std::vector;
-
+class Vendor;
+class Configuration;
 
 class __deprecated pkgVendorList
 {
    protected:
-   vector<Vendor const *> VendorList;
+   std::vector<Vendor const *> VendorList;
 
    bool CreateList(Configuration& Cnf);
-   const Vendor* LookupFingerprint(string Fingerprint);
+   const Vendor* LookupFingerprint(std::string Fingerprint);
 
    public:
-   typedef vector<Vendor const *>::const_iterator const_iterator;
+   typedef std::vector<Vendor const *>::const_iterator const_iterator;
    bool ReadMainList();
-   bool Read(string File);
+   bool Read(std::string File);
 
    // List accessors
    inline const_iterator begin() const {return VendorList.begin();};
@@ -42,7 +39,7 @@ class __deprecated pkgVendorList
    inline unsigned int size() const {return VendorList.size();};
    inline bool empty() const {return VendorList.empty();};
 
-   const Vendor* FindVendor(const vector<string> GPGVOutput);
+   const Vendor* FindVendor(const std::vector<std::string> GPGVOutput);
 
    ~pkgVendorList();
 };
index 49c53a93a8073041a4f2fe1ec43117c8f3c1e77f..92dbc2576732edde7bd8c17bdf3375f000b8c185 100644 (file)
 #ifndef PKGLIB_VERSION_H
 #define PKGLIB_VERSION_H
 
-
-#include <apt-pkg/strutl.h>    
+#include <apt-pkg/strutl.h>
 #include <string>
 
-using std::string;
-
 class pkgVersioningSystem
 {
    public:
@@ -43,7 +40,7 @@ class pkgVersioningSystem
    virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) = 0;
    virtual int DoCmpReleaseVer(const char *A,const char *Aend,
                               const char *B,const char *Bend) = 0;
-   virtual string UpstreamVersion(const char *A) = 0;
+   virtual std::string UpstreamVersion(const char *A) = 0;
    
    // See if the given VS is compatible with this one.. 
    virtual bool TestCompatibility(pkgVersioningSystem const &Against) 
@@ -57,8 +54,4 @@ class pkgVersioningSystem
    virtual ~pkgVersioningSystem() {};
 };
 
-#ifdef APT_COMPATIBILITY
-#include <apt-pkg/debversion.h>
-#endif
-
 #endif
index f336b3c3525c92079514a2d2056ace0124a1af85..e4fa0ea65f10fd2be0a3d4c737db3e5eefc89673 100644 (file)
@@ -24,6 +24,8 @@
 #include <regex.h>
                                                                        /*}}}*/
 
+using std::string;
+
 // VersionMatch::pkgVersionMatch - Constructor                         /*{{{*/
 // ---------------------------------------------------------------------
 /* Break up the data string according to the selected type */
index 39639a23dc3dd565126b008ada319074764921ae..da103fc5b5fec0c438e3afc1b5523ea04a2a7a79 100644 (file)
 #include <string>
 #include <apt-pkg/pkgcache.h>
 
-using std::string;
-
 class pkgVersionMatch
 {   
    // Version Matching
-   string VerStr;
+   std::string VerStr;
    bool VerPrefixMatch;
 
    // Release Matching
-   string RelVerStr;
+   std::string RelVerStr;
    bool RelVerPrefixMatch;
-   string RelOrigin;
-   string RelRelease;
-   string RelCodename;
-   string RelArchive;
-   string RelLabel;
-   string RelComponent;
-   string RelArchitecture;
+   std::string RelOrigin;
+   std::string RelRelease;
+   std::string RelCodename;
+   std::string RelArchive;
+   std::string RelLabel;
+   std::string RelComponent;
+   std::string RelArchitecture;
    bool MatchAll;
    
    // Origin Matching
-   string OrSite;
+   std::string OrSite;
    
    public:
    
    enum MatchType {None = 0,Version,Release,Origin} Type;
    
-   bool MatchVer(const char *A,string B,bool Prefix);
+   bool MatchVer(const char *A,std::string B,bool Prefix);
    bool ExpressionMatches(const char *pattern, const char *string);
    bool ExpressionMatches(const std::string& pattern, const char *string);
    bool FileMatch(pkgCache::PkgFileIterator File);
    pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg);
                               
-   pkgVersionMatch(string Data,MatchType Type);
+   pkgVersionMatch(std::string Data,MatchType Type);
 };
 
 #endif
index 48f90ae59d87eebe2a0ab1318bb20fe7fe228156..8f0903923a2440cfbecf1917045efd9672618a9b 100644 (file)
@@ -12,6 +12,8 @@
 
 #include <apt-pkg/acquire.h>
 
+#include <string>
+
 class AcqTextStatus : public pkgAcquireStatus
 {
    unsigned int &ScreenWidth;
@@ -21,7 +23,7 @@ class AcqTextStatus : public pkgAcquireStatus
    
    public:
    
-   virtual bool MediaChange(string Media,string Drive);
+   virtual bool MediaChange(std::string Media,std::string Drive);
    virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
    virtual void Fetch(pkgAcquire::ItemDesc &Itm);
    virtual void Done(pkgAcquire::ItemDesc &Itm);
index a4cdf784e29c959c4be8012a727029f7e68980b2..82a31c9b189c2378df0c7f436fb339064b74a983 100644 (file)
@@ -16,7 +16,6 @@
 #include<config.h>
 
 #include <apt-pkg/error.h>
-#include <apt-pkg/pkgcachegen.h>
 #include <apt-pkg/cachefile.h>
 #include <apt-pkg/cacheset.h>
 #include <apt-pkg/init.h>
@@ -24,6 +23,7 @@
 #include <apt-pkg/sourcelist.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/pkgrecords.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/version.h>
@@ -31,6 +31,9 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/sptr.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/metaindex.h>
 
 #include <cassert>
 #include <locale.h>
@@ -40,6 +43,7 @@
 #include <regex.h>
 #include <stdio.h>
 #include <iomanip>
+#include <algorithm>
 
 #include <apti18n.h>
                                                                        /*}}}*/
index 8608b1215e74ec16e2744e8277b0123da15fbaeb..fa48debcdef9cff0a4820e36e8eeb5517b960535 100644 (file)
@@ -23,6 +23,8 @@
 #include <apt-pkg/acquire.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/cdrom.h>
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <locale.h>
 #include <iostream>
index df29589751e2763b6fbbc5ed961a12bdd2874a7f..94f6ee9b0f88f2a8d59c5622402e262b45449482 100644 (file)
@@ -24,6 +24,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <locale.h>
 #include <iostream>
index dab0cc6fd63a0059f6eb3f72c0ce08bcc2464cf5..e82e15c6e3a5c6c791d42f8b6baffb17f80a06ae 100644 (file)
@@ -12,6 +12,7 @@
 #include <config.h>
 
 #include <cstdio>
+#include <iostream>
                                                                        /*}}}*/
 
 // ShowHelp - Show a help screen                                       /*{{{*/
index 5d7b76c23e33b2804e9775f36807efc9314f80c8..d5c1a3208db11c0a7d7b78bc1bad75fc450d4c38 100644 (file)
@@ -30,6 +30,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <stdio.h>
 #include <string.h>
index d8f207f0aebe36eb62ab2a26a58ec779efc28cbb..88e7346979ec1fe2e82ebfe7ed433f5f4c2ecfb3 100644 (file)
@@ -36,6 +36,7 @@
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/acquire-item.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
 #include <apt-pkg/clean.h>
 #include <apt-pkg/srcrecords.h>
 #include <apt-pkg/version.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/versionmatch.h>
+#include <apt-pkg/progress.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/pkgrecords.h>
+#include <apt-pkg/indexfile.h>
 
 #include "acqprogress.h"
 
@@ -1684,8 +1689,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
            // install it in the first place, so nuke it instead of show it
            if (Cache[Pkg].Install() == true && Pkg.CurrentVer() == 0)
            {
+              if (Pkg.CandVersion() != 0)
+                 tooMuch.insert(Pkg);
               Cache->MarkDelete(Pkg, false);
-              tooMuch.insert(Pkg);
            }
            // only show stuff in the list that is not yet marked for removal
            else if(hideAutoRemove == false && Cache[Pkg].Delete() == false) 
@@ -1709,33 +1715,41 @@ bool DoAutomaticRemove(CacheFile &Cache)
       bool Changed;
       do {
         Changed = false;
-        for (APT::PackageSet::const_iterator P = tooMuch.begin();
-             P != tooMuch.end() && Changed == false; ++P)
+        for (APT::PackageSet::const_iterator Pkg = tooMuch.begin();
+             Pkg != tooMuch.end() && Changed == false; ++Pkg)
         {
-           for (pkgCache::DepIterator R = P.RevDependsList();
-                R.end() == false; ++R)
-           {
-              if (R.IsNegative() == true ||
-                  Cache->IsImportantDep(R) == false)
-                 continue;
-              pkgCache::PkgIterator N = R.ParentPkg();
-              if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false))
-                 continue;
-              if (Debug == true)
-                 std::clog << "Save " << P << " as another installed garbage package depends on it" << std::endl;
-              Cache->MarkInstall(P, false);
-              if(hideAutoRemove == false)
+           APT::PackageSet too;
+           too.insert(Pkg);
+           for (pkgCache::PrvIterator Prv = Cache[Pkg].CandidateVerIter(Cache).ProvidesList();
+                Prv.end() == false; ++Prv)
+              too.insert(Prv.ParentPkg());
+           for (APT::PackageSet::const_iterator P = too.begin();
+                P != too.end() && Changed == false; ++P) {
+              for (pkgCache::DepIterator R = P.RevDependsList();
+                   R.end() == false; ++R)
               {
-                 ++autoRemoveCount;
-                 if (smallList == false)
-                 {
-                    autoremovelist += P.FullName(true) + " ";
-                    autoremoveversions += string(Cache[P].CandVersion) + "\n";
-                 }
+                 if (R.IsNegative() == true ||
+                     Cache->IsImportantDep(R) == false)
+                    continue;
+                pkgCache::PkgIterator N = R.ParentPkg();
+                if (N.end() == true || (N->CurrentVer == 0 && (*Cache)[N].Install() == false))
+                   continue;
+                if (Debug == true)
+                   std::clog << "Save " << Pkg << " as another installed garbage package depends on it" << std::endl;
+                Cache->MarkInstall(Pkg, false);
+                if (hideAutoRemove == false)
+                {
+                   ++autoRemoveCount;
+                   if (smallList == false)
+                   {
+                      autoremovelist += Pkg.FullName(true) + " ";
+                      autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
+                   }
+                }
+                tooMuch.erase(Pkg);
+                Changed = true;
+                break;
               }
-              tooMuch.erase(P);
-              Changed = true;
-              break;
            }
         }
       } while (Changed == true);
index ef6c688fec74b488603e994b4113f2551ede8a1d..1b636e4d5fe6c6851a7cc5f718cdb07e455bc30f 100644 (file)
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/cachefile.h>
+#include <apt-pkg/cacheset.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/edsp.h>
 #include <apt-pkg/algorithms.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <config.h>
 #include <apti18n.h>
index 8c9a47913e2d2854b05fa688b02e9866ac50a6d5..339cbdf447c4851d2a46e50c4644b8eec645f980 100644 (file)
@@ -13,6 +13,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <algorithm>
 
index 44b74cf6c0901fcd3af204e2cb5fb1b07cddb425..20ae14f2abf8e52e292a286f1eb066abec3d2c6b 100644 (file)
@@ -20,6 +20,8 @@
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <vector>
 #include <algorithm>
index a06abbbc08dfcb8864107da9584b8d562354b5b2..27d1c7c07825e66664bfda7fe2049c573562030b 100644 (file)
@@ -1,5 +1,36 @@
 apt (0.8.16~exp7) UNRELEASEDexperimental; urgency=low
 
+  [ David Kalnischkies ]
+  * do not pollute namespace in the headers with using (Closes: #500198)
+  * use forward declaration in headers if possible instead of includes
+  * remove old APT_COMPATIBILITY ifdef's
+  * apt-pkg/deb/dpkgpm.cc:
+    - use std::vector instead of fixed size arrays to store args and
+      multiarch-packagename strings
+    - load the dpkg base arguments only one time and reuse them later
+  * cmdline/apt-get.cc:
+    - follow Provides in the evaluation of saving candidates, too, for
+      statisfying garbage package dependencies (Closes: #640590)
+  * apt-pkg/algorithms.cc:
+    - if a package is garbage, don't try to save it with FixByInstall
+  * apt-pkg/deb/debsrcrecords.cc:
+    - remove the limit of 400 Binaries for a source package (Closes: #622110)
+  * apt-pkg/deb/deblistparser.cc:
+    - fix crash when the dynamic mmap needs to be grown in
+      LoadReleaseInfo (LP: #854090)
+  * apt-pkg/deb/debmetaindex.cc:
+    - none is a separator, not a language: no need for Index (Closes: #624218)
+  * apt-pkg/aptconfiguration.cc:
+    - do not builtin languages only if none is forced (Closes: #643787)
+  * apt-pkg/pkgcachegen.cc:
+    - refactor MergeList by creating -Group, -Package and -Version specialist
+    - share description list between "same" versions (LP: #868977)
+      This also means that descriptions are shared across archives now.
+    - add implicit dependencies needed for Multi-Arch at the time a Version
+      struct is created and not at the end of the cache generation
+  * apt-pkg/pkgcache.cc:
+    - always prefer "en" over "" for "en"-language regardless of cache-order
+
   [ Michael Vogt ]
   * apt-pkg/contrib/configuration.cc:
     - fix double delete (LP: #848907)
@@ -8,17 +39,12 @@ apt (0.8.16~exp7) UNRELEASEDexperimental; urgency=low
     - fix fetching language information by adding OptionalSubIndexTarget
   * methods/https.cc:
     - cleanup broken downloads properly
-  
+
   [ Colin Watson ]
   * ftparchive/cachedb.cc:
     - fix buffersize in bytes2hex
 
-  [ David Kalnischkies ]  
-  * apt-pkg/deb/deblistparser.cc:
-    - fix crash when the dynamic mmap needs to be grown in
-      LoadReleaseInfo (LP: #854090)
-
- -- Michael Vogt <michael.vogt@ubuntu.com>  Wed, 05 Oct 2011 18:14:11 +0200
+ -- Michael Vogt <mvo@debian.org>  Fri, 14 Oct 2011 13:51:35 +0200
 
 apt (0.8.16~exp6) experimental; urgency=low
 
index 6eccb8d4ae6f8f046e49bc5f30c85a99f230e0a9..f0bfa2a6d613cc4ae54c47a5c0e7ba80c79c54a3 100644 (file)
@@ -18,6 +18,7 @@
 #include <apt-pkg/sha2.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
     
 #include <netinet/in.h>       // htonl, etc
 
@@ -28,7 +29,7 @@
 // CacheDB::ReadyDB - Ready the DB2                                    /*{{{*/
 // ---------------------------------------------------------------------
 /* This opens the DB2 file for caching package information */
-bool CacheDB::ReadyDB(string const &DB)
+bool CacheDB::ReadyDB(std::string const &DB)
 {
    int err;
 
@@ -48,7 +49,7 @@ bool CacheDB::ReadyDB(string const &DB)
    
    DBLoaded = false;
    Dbp = 0;
-   DBFile = string();
+   DBFile = std::string();
    
    if (DB.empty())
       return true;
@@ -162,7 +163,7 @@ bool CacheDB::GetCurStat()
                                                                        /*}}}*/
 // CacheDB::GetFileInfo - Get all the info about the file              /*{{{*/
 // ---------------------------------------------------------------------
-bool CacheDB::GetFileInfo(string const &FileName, bool const &DoControl, bool const &DoContents,
+bool CacheDB::GetFileInfo(std::string const &FileName, bool const &DoControl, bool const &DoContents,
                                bool const &GenContentsOnly, bool const &DoMD5, bool const &DoSHA1,
                                bool const &DoSHA256,   bool const &DoSHA512, 
                           bool const &checkMtime)
@@ -298,9 +299,9 @@ bool CacheDB::LoadContents(bool const &GenOnly)
 }
                                                                        /*}}}*/
 
-static string bytes2hex(uint8_t *bytes, size_t length) {
+static std::string bytes2hex(uint8_t *bytes, size_t length) {
    char buf[3];
-   string space;
+   std::string space;
 
    space.reserve(length*2 + 1);
    for (size_t i = 0; i < length; i++) {
@@ -500,7 +501,7 @@ bool CacheDB::Clean()
              stringcmp(Colon + 1, (char *)Key.data+Key.size,"cl") == 0 ||
              stringcmp(Colon + 1, (char *)Key.data+Key.size,"cn") == 0)
         {
-            if (FileExists(string((const char *)Key.data,Colon)) == true)
+            if (FileExists(std::string((const char *)Key.data,Colon)) == true)
                continue;            
         }
       }
index 6bd5aa36c34c162b64e86ed7c439a058452f10be..377c4160728463117402a9c2f85f9ce1e82903a6 100644 (file)
 #define CACHEDB_H
 
 
+#include <apt-pkg/debfile.h>
 
 #include <db.h>
-#include <string>
-#include <apt-pkg/debfile.h>
 #include <inttypes.h>
 #include <sys/stat.h>
 #include <errno.h>
-    
+#include <string>
+
 #include "contents.h"
-    
+
 class CacheDB
 {
    protected:
@@ -34,7 +34,7 @@ class CacheDB
    DB *Dbp;
    bool DBLoaded;
    bool ReadOnly;
-   string DBFile;
+   std::string DBFile;
 
    // Generate a key for the DB of a given type
    inline void InitQuery(const char *Type)
@@ -90,7 +90,7 @@ class CacheDB
    struct StatStore OldStat;
    
    // 'set' state
-   string FileName;
+   std::string FileName;
    FileFd *Fd;
    debDebFile *DebFile;
    
@@ -99,10 +99,10 @@ class CacheDB
    // Data collection helpers
    debDebFile::MemControlExtract Control;
    ContentsExtract Contents;
-   string MD5Res;
-   string SHA1Res;
-   string SHA256Res;
-   string SHA512Res;
+   std::string MD5Res;
+   std::string SHA1Res;
+   std::string SHA256Res;
+   std::string SHA512Res;
    
    // Runtime statistics
    struct Stats
@@ -129,21 +129,21 @@ class CacheDB
       Stats() : Bytes(0), MD5Bytes(0), SHA1Bytes(0), SHA256Bytes(0), Packages(0), Misses(0), DeLinkBytes(0) {};
    } Stats;
    
-   bool ReadyDB(string const &DB);
+   bool ReadyDB(std::string const &DB);
    inline bool DBFailed() {return Dbp != 0 && DBLoaded == false;};
    inline bool Loaded() {return DBLoaded == true;};
    
    inline unsigned long long GetFileSize(void) {return CurStat.FileSize;}
    
-   bool SetFile(string const &FileName,struct stat St,FileFd *Fd);
-   bool GetFileInfo(string const &FileName, bool const &DoControl, bool const &DoContents, bool const &GenContentsOnly,
+   bool SetFile(std::string const &FileName,struct stat St,FileFd *Fd);
+   bool GetFileInfo(std::string const &FileName, bool const &DoControl, bool const &DoContents, bool const &GenContentsOnly,
                    bool const &DoMD5, bool const &DoSHA1, bool const &DoSHA256, bool const &DoSHA512, bool const &checkMtime = false);
    bool Finish();   
    
    bool Clean();
    
-   CacheDB(string const &DB) : Dbp(0), Fd(NULL), DebFile(0) {ReadyDB(DB);};
-   ~CacheDB() {ReadyDB(string()); delete DebFile;};
+   CacheDB(std::string const &DB) : Dbp(0), Fd(NULL), DebFile(0) {ReadyDB(DB);};
+   ~CacheDB() {ReadyDB(std::string()); delete DebFile;};
 };
     
 #endif
index 65d8dd1cebe87eca6292985967f74a938fc85647..bbc5a1e2b95275cb4842d2cab023f6ff84641b6b 100644 (file)
@@ -380,7 +380,7 @@ bool ContentsExtract::TakeContents(const void *NewData,unsigned long long Length
 // ContentsExtract::Add - Read the contents data into the sorter       /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-void ContentsExtract::Add(GenContents &Contents,string const &Package)
+void ContentsExtract::Add(GenContents &Contents,std::string const &Package)
 {
    const char *Start = Data;
    char *Pkg = Contents.Mystrdup(Package.c_str());
index f549ce17fce7b407ffa47eecde2705ee0ba30609..4af9db574b79168f41d5e6a3f097443855287bd4 100644 (file)
     
 #include <stdlib.h>
 #include <stdio.h>
-#include <apt-pkg/debfile.h>
 #include <apt-pkg/dirstream.h>
 
+class debDebFile;
+
 class GenContents
 {
    struct Node
@@ -80,7 +81,7 @@ class ContentsExtract : public pkgDirStream
    virtual bool DoItem(Item &Itm,int &Fd);      
    void Reset() {CurSize = 0;};
    bool TakeContents(const void *Data,unsigned long long Length);
-   void Add(GenContents &Contents,string const &Package);
+   void Add(GenContents &Contents,std::string const &Package);
    
    ContentsExtract() : Data(0), MaxSize(0), CurSize(0) {};
    virtual ~ContentsExtract() {delete [] Data;};
index 4839af47dba312dd9139ca05a36d65746bddc6bc..5496b06d02e18f09171aa4caa4949d65a46b1275 100644 (file)
 #ifndef MULTICOMPRESS_H
 #define MULTICOMPRESS_H
 
-
-
-#include <string>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/aptconfiguration.h>
+
+#include <string>
 #include <stdio.h>
 #include <sys/types.h>
     
@@ -29,7 +28,7 @@ class MultiCompress
    // An output file
    struct Files
    {
-      string Output;
+      std::string Output;
       APT::Configuration::Compressor CompressProg;
       Files *Next;
       FileFd TmpFile;
@@ -57,9 +56,9 @@ class MultiCompress
    bool Finalize(unsigned long long &OutSize);
    bool OpenOld(int &Fd,pid_t &Proc);
    bool CloseOld(int Fd,pid_t Proc);
-   static bool GetStat(string const &Output,string const &Compress,struct stat &St);
+   static bool GetStat(std::string const &Output,std::string const &Compress,struct stat &St);
    
-   MultiCompress(string const &Output,string const &Compress,
+   MultiCompress(std::string const &Output,std::string const &Compress,
                 mode_t const &Permissions, bool const &Write = true);
    ~MultiCompress();
 };
index a43b8387665b5b7e84eee1ee6d37eeac2d3c1b2b..76a3dfd1e88b05cc835121b06049a14c44d0d3bd 100644 (file)
@@ -22,7 +22,6 @@
 #include <set>
 
 #include "cachedb.h"
-#include "multicompress.h"
 #include "override.h"
 #include "apt-ftparchive.h"
 
@@ -31,7 +30,7 @@ using std::cout;
 using std::endl;
 using std::vector;
 using std::map;
-    
+
 class FTWScanner
 {
    protected:
@@ -81,6 +80,8 @@ class FTWScanner
    virtual ~FTWScanner() {};
 };
 
+class MultiCompress;
+
 class TranslationWriter
 {
    MultiCompress *Comp;
index eff83bda737e9b775039bc7fef948a6b475b5744..8e7e465576cd78b6766834f76aaab640df87409a 100644 (file)
@@ -20,6 +20,7 @@
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
@@ -47,9 +48,9 @@ class Bzip2Method : public pkgAcqMethod
 bool Bzip2Method::Fetch(FetchItem *Itm)
 {
    URI Get = Itm->Uri;
-   string Path = Get.Host + Get.Path; // To account for relative paths
+   std::string Path = Get.Host + Get.Path; // To account for relative paths
    
-   string GzPathOption = "Dir::bin::"+string(Prog);
+   std::string GzPathOption = "Dir::bin::" + std::string(Prog);
 
    FetchResult Res;
    Res.Filename = Itm->DestFile;
@@ -78,7 +79,7 @@ bool Bzip2Method::Fetch(FetchItem *Itm)
       SetCloseExec(STDOUT_FILENO,false);
       
       const char *Args[3];
-      string Tmp = _config->Find(GzPathOption,Prog);
+      std::string Tmp = _config->Find(GzPathOption,Prog);
       Args[0] = Tmp.c_str();
       Args[1] = "-d";
       Args[2] = 0;
index bc115d25946e720bf18479924fb5b8ea8c5d2c65..e7114b16816541befc34539e49704a8095d84baf 100644 (file)
@@ -16,6 +16,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
 
 #include <sys/stat.h>
index 16fb6e793519c6e590a2df9d3029a92337767401..9a092a43c20298ea47034ca157e76e7e64a9d5d6 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <apt-pkg/error.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/acquire-method.h>
 
 #include <stdio.h>
 #include <errno.h>
 #include <apti18n.h>
                                                                        /*}}}*/
 
-static string LastHost;
+static std::string LastHost;
 static int LastPort = 0;
 static struct addrinfo *LastHostAddr = 0;
 static struct addrinfo *LastUsed = 0;
 
 // Set of IP/hostnames that we timed out before or couldn't resolve
-static std::set<string> bad_addr;
+static std::set<std::string> bad_addr;
 
 // RotateDNS - Select a new server from a DNS rotation                 /*{{{*/
 // ---------------------------------------------------------------------
@@ -58,7 +60,7 @@ void RotateDNS()
 // DoConnect - Attempt a connect operation                             /*{{{*/
 // ---------------------------------------------------------------------
 /* This helper function attempts a connection to a single address. */
-static bool DoConnect(struct addrinfo *Addr,string Host,
+static bool DoConnect(struct addrinfo *Addr,std::string Host,
                      unsigned long TimeOut,int &Fd,pkgAcqMethod *Owner)
 {
    // Show a status indicator
@@ -73,7 +75,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
    Owner->Status(_("Connecting to %s (%s)"),Host.c_str(),Name);
 
    // if that addr did timeout before, we do not try it again
-   if(bad_addr.find(string(Name)) != bad_addr.end())
+   if(bad_addr.find(std::string(Name)) != bad_addr.end())
       return false;
 
    /* If this is an IP rotation store the IP we are using.. If something goes
@@ -100,7 +102,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
    /* This implements a timeout for connect by opening the connection
       nonblocking */
    if (WaitFd(Fd,true,TimeOut) == false) {
-      bad_addr.insert(bad_addr.begin(), string(Name));
+      bad_addr.insert(bad_addr.begin(), std::string(Name));
       Owner->SetFailReason("Timeout");
       return _error->Error(_("Could not connect to %s:%s (%s), "
                           "connection timed out"),Host.c_str(),Service,Name);
@@ -119,7 +121,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
          Owner->SetFailReason("ConnectionRefused");
       else if (errno == ETIMEDOUT)
         Owner->SetFailReason("ConnectionTimedOut");
-      bad_addr.insert(bad_addr.begin(), string(Name));
+      bad_addr.insert(bad_addr.begin(), std::string(Name));
       return _error->Errno("connect",_("Could not connect to %s:%s (%s)."),Host.c_str(),
                           Service,Name);
    }
@@ -130,7 +132,7 @@ static bool DoConnect(struct addrinfo *Addr,string Host,
 // Connect - Connect to a server                                       /*{{{*/
 // ---------------------------------------------------------------------
 /* Performs a connection to the server */
-bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd,
+bool Connect(std::string Host,int Port,const char *Service,int DefPort,int &Fd,
             unsigned long TimeOut,pkgAcqMethod *Owner)
 {
    if (_error->PendingError() == true)
index 6f208e31d0146d03c60b102ae56dbc1e28f033f5..bbe1bb35d1add08ce3fd3a5135ddac0580dab00d 100644 (file)
 #define CONNECT_H
 
 #include <string>
-#include <apt-pkg/acquire-method.h>
 
-bool Connect(string To,int Port,const char *Service,int DefPort,
+class pkgAcqMethod;
+
+bool Connect(std::string To,int Port,const char *Service,int DefPort,
             int &Fd,unsigned long TimeOut,pkgAcqMethod *Owner);
 void RotateDNS();
 
index 94467e054c7e5f687fa1fd36fa287d82580ba232..f8d58e479703b66bb2075480abb0b6fea15da534 100644 (file)
@@ -12,6 +12,7 @@
 #include <config.h>
 
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
@@ -37,7 +38,7 @@ class CopyMethod : public pkgAcqMethod
 bool CopyMethod::Fetch(FetchItem *Itm)
 {
    URI Get = Itm->Uri;
-   string File = Get.Path;
+   std::string File = Get.Path;
 
    // Stat the file and send a start message
    struct stat Buf;
index 9fc4cd76c32b18f9adfb98318413eafde94354c1..5025c996d7008784848d233ac967aede3d4df617 100644 (file)
@@ -19,6 +19,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
 
 #include <sys/stat.h>
 #include <unistd.h>
@@ -40,7 +41,7 @@ class FileMethod : public pkgAcqMethod
 bool FileMethod::Fetch(FetchItem *Itm)
 {
    URI Get = Itm->Uri;
-   string File = Get.Path;
+   std::string File = Get.Path;
    FetchResult Res;
    if (Get.Host.empty() == false)
       return _error->Error(_("Invalid URI, local URIS must not start with //"));
@@ -58,10 +59,10 @@ bool FileMethod::Fetch(FetchItem *Itm)
    }
    
    // See if we can compute a file without a .gz exentsion
-   string::size_type Pos = File.rfind(".gz");
+   std::string::size_type Pos = File.rfind(".gz");
    if (Pos + 3 == File.length())
    {
-      File = string(File,0,Pos);
+      File = std::string(File,0,Pos);
       if (stat(File.c_str(),&Buf) == 0)
       {
         FetchResult AltRes;
index 861647aeab9b2423ed318d84786dd1268dcffb2b..2ca0ac6f702f80b704589064f1325c8cedffa694 100644 (file)
@@ -22,6 +22,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
index b4913ca575335e9077a6e70a60c33e1beba5255c..2634f07322ef8f9ac418ac5d87ce06250c33ed95 100644 (file)
 #ifndef APT_FTP_H
 #define APT_FTP_H
 
+#include <apt-pkg/strutl.h>
+
+#include <string>
+
 class FTPConn
 {
    char Buffer[1024*10];
@@ -33,7 +37,7 @@ class FTPConn
    socklen_t ServerAddrLen;
    
    // Private helper functions
-   bool ReadLine(string &Text);      
+   bool ReadLine(std::string &Text);
    bool Login();
    bool CreateDataFd();
    bool Finalize();
@@ -43,8 +47,8 @@ class FTPConn
    bool Comp(URI Other) {return Other.Host == ServerName.Host && Other.Port == ServerName.Port && Other.User == ServerName.User && Other.Password == ServerName.Password; };
    
    // Raw connection IO
-   bool ReadResp(unsigned int &Ret,string &Text);
-   bool WriteMsg(unsigned int &Ret,string &Text,const char *Fmt,...);
+   bool ReadResp(unsigned int &Ret,std::string &Text);
+   bool WriteMsg(unsigned int &Ret,std::string &Text,const char *Fmt,...);
    
    // Connection control
    bool Open(pkgAcqMethod *Owner);
@@ -65,11 +69,11 @@ class FTPConn
 class FtpMethod : public pkgAcqMethod
 {
    virtual bool Fetch(FetchItem *Itm);
-   virtual bool Configuration(string Message);
+   virtual bool Configuration(std::string Message);
    
    FTPConn *Server;
    
-   static string FailFile;
+   static std::string FailFile;
    static int FailFd;
    static time_t FailTime;
    static void SigTerm(int);
index 251bcbc900071c88513fcc926a6f8a4feb32d47d..2b2aba017c45e6df20968700b45f2d4172c21491 100644 (file)
@@ -5,6 +5,7 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/indexcopy.h>
+#include <apt-pkg/configuration.h>
 
 #include <utime.h>
 #include <stdio.h>
@@ -17,6 +18,9 @@
 
 #include <apti18n.h>
 
+using std::string;
+using std::vector;
+
 #define GNUPGPREFIX "[GNUPG:]"
 #define GNUPGBADSIG "[GNUPG:] BADSIG"
 #define GNUPGNOPUBKEY "[GNUPG:] NO_PUBKEY"
index f4bb052e26191073d1a2822a66853d2e2cdc88f7..a51497948646d1d0ac98e2bb70017f1cbbcaaf7b 100644 (file)
@@ -41,7 +41,7 @@ class GzipMethod : public pkgAcqMethod
 bool GzipMethod::Fetch(FetchItem *Itm)
 {
    URI Get = Itm->Uri;
-   string Path = Get.Host + Get.Path; // To account for relative paths
+   std::string Path = Get.Host + Get.Path; // To account for relative paths
    
    FetchResult Res;
    Res.Filename = Itm->DestFile;
index b60cfeb9ed53fe3c374fe8e5808384ce5b6e2629..0d81c73ed7390820a51b1eea5a57d97440336580 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/acquire-method.h>
+#include <apt-pkg/configuration.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
@@ -288,6 +289,11 @@ void CircleBuf::Stats()
    clog << "Got " << InP << " in " << Diff << " at " << InP/Diff << endl;*/
 }
                                                                        /*}}}*/
+CircleBuf::~CircleBuf()
+{
+   delete [] Buf;
+   delete Hash;
+}
 
 // ServerState::ServerState - Constructor                              /*{{{*/
 // ---------------------------------------------------------------------
index c47d7184aab68fc5b50cab41594c952de1b00c30..c73d4df5ca5252d159ce7fd9c03ddcbc25b80f64 100644 (file)
 
 #define MAXLEN 360
 
-#include <apt-pkg/hashes.h>
+#include <apt-pkg/strutl.h>
+
+#include <string>
 
 using std::cout;
 using std::endl;
 
 class HttpMethod;
+class Hashes;
 
 class CircleBuf
 {
@@ -26,7 +29,7 @@ class CircleBuf
    unsigned long long Size;
    unsigned long long InP;
    unsigned long long OutP;
-   string OutQueue;
+   std::string OutQueue;
    unsigned long long StrPos;
    unsigned long long MaxGet;
    struct timeval Start;
@@ -60,11 +63,11 @@ class CircleBuf
    
    // Read data in
    bool Read(int Fd);
-   bool Read(string Data);
+   bool Read(std::string Data);
    
    // Write data out
    bool Write(int Fd);
-   bool WriteTillEl(string &Data,bool Single = false);
+   bool WriteTillEl(std::string &Data,bool Single = false);
    
    // Control the write limit
    void Limit(long long Max) {if (Max == -1) MaxGet = 0-1; else MaxGet = OutP + Max;}   
@@ -80,7 +83,7 @@ class CircleBuf
    void Stats();
 
    CircleBuf(unsigned long long Size);
-   ~CircleBuf() {delete [] Buf; delete Hash;};
+   ~CircleBuf();
 };
 
 struct ServerState
@@ -99,7 +102,7 @@ struct ServerState
    enum {Chunked,Stream,Closes} Encoding;
    enum {Header, Data} State;
    bool Persistent;
-   string Location;
+   std::string Location;
    
    // This is a Persistent attribute of the server itself.
    bool Pipeline;
@@ -112,7 +115,7 @@ struct ServerState
    int ServerFd;
    URI ServerName;
   
-   bool HeaderLine(string Line);
+   bool HeaderLine(std::string Line);
    bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
    void Reset() {Major = 0; Minor = 0; Result = 0; Size = 0; StartPos = 0;
                  Encoding = Closes; time(&Date); ServerFd = -1; 
@@ -167,10 +170,10 @@ class HttpMethod : public pkgAcqMethod
    /** \brief Try to AutoDetect the proxy */
    bool AutoDetectProxy();
 
-   virtual bool Configuration(string Message);
+   virtual bool Configuration(std::string Message);
    
    // In the event of a fatal signal this file will be closed and timestamped.
-   static string FailFile;
+   static std::string FailFile;
    static int FailFd;
    static time_t FailTime;
    static void SigTerm(int);
@@ -178,8 +181,8 @@ class HttpMethod : public pkgAcqMethod
    protected:
    virtual bool Fetch(FetchItem *);
    
-   string NextURI;
-   string AutoDetectProxyCmd;
+   std::string NextURI;
+   std::string AutoDetectProxyCmd;
 
    public:
    friend struct ServerState;
index 709744ce335a7664c745e15e141e58aa737ff751..335699907a8ee5f70bb3ee540df492b84c6b7ae3 100644 (file)
@@ -17,6 +17,7 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/netrc.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
index 3f0c416b6c9d5638faf9364a50c68cc932d0f8ae..b7adeb88084f32bb762796a318e8227960195178 100644 (file)
@@ -20,7 +20,7 @@ using std::cout;
 using std::endl;
 
 class HttpsMethod;
-
+class FileFd;
 
 class HttpsMethod : public pkgAcqMethod
 {
@@ -45,6 +45,7 @@ class HttpsMethod : public pkgAcqMethod
    };
 };
 
+#include <apt-pkg/strutl.h>
 URI Proxy;
 
 #endif
index 61a7f12fd0aef68bbf424f42d28253e9e5de20b2..3d5983efa59a49b3d7b67b633daadedb923ded50 100644 (file)
@@ -18,7 +18,8 @@
 #include <apt-pkg/error.h>
 #include <apt-pkg/hashes.h>
 #include <apt-pkg/sourcelist.h>
-
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/metaindex.h>
 
 #include <algorithm>
 #include <fstream>
index 97d18144a49bfbc64440941c58fc6f3b6ea54344..81e531e2197c67cca7dc0969732ad8239529f8d8 100644 (file)
@@ -11,8 +11,9 @@
 #ifndef APT_MIRROR_H
 #define APT_MIRROR_H
 
-
 #include <iostream>
+#include <string>
+#include <vector>
 
 using std::cout;
 using std::cerr;
@@ -24,29 +25,29 @@ class MirrorMethod : public HttpMethod
 {
    FetchResult Res;
    // we simply transform between BaseUri and Mirror
-   string BaseUri;    // the original mirror://... url
-   string Mirror;     // the selected mirror uri (http://...)
-   vector<string> AllMirrors; // all available mirrors
-   string MirrorFile; // the file that contains the list of mirrors
+   std::string BaseUri;    // the original mirror://... url
+   std::string Mirror;     // the selected mirror uri (http://...)
+   std::vector<std::string> AllMirrors; // all available mirrors
+   std::string MirrorFile; // the file that contains the list of mirrors
    bool DownloadedMirrorFile; // already downloaded this session
-   string Dist;       // the target distrubtion (e.g. sid, oneiric)
+   std::string Dist;       // the target distrubtion (e.g. sid, oneiric)
 
    bool Debug;
 
  protected:
-   bool DownloadMirrorFile(string uri);
-   bool RandomizeMirrorFile(string file);
-   string GetMirrorFileName(string uri);
+   bool DownloadMirrorFile(std::string uri);
+   bool RandomizeMirrorFile(std::string file);
+   std::string GetMirrorFileName(std::string uri);
    bool InitMirrors();
    bool TryNextMirror();
    void CurrentQueueUriToMirror();
-   bool Clean(string dir);
+   bool Clean(std::string dir);
    
    // we need to overwrite those to transform the url back
-   virtual void Fail(string Why, bool Transient = false);
+   virtual void Fail(std::string Why, bool Transient = false);
    virtual void URIStart(FetchResult &Res);
    virtual void URIDone(FetchResult &Res,FetchResult *Alt = 0);
-   virtual bool Configuration(string Message);
+   virtual bool Configuration(std::string Message);
 
  public:
    MirrorMethod();
index bc941ed049f84a3e0b85379f7505372bbbe1e4f1..ef00fcaa39de83364d5b284e77d0955378481096 100644 (file)
@@ -7,6 +7,7 @@
 #include <apt-pkg/acquire-method.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/uio.h>
@@ -472,7 +473,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
 {
    Debug = _config->FindB("Debug::pkgAcquire::RRed", false);
    URI Get = Itm->Uri;
-   string Path = Get.Host + Get.Path; // To account for relative paths
+   std::string Path = Get.Host + Get.Path; // To account for relative paths
 
    FetchResult Res;
    Res.Filename = Itm->DestFile;
@@ -525,7 +526,7 @@ bool RredMethod::Fetch(FetchItem *Itm)                                              /*{{{*/
       and use the access time from the "old" file */
    struct stat BufBase, BufPatch;
    if (stat(Path.c_str(),&BufBase) != 0 ||
-       stat(string(Path+".ed").c_str(),&BufPatch) != 0)
+       stat(std::string(Path+".ed").c_str(),&BufPatch) != 0)
       return _error->Errno("stat",_("Failed to stat"));
 
    struct utimbuf TimeBuf;
index c95a4d3eb5cee7cc09d9be60f295d5c954e95f1f..da9777fc48f44634845253b94b6526bf3c18abc6 100644 (file)
@@ -14,6 +14,9 @@
 #include <config.h>
 
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/configuration.h>
 
 #include <sys/stat.h>
 #include <sys/time.h>
@@ -32,7 +35,7 @@ const char *Prog;
 unsigned long TimeOut = 120;
 Configuration::Item const *RshOptions = 0;
 time_t RSHMethod::FailTime = 0;
-string RSHMethod::FailFile;
+std::string RSHMethod::FailFile;
 int RSHMethod::FailFd = -1;
 
 // RSHConn::RSHConn - Constructor                                      /*{{{*/
@@ -85,7 +88,7 @@ bool RSHConn::Open()
 // RSHConn::Connect - Fire up rsh and connect                          /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool RSHConn::Connect(string Host, string User)
+bool RSHConn::Connect(std::string Host, std::string User)
 {
    // Create the pipes
    int Pipes[4] = {-1,-1,-1,-1};
@@ -154,7 +157,7 @@ bool RSHConn::Connect(string Host, string User)
 // RSHConn::ReadLine - Very simple buffered read with timeout          /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool RSHConn::ReadLine(string &Text)
+bool RSHConn::ReadLine(std::string &Text)
 {
    if (Process == -1 || ReadFd == -1)
       return false;
@@ -174,7 +177,7 @@ bool RSHConn::ReadLine(string &Text)
             continue;
 
          I++;
-         Text = string(Buffer,I);
+         Text = std::string(Buffer,I);
          memmove(Buffer,Buffer+I,Len - I);
          Len -= I;
          return true;
@@ -205,7 +208,7 @@ bool RSHConn::ReadLine(string &Text)
 // ---------------------------------------------------------------------
 /* The remote sync flag appends a || echo which will insert blank line
    once the command completes. */
-bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
+bool RSHConn::WriteMsg(std::string &Text,bool Sync,const char *Fmt,...)
 {
    va_list args;
    va_start(args,Fmt);
@@ -254,7 +257,7 @@ bool RSHConn::WriteMsg(string &Text,bool Sync,const char *Fmt,...)
 bool RSHConn::Size(const char *Path,unsigned long long &Size)
 {
    // Query the size
-   string Msg;
+       std::string Msg;
    Size = 0;
 
    if (WriteMsg(Msg,true,"find %s -follow -printf '%%s\\n'",Path) == false)
@@ -276,7 +279,7 @@ bool RSHConn::ModTime(const char *Path, time_t &Time)
 {
    Time = time(&Time);
    // Query the mod time
-   string Msg;
+   std::string Msg;
 
    if (WriteMsg(Msg,true,"TZ=UTC find %s -follow -printf '%%TY%%Tm%%Td%%TH%%TM%%TS\\n'",Path) == false)
       return false;
@@ -309,7 +312,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long long Resume,
    }
    
    // FIXME: Detect file-not openable type errors.
-   string Jnk;
+   std::string Jnk;
    if (WriteMsg(Jnk,false,"dd if=%s bs=2048 skip=%u", Path, Resume / 2048) == false)
       return false;
 
@@ -366,7 +369,7 @@ RSHMethod::RSHMethod() : pkgAcqMethod("1.0",SendConfig)
                                                                        /*}}}*/
 // RSHMethod::Configuration - Handle a configuration message           /*{{{*/
 // ---------------------------------------------------------------------
-bool RSHMethod::Configuration(string Message)
+bool RSHMethod::Configuration(std::string Message)
 {
    char ProgStr[100];
   
index c81396b5fd0bb0b5b4d3bd1179f4cc424c12d7d2..d7efa3f065dee3d9d180dd0fba1d49c467b6ee54 100644 (file)
@@ -12,9 +12,9 @@
 
 #include <string>
 #include <apt-pkg/strutl.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/acquire-method.h>
-#include <apt-pkg/fileutl.h>
+
+class Hashes;
+class FileFd;
 
 class RSHConn
 {
@@ -25,15 +25,15 @@ class RSHConn
    URI ServerName;
 
    // Private helper functions
-   bool ReadLine(string &Text);
+   bool ReadLine(std::string &Text);
 
    public:
 
    pid_t Process;
 
    // Raw connection IO
-   bool WriteMsg(string &Text,bool Sync,const char *Fmt,...);
-   bool Connect(string Host, string User);
+   bool WriteMsg(std::string &Text,bool Sync,const char *Fmt,...);
+   bool Connect(std::string Host, std::string User);
    bool Comp(URI Other) const {return Other.Host == ServerName.Host && Other.Port == ServerName.Port;};
 
    // Connection control
@@ -50,14 +50,16 @@ class RSHConn
    ~RSHConn();
 };
 
+#include <apt-pkg/acquire-method.h>
+
 class RSHMethod : public pkgAcqMethod
 {
    virtual bool Fetch(FetchItem *Itm);
-   virtual bool Configuration(string Message);
+   virtual bool Configuration(std::string Message);
 
    RSHConn *Server;
 
-   static string FailFile;
+   static std::string FailFile;
    static int FailFd;
    static time_t FailTime;
    static void SigTerm(int);
index a2e71760edea3e97504783d3472867027474707f..b55f793a4860b3590ca8d717a7222c86814a89cd 100644 (file)
@@ -149,6 +149,7 @@ setupenvironment() {
        echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
        echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
        echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
+       echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
        echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
        echo 'quiet::NoUpdate "true";' >> aptconfig.conf
        export LC_ALL=C
@@ -156,13 +157,26 @@ setupenvironment() {
        msgdone "info"
 }
 
+getarchitecture() {
+       if [ "$1" = "native" -o -z "$1" ]; then
+               eval `aptconfig shell ARCH APT::Architecture`
+               if [ -n "$ARCH" ]; then
+                       echo $ARCH
+               else
+                       dpkg-architecture -qDEB_BUILD_ARCH
+               fi
+       else
+               echo $1
+       fi
+}
+
 configarchitecture() {
        local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
        rm -f $CONFFILE
-       echo "APT::Architecture \"$1\";" > $CONFFILE
+       echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
        shift
        while [ -n "$1" ]; do
-               echo "APT::Architectures:: \"$1\";" >> $CONFFILE
+               echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
                shift
        done
 }
@@ -275,7 +289,7 @@ Package: $NAME" > ${BUILDDIR}/debian/control
                echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
        done
 
-       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                rm -rf ${BUILDDIR}/debian/tmp
                mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin
                cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}
@@ -298,6 +312,7 @@ buildpackage() {
        local BUILDDIR=$1
        local RELEASE=$2
        local SECTION=$3
+       local ARCH=$(getarchitecture $4)
        msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… "
        cd $BUILDDIR
        if [ "$ARCH" = "all" ]; then
@@ -408,7 +423,7 @@ insertpackage() {
        local DEPENDENCIES="$5"
        local PRIORITY="${6:-optional}"
        local ARCHS=""
-       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                if [ "$arch" = "all" ]; then
                        ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
                else
@@ -465,7 +480,7 @@ insertinstalledpackage() {
        local DEPENDENCIES="$4"
        local PRIORITY="${5:-optional}"
        local FILE="rootdir/var/lib/dpkg/status"
-       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do
+       for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
                echo "Package: $NAME
 Status: install ok installed
 Priority: $PRIORITY
@@ -715,8 +730,7 @@ N: Can't select versions from package '$1' as it is purely virtual"
 N: No packages found"
        local COMPAREFILE=$(mktemp)
        addtrap "rm $COMPAREFILE;"
-       local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU)
-       eval `apt-config shell ARCH APT::Architecture`
+       local ARCH="$(getarchitecture 'native')"
        echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
        aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }
index 7db93c32fb70767b5d84febd8ca411b3d102a8e6..4edb7c173f1d8fbf13e0649e95006c2014d4beb2 100755 (executable)
@@ -13,13 +13,12 @@ buildsimplenativepackage 'apt' 'all' '2.0' 'unstable'
 setupaptarchive
 
 testdownload() {
-       msgtest 'Test download of package file' $1
-       if [ -z "$3" ]; then
-               aptget download ${2}
-       else
-               aptget download ${2}/${3}
+       local APT="$2"
+       if [ -n "$3" ]; then
+               APT="${APT}/${3}"
        fi
-       test -f $1 && msgpass || msgfail
+       msgtest "Test download of package file $1 with" "$APT"
+       aptget -qq download ${APT} && test -f $1 && msgpass || msgfail
 }
 
 testdownload apt_1.0_all.deb apt stable
index 3e2693f8513558b168998a3f4532825925135e5f..e0dd7737f42e6e39636b0cc40f5581a4eabdd51a 100755 (executable)
@@ -3,7 +3,7 @@ set -e
 
 . $(readlink -f $(dirname $0))/framework
 setupenvironment
-configarchitecture "i386" "armel"
+configarchitecture 'i386' 'armel'
 
 pkglibc6="Package: libc6
 Architecture: armel
index 5c103da6f49f35553b290d8d7be68ead6746b20f..bb1ac0e540787fe0dca22fbe9a6a42193f657d14 100755 (executable)
@@ -13,7 +13,7 @@ setupflataptarchive
 testaptgetupdate() {
        rm -rf rootdir/var/lib/apt
        aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true
-       sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
+       sed -i -e '/^Fetched / d' -e '/Ign / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
        GIVEN="$1"
        shift
        msgtest "Test for correctness of" "apt-get update with $*"
@@ -78,7 +78,6 @@ testoverfile() {
 
        createemptyfile 'en'
        testaptgetupdate "Get:1 file:  InRelease []
-Ign file:  Translation-en
 Reading package lists..." "empty file en.$COMPRESS over file"
 
        createemptyarchive 'en'
@@ -89,12 +88,10 @@ Reading package lists..." "empty archive en.$COMPRESS over file"
        # FIXME: Why omits the file transport the Packages Get line?
        #Get:3 file:  Packages []
        testaptgetupdate "Get:1 file:  InRelease []
-Ign file:  Translation-en
 Reading package lists..." "empty archive Packages.$COMPRESS over file"
 
        createemptyfile 'Packages'
        testaptgetupdate "Get:1 file:  InRelease []
-Ign file:  Translation-en
 Err file:  Packages
   Empty files can't be valid archives
 W: Failed to fetch ${COMPRESSOR}:$(readlink -f aptarchive/Packages.$COMPRESS)  Empty files can't be valid archives
@@ -109,7 +106,6 @@ testoverhttp() {
        testaptgetupdate "Get:1 http://localhost  InRelease []
 Get:2 http://localhost  Packages []
 Get:3 http://localhost  Translation-en
-Ign http://localhost  Translation-en
 Reading package lists..." "empty file en.$COMPRESS over http"
 
        createemptyarchive 'en'
@@ -121,14 +117,12 @@ Reading package lists..." "empty archive en.$COMPRESS over http"
        createemptyarchive 'Packages'
        testaptgetupdate "Get:1 http://localhost  InRelease []
 Get:2 http://localhost  Packages []
-Ign http://localhost  Translation-en
 Reading package lists..." "empty archive Packages.$COMPRESS over http"
 
        createemptyfile 'Packages'
        #FIXME: we should response with a good error message instead
        testaptgetupdate "Get:1 http://localhost  InRelease []
 Get:2 http://localhost  Packages
-Ign http://localhost  Translation-en
 Err http://localhost  Packages
   Empty files can't be valid archives
 W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages)  Empty files can't be valid archives
index 44ab919006dfa0de3a8c3433709af90fd35b5b12..03fddbfdadc6845c66e5590cdf872dc772ca7316 100755 (executable)
@@ -4,7 +4,7 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386' 'amd64'
 
 # we need a valid locale here, otherwise the language configuration
 # will be overridden by LC_ALL=C
@@ -22,8 +22,22 @@ Size: 2140230
 MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08
 Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c"
 
+PACKAGESTANZA2='Package: apt
+Priority: important
+Section: admin
+Installed-Size: 5984
+Maintainer: APT Development Team <deity@lists.debian.org>
+Architecture: amd64
+Version: 0.8.7
+Filename: pool/main/a/apt/apt_0.8.7_amd64.deb
+Size: 2210342
+MD5sum: 4a869bfbdef9ebc9fa74f7a5271e8d1a
+Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c'
 
 echo "$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+
+$PACKAGESTANZA2
 Description: Advanced front-end for dpkg" > aptarchive/Packages
 
 echo "Package: apt
@@ -53,6 +67,13 @@ Description-${LOCALE}: Mächtige Oberfläche für dpkg
  APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
  um Pakete zu installieren und Upgrades durchzuführen.
 "
+LOCALESTANZA2="$PACKAGESTANZA2
+Description-${LOCALE}: Mächtige Oberfläche für dpkg
+ Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
+ auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
+ APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
+ um Pakete zu installieren und Upgrades durchzuführen.
+"
 
 testrun() {
        echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
@@ -60,6 +81,8 @@ testrun() {
        rm -rf rootdir/var/lib/apt/lists
        setupaptarchive
        testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE}
+       testequal "$LOCALESTANZA" aptcache show apt:i386 -o Test=File-${LOCALE}
+       testequal "$LOCALESTANZA2" aptcache show apt:amd64 -o Test=File-${LOCALE}
        testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE}
        testequal "$LOCALESTANZA" aptcache show apt -o Acquire::Languages::="ww" -o Test=File-${LOCALE}
        LC_ALL=C testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-${LOCALE}
@@ -73,6 +96,9 @@ testrun() {
 testrun
 
 echo "$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+
+$PACKAGESTANZA2
 Description: Advanced front-end for dpkg" > aptarchive/Packages
 
 echo "Package: apt
@@ -88,5 +114,11 @@ Description-en: Advanced front-end for dpkg
  It provides the apt-get utility and APT dselect method that provides a
  simpler, safer way to install and upgrade packages.
 "
+ENGLISHSTANZA2="$PACKAGESTANZA2
+Description-en: Advanced front-end for dpkg
+ This is Debian's next generation front-end for the dpkg package manager.
+ It provides the apt-get utility and APT dselect method that provides a
+ simpler, safer way to install and upgrade packages.
+"
 
 testrun
index b8cfe59e2f3632ee19fc47f1796bbfb09825a6f2..dd9efb785c92f68f79199aaebb0cb180da783aab 100755 (executable)
@@ -4,9 +4,7 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture "i386" "amd64"
-
-buildsimplenativepackage 'peace-dpkg' 'all' '1.0' 'stable'
+configarchitecture 'i386' 'amd64'
 
 buildsimplenativepackage 'libc6' 'i386' '1.0' 'stable'
 buildsimplenativepackage 'libc6' 'amd64' '1.0' 'stable'
@@ -17,9 +15,6 @@ buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6'
 
 setupaptarchive
 
-aptget install peace-dpkg:i386 -y -qq 2>&1 > /dev/null
-testdpkginstalled peace-dpkg
-
 aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null
 testdpkginstalled libc6
 testequal 'Reading package lists...
diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling
new file mode 100755 (executable)
index 0000000..a1e708d
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
+
+setupaptarchive
+
+changetowebserver
+
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'No download of non-existent locals' 'with Index'
+LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of existent locals' 'with Index'
+LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of en in LC_ALL=C' 'with Index'
+LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of en as forced language' 'with Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing else in forced language' 'with Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download no Translation- if forced language is non-existent' 'with Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing if none is forced' 'with Index'
+aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+sed -i '/i18n\/Index$/ d' $(find aptarchive -name 'Release')
+signreleasefiles
+
+# we have to try as not every archive includes the i18n Index in the Release file - if it has one at all
+msgtest 'Download no Translation- if forced language is non-existent' 'with not-announced Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+find aptarchive -name 'Index' -delete
+
+msgtest 'Download of en as forced language' 'without Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing else in forced language' 'without Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of ast_DE as forced language' 'without Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing else in forced language' 'without Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing if none is forced' 'without Index'
+aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+mkdir -p rootdir/var/lib/apt/lists
+touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
+
+msgtest 'Download of builtin files' 'without Index'
+aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+mkdir -p rootdir/var/lib/apt/lists
+touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
+
+msgtest 'Download of nothing (even builtin) if none is forced' 'without Index'
+aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
index 82ba9e59201957673fffe65561533becb7d833d2..0e0e9618de43b1e28f15a9075bbc3f096aec209e 100755 (executable)
@@ -4,12 +4,12 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture "i386"
+configarchitecture 'native'
 
-buildsimplenativepackage "old-pkg" "i386" "1.0" "stable"
+buildsimplenativepackage "old-pkg" "native" "1.0" "stable"
 buildsimplenativepackage "unrelated" "all" "0.5" "unstable"
 
-setupsimplenativepackage "new-pkg" "i386" "2.0" "unstable" "Provides: old-pkg
+setupsimplenativepackage "new-pkg" "native" "2.0" "unstable" "Provides: old-pkg
 Replaces: old-pkg
 Conflicts: old-pkg (<< 2.0)"
 BUILDDIR="incoming/new-pkg-2.0"
@@ -43,12 +43,12 @@ Note: This is done automatic and on purpose by dpkg." > $COMPAREFILE
 $CMD 2>&1 | tail -n 4 | diff $COMPAREFILE - && msgpass || msgfail
 rm $COMPAREFILE
 
-sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d'
+sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
 testfileequal "rootdir/var/log/apt/history.log" "
-Install: old-pkg:i386 (1.0)
+Install: old-pkg:native (1.0)
 
-Install: new-pkg:i386 (2.0, automatic)
-Upgrade: old-pkg:i386 (1.0, 2.0)
+Install: new-pkg:native (2.0, automatic)
+Upgrade: old-pkg:native (1.0, 2.0)
 Disappeared: old-pkg (1.0)"
 
 testmarkedauto  # new-pkg should have get the manual flag from old-pkg
index 93b67fc021d40c6850573b60563409e8af78bac4..f55c6e90967ca2dd406052c4444d95e1c27070d2 100755 (executable)
@@ -4,14 +4,14 @@ set -e
 TESTDIR=$(readlink -f $(dirname $0))
 . $TESTDIR/framework
 setupenvironment
-configarchitecture 'i386'
+configarchitecture 'native'
 
-setupsimplenativepackage 'compiz-core' 'i386' '1.0' 'unstable'
+setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
 BUILDDIR='incoming/compiz-core-1.0'
 mkdir -p ${BUILDDIR}/debian/compiz-core/etc
 echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
 echo 'compiz.conf      /etc/compiz.conf' >> ${BUILDDIR}/debian/install
-buildpackage "$BUILDDIR" 'unstable' 'main'
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
 rm -rf "$BUILDDIR"
 
 setupaptarchive
@@ -27,7 +27,7 @@ aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail
 testdpkgnotinstalled compiz-core
 
 msgtest 'Check that conffiles are still around for' 'compiz-core'
-dpkg -l compiz-core | grep '^rc' 2>&1 >/dev/null && msgpass || msgfail
+dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail
 
 testequal 'Reading package lists...
 Building dependency tree...
index 29dcbf371bdaf68663dcfb753f0815269bc2fd15..a1b3600aad922662c9568cdb73da30560609a644 100644 (file)
@@ -1,5 +1,6 @@
 #include <apt-pkg/debfile.h>
 #include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
 
 #include <iostream>
 #include <unistd.h>
index dc25ab357d16311421fc8d9e3b712f5249536937..88f5f0153324db5ddeeba1a8d6dabb1e0d675e59 100644 (file)
@@ -2,12 +2,15 @@
 #include <stdio.h>
 #include <assert.h>
 
+#include <vector>
+#include <iostream>
+
 int main()
 {
    pkgUdevCdromDevices c;
    assert(c.Dlopen());
 
-   vector<CdromDevice> l;
+   std::vector<CdromDevice> l;
    l = c.Scan();
    assert(l.empty() == false);
    for (size_t i = 0; i < l.size(); ++i)
index b790df618f7b27871125b0c0a687280989f4edbb..f7ddb72f05878bf849e24a6d28e92ef02eb28d5c 100644 (file)
@@ -6,6 +6,8 @@
 #include <apt-pkg/extract.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
 
 #include <stdio.h>
 #include <stdlib.h>
index fae9b6c6423c33fa0c56402735fa0c5e7ad904c0..a07be4b5739289524d079564cc0fb0a865de601d 100644 (file)
@@ -26,6 +26,18 @@ void assertEquals(int const &expect, unsigned int const &get, unsigned long cons
        assertEquals<unsigned int const&, unsigned int const&>(expect, get, line);
 }
 
+void assertEquals(unsigned long const &expect, int const &get, unsigned long const &line) {
+       if (get < 0)
+               OutputAssertEqual(expect, "==", get, line);
+       assertEquals<unsigned long const&, unsigned long const&>(expect, get, line);
+}
+
+void assertEquals(int const &expect, unsigned long const &get, unsigned long const &line) {
+       if (expect < 0)
+               OutputAssertEqual(expect, "==", get, line);
+       assertEquals<unsigned long const&, unsigned long const&>(expect, get, line);
+}
+
 
 #define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__)
 
@@ -54,6 +66,21 @@ void assertEqualsOr2(int const &expect1, int const &expect2, unsigned int const
 }
 
 
+#define equalsOr3(w,x,y,z) assertEqualsOr3(x, y, z, w, __LINE__)
+
+template < typename X, typename Y >
+void OutputAssertEqualOr3(X expect1, X expect2, X expect3, char const* compare, Y get, unsigned long const &line) {
+       std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« " << compare << " »" << get << "« at line " << line << std::endl;
+}
+
+template < typename X, typename Y >
+void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const &line) {
+       if (expect1 == get || expect2 == get || expect3 == get)
+               return;
+       OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line);
+}
+
+
 // simple helper to quickly output a vectors
 template < typename X >
 void dumpVector(X vec) {
index f6aa7a69785baaca4e11cad929934f61dd8ccf0c..a1c801ea207afd09da7675bf7ea0d2bc00629b53 100644 (file)
@@ -126,13 +126,19 @@ int main(int argc,char *argv[])
 
        _config->Set("Dir::State::lists", argv[1]);
        vec = APT::Configuration::getLanguages(true, false, env);
-       equals(vec.size(), 6);
+       equals(vec.size(), 7);
        equals(vec[0], "de_DE");
        equals(vec[1], "de");
        equals(vec[2], "en");
        equals(vec[3], "none");
-       equalsOr2(vec[4], "pt", "tr");
-       equalsOr2(vec[5], "tr", "pt");
+       equalsOr3(vec[4], "pt", "tr", "ast_DE");
+       equalsOr3(vec[5], "tr", "pt", "ast_DE");
+       equalsOr3(vec[6], "tr", "pt", "ast_DE");
+
+       _config->Set("Acquire::Languages", "none");
+       vec = APT::Configuration::getLanguages(true, false, env);
+       equals(vec.size(), 0);
+       _config->Set("Acquire::Languages", "");
 
        _config->Set("Dir::State::lists", "/non-existing-dir");
        _config->Set("Acquire::Languages::1", "none");
index 5ee014ccab6e2c75507bce33ead7cbcf2f2dbeae..b2c95e840d3873d3f470b52c454b786188e92545 100644 (file)
@@ -7,7 +7,7 @@
 #include <stdio.h>
 #include <iostream>
 
-#define P(x)   string(argv[1]).append("/").append(x)
+#define P(x)   std::string(argv[1]).append("/").append(x)
 
 int main(int argc,char *argv[])
 {
index 2cb71cc38fb0a839780b0d2a76c5405d0d9cf21c..396e4cf6b36304e114731eb189a050f97df40138 100644 (file)
@@ -146,7 +146,7 @@ int main(int argc, char** argv)
    equals(sha2.VerifyFile(argv[1]), true);
    }
    {
-   HashString sha2("SHA256:"+string(argv[4]));
+   HashString sha2("SHA256:" + std::string(argv[4]));
    equals(sha2.VerifyFile(argv[1]), true);
    }
 
index 7b496878ddaf55b50985f22b89a48ed7752b5562..b5d92d9d2b85db315ff24b0984a178bdceffec9a 100644 (file)
@@ -4,8 +4,8 @@
 #include "assert.h"
 
 int main(int argc,char *argv[]) {
-       string Package;
-       string Version;
+       std::string Package;
+       std::string Version;
        unsigned int Op = 5;
        unsigned int Null = 0;
        bool StripMultiArch = true;
index 8cb2e049ca60edc4ef681858375a0d6db8b26263..ada2dc38b0a84e8b6b97afe6a875e221ddca0b9c 100755 (executable)
@@ -64,7 +64,8 @@ do
                touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
                        "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
                        "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
-                       "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
+                       "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" \
+                       "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
        elif [ $name = "HashSums${EXT}" ]; then
                TMP="$(mktemp)"
                dmesg > $TMP
index af6eb2cc635a681e8b07a89ff3edc610bfbfc3a5..bfe0d722254b1b12129d9c6720691ef2587a899c 100644 (file)
@@ -4,7 +4,7 @@
 
 int main(int argc,char *argv[])
 {
-   string input, output, expected;
+   std::string input, output, expected;
 
    // no input
    input = "foobar";