diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-23 08:20:18 +0000 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-23 08:20:18 +0000 |
commit | bdcf3b49360a353381e981d1918fc300c559948a (patch) | |
tree | 09f334d69228757c90c56d0d644a169c300ee8a1 | |
parent | 64995601ae9335dedd180d634940f1426598f7f0 (diff) | |
parent | 25182152bc7812fdd56fd40f8b9a04a140079585 (diff) |
* cherry-picked patches from apt--fixes and apt--mvo
Patches applied:
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-14
* added Hashsum support for file and cdrom
* michael.vogt@ubuntu.com--2005/apt--fixes--0--patch-18
* Change pkgPolicy::Pin from private to protected
* michael.vogt@ubuntu.com--2005/apt--mvo--0--patch-47
* improve the timeout handling (again)
-rw-r--r-- | apt-pkg/acquire-item.cc | 6 | ||||
-rw-r--r-- | apt-pkg/policy.h | 4 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 2 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | methods/cdrom.cc | 7 | ||||
-rw-r--r-- | methods/connect.cc | 3 | ||||
-rw-r--r-- | methods/file.cc | 8 |
7 files changed, 32 insertions, 6 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 14acad85a..ef107444f 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -401,7 +401,8 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) unlink(Final.c_str()); // if we get a timeout if fail - if(LookupTag(Message,"FailReason") == "Timeout") { + if(LookupTag(Message,"FailReason") == "Timeout" || + LookupTag(Message,"FailReason") == "TmpResolveFailure") { Item::Failed(Message,Cnf); return; } @@ -904,7 +905,8 @@ void pkgAcqArchive::Done(string Message,unsigned long Size,string Md5Hash, { Status = StatError; ErrorText = _("MD5Sum mismatch"); - Rename(DestFile,DestFile + ".FAILED"); + if(FileExists(DestFile)) + Rename(DestFile,DestFile + ".FAILED"); return; } } diff --git a/apt-pkg/policy.h b/apt-pkg/policy.h index 15f204798..40ebd3f70 100644 --- a/apt-pkg/policy.h +++ b/apt-pkg/policy.h @@ -45,6 +45,8 @@ using std::vector; class pkgPolicy : public pkgDepCache::Policy { + protected: + struct Pin { pkgVersionMatch::MatchType Type; @@ -58,8 +60,6 @@ class pkgPolicy : public pkgDepCache::Policy string Pkg; }; - protected: - Pin *Pins; signed short *PFPriority; vector<Pin> Defaults; diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index e673e0f5b..7e079b91c 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1659,7 +1659,7 @@ bool DoInstall(CommandLine &CmdL) // See if we need to prompt if (Cache->InstCount() == ExpectedInst && Cache->DelCount() == 0) return InstallPackages(Cache,false,false); - + return InstallPackages(Cache,false); } /*}}}*/ diff --git a/debian/changelog b/debian/changelog index 35cba6007..61f5be622 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,14 @@ apt (0.6.40.2) unstable; urgency=low * improved the support for "error" and "conffile" reporting from dpkg, added the format to README.progress-reporting * added README.progress-reporting to the apt-doc package + * Do md5sum checking for file and cdrom method (closes: #319142) + * Change pkgPolicy::Pin from private to protected to let subclasses + access it too (closes: #321799) + * methods/connect.cc: + - send failure reason for EAI_AGAIN (TmpResolveFailure) to acuire-item + * apt-pkg/acquire-item.cc: + - fail early if a FailReason is TmpResolveFailure (avoids hangs during + the install when no network is available) -- diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 7cc036814..41eb8a0ee 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -13,6 +13,7 @@ #include <apt-pkg/error.h> #include <apt-pkg/configuration.h> #include <apt-pkg/fileutl.h> +#include <apt-pkg/hashes.h> #include <sys/stat.h> #include <unistd.h> @@ -180,6 +181,12 @@ bool CDROMMethod::Fetch(FetchItem *Itm) CurrentID = NewID; Res.LastModified = Buf.st_mtime; Res.Size = Buf.st_size; + + Hashes Hash; + FileFd Fd(Res.Filename, FileFd::ReadOnly); + Hash.AddFD(Fd.Fd(), Fd.Size()); + Res.TakeHashes(Hash); + URIDone(Res); return true; } diff --git a/methods/connect.cc b/methods/connect.cc index b85df6887..4e48927ed 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -166,8 +166,11 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd, } if (Res == EAI_AGAIN) + { + Owner->SetFailExtraMsg("\nFailReason: TmpResolveFailure"); return _error->Error(_("Temporary failure resolving '%s'"), Host.c_str()); + } return _error->Error(_("Something wicked happened resolving '%s:%s' (%i)"), Host.c_str(),ServStr,Res); } diff --git a/methods/file.cc b/methods/file.cc index 3500de9f5..9cdd5bc2d 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -15,6 +15,8 @@ // Include Files /*{{{*/ #include <apt-pkg/acquire-method.h> #include <apt-pkg/error.h> +#include <apt-pkg/hashes.h> +#include <apt-pkg/fileutl.h> #include <sys/stat.h> #include <unistd.h> @@ -75,7 +77,11 @@ bool FileMethod::Fetch(FetchItem *Itm) if (Res.Filename.empty() == true) return _error->Error(_("File not found")); - + + Hashes Hash; + FileFd Fd(Res.Filename, FileFd::ReadOnly); + Hash.AddFD(Fd.Fd(), Fd.Size()); + Res.TakeHashes(Hash); URIDone(Res); return true; } |