summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2005-11-22 19:34:02 +0000
committerMichael Vogt <michael.vogt@ubuntu.com>2005-11-22 19:34:02 +0000
commit46e00f9d71300f3a80a4a311e369e64a48ce396f (patch)
tree4d6deaf2b5453dabf796e82ee2d02658a3c42d07 /apt-pkg
parent71a174eec0debaed2159b043ff6ef81cd618408b (diff)
* ABI change: merged more flexible pkgAcquireFile code
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc27
-rw-r--r--apt-pkg/acquire-item.h11
-rw-r--r--apt-pkg/init.h2
-rw-r--r--apt-pkg/makefile2
4 files changed, 25 insertions, 17 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index debd1face..88c25de43 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -184,7 +184,7 @@ string pkgAcqIndex::Custom600Headers()
void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
{
// no .bz2 found, retry with .gz
- if(Desc.URI.substr(Desc.URI.size()-3,Desc.URI.size()-1) == "bz2") {
+ if(Desc.URI.substr(Desc.URI.size()-3) == "bz2") {
Desc.URI = Desc.URI.substr(0,Desc.URI.size()-3) + "gz";
// retry with a gzip one
@@ -290,7 +290,7 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string MD5,
else
Local = true;
- string compExt = Desc.URI.substr(Desc.URI.size()-3,Desc.URI.size()-1);
+ string compExt = Desc.URI.substr(Desc.URI.size()-3);
char *decompProg;
if(compExt == "bz2")
decompProg = "bzip2";
@@ -315,10 +315,9 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,
const vector<IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser) :
Item(Owner), RealURI(URI), MetaIndexURI(MetaIndexURI),
- MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc)
+ MetaIndexURIDesc(MetaIndexURIDesc), MetaIndexShortDesc(MetaIndexShortDesc),
+ MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
{
- this->MetaIndexParser = MetaIndexParser;
- this->IndexTargets = IndexTargets;
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
@@ -430,11 +429,9 @@ pkgAcqMetaIndex::pkgAcqMetaIndex(pkgAcquire *Owner,
string SigFile,
const vector<struct IndexTarget*>* IndexTargets,
indexRecords* MetaIndexParser) :
- Item(Owner), RealURI(URI), SigFile(SigFile)
+ Item(Owner), RealURI(URI), SigFile(SigFile), AuthPass(false),
+ MetaIndexParser(MetaIndexParser), IndexTargets(IndexTargets)
{
- this->AuthPass = false;
- this->MetaIndexParser = MetaIndexParser;
- this->IndexTargets = IndexTargets;
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
DestFile += URItoFileName(URI);
@@ -1008,13 +1005,19 @@ void pkgAcqArchive::Finished()
// ---------------------------------------------------------------------
/* The file is added to the queue */
pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,
- unsigned long Size,string Dsc,string ShortDesc) :
+ unsigned long Size,string Dsc,string ShortDesc,
+ const string &DestDir, const string &DestFilename) :
Item(Owner), Md5Hash(MD5)
{
Retries = _config->FindI("Acquire::Retries",0);
- DestFile = flNotDir(URI);
-
+ if(!DestFilename.empty())
+ DestFile = DestFilename;
+ else if(!DestDir.empty())
+ DestFile = DestDir + "/" + flNotDir(URI);
+ else
+ DestFile = flNotDir(URI);
+
// Create the item
Desc.URI = URI;
Desc.Description = Dsc;
diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h
index 90f80368b..c34b5ef69 100644
--- a/apt-pkg/acquire-item.h
+++ b/apt-pkg/acquire-item.h
@@ -224,9 +224,14 @@ class pkgAcqFile : public pkgAcquire::Item
pkgAcquire::MethodConfig *Cnf);
virtual string MD5Sum() {return Md5Hash;};
virtual string DescURI() {return Desc.URI;};
-
- pkgAcqFile(pkgAcquire *Owner,string URI,string MD5,unsigned long Size,
- string Desc,string ShortDesc);
+
+ // If DestFilename is empty, download to DestDir/<basename> if
+ // DestDir is non-empty, $CWD/<basename> otherwise. If
+ // DestFilename is NOT empty, DestDir is ignored and DestFilename
+ // is the absolute name to which the file should be downloaded.
+ pkgAcqFile(pkgAcquire *Owner, string URI, string MD5, unsigned long Size,
+ string Desc, string ShortDesc,
+ const string &DestDir="", const string &DestFilename="");
};
#endif
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index e21351797..8255b406a 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -18,7 +18,7 @@
// See the makefile
#define APT_PKG_MAJOR 3
-#define APT_PKG_MINOR 10
+#define APT_PKG_MINOR 11
#define APT_PKG_RELEASE 0
extern const char *pkgVersion;
diff --git a/apt-pkg/makefile b/apt-pkg/makefile
index 8de7d945e..0e6aecc65 100644
--- a/apt-pkg/makefile
+++ b/apt-pkg/makefile
@@ -13,7 +13,7 @@ include ../buildlib/defaults.mak
# methods/makefile - FIXME
LIBRARY=apt-pkg
LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER)
-MAJOR=3.10
+MAJOR=3.11
MINOR=0
SLIBS=$(PTHREADLIB) $(INTLLIBS)
APT_DOMAIN:=libapt-pkg$(MAJOR)