Michael Vogt 11 年 前
コミット
c045cc0268
共有2 個のファイルを変更した33 個の追加37 個の削除を含む
  1. 11 10
      apt-pkg/acquire-item.cc
  2. 22 27
      apt-pkg/acquire-item.h

+ 11 - 10
apt-pkg/acquire-item.cc

@@ -1470,10 +1470,10 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,          		/*{{{*/
                              string MetaIndexFile,
 			     const vector<IndexTarget*>* IndexTargets,
 			     indexRecords* MetaIndexParser) :
-   pkgAcqMetaBase(Owner, HashStringList(), TransactionManager), RealURI(URI), 
-   MetaIndexParser(MetaIndexParser), MetaIndexFile(MetaIndexFile),
-   URIDesc(URIDesc), ShortDesc(ShortDesc),
-   IndexTargets(IndexTargets), AuthPass(false), IMSHit(false)
+   pkgAcqMetaBase(Owner, IndexTargets, MetaIndexParser, 
+                  HashStringList(), TransactionManager),
+   RealURI(URI), MetaIndexFile(MetaIndexFile), URIDesc(URIDesc),
+   ShortDesc(ShortDesc), AuthPass(false), IMSHit(false)
 {
    DestFile = _config->FindDir("Dir::State::lists") + "partial/";
    DestFile += URItoFileName(URI);
@@ -1577,7 +1577,7 @@ void pkgAcqMetaSig::Done(string Message,unsigned long long Size, HashStringList
    {
       // load indexes and queue further downloads
       MetaIndexParser->Load(MetaIndexFile);
-      ((pkgAcqMetaIndex*)TransactionManager)->QueueIndexes(true);
+      QueueIndexes(true);
    }
 
    Complete = true;
@@ -1622,7 +1622,7 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf)/*{{{*/
       // we parse the indexes here because at this point the user wanted
       // a repository that may potentially harm him
       MetaIndexParser->Load(MetaIndexFile);
-      ((pkgAcqMetaIndex*)TransactionManager)->QueueIndexes(true);
+      QueueIndexes(true);
    } 
    else 
    {
@@ -1648,9 +1648,10 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,			/*{{{*/
                                  string MetaIndexSigURI,string MetaIndexSigURIDesc, string MetaIndexSigShortDesc,
 				 const vector<IndexTarget*>* IndexTargets,
 				 indexRecords* MetaIndexParser) :
-   pkgAcqMetaBase(Owner, HashStringList(), TransactionManager), RealURI(URI), IndexTargets(IndexTargets),
-   URIDesc(URIDesc), ShortDesc(ShortDesc),
-   MetaIndexParser(MetaIndexParser), AuthPass(false), IMSHit(false),
+   pkgAcqMetaBase(Owner, IndexTargets, MetaIndexParser, HashStringList(),
+                  TransactionManager), 
+   RealURI(URI), URIDesc(URIDesc), ShortDesc(ShortDesc),
+   AuthPass(false), IMSHit(false),
    MetaIndexSigURI(MetaIndexSigURI), MetaIndexSigURIDesc(MetaIndexSigURIDesc),
    MetaIndexSigShortDesc(MetaIndexSigShortDesc)
 {
@@ -1881,7 +1882,7 @@ void pkgAcqMetaIndex::AuthDone(string Message)				/*{{{*/
 #endif
 }
 									/*}}}*/
-void pkgAcqMetaIndex::QueueIndexes(bool verify)				/*{{{*/
+void pkgAcqMetaBase::QueueIndexes(bool verify)				/*{{{*/
 {
    bool transInRelease = false;
    {

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

@@ -356,6 +356,24 @@ class pkgAcqMetaBase  : public pkgAcquire::Item
  protected:
    std::vector<Item*> Transaction;
 
+   /** \brief A package-system-specific parser for the meta-index file. */
+   indexRecords *MetaIndexParser;
+
+   /** \brief The index files which should be looked up in the meta-index
+    *  and then downloaded.
+    */
+   const std::vector<IndexTarget*>* IndexTargets;
+
+   /** \brief Starts downloading the individual index files.
+    *
+    *  \param verify If \b true, only indices whose expected hashsum
+    *  can be determined from the meta-index will be downloaded, and
+    *  the hashsums of indices will be checked (reporting
+    *  #StatAuthError if there is a mismatch).  If verify is \b false,
+    *  no hashsum checking will be performed.
+    */
+   void QueueIndexes(bool verify);
+
  public:
    // transaction code
    void Add(Item *I);
@@ -369,9 +387,12 @@ class pkgAcqMetaBase  : public pkgAcquire::Item
 
 
    pkgAcqMetaBase(pkgAcquire *Owner,
+                  const std::vector<IndexTarget*>* IndexTargets,
+                  indexRecords* MetaIndexParser,
                   HashStringList const &ExpectedHashes=HashStringList(),
                   pkgAcqMetaBase *TransactionManager=NULL)
-      : Item(Owner, ExpectedHashes, TransactionManager) {};
+      : Item(Owner, ExpectedHashes, TransactionManager),
+        MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets) {};
 };
 
 /** \brief An acquire item that downloads the detached signature	{{{
@@ -397,19 +418,9 @@ class pkgAcqMetaSig : public pkgAcqMetaBase
    std::string URIDesc;
    std::string ShortDesc;
 
-   /** \brief A package-system-specific parser for the meta-index file. */
-   indexRecords* MetaIndexParser;
-
    /** \brief The file we need to verify */
    std::string MetaIndexFile;
 
-   /** \brief The index files which should be looked up in the meta-index
-    *  and then downloaded.
-    *
-    *  \todo Why a list of pointers instead of a list of structs?
-    */
-   const std::vector<IndexTarget*>* IndexTargets;
-
    /** \brief If we are in fetching or download state */
    bool AuthPass;
 
@@ -463,12 +474,6 @@ class pkgAcqMetaIndex : public pkgAcqMetaBase
     */
    std::string SigFile;
 
-   /** \brief The index files to download. */
-   const std::vector<IndexTarget*>* IndexTargets;
-
-   /** \brief The parser for the meta-index file. */
-   indexRecords* MetaIndexParser;
-
    /** \brief If \b true, the index's signature is currently being verified.
     */
    bool AuthPass;
@@ -521,16 +526,6 @@ class pkgAcqMetaIndex : public pkgAcqMetaBase
    
    public:
 
-   /** \brief Starts downloading the individual index files.
-    *
-    *  \param verify If \b true, only indices whose expected hashsum
-    *  can be determined from the meta-index will be downloaded, and
-    *  the hashsums of indices will be checked (reporting
-    *  #StatAuthError if there is a mismatch).  If verify is \b false,
-    *  no hashsum checking will be performed.
-    */
-   void QueueIndexes(bool verify);
-
    // Specialized action members
    virtual void Failed(std::string Message,pkgAcquire::MethodConfig *Cnf);
    virtual void Done(std::string Message,unsigned long long Size, HashStringList const &Hashes,