summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc28
-rw-r--r--cmdline/apt-get.cc13
-rw-r--r--debian/changelog4
-rw-r--r--doc/examples/configure-index1
-rw-r--r--test/makefile8
5 files changed, 41 insertions, 13 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 4f0abbb91..916fca71e 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1327,7 +1327,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *Owner,pkgSourceList *Sources,
the archive is already available in the cache and stashs the MD5 for
checking later. */
bool pkgAcqArchive::QueueNext()
-{
+{
+ string const ForceHash = _config->Find("Acquire::ForceHash");
for (; Vf.end() == false; Vf++)
{
// Ignore not source sources
@@ -1350,12 +1351,25 @@ bool pkgAcqArchive::QueueNext()
return false;
string PkgFile = Parse.FileName();
- if(Parse.SHA256Hash() != "")
- ExpectedHash = HashString("SHA256", Parse.SHA256Hash());
- else if (Parse.SHA1Hash() != "")
- ExpectedHash = HashString("SHA1", Parse.SHA1Hash());
- else
- ExpectedHash = HashString("MD5Sum", Parse.MD5Hash());
+ if (ForceHash.empty() == false)
+ {
+ if(stringcasecmp(ForceHash, "sha256") == 0)
+ ExpectedHash = HashString("SHA256", Parse.SHA256Hash());
+ else if (stringcasecmp(ForceHash, "sha1") == 0)
+ ExpectedHash = HashString("SHA1", Parse.SHA1Hash());
+ else
+ ExpectedHash = HashString("MD5Sum", Parse.MD5Hash());
+ }
+ else
+ {
+ string Hash;
+ if ((Hash = Parse.SHA256Hash()).empty() == false)
+ ExpectedHash = HashString("SHA256", Hash);
+ else if ((Hash = Parse.SHA1Hash()).empty() == false)
+ ExpectedHash = HashString("SHA1", Hash);
+ else
+ ExpectedHash = HashString("MD5Sum", Parse.MD5Hash());
+ }
if (PkgFile.empty() == true)
return _error->Error(_("The package index files are corrupted. No Filename: "
"field for package %s."),
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 416d316da..7c42e672d 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -815,8 +815,14 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
// Create the download object
pkgAcquire Fetcher;
AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));
- if (Fetcher.Setup(&Stat, _config->FindB("APT::Get::Print-URIs", false)
- ? "" : _config->FindDir("Dir::Cache::Archives")) == false)
+ if (_config->FindB("APT::Get::Print-URIs", false) == true)
+ {
+ // force a hashsum for compatibility reasons
+ _config->CndSet("Acquire::ForceHash", "md5sum");
+ if (Fetcher.Setup(&Stat, "") == false)
+ return false;
+ }
+ else if (Fetcher.Setup(&Stat, _config->FindDir("Dir::Cache::Archives")) == false)
return false;
// Read the source list
@@ -1441,6 +1447,9 @@ bool DoUpdate(CommandLine &CmdL)
// Just print out the uris an exit if the --print-uris flag was used
if (_config->FindB("APT::Get::Print-URIs") == true)
{
+ // force a hashsum for compatibility reasons
+ _config->CndSet("Acquire::ForceHash", "md5sum");
+
// get a fetcher
pkgAcquire Fetcher;
if (Fetcher.Setup(&Stat) == false)
diff --git a/debian/changelog b/debian/changelog
index ffab08eb1..4cdbd4d93 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,8 +11,12 @@ apt (0.7.26~exp4) experimental; urgency=low
- check for and create directories in Setup if needed instead of
error out unfriendly in the Constructor (Closes: #523920, #525783)
- optional handle a lock file in Setup()
+ * apt-pkg/acquire-item.cc:
+ - Acquire::ForceHash to force method for expected hash
* cmdline/apt-get.cc:
- remove the lock file handling and let Acquire take care of it instead
+ - display MD5Sum in --print-uris if not forced to use another method
+ instead of displaying the strongest available (Closes: #576420)
-- David Kalnischkies <kalnischkies@gmail.com> Sat, 03 Apr 2010 14:58:39 +0200
diff --git a/doc/examples/configure-index b/doc/examples/configure-index
index 3167e46da..d168417d8 100644
--- a/doc/examples/configure-index
+++ b/doc/examples/configure-index
@@ -169,6 +169,7 @@ Acquire
Queue-Mode "host"; // host|access
Retries "0";
Source-Symlinks "true";
+ ForceHash "sha256"; // hashmethod used for expected hash: sha256, sha1 or md5sum
PDiffs "true"; // try to get the IndexFile diffs
PDiffs::FileLimit "4"; // don't use diffs if we would need more than 4 diffs
diff --git a/test/makefile b/test/makefile
index b8c104eae..52adb96a2 100644
--- a/test/makefile
+++ b/test/makefile
@@ -68,7 +68,7 @@ SOURCE = test_udevcdrom.cc
include $(PROGRAM_H)
# Program for checking rpm versions
-PROGRAM=rpmver
-SLIBS = -lapt-pkg -lrpm
-SOURCE = rpmver.cc
-include $(PROGRAM_H)
+#PROGRAM=rpmver
+#SLIBS = -lapt-pkg -lrpm
+#SOURCE = rpmver.cc
+#include $(PROGRAM_H)