~jr/ubuntu/oneiric/apt/bzr-get-rename

« back to all changes in this revision

Viewing changes to apt-pkg/acquire-item.h

  • Committer: Bazaar Package Importer
  • Author(s): Matt Zimmerman
  • Date: 2005-03-07 20:08:33 UTC
  • Revision ID: james.westby@ubuntu.com-20050307200833-0lxdgg2cb4oculdv
Tags: 0.6.35
* Merge apt--mvo--0 (incorporates 0.6.34ubuntu1):
  - Implement MaxSize and MaxAge in apt.cron.daily, to prevent the cache
    from growing too large (Ubuntu #6761)
  - some comments about the pkgAcqMetaSig::Custom600Headers() added
  - use gpg --with-colons
  - commented the ftp no_proxy unseting in methods/ftp.cc
  - added support for "Acquire::gpgv::options" in methods/gpgv.cc
* Merge bubulle@debian.org--2005/apt--main--0
  - Make capitalization more consistent
  - Un-fuzzy translations resulting from capitalization changes
  - Italian translation update

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// -*- mode: cpp; mode: fold -*-
2
2
// Description                                                          /*{{{*/
3
 
// $Id: acquire-item.h,v 1.25 2001/02/20 07:03:17 jgg Exp $
 
3
// $Id: acquire-item.h,v 1.26.2.3 2004/01/02 18:51:00 mdz Exp $
4
4
/* ######################################################################
5
5
 
6
6
   Acquire Item - Item to acquire
22
22
 
23
23
#include <apt-pkg/acquire.h>
24
24
#include <apt-pkg/indexfile.h>
 
25
#include <apt-pkg/vendor.h>
 
26
#include <apt-pkg/sourcelist.h>
25
27
#include <apt-pkg/pkgrecords.h>
 
28
#include <apt-pkg/indexrecords.h>
26
29
 
27
30
#ifdef __GNUG__
28
31
#pragma interface "apt-pkg/acquire-item.h"
45
48
   public:
46
49
 
47
50
   // State of the item
48
 
   enum {StatIdle, StatFetching, StatDone, StatError} Status;
 
51
   enum {StatIdle, StatFetching, StatDone, StatError, StatAuthError} Status;
49
52
   string ErrorText;
50
53
   unsigned long FileSize;
51
54
   unsigned long PartialSize;   
67
70
   virtual void Start(string Message,unsigned long Size);
68
71
   virtual string Custom600Headers() {return string();};
69
72
   virtual string DescURI() = 0;
 
73
   virtual string ShortDesc() {return DescURI();}
70
74
   virtual void Finished() {};
71
75
   
72
76
   // Inquire functions
73
77
   virtual string MD5Sum() {return string();};
74
78
   pkgAcquire *GetOwner() {return Owner;};
 
79
   virtual bool IsTrusted() {return false;};
75
80
   
76
81
   Item(pkgAcquire *Owner);
77
82
   virtual ~Item();
86
91
   bool Erase;
87
92
   pkgAcquire::ItemDesc Desc;
88
93
   string RealURI;
 
94
   string ExpectedMD5;
89
95
   
90
96
   public:
91
97
   
92
98
   // Specialized action members
 
99
   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
93
100
   virtual void Done(string Message,unsigned long Size,string Md5Hash,
94
101
                     pkgAcquire::MethodConfig *Cnf);
95
102
   virtual string Custom600Headers();
96
 
   virtual string DescURI() {return RealURI;};
 
103
   virtual string DescURI() {return RealURI + ".gz";};
97
104
 
98
105
   pkgAcqIndex(pkgAcquire *Owner,string URI,string URIDesc,
99
 
               string ShortDesct);
100
 
};
101
 
 
102
 
// Item class for index files
103
 
class pkgAcqIndexRel : public pkgAcquire::Item
104
 
{
105
 
   protected:
106
 
   
107
 
   pkgAcquire::ItemDesc Desc;
108
 
   string RealURI;
109
 
   
110
 
   public:
111
 
   
112
 
   // Specialized action members
113
 
   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
114
 
   virtual void Done(string Message,unsigned long Size,string Md5Hash,
115
 
                     pkgAcquire::MethodConfig *Cnf);   
116
 
   virtual string Custom600Headers();
117
 
   virtual string DescURI() {return RealURI;};
118
 
   
119
 
   pkgAcqIndexRel(pkgAcquire *Owner,string URI,string URIDesc,
120
 
               string ShortDesct);
 
106
               string ShortDesct, string ExpectedMD5, string compressExt="");
 
107
};
 
108
 
 
109
struct IndexTarget
 
110
{
 
111
   string URI;
 
112
   string Description;
 
113
   string ShortDesc;
 
114
   string MetaKey;
 
115
};
 
116
 
 
117
// Item class for index signatures
 
118
class pkgAcqMetaSig : public pkgAcquire::Item
 
119
{
 
120
   protected:
 
121
   
 
122
   pkgAcquire::ItemDesc Desc;
 
123
   string RealURI,MetaIndexURI,MetaIndexURIDesc,MetaIndexShortDesc;
 
124
   indexRecords* MetaIndexParser;
 
125
   const vector<struct IndexTarget*>* IndexTargets;
 
126
 
 
127
   public:
 
128
   
 
129
   // Specialized action members
 
130
   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 
131
   virtual void Done(string Message,unsigned long Size,string Md5Hash,
 
132
                     pkgAcquire::MethodConfig *Cnf);
 
133
   virtual string Custom600Headers();
 
134
   virtual string DescURI() {return RealURI; };
 
135
 
 
136
   pkgAcqMetaSig(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc,
 
137
                 string MetaIndexURI, string MetaIndexURIDesc, string MetaIndexShortDesc,
 
138
                 const vector<struct IndexTarget*>* IndexTargets,
 
139
                 indexRecords* MetaIndexParser);
 
140
};
 
141
 
 
142
// Item class for index signatures
 
143
class pkgAcqMetaIndex : public pkgAcquire::Item
 
144
{
 
145
   protected:
 
146
   
 
147
   pkgAcquire::ItemDesc Desc;
 
148
   string RealURI; // FIXME: is this redundant w/ Desc.URI?
 
149
   string SigFile;
 
150
   const vector<struct IndexTarget*>* IndexTargets;
 
151
   indexRecords* MetaIndexParser;
 
152
   bool AuthPass;
 
153
 
 
154
   bool VerifyVendor();
 
155
   void RetrievalDone(string Message);
 
156
   void AuthDone(string Message);
 
157
   void QueueIndexes(bool verify);
 
158
   
 
159
   public:
 
160
   
 
161
   // Specialized action members
 
162
   virtual void Failed(string Message,pkgAcquire::MethodConfig *Cnf);
 
163
   virtual void Done(string Message,unsigned long Size,string Md5Hash,
 
164
                     pkgAcquire::MethodConfig *Cnf);
 
165
   virtual string Custom600Headers();
 
166
   virtual string DescURI() {return RealURI; };
 
167
 
 
168
   pkgAcqMetaIndex(pkgAcquire *Owner,
 
169
                   string URI,string URIDesc, string ShortDesc,
 
170
                   string SigFile,
 
171
                   const vector<struct IndexTarget*>* IndexTargets,
 
172
                   indexRecords* MetaIndexParser);
121
173
};
122
174
 
123
175
// Item class for archive files
134
186
   string &StoreFilename;
135
187
   pkgCache::VerFileIterator Vf;
136
188
   unsigned int Retries;
 
189
   bool Trusted; 
137
190
 
138
191
   // Queue the next available file for download.
139
192
   bool QueueNext();
146
199
                     pkgAcquire::MethodConfig *Cnf);
147
200
   virtual string MD5Sum() {return MD5;};
148
201
   virtual string DescURI() {return Desc.URI;};
 
202
   virtual string ShortDesc() {return Desc.ShortDesc;};
149
203
   virtual void Finished();
 
204
   virtual bool IsTrusted();
150
205
   
151
206
   pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
152
207
                 pkgRecords *Recs,pkgCache::VerIterator const &Version,