summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@ubuntu.com>2014-05-08 09:48:51 +0200
committerMichael Vogt <mvo@ubuntu.com>2014-05-08 09:48:51 +0200
commit864a3375f7bf0b3772f4f2ae212b802f6cab5ff9 (patch)
tree1df83bd5badeea61a237ecf5c6aac884cd9ae0ee /apt-pkg
parent34de054cffeb8e64c09efd452a78271bb85d4831 (diff)
parentc6e9cc582c7093b08c7c057c1f7885eb07e06959 (diff)
Merge remote-tracking branch 'mvo/bugfix/update-progress-reporting' into debian/experimental
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc2
-rw-r--r--apt-pkg/acquire.cc13
-rw-r--r--apt-pkg/contrib/hashes.cc2
-rw-r--r--apt-pkg/contrib/hashes.h2
4 files changed, 14 insertions, 5 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 07be72124..913764f64 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -936,6 +936,8 @@ pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner,
}
CompressionExtension = comprExt;
+ Verify = true;
+
Init(URI, URIDesc, ShortDesc);
}
pkgAcqIndex::pkgAcqIndex(pkgAcquire *Owner, IndexTarget const *Target,
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc
index 37964c943..57cbba169 100644
--- a/apt-pkg/acquire.cc
+++ b/apt-pkg/acquire.cc
@@ -822,7 +822,9 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
// Compute the total number of bytes to fetch
unsigned int Unknown = 0;
unsigned int Count = 0;
- for (pkgAcquire::ItemCIterator I = Owner->ItemsBegin(); I != Owner->ItemsEnd();
+ bool UnfetchedReleaseFiles = false;
+ for (pkgAcquire::ItemCIterator I = Owner->ItemsBegin();
+ I != Owner->ItemsEnd();
++I, ++Count)
{
TotalItems++;
@@ -836,6 +838,10 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
// see if the method tells us to expect more
TotalItems += (*I)->ExpectedAdditionalItems;
+ // check if there are unfetched Release files
+ if ((*I)->Complete == false && (*I)->ExpectedAdditionalItems > 0)
+ UnfetchedReleaseFiles = true;
+
TotalBytes += (*I)->FileSize;
if ((*I)->Complete == true)
CurrentBytes += (*I)->FileSize;
@@ -895,9 +901,8 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner)
Time = NewTime;
}
- // calculate the percentage, if we have too little data assume 0%
- // FIXME: the 5k is totally arbitrary
- if (TotalBytes < 5*1024)
+ // calculate the percentage, if we have too little data assume 1%
+ if (TotalBytes > 0 && UnfetchedReleaseFiles)
Percent = 0;
else
// use both files and bytes because bytes can be unreliable
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 1fce0d75f..15f83615d 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -133,7 +133,7 @@ bool Hashes::AddFD(int const Fd,unsigned long long Size, bool const addMD5,
bool const addSHA1, bool const addSHA256, bool const addSHA512)
{
unsigned char Buf[64*64];
- bool const ToEOF = (Size == 0);
+ bool const ToEOF = (Size == UntilEOF);
while (Size != 0 || ToEOF)
{
unsigned long long n = sizeof(Buf);
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index 5cd1af03b..7a62f8a8f 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/apt-pkg/contrib/hashes.h
@@ -78,6 +78,8 @@ class Hashes
SHA256Summation SHA256;
SHA512Summation SHA512;
+ static const int UntilEOF = 0;
+
inline bool Add(const unsigned char *Data,unsigned long long Size)
{
return MD5.Add(Data,Size) && SHA1.Add(Data,Size) && SHA256.Add(Data,Size) && SHA512.Add(Data,Size);