summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc52
1 files changed, 38 insertions, 14 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 9c6f85093..b9d9a0af3 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1018,9 +1018,7 @@ bool pkgAcquire::Item::IsRedirectionLoop(std::string const &NewURI) /*{{{*/
return false;
}
/*}}}*/
-
- /*}}}*/
-int pkgAcquire::Item::Priority() /*{{{*/
+int pkgAcquire::Item::Priority() /*{{{*/
{
// Stage 1: Meta indices and diff indices
// - those need to be fetched first to have progress reporting working
@@ -2057,7 +2055,7 @@ void pkgAcqDiffIndex::QueueOnIMSHit() const /*{{{*/
{
// list cleanup needs to know that this file as well as the already
// present index is ours, so we create an empty diff to save it for us
- new pkgAcqIndexDiffs(Owner, TransactionManager, Target);
+ new pkgAcqIndexDiffs(Owner, TransactionManager, Target, UsedMirror, Target.URI);
}
/*}}}*/
static bool RemoveFileForBootstrapLinking(bool const Debug, std::string const &For, std::string const &Boot)/*{{{*/
@@ -2433,14 +2431,26 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/
}
}
+ std::string indexURI = Desc.URI;
+ auto const byhashidx = indexURI.find("/by-hash/");
+ if (byhashidx != std::string::npos)
+ indexURI = indexURI.substr(0, byhashidx - strlen(".diff"));
+ else
+ {
+ auto end = indexURI.length() - strlen(".diff/Index");
+ if (CurrentCompressionExtension != "uncompressed")
+ end -= (1 + CurrentCompressionExtension.length());
+ indexURI = indexURI.substr(0, end);
+ }
+
if (pdiff_merge == false)
- new pkgAcqIndexDiffs(Owner, TransactionManager, Target, available_patches);
+ new pkgAcqIndexDiffs(Owner, TransactionManager, Target, UsedMirror, indexURI, available_patches);
else
{
diffs = new std::vector<pkgAcqIndexMergeDiffs*>(available_patches.size());
for(size_t i = 0; i < available_patches.size(); ++i)
(*diffs)[i] = new pkgAcqIndexMergeDiffs(Owner, TransactionManager,
- Target,
+ Target, UsedMirror, indexURI,
available_patches[i],
diffs);
}
@@ -2510,8 +2520,9 @@ pkgAcqDiffIndex::~pkgAcqDiffIndex()
pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire * const Owner,
pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target,
+ std::string const &indexUsedMirror, std::string const &indexURI,
vector<DiffInfo> const &diffs)
- : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL),
+ : pkgAcqBaseIndex(Owner, TransactionManager, Target), indexURI(indexURI),
available_patches(diffs)
{
DestFile = GetKeepCompressedFileName(GetPartialFileNameFromURI(Target.URI), Target);
@@ -2522,6 +2533,12 @@ pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire * const Owner,
Description = Target.Description;
Desc.ShortDesc = Target.ShortDesc;
+ UsedMirror = indexUsedMirror;
+ if (UsedMirror == "DIRECT")
+ UsedMirror.clear();
+ else if (UsedMirror.empty() == false && Description.find(" ") != string::npos)
+ Description.replace(0, Description.find(" "), UsedMirror);
+
if(available_patches.empty() == true)
{
// we are done (yeah!), check hashes against the final file
@@ -2636,7 +2653,7 @@ bool pkgAcqIndexDiffs::QueueNextDiff() /*{{{*/
}
// queue the right diff
- Desc.URI = Target.URI + ".diff/" + available_patches[0].file + ".gz";
+ Desc.URI = indexURI + ".diff/" + available_patches[0].file + ".gz";
Desc.Description = Description + " " + available_patches[0].file + string(".pdiff");
DestFile = GetKeepCompressedFileName(GetPartialFileNameFromURI(Target.URI + ".diff/" + available_patches[0].file), Target);
@@ -2689,7 +2706,7 @@ void pkgAcqIndexDiffs::Done(string const &Message, HashStringList const &Hashes,
// see if there is more to download
if(available_patches.empty() == false)
{
- new pkgAcqIndexDiffs(Owner, TransactionManager, Target, available_patches);
+ new pkgAcqIndexDiffs(Owner, TransactionManager, Target, UsedMirror, indexURI, available_patches);
Finish();
} else {
DestFile = PatchedFile;
@@ -2718,19 +2735,26 @@ pkgAcqIndexDiffs::~pkgAcqIndexDiffs() {}
pkgAcqIndexMergeDiffs::pkgAcqIndexMergeDiffs(pkgAcquire * const Owner,
pkgAcqMetaClearSig * const TransactionManager,
IndexTarget const &Target,
+ std::string const &indexUsedMirror, std::string const &indexURI,
DiffInfo const &patch,
std::vector<pkgAcqIndexMergeDiffs*> const * const allPatches)
- : pkgAcqBaseIndex(Owner, TransactionManager, Target), d(NULL),
- patch(patch), allPatches(allPatches), State(StateFetchDiff)
+ : pkgAcqBaseIndex(Owner, TransactionManager, Target), indexURI(indexURI),
+ patch(patch), allPatches(allPatches), State(StateFetchDiff)
{
Debug = _config->FindB("Debug::pkgAcquire::Diffs",false);
- Desc.Owner = this;
Description = Target.Description;
+ UsedMirror = indexUsedMirror;
+ if (UsedMirror == "DIRECT")
+ UsedMirror.clear();
+ else if (UsedMirror.empty() == false && Description.find(" ") != string::npos)
+ Description.replace(0, Description.find(" "), UsedMirror);
+
+ Desc.Owner = this;
Desc.ShortDesc = Target.ShortDesc;
- Desc.URI = Target.URI + ".diff/" + patch.file + ".gz";
+ Desc.URI = indexURI + ".diff/" + patch.file + ".gz";
Desc.Description = Description + " " + patch.file + ".pdiff";
- DestFile = GetPartialFileNameFromURI(Desc.URI);
+ DestFile = GetPartialFileNameFromURI(Target.URI + ".diff/" + patch.file + ".gz");
if(Debug)
std::clog << "pkgAcqIndexMergeDiffs: " << Desc.URI << std::endl;