Browse Source

* apt-pkg/acquire-item.cc:

- Acquire::ForceHash to force method for expected hash
  - display MD5Sum in --print-uris if not forced to use another method
    instead of displaying the strongest available (Closes: #576420)
tags/debian/0.8.0
David Kalnischkies 11 years ago
parent
commit
a722b2c5c9
5 changed files with 41 additions and 13 deletions
  1. +21
    -7
      apt-pkg/acquire-item.cc
  2. +11
    -2
      cmdline/apt-get.cc
  3. +4
    -0
      debian/changelog
  4. +1
    -0
      doc/examples/configure-index
  5. +4
    -4
      test/makefile

+ 21
- 7
apt-pkg/acquire-item.cc View File

@@ -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."),


+ 11
- 2
cmdline/apt-get.cc View File

@@ -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)


+ 4
- 0
debian/changelog View File

@@ -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



+ 1
- 0
doc/examples/configure-index View File

@@ -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


+ 4
- 4
test/makefile View File

@@ -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)

Loading…
Cancel
Save