From: Michael Vogt Date: Tue, 21 Feb 2006 16:39:25 +0000 (+0000) Subject: * more work for the DefaultAptSources spec X-Git-Tag: 0.7.24ubuntu1~264 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/7e5f33eb8a0f224b938f17236f684ba5cadb9c7f * more work for the DefaultAptSources spec apt-pkg/acquire-item.h: - add new pkgAcquire::Item::StatTransientNetworkError status apt-pkg/acquire-item.cc: - if we get a StatTransientNetworkError use old sigfile and indexfiles apt-pkg/acquire-worker.cc: - set StatTransientNetworkError on "Timeout", "TmpResolveFailure", "ConnectionRefused" cmdline/apt-get.cc: - handle a StatTransientNetworkError different than a normal error (warning instead of error) --- diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index dee00c63e..da9becc44 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -75,7 +75,7 @@ void pkgAcquire::Item::Failed(string Message,pkgAcquire::MethodConfig *Cnf) Dequeue(); return; } - + Status = StatError; Dequeue(); } @@ -393,13 +393,15 @@ void pkgAcqMetaSig::Failed(string Message,pkgAcquire::MethodConfig *Cnf) string Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI); // if we get a network error we fail gracefully - if(LookupTag(Message,"FailReason") == "Timeout" || - LookupTag(Message,"FailReason") == "TmpResolveFailure" || - LookupTag(Message,"FailReason") == "ConnectionRefused") { + if(Status == StatTransientNetworkError) + { Item::Failed(Message,Cnf); // move the sigfile back on network failures (and re-authenticated?) if(FileExists(DestFile)) Rename(DestFile,Final); + + // set the status back to , Item::Failed likes to reset it + Status = pkgAcquire::Item::StatTransientNetworkError; return; } diff --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index da1bea801..1c83f8d2e 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -48,7 +48,8 @@ class pkgAcquire::Item public: // State of the item - enum {StatIdle, StatFetching, StatDone, StatError, StatAuthError} Status; + enum {StatIdle, StatFetching, StatDone, StatError, + StatAuthError, StatTransientNetworkError} Status; string ErrorText; unsigned long FileSize; unsigned long PartialSize; diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index d06024178..8ab67778b 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -307,6 +307,13 @@ bool pkgAcquire::Worker::RunMessages() pkgAcquire::Item *Owner = Itm->Owner; pkgAcquire::ItemDesc Desc = *Itm; OwnerQ->ItemDone(Itm); + + // set some status + if(LookupTag(Message,"FailReason") == "Timeout" || + LookupTag(Message,"FailReason") == "TmpResolveFailure" || + LookupTag(Message,"FailReason") == "ConnectionRefused") + Owner->Status = pkgAcquire::Item::StatTransientNetworkError; + Owner->Failed(Message,Config); ItemDone(); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 99a51c9b8..e98d4fec5 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1355,20 +1355,29 @@ bool DoUpdate(CommandLine &CmdL) return false; bool Failed = false; + bool TransientNetworkFailure = false; for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++) { if ((*I)->Status == pkgAcquire::Item::StatDone) continue; (*I)->Finished(); - + fprintf(stderr,_("Failed to fetch %s %s\n"),(*I)->DescURI().c_str(), (*I)->ErrorText.c_str()); + + if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError) + { + TransientNetworkFailure = true; + continue; + } + Failed = true; } // Clean out any old list files - if (!Failed && _config->FindB("APT::Get::List-Cleanup",true) == true) + if (!TransientNetworkFailure && + _config->FindB("APT::Get::List-Cleanup",true) == true) { if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) @@ -1380,9 +1389,11 @@ bool DoUpdate(CommandLine &CmdL) if (Cache.BuildCaches() == false) return false; - if (Failed == true) + if (TransientNetworkFailure == true) _error->Warning(_("Some index files failed to download, they have been ignored, or old ones used instead.")); - + else if (Failed == true) + return _error->Error(_("Some index files failed to download, they have been ignored, or old ones used instead.")); + return true; } /*}}}*/ diff --git a/po/apt-all.pot b/po/apt-all.pot index 23de34b5c..c1edb1c79 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2006-01-20 14:06+0100\n" +"POT-Creation-Date: 2006-02-21 15:07+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -146,14 +146,14 @@ msgstr "" msgid " %4i %s\n" msgstr "" -#: cmdline/apt-cache.cc:1651 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70 +#: cmdline/apt-cache.cc:1652 cmdline/apt-cdrom.cc:138 cmdline/apt-config.cc:70 #: cmdline/apt-extracttemplates.cc:225 ftparchive/apt-ftparchive.cc:550 -#: cmdline/apt-get.cc:2378 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-get.cc:2380 cmdline/apt-sortpkgs.cc:144 #, c-format msgid "%s %s for %s %s compiled on %s %s\n" msgstr "" -#: cmdline/apt-cache.cc:1658 +#: cmdline/apt-cache.cc:1659 msgid "" "Usage: apt-cache [options] command\n" " apt-cache [options] add file1 [file2 ...]\n" @@ -243,7 +243,7 @@ msgid "" " -o=? Set an arbitrary configuration option, eg -o dir::cache=/tmp\n" msgstr "" -#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:710 +#: cmdline/apt-extracttemplates.cc:267 apt-pkg/pkgcachegen.cc:712 #, c-format msgid "Unable to write to %s" msgstr "" @@ -535,7 +535,7 @@ msgstr "" msgid "Y" msgstr "" -#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1515 +#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1517 #, c-format msgid "Regex compilation error - %s" msgstr "" @@ -694,11 +694,11 @@ msgstr "" msgid "Internal error, Ordering didn't finish" msgstr "" -#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1809 cmdline/apt-get.cc:1842 +#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1811 cmdline/apt-get.cc:1844 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1890 cmdline/apt-get.cc:2126 +#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1892 cmdline/apt-get.cc:2128 #: apt-pkg/cachefile.cc:67 msgid "The list of sources could not be read." msgstr "" @@ -727,7 +727,7 @@ msgstr "" msgid "After unpacking %sB disk space will be freed.\n" msgstr "" -#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:1980 +#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:1982 #, c-format msgid "Couldn't determine free space in %s" msgstr "" @@ -761,7 +761,7 @@ msgstr "" msgid "Do you want to continue [Y/n]? " msgstr "" -#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1365 cmdline/apt-get.cc:2023 +#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1366 cmdline/apt-get.cc:2025 #, c-format msgid "Failed to fetch %s %s\n" msgstr "" @@ -770,7 +770,7 @@ msgstr "" msgid "Some files failed to download" msgstr "" -#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:2032 +#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:2034 msgid "Download complete and in download only mode" msgstr "" @@ -866,41 +866,41 @@ msgstr "" msgid "The update command takes no arguments" msgstr "" -#: cmdline/apt-get.cc:1326 cmdline/apt-get.cc:1420 +#: cmdline/apt-get.cc:1326 msgid "Unable to lock the list directory" msgstr "" -#: cmdline/apt-get.cc:1384 +#: cmdline/apt-get.cc:1393 cmdline/apt-get.cc:1395 msgid "" "Some index files failed to download, they have been ignored, or old ones " "used instead." msgstr "" -#: cmdline/apt-get.cc:1403 +#: cmdline/apt-get.cc:1414 msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1502 cmdline/apt-get.cc:1538 +#: cmdline/apt-get.cc:1504 cmdline/apt-get.cc:1540 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1525 +#: cmdline/apt-get.cc:1527 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1555 +#: cmdline/apt-get.cc:1557 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1558 +#: cmdline/apt-get.cc:1560 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" -#: cmdline/apt-get.cc:1570 +#: cmdline/apt-get.cc:1572 msgid "" "Some packages could not be installed. This may mean that you have\n" "requested an impossible situation or if you are using the unstable\n" @@ -908,163 +908,163 @@ msgid "" "or been moved out of Incoming." msgstr "" -#: cmdline/apt-get.cc:1578 +#: cmdline/apt-get.cc:1580 msgid "" "Since you only requested a single operation it is extremely likely that\n" "the package is simply not installable and a bug report against\n" "that package should be filed." msgstr "" -#: cmdline/apt-get.cc:1583 +#: cmdline/apt-get.cc:1585 msgid "The following information may help to resolve the situation:" msgstr "" -#: cmdline/apt-get.cc:1586 +#: cmdline/apt-get.cc:1588 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1612 +#: cmdline/apt-get.cc:1614 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1683 +#: cmdline/apt-get.cc:1685 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1684 +#: cmdline/apt-get.cc:1686 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1704 +#: cmdline/apt-get.cc:1706 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1707 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1709 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1712 +#: cmdline/apt-get.cc:1714 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1777 cmdline/apt-get.cc:1785 +#: cmdline/apt-get.cc:1779 cmdline/apt-get.cc:1787 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1885 +#: cmdline/apt-get.cc:1887 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1915 cmdline/apt-get.cc:2144 +#: cmdline/apt-get.cc:1917 cmdline/apt-get.cc:2146 #, c-format msgid "Unable to find a source package for %s" msgstr "" -#: cmdline/apt-get.cc:1959 +#: cmdline/apt-get.cc:1961 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1983 +#: cmdline/apt-get.cc:1985 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:1988 +#: cmdline/apt-get.cc:1990 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:1991 +#: cmdline/apt-get.cc:1993 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:1997 +#: cmdline/apt-get.cc:1999 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2028 +#: cmdline/apt-get.cc:2030 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2056 +#: cmdline/apt-get.cc:2058 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2068 +#: cmdline/apt-get.cc:2070 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2069 +#: cmdline/apt-get.cc:2071 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2086 +#: cmdline/apt-get.cc:2088 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2105 +#: cmdline/apt-get.cc:2107 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2121 +#: cmdline/apt-get.cc:2123 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2149 +#: cmdline/apt-get.cc:2151 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2169 +#: cmdline/apt-get.cc:2171 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2221 +#: cmdline/apt-get.cc:2223 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2273 +#: cmdline/apt-get.cc:2275 #, c-format msgid "" "%s dependency for %s cannot be satisfied because no available versions of " "package %s can satisfy version requirements" msgstr "" -#: cmdline/apt-get.cc:2308 +#: cmdline/apt-get.cc:2310 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2333 +#: cmdline/apt-get.cc:2335 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2347 +#: cmdline/apt-get.cc:2349 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2351 +#: cmdline/apt-get.cc:2353 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2383 +#: cmdline/apt-get.cc:2385 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2424 +#: cmdline/apt-get.cc:2426 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" @@ -1349,9 +1349,9 @@ msgid "The info and temp directories need to be on the same filesystem" msgstr "" #. Build the status cache -#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:643 -#: apt-pkg/pkgcachegen.cc:712 apt-pkg/pkgcachegen.cc:717 -#: apt-pkg/pkgcachegen.cc:840 +#: apt-inst/deb/dpkgdb.cc:139 apt-pkg/pkgcachegen.cc:645 +#: apt-pkg/pkgcachegen.cc:714 apt-pkg/pkgcachegen.cc:719 +#: apt-pkg/pkgcachegen.cc:842 msgid "Reading package lists" msgstr "" @@ -1666,34 +1666,34 @@ msgstr "" msgid "Could not connect to %s:%s (%s), connection timed out" msgstr "" -#: methods/connect.cc:106 +#: methods/connect.cc:108 #, c-format msgid "Could not connect to %s:%s (%s)." msgstr "" #. We say this mainly because the pause here is for the #. ssh connection that is still going -#: methods/connect.cc:134 methods/rsh.cc:425 +#: methods/connect.cc:136 methods/rsh.cc:425 #, c-format msgid "Connecting to %s" msgstr "" -#: methods/connect.cc:165 +#: methods/connect.cc:167 #, c-format msgid "Could not resolve '%s'" msgstr "" -#: methods/connect.cc:171 +#: methods/connect.cc:173 #, c-format msgid "Temporary failure resolving '%s'" msgstr "" -#: methods/connect.cc:174 +#: methods/connect.cc:176 #, c-format msgid "Something wicked happened resolving '%s:%s' (%i)" msgstr "" -#: methods/connect.cc:221 +#: methods/connect.cc:223 #, c-format msgid "Unable to connect to %s %s:" msgstr "" @@ -2218,7 +2218,7 @@ msgstr "" msgid "Method %s did not start correctly" msgstr "" -#: apt-pkg/acquire-worker.cc:377 +#: apt-pkg/acquire-worker.cc:384 #, c-format msgid "Please insert the disc labeled: '%s' in the drive '%s' and press enter." msgstr "" @@ -2328,16 +2328,16 @@ msgstr "" msgid "Package %s %s was not found while processing file dependencies" msgstr "" -#: apt-pkg/pkgcachegen.cc:574 +#: apt-pkg/pkgcachegen.cc:575 #, c-format msgid "Couldn't stat source package list %s" msgstr "" -#: apt-pkg/pkgcachegen.cc:658 +#: apt-pkg/pkgcachegen.cc:660 msgid "Collecting File Provides" msgstr "" -#: apt-pkg/pkgcachegen.cc:785 apt-pkg/pkgcachegen.cc:792 +#: apt-pkg/pkgcachegen.cc:787 apt-pkg/pkgcachegen.cc:794 msgid "IO Error saving source cache" msgstr "" @@ -2346,35 +2346,35 @@ msgstr "" msgid "rename failed, %s (%s -> %s)." msgstr "" -#: apt-pkg/acquire-item.cc:236 apt-pkg/acquire-item.cc:950 +#: apt-pkg/acquire-item.cc:236 apt-pkg/acquire-item.cc:951 msgid "MD5Sum mismatch" msgstr "" -#: apt-pkg/acquire-item.cc:645 +#: apt-pkg/acquire-item.cc:646 msgid "There are no public key available for the following key IDs:\n" msgstr "" -#: apt-pkg/acquire-item.cc:758 +#: apt-pkg/acquire-item.cc:759 #, c-format msgid "" "I wasn't able to locate a file for the %s package. This might mean you need " "to manually fix this package. (due to missing arch)" msgstr "" -#: apt-pkg/acquire-item.cc:817 +#: apt-pkg/acquire-item.cc:818 #, c-format msgid "" "I wasn't able to locate file for the %s package. This might mean you need to " "manually fix this package." msgstr "" -#: apt-pkg/acquire-item.cc:853 +#: apt-pkg/acquire-item.cc:854 #, c-format msgid "" "The package index files are corrupted. No Filename: field for package %s." msgstr "" -#: apt-pkg/acquire-item.cc:940 +#: apt-pkg/acquire-item.cc:941 msgid "Size mismatch" msgstr ""