From 89b70b5a5c80b15d928b6593604bacc02a1b9a51 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Jun 2006 09:52:46 +0200 Subject: * apt-pkg/cachefile, cmdline/apt-get.cc: - move the code that does the work from apt-get.cc to pkgCacheFile::ListUpdate() --- apt-pkg/cachefile.cc | 46 +++++++++++++++++++++ apt-pkg/cachefile.h | 3 ++ cmdline/apt-get.cc | 45 +++++---------------- po/apt-all.pot | 110 +++++++++++++++++++++++++-------------------------- 4 files changed, 114 insertions(+), 90 deletions(-) diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index ab3003092..96d9672c2 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include /*}}}*/ @@ -111,6 +112,51 @@ bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock) } /*}}}*/ +// CacheFile::ListUpdate - update the cache files /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, pkgSourceList &List) +{ + pkgAcquire Fetcher(&Stat); + + // Populate it with the source selection + if (List.GetIndexes(&Fetcher) == false) + return false; + + // Run it + if (Fetcher.Run() == pkgAcquire::Failed) + return false; + + bool Failed = false; + for (pkgAcquire::ItemIterator I = Fetcher.ItemsBegin(); I != Fetcher.ItemsEnd(); I++) + { + if ((*I)->Status == pkgAcquire::Item::StatDone) + continue; + + (*I)->Finished(); + + _error->Warning(_("Failed to fetch %s %s\n"), + (*I)->DescURI().c_str(), + (*I)->ErrorText.c_str()); + Failed = true; + } + + // Clean out any old list files (if it was not a failure) + // Keep "APT::Get::List-Cleanup" name for compatibility, but + // this is really a global option for the APT library now + if (!Failed && (_config->FindB("APT::Get::List-Cleanup",true) == true || + _config->FindB("APT::List-Cleanup",true) == true)) + { + if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || + Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) + return false; + } + + + return (Failed == false); +} + /*}}}*/ + // CacheFile::Close - close the cache files /*{{{*/ // --------------------------------------------------------------------- /* */ diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index a128c29ab..366e3576f 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -22,6 +22,8 @@ #endif #include +#include +#include class pkgPolicy; class pkgCacheFile @@ -48,6 +50,7 @@ class pkgCacheFile bool BuildCaches(OpProgress &Progress,bool WithLock = true); bool Open(OpProgress &Progress,bool WithLock = true); + bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List); void Close(); pkgCacheFile(); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index d4a6bee32..ed99d431a 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1326,14 +1326,15 @@ bool DoUpdate(CommandLine &CmdL) return _error->Error(_("Unable to lock the list directory")); } - // Create the download object + // Create the progress AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0)); - pkgAcquire Fetcher(&Stat); - - + // Just print out the uris an exit if the --print-uris flag was used if (_config->FindB("APT::Get::Print-URIs") == true) { + // get a fetcher + pkgAcquire Fetcher(&Stat); + // Populate it with the source selection and get all Indexes // (GetAll=true) if (List.GetIndexes(&Fetcher,true) == false) @@ -1346,41 +1347,15 @@ bool DoUpdate(CommandLine &CmdL) return true; } - // Populate it with the source selection - if (List.GetIndexes(&Fetcher) == false) - return false; - - // Run it - if (Fetcher.Run() == pkgAcquire::Failed) - return false; - - bool Failed = 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()); - Failed = true; - } - - // Clean out any old list files - if (!Failed && _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) - return false; - } - - // Prepare the cache. + // do the work CacheFile Cache; + bool res = Cache.ListUpdate(Stat, List); + + // Rebuild the cache. if (Cache.BuildCaches() == false) return false; - if (Failed == true) + if (res == false) 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 d2209487a..5b84c3768 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-05-08 11:02+0200\n" +"POT-Creation-Date: 2006-06-07 09:49+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -148,7 +148,7 @@ msgstr "" #: 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:2369 cmdline/apt-sortpkgs.cc:144 +#: cmdline/apt-get.cc:2344 cmdline/apt-sortpkgs.cc:144 #, c-format msgid "%s %s for %s %s compiled on %s %s\n" msgstr "" @@ -535,7 +535,7 @@ msgstr "" msgid "Y" msgstr "" -#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1506 +#: cmdline/apt-get.cc:142 cmdline/apt-get.cc:1481 #, c-format msgid "Regex compilation error - %s" msgstr "" @@ -694,12 +694,12 @@ msgstr "" msgid "Internal error, Ordering didn't finish" msgstr "" -#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1800 cmdline/apt-get.cc:1833 +#: cmdline/apt-get.cc:791 cmdline/apt-get.cc:1775 cmdline/apt-get.cc:1808 msgid "Unable to lock the download directory" msgstr "" -#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1881 cmdline/apt-get.cc:2117 -#: apt-pkg/cachefile.cc:67 +#: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1856 cmdline/apt-get.cc:2092 +#: apt-pkg/cachefile.cc:68 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:1971 +#: cmdline/apt-get.cc:846 cmdline/apt-get.cc:1946 #, 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:2014 +#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1989 apt-pkg/cachefile.cc:138 #, 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:2023 +#: cmdline/apt-get.cc:980 cmdline/apt-get.cc:1998 msgid "Download complete and in download only mode" msgstr "" @@ -870,37 +870,37 @@ msgstr "" msgid "Unable to lock the list directory" msgstr "" -#: cmdline/apt-get.cc:1384 +#: cmdline/apt-get.cc:1359 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:1378 msgid "Internal error, AllUpgrade broke stuff" msgstr "" -#: cmdline/apt-get.cc:1493 cmdline/apt-get.cc:1529 +#: cmdline/apt-get.cc:1468 cmdline/apt-get.cc:1504 #, c-format msgid "Couldn't find package %s" msgstr "" -#: cmdline/apt-get.cc:1516 +#: cmdline/apt-get.cc:1491 #, c-format msgid "Note, selecting %s for regex '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1546 +#: cmdline/apt-get.cc:1521 msgid "You might want to run `apt-get -f install' to correct these:" msgstr "" -#: cmdline/apt-get.cc:1549 +#: cmdline/apt-get.cc:1524 msgid "" "Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a " "solution)." msgstr "" -#: cmdline/apt-get.cc:1561 +#: cmdline/apt-get.cc:1536 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:1569 +#: cmdline/apt-get.cc:1544 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:1574 +#: cmdline/apt-get.cc:1549 msgid "The following information may help to resolve the situation:" msgstr "" -#: cmdline/apt-get.cc:1577 +#: cmdline/apt-get.cc:1552 msgid "Broken packages" msgstr "" -#: cmdline/apt-get.cc:1603 +#: cmdline/apt-get.cc:1578 msgid "The following extra packages will be installed:" msgstr "" -#: cmdline/apt-get.cc:1674 +#: cmdline/apt-get.cc:1649 msgid "Suggested packages:" msgstr "" -#: cmdline/apt-get.cc:1675 +#: cmdline/apt-get.cc:1650 msgid "Recommended packages:" msgstr "" -#: cmdline/apt-get.cc:1695 +#: cmdline/apt-get.cc:1670 msgid "Calculating upgrade... " msgstr "" -#: cmdline/apt-get.cc:1698 methods/ftp.cc:702 methods/connect.cc:101 +#: cmdline/apt-get.cc:1673 methods/ftp.cc:702 methods/connect.cc:101 msgid "Failed" msgstr "" -#: cmdline/apt-get.cc:1703 +#: cmdline/apt-get.cc:1678 msgid "Done" msgstr "" -#: cmdline/apt-get.cc:1768 cmdline/apt-get.cc:1776 +#: cmdline/apt-get.cc:1743 cmdline/apt-get.cc:1751 msgid "Internal error, problem resolver broke stuff" msgstr "" -#: cmdline/apt-get.cc:1876 +#: cmdline/apt-get.cc:1851 msgid "Must specify at least one package to fetch source for" msgstr "" -#: cmdline/apt-get.cc:1906 cmdline/apt-get.cc:2135 +#: cmdline/apt-get.cc:1881 cmdline/apt-get.cc:2110 #, c-format msgid "Unable to find a source package for %s" msgstr "" -#: cmdline/apt-get.cc:1950 +#: cmdline/apt-get.cc:1925 #, c-format msgid "Skipping already downloaded file '%s'\n" msgstr "" -#: cmdline/apt-get.cc:1974 +#: cmdline/apt-get.cc:1949 #, c-format msgid "You don't have enough free space in %s" msgstr "" -#: cmdline/apt-get.cc:1979 +#: cmdline/apt-get.cc:1954 #, c-format msgid "Need to get %sB/%sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:1982 +#: cmdline/apt-get.cc:1957 #, c-format msgid "Need to get %sB of source archives.\n" msgstr "" -#: cmdline/apt-get.cc:1988 +#: cmdline/apt-get.cc:1963 #, c-format msgid "Fetch source %s\n" msgstr "" -#: cmdline/apt-get.cc:2019 +#: cmdline/apt-get.cc:1994 msgid "Failed to fetch some archives." msgstr "" -#: cmdline/apt-get.cc:2047 +#: cmdline/apt-get.cc:2022 #, c-format msgid "Skipping unpack of already unpacked source in %s\n" msgstr "" -#: cmdline/apt-get.cc:2059 +#: cmdline/apt-get.cc:2034 #, c-format msgid "Unpack command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2060 +#: cmdline/apt-get.cc:2035 #, c-format msgid "Check if the 'dpkg-dev' package is installed.\n" msgstr "" -#: cmdline/apt-get.cc:2077 +#: cmdline/apt-get.cc:2052 #, c-format msgid "Build command '%s' failed.\n" msgstr "" -#: cmdline/apt-get.cc:2096 +#: cmdline/apt-get.cc:2071 msgid "Child process failed" msgstr "" -#: cmdline/apt-get.cc:2112 +#: cmdline/apt-get.cc:2087 msgid "Must specify at least one package to check builddeps for" msgstr "" -#: cmdline/apt-get.cc:2140 +#: cmdline/apt-get.cc:2115 #, c-format msgid "Unable to get build-dependency information for %s" msgstr "" -#: cmdline/apt-get.cc:2160 +#: cmdline/apt-get.cc:2135 #, c-format msgid "%s has no build depends.\n" msgstr "" -#: cmdline/apt-get.cc:2212 +#: cmdline/apt-get.cc:2187 #, c-format msgid "" "%s dependency for %s cannot be satisfied because the package %s cannot be " "found" msgstr "" -#: cmdline/apt-get.cc:2264 +#: cmdline/apt-get.cc:2239 #, 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:2299 +#: cmdline/apt-get.cc:2274 #, c-format msgid "Failed to satisfy %s dependency for %s: Installed package %s is too new" msgstr "" -#: cmdline/apt-get.cc:2324 +#: cmdline/apt-get.cc:2299 #, c-format msgid "Failed to satisfy %s dependency for %s: %s" msgstr "" -#: cmdline/apt-get.cc:2338 +#: cmdline/apt-get.cc:2313 #, c-format msgid "Build-dependencies for %s could not be satisfied." msgstr "" -#: cmdline/apt-get.cc:2342 +#: cmdline/apt-get.cc:2317 msgid "Failed to process build dependencies" msgstr "" -#: cmdline/apt-get.cc:2374 +#: cmdline/apt-get.cc:2349 msgid "Supported modules:" msgstr "" -#: cmdline/apt-get.cc:2415 +#: cmdline/apt-get.cc:2390 msgid "" "Usage: apt-get [options] command\n" " apt-get [options] install|remove pkg1 [pkg2 ...]\n" @@ -2089,15 +2089,15 @@ msgstr "" msgid "extra" msgstr "" -#: apt-pkg/depcache.cc:60 apt-pkg/depcache.cc:89 +#: apt-pkg/depcache.cc:61 apt-pkg/depcache.cc:90 msgid "Building dependency tree" msgstr "" -#: apt-pkg/depcache.cc:61 +#: apt-pkg/depcache.cc:62 msgid "Candidate versions" msgstr "" -#: apt-pkg/depcache.cc:90 +#: apt-pkg/depcache.cc:91 msgid "Dependency generation" msgstr "" @@ -2245,11 +2245,11 @@ msgstr "" msgid "You must put some 'source' URIs in your sources.list" msgstr "" -#: apt-pkg/cachefile.cc:73 +#: apt-pkg/cachefile.cc:74 msgid "The package lists or status file could not be parsed or opened." msgstr "" -#: apt-pkg/cachefile.cc:77 +#: apt-pkg/cachefile.cc:78 msgid "You may want to run apt-get update to correct these problems" msgstr "" -- cgit v1.2.3-70-g09d2 From 614adaa09f9f24dccd9e2e8bb4eb00d17285c92e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Jun 2006 10:03:41 +0200 Subject: * apt-pkg/deb/dpkgpm.cc, apt-pkg/contrib/fileutl.{cc,h}: - move the RunScripts() code into fileutl.{cc,h} * apt-pkg/cachefile.cc: - add support for "APT::Update::{Pre,Post}-Invoke" scripts --- apt-pkg/cachefile.cc | 6 +++++ apt-pkg/contrib/fileutl.cc | 67 +++++++++++++++++++++++++++++++++++++++++++++- apt-pkg/contrib/fileutl.h | 1 + apt-pkg/deb/dpkgpm.cc | 56 ++------------------------------------ po/apt-all.pot | 60 ++++++++++++++++++++--------------------- 5 files changed, 105 insertions(+), 85 deletions(-) diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 96d9672c2..8b8e6dc98 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include /*}}}*/ @@ -123,6 +124,9 @@ bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, pkgSourceList &List) if (List.GetIndexes(&Fetcher) == false) return false; + // Run scripts + RunScripts("APT::Update::Pre-Invoke"); + // Run it if (Fetcher.Run() == pkgAcquire::Failed) return false; @@ -152,6 +156,8 @@ bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, pkgSourceList &List) return false; } + // Run the scripts + RunScripts("APT::Update::Post-Invoke"); return (Failed == false); } diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 9fd71728e..77287952a 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -8,9 +8,12 @@ CopyFile - Buffered copy of a single file GetLock - dpkg compatible lock file manipulation (fcntl) - This source is placed in the Public Domain, do with it what you will + Most of this source is placed in the Public Domain, do with it what + you will It was originally written by Jason Gunthorpe . + The exception is RunScripts() it is under the GPLv2 + ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ @@ -38,6 +41,68 @@ using namespace std; +// RunScripts - Run a set of scripts from a configuration subtree /*{{{*/ +// --------------------------------------------------------------------- +/* */ +bool RunScripts(const char *Cnf) +{ + Configuration::Item const *Opts = _config->Tree(Cnf); + if (Opts == 0 || Opts->Child == 0) + return true; + Opts = Opts->Child; + + // Fork for running the system calls + pid_t Child = ExecFork(); + + // This is the child + if (Child == 0) + { + if (chdir("/tmp/") != 0) + _exit(100); + + unsigned int Count = 1; + for (; Opts != 0; Opts = Opts->Next, Count++) + { + if (Opts->Value.empty() == true) + continue; + + if (system(Opts->Value.c_str()) != 0) + _exit(100+Count); + } + _exit(0); + } + + // Wait for the child + int Status = 0; + while (waitpid(Child,&Status,0) != Child) + { + if (errno == EINTR) + continue; + return _error->Errno("waitpid","Couldn't wait for subprocess"); + } + + // Restore sig int/quit + signal(SIGQUIT,SIG_DFL); + signal(SIGINT,SIG_DFL); + + // Check for an error code. + if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0) + { + unsigned int Count = WEXITSTATUS(Status); + if (Count > 100) + { + Count -= 100; + for (; Opts != 0 && Count != 1; Opts = Opts->Next, Count--); + _error->Error("Problem executing scripts %s '%s'",Cnf,Opts->Value.c_str()); + } + + return _error->Error("Sub-process returned an error code"); + } + + return true; +} + /*}}}*/ + // CopyFile - Buffered copy of a file /*{{{*/ // --------------------------------------------------------------------- /* The caller is expected to set things so that failure causes erasure */ diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 041aa3309..363dd041d 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -80,6 +80,7 @@ class FileFd virtual ~FileFd(); }; +bool RunScripts(const char *Cnf); bool CopyFile(FileFd &From,FileFd &To); int GetLock(string File,bool Errors = true); bool FileExists(string File); diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 667db8ff2..fe13614c5 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -93,60 +94,7 @@ bool pkgDPkgPM::Remove(PkgIterator Pkg,bool Purge) each one is run with system from a forked child. */ bool pkgDPkgPM::RunScripts(const char *Cnf) { - Configuration::Item const *Opts = _config->Tree(Cnf); - if (Opts == 0 || Opts->Child == 0) - return true; - Opts = Opts->Child; - - // Fork for running the system calls - pid_t Child = ExecFork(); - - // This is the child - if (Child == 0) - { - if (chdir("/tmp/") != 0) - _exit(100); - - unsigned int Count = 1; - for (; Opts != 0; Opts = Opts->Next, Count++) - { - if (Opts->Value.empty() == true) - continue; - - if (system(Opts->Value.c_str()) != 0) - _exit(100+Count); - } - _exit(0); - } - - // Wait for the child - int Status = 0; - while (waitpid(Child,&Status,0) != Child) - { - if (errno == EINTR) - continue; - return _error->Errno("waitpid","Couldn't wait for subprocess"); - } - - // Restore sig int/quit - signal(SIGQUIT,SIG_DFL); - signal(SIGINT,SIG_DFL); - - // Check for an error code. - if (WIFEXITED(Status) == 0 || WEXITSTATUS(Status) != 0) - { - unsigned int Count = WEXITSTATUS(Status); - if (Count > 100) - { - Count -= 100; - for (; Opts != 0 && Count != 1; Opts = Opts->Next, Count--); - _error->Error("Problem executing scripts %s '%s'",Cnf,Opts->Value.c_str()); - } - - return _error->Error("Sub-process returned an error code"); - } - - return true; + RunScripts(Cnf); } /*}}}*/ // DPkgPM::SendV2Pkgs - Send version 2 package info /*{{{*/ diff --git a/po/apt-all.pot b/po/apt-all.pot index 5b84c3768..0b647873f 100644 --- a/po/apt-all.pot +++ b/po/apt-all.pot @@ -699,7 +699,7 @@ msgid "Unable to lock the download directory" msgstr "" #: cmdline/apt-get.cc:801 cmdline/apt-get.cc:1856 cmdline/apt-get.cc:2092 -#: apt-pkg/cachefile.cc:68 +#: apt-pkg/cachefile.cc:69 msgid "The list of sources could not be read." msgstr "" @@ -761,7 +761,7 @@ msgstr "" msgid "Do you want to continue [Y/n]? " msgstr "" -#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1989 apt-pkg/cachefile.cc:138 +#: cmdline/apt-get.cc:961 cmdline/apt-get.cc:1989 apt-pkg/cachefile.cc:142 #, c-format msgid "Failed to fetch %s %s\n" msgstr "" @@ -1544,7 +1544,7 @@ msgstr "" msgid "Server closed the connection" msgstr "" -#: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:471 methods/rsh.cc:190 +#: methods/ftp.cc:338 apt-pkg/contrib/fileutl.cc:536 methods/rsh.cc:190 msgid "Read error" msgstr "" @@ -1556,7 +1556,7 @@ msgstr "" msgid "Protocol corruption" msgstr "" -#: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:510 methods/rsh.cc:232 +#: methods/ftp.cc:446 apt-pkg/contrib/fileutl.cc:575 methods/rsh.cc:232 msgid "Write error" msgstr "" @@ -1953,70 +1953,70 @@ msgstr "" msgid "Failed to stat the cdrom" msgstr "" -#: apt-pkg/contrib/fileutl.cc:82 +#: apt-pkg/contrib/fileutl.cc:147 #, c-format msgid "Not using locking for read only lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:87 +#: apt-pkg/contrib/fileutl.cc:152 #, c-format msgid "Could not open lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:105 +#: apt-pkg/contrib/fileutl.cc:170 #, c-format msgid "Not using locking for nfs mounted lock file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:109 +#: apt-pkg/contrib/fileutl.cc:174 #, c-format msgid "Could not get lock %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:377 +#: apt-pkg/contrib/fileutl.cc:442 #, c-format msgid "Waited for %s but it wasn't there" msgstr "" -#: apt-pkg/contrib/fileutl.cc:387 +#: apt-pkg/contrib/fileutl.cc:452 #, c-format msgid "Sub-process %s received a segmentation fault." msgstr "" -#: apt-pkg/contrib/fileutl.cc:390 +#: apt-pkg/contrib/fileutl.cc:455 #, c-format msgid "Sub-process %s returned an error code (%u)" msgstr "" -#: apt-pkg/contrib/fileutl.cc:392 +#: apt-pkg/contrib/fileutl.cc:457 #, c-format msgid "Sub-process %s exited unexpectedly" msgstr "" -#: apt-pkg/contrib/fileutl.cc:436 +#: apt-pkg/contrib/fileutl.cc:501 #, c-format msgid "Could not open file %s" msgstr "" -#: apt-pkg/contrib/fileutl.cc:492 +#: apt-pkg/contrib/fileutl.cc:557 #, c-format msgid "read, still have %lu to read but none left" msgstr "" -#: apt-pkg/contrib/fileutl.cc:522 +#: apt-pkg/contrib/fileutl.cc:587 #, c-format msgid "write, still have %lu to write but couldn't" msgstr "" -#: apt-pkg/contrib/fileutl.cc:597 +#: apt-pkg/contrib/fileutl.cc:662 msgid "Problem closing the file" msgstr "" -#: apt-pkg/contrib/fileutl.cc:603 +#: apt-pkg/contrib/fileutl.cc:668 msgid "Problem unlinking the file" msgstr "" -#: apt-pkg/contrib/fileutl.cc:614 +#: apt-pkg/contrib/fileutl.cc:679 msgid "Problem syncing the file" msgstr "" @@ -2245,11 +2245,11 @@ msgstr "" msgid "You must put some 'source' URIs in your sources.list" msgstr "" -#: apt-pkg/cachefile.cc:74 +#: apt-pkg/cachefile.cc:75 msgid "The package lists or status file could not be parsed or opened." msgstr "" -#: apt-pkg/cachefile.cc:78 +#: apt-pkg/cachefile.cc:79 msgid "You may want to run apt-get update to correct these problems" msgstr "" @@ -2477,52 +2477,52 @@ msgstr "" msgid "Wrote %i records with %i missing files and %i mismatched files\n" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:358 +#: apt-pkg/deb/dpkgpm.cc:306 #, c-format msgid "Preparing %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:359 +#: apt-pkg/deb/dpkgpm.cc:307 #, c-format msgid "Unpacking %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:364 +#: apt-pkg/deb/dpkgpm.cc:312 #, c-format msgid "Preparing to configure %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:365 +#: apt-pkg/deb/dpkgpm.cc:313 #, c-format msgid "Configuring %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:366 +#: apt-pkg/deb/dpkgpm.cc:314 #, c-format msgid "Installed %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:371 +#: apt-pkg/deb/dpkgpm.cc:319 #, c-format msgid "Preparing for removal of %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:372 +#: apt-pkg/deb/dpkgpm.cc:320 #, c-format msgid "Removing %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:373 +#: apt-pkg/deb/dpkgpm.cc:321 #, c-format msgid "Removed %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:378 +#: apt-pkg/deb/dpkgpm.cc:326 #, c-format msgid "Preparing to completely remove %s" msgstr "" -#: apt-pkg/deb/dpkgpm.cc:379 +#: apt-pkg/deb/dpkgpm.cc:327 #, c-format msgid "Completely removed %s" msgstr "" -- cgit v1.2.3-70-g09d2 From f8477782df203e1998a8704e71a1a3cc699e9e3a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 7 Jun 2006 10:06:45 +0200 Subject: * doc/examples/configure-index: - document the new features * apt-pkg/init.h, apt-pkg/makefile, methods/makefile: - we break the ABI, record this --- apt-pkg/init.h | 2 +- apt-pkg/makefile | 2 +- doc/examples/configure-index | 6 ++++++ methods/makefile | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apt-pkg/init.h b/apt-pkg/init.h index 8255b406a..b584b2cce 100644 --- a/apt-pkg/init.h +++ b/apt-pkg/init.h @@ -18,7 +18,7 @@ // See the makefile #define APT_PKG_MAJOR 3 -#define APT_PKG_MINOR 11 +#define APT_PKG_MINOR 12 #define APT_PKG_RELEASE 0 extern const char *pkgVersion; diff --git a/apt-pkg/makefile b/apt-pkg/makefile index 0e6aecc65..ab0ff8005 100644 --- a/apt-pkg/makefile +++ b/apt-pkg/makefile @@ -13,7 +13,7 @@ include ../buildlib/defaults.mak # methods/makefile - FIXME LIBRARY=apt-pkg LIBEXT=$(GLIBC_VER)$(LIBSTDCPP_VER) -MAJOR=3.11 +MAJOR=3.12 MINOR=0 SLIBS=$(PTHREADLIB) $(INTLLIBS) APT_DOMAIN:=libapt-pkg$(MAJOR) diff --git a/doc/examples/configure-index b/doc/examples/configure-index index b87e85030..c5e8ba701 100644 --- a/doc/examples/configure-index +++ b/doc/examples/configure-index @@ -72,6 +72,12 @@ APT NoAct "false"; }; + Update + { + Pre-Invoke {"touch /var/lib/apt/pre-update-stamp"; }; + Post-Invoke {"touch /var/lib/apt/post-update-stamp"; }; + }; + Authentication { TrustCDROM "false"; // consider the CDROM always trusted diff --git a/methods/makefile b/methods/makefile index 1e3b1ef85..3f561a2c3 100644 --- a/methods/makefile +++ b/methods/makefile @@ -7,7 +7,7 @@ include ../buildlib/defaults.mak BIN := $(BIN)/methods # FIXME.. -LIB_APT_PKG_MAJOR = 3.11 +LIB_APT_PKG_MAJOR = 3.12 APT_DOMAIN := libapt-pkg$(LIB_APT_PKG_MAJOR) # The file method -- cgit v1.2.3-70-g09d2 From aff87a762f86ed47f2b81ccbac23faa5d9fddcdb Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 17 Dec 2007 20:49:50 +0100 Subject: apt-pkg/deb/dpkgpm.cc: fix types --- apt-pkg/deb/dpkgpm.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index d796146fa..11bf827d7 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -342,8 +342,8 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) */ void pkgDPkgPM::DoStdin(int master) { - char input_buf[256] = {0,}; - int len = read(0, input_buf, sizeof(input_buf)); + unsigned char input_buf[256] = {0,}; + ssize_t len = read(0, input_buf, sizeof(input_buf)); if (len) write(master, input_buf, len); else @@ -357,9 +357,9 @@ void pkgDPkgPM::DoStdin(int master) */ void pkgDPkgPM::DoTerminalPty(int master) { - char term_buf[1024] = {0,}; + unsigned char term_buf[1024] = {0,0, }; - int len=read(master, term_buf, sizeof(term_buf)); + ssize_t len=read(master, term_buf, sizeof(term_buf)); if(len == -1 && errno == EIO) { // this happens when the child is about to exit, we -- cgit v1.2.3-70-g09d2 From 9c9d7a81217873c1c0dc453cac4b66850084f522 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Jan 2008 09:55:53 +0100 Subject: * debian/control: - build against libdb-dev (instead of libdb4.4-dev) --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 742e8ca5c..2e9e306c8 100644 --- a/debian/control +++ b/debian/control @@ -4,7 +4,7 @@ Priority: important Maintainer: APT Development Team Uploaders: Jason Gunthorpe , Adam Heath , Matt Zimmerman , Michael Vogt , Otavio Salvador Standards-Version: 3.7.2.2 -Build-Depends: debhelper (>= 5.0), libdb4.4-dev, gettext (>= 0.12), libcurl4-gnutls-dev | libcurl3-gnutls-dev (>= 7.15.5) +Build-Depends: debhelper (>= 5.0), libdb-dev, gettext (>= 0.12), libcurl4-gnutls-dev | libcurl3-gnutls-dev (>= 7.15.5) Build-Depends-Indep: debiandoc-sgml, docbook-utils (>= 0.6.12-1) XS-Vcs-Bzr: http://bzr.debian.org/apt/debian-sid/ -- cgit v1.2.3-70-g09d2 From 3a6d37fdcfbdb152eb00371ff69b8871c9a02527 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Jan 2008 11:25:58 +0100 Subject: * apt-pkg/packagemanager.{cc,h}: - propergate the Immediate flag to make hitting the "E: Internal Error, Could not perform immediate configuration (2)" harder --- apt-pkg/packagemanager.cc | 53 ++++++++++++++++++++++++++++++++++++----------- apt-pkg/packagemanager.h | 1 + debian/changelog | 4 ++++ 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index d6172c6c4..c391a6036 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -118,6 +118,41 @@ bool pkgPackageManager::FixMissing() } /*}}}*/ +// PM::ImmediateAdd - Add the immediate flag recursivly /*{{{*/ +// --------------------------------------------------------------------- +/* This adds the immediate flag to the pkg and recursively to the + dependendies + */ +void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer) +{ + DepIterator D; + + if(UseInstallVer) + { + if(Cache[I].InstallVer == 0) + return; + D = Cache[I].InstVerIter(Cache).DependsList(); + } else { + if (I->CurrentVer == 0) + return; + D = I.CurrentVer().DependsList(); + } + + for ( /* nothing */ ; D.end() == false; D++) + if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) + { + if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate)) + { + if(Debug) + clog << "ImmediateAdd(): Adding Immediate flag to " << I.Name() << endl; + List->Flag(D.TargetPkg(),pkgOrderList::Immediate); + ImmediateAdd(D.TargetPkg(), UseInstallVer); + } + } + return; +} + /*}}}*/ + // PM::CreateOrderList - Create the ordering class /*{{{*/ // --------------------------------------------------------------------- /* This populates the ordering list with all the packages that are @@ -144,21 +179,15 @@ bool pkgPackageManager::CreateOrderList() (I->Flags & pkgCache::Flag::Important) == pkgCache::Flag::Important) && NoImmConfigure == false) { + if(Debug) + clog << "CreateOrderList(): Adding Immediate flag for " << I.Name() << endl; List->Flag(I,pkgOrderList::Immediate); - - // Look for other packages to make immediate configurea - if (Cache[I].InstallVer != 0) - for (DepIterator D = Cache[I].InstVerIter(Cache).DependsList(); - D.end() == false; D++) - if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) - List->Flag(D.TargetPkg(),pkgOrderList::Immediate); + + // Look for other install packages to make immediate configurea + ImmediateAdd(I, true); // And again with the current version. - if (I->CurrentVer != 0) - for (DepIterator D = I.CurrentVer().DependsList(); - D.end() == false; D++) - if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) - List->Flag(D.TargetPkg(),pkgOrderList::Immediate); + ImmediateAdd(I, false); } // Not interesting diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index 53cd4c96f..a1bfdc52d 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -49,6 +49,7 @@ class pkgPackageManager : protected pkgCache::Namespace bool Debug; bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0); + void ImmediateAdd(PkgIterator P, bool UseInstallVer); virtual OrderResult OrderInstall(); bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver); bool CreateOrderList(); diff --git a/debian/changelog b/debian/changelog index ef9784178..4f22e9d92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -43,6 +43,10 @@ apt (0.7.10) UNRELEASED; urgency=low * apt-pkg/acquire-item.{cc,h}: - make the authentication download code more robust against servers/proxies with broken If-Range implementations + * apt-pkg/packagemanager.{cc,h}: + - propergate the Immediate flag to make hitting the + "E: Internal Error, Could not perform immediate configuration (2)" + harder [ Chris Cheney ] * ftparchive/contents.cc: -- cgit v1.2.3-70-g09d2 From 110277098f846c98cbb1f155fe7d53ecca64cc1a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 3 Jan 2008 13:46:54 +0100 Subject: add missing changelog entry --- debian/changelog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/debian/changelog b/debian/changelog index 4f22e9d92..52625ee2d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,6 +47,8 @@ apt (0.7.10) UNRELEASED; urgency=low - propergate the Immediate flag to make hitting the "E: Internal Error, Could not perform immediate configuration (2)" harder + * debian/control: + - build against libdb-dev (instead of libdb4.4-dev) [ Chris Cheney ] * ftparchive/contents.cc: -- cgit v1.2.3-70-g09d2 From dabe757a0a6d91e07ba30e3d580e49fe56eb4737 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 4 Jan 2008 21:45:54 +0100 Subject: support optional PulseInterval in ListUpdate --- apt-pkg/cachefile.cc | 14 +++++++++++--- apt-pkg/cachefile.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 4c2c56893..22eac2f60 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -114,8 +114,11 @@ bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock) /* This is a simple wrapper to update the cache. it will fetch stuff * from the network (or any other sources defined in sources.list) */ -bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, pkgSourceList &List) +bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, + pkgSourceList &List, + int PulseInterval) { + pkgAcquire::RunResult res; pkgAcquire Fetcher(&Stat); // Populate it with the source selection @@ -125,8 +128,13 @@ bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, pkgSourceList &List) // Run scripts RunScripts("APT::Update::Pre-Invoke"); - // Run it - if (Fetcher.Run() == pkgAcquire::Failed) + // check arguments + if(PulseInterval>0) + res = Fetcher.Run(PulseInterval); + else + res = Fetcher.Run(); + + if (res == pkgAcquire::Failed) return false; bool Failed = false; diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index 02c6188a7..8408af996 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -47,7 +47,7 @@ class pkgCacheFile bool BuildCaches(OpProgress &Progress,bool WithLock = true); bool Open(OpProgress &Progress,bool WithLock = true); - bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List); + bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List, int PulseInterval=0); void Close(); pkgCacheFile(); -- cgit v1.2.3-70-g09d2 From 760d4968005c97f0d5fd6403633f367aac89c763 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Jan 2008 16:47:40 +0100 Subject: * move the ListUpdate() code from cachefile.h into algorithms.{cc,h} as it does not require a cachefile at all --- apt-pkg/algorithms.cc | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++- apt-pkg/algorithms.h | 3 ++ apt-pkg/cachefile.cc | 74 ------------------------------------------------- apt-pkg/cachefile.h | 1 - cmdline/apt-get.cc | 2 +- debian/changelog | 2 +- 6 files changed, 80 insertions(+), 78 deletions(-) diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 158f9c258..6e2b97557 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -19,7 +19,7 @@ #include #include #include - +#include #include #include @@ -1302,3 +1302,77 @@ void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List) } /*}}}*/ +// CacheFile::ListUpdate - update the cache files /*{{{*/ +// --------------------------------------------------------------------- +/* This is a simple wrapper to update the cache. it will fetch stuff + * from the network (or any other sources defined in sources.list) + */ +bool ListUpdate(pkgAcquireStatus &Stat, + pkgSourceList &List, + int PulseInterval) +{ + pkgAcquire::RunResult res; + pkgAcquire Fetcher(&Stat); + + // Populate it with the source selection + if (List.GetIndexes(&Fetcher) == false) + return false; + + // Run scripts + RunScripts("APT::Update::Pre-Invoke"); + + // check arguments + if(PulseInterval>0) + res = Fetcher.Run(PulseInterval); + else + res = Fetcher.Run(); + + if (res == pkgAcquire::Failed) + 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(); + + _error->Warning(_("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 + // Keep "APT::Get::List-Cleanup" name for compatibility, but + // this is really a global option for the APT library now + if (!TransientNetworkFailure && !Failed && + (_config->FindB("APT::Get::List-Cleanup",true) == true || + _config->FindB("APT::List-Cleanup",true) == true)) + { + if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || + Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) + // something went wrong with the clean + return false; + } + + 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.")); + + + // Run the scripts if all was fine + RunScripts("APT::Update::Post-Invoke"); + return true; +} + /*}}}*/ diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index b72874d8e..defaed57d 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -33,6 +33,7 @@ #include #include +#include #include @@ -130,5 +131,7 @@ bool pkgAllUpgrade(pkgDepCache &Cache); bool pkgMinimizeUpgrade(pkgDepCache &Cache); void pkgPrioSortList(pkgCache &Cache,pkgCache::Version **List); + +bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List, int PulseInterval=0); #endif diff --git a/apt-pkg/cachefile.cc b/apt-pkg/cachefile.cc index 22eac2f60..1a84aea54 100644 --- a/apt-pkg/cachefile.cc +++ b/apt-pkg/cachefile.cc @@ -109,80 +109,6 @@ bool pkgCacheFile::Open(OpProgress &Progress,bool WithLock) } /*}}}*/ -// CacheFile::ListUpdate - update the cache files /*{{{*/ -// --------------------------------------------------------------------- -/* This is a simple wrapper to update the cache. it will fetch stuff - * from the network (or any other sources defined in sources.list) - */ -bool pkgCacheFile::ListUpdate(pkgAcquireStatus &Stat, - pkgSourceList &List, - int PulseInterval) -{ - pkgAcquire::RunResult res; - pkgAcquire Fetcher(&Stat); - - // Populate it with the source selection - if (List.GetIndexes(&Fetcher) == false) - return false; - - // Run scripts - RunScripts("APT::Update::Pre-Invoke"); - - // check arguments - if(PulseInterval>0) - res = Fetcher.Run(PulseInterval); - else - res = Fetcher.Run(); - - if (res == pkgAcquire::Failed) - 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 - // Keep "APT::Get::List-Cleanup" name for compatibility, but - // this is really a global option for the APT library now - if (!TransientNetworkFailure && !Failed && - (_config->FindB("APT::Get::List-Cleanup",true) == true || - _config->FindB("APT::List-Cleanup",true) == true)) - { - if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || - Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) - // something went wrong with the clean - return false; - } - - 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.")); - - - // Run the scripts if all was fine - RunScripts("APT::Update::Post-Invoke"); - return true; -} - /*}}}*/ // CacheFile::Close - close the cache files /*{{{*/ // --------------------------------------------------------------------- diff --git a/apt-pkg/cachefile.h b/apt-pkg/cachefile.h index 8408af996..3b057951c 100644 --- a/apt-pkg/cachefile.h +++ b/apt-pkg/cachefile.h @@ -47,7 +47,6 @@ class pkgCacheFile bool BuildCaches(OpProgress &Progress,bool WithLock = true); bool Open(OpProgress &Progress,bool WithLock = true); - bool ListUpdate(pkgAcquireStatus &progress, pkgSourceList &List, int PulseInterval=0); void Close(); pkgCacheFile(); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5f46dd605..258133c19 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1374,7 +1374,7 @@ bool DoUpdate(CommandLine &CmdL) // do the work CacheFile Cache; - bool res = Cache.ListUpdate(Stat, List); + bool res = ListUpdate(Stat, List); // Rebuild the cache. if (Cache.BuildCaches() == false) diff --git a/debian/changelog b/debian/changelog index ee5384c42..9f78d5916 100644 --- a/debian/changelog +++ b/debian/changelog @@ -50,7 +50,7 @@ apt (0.7.10) UNRELEASED; urgency=low * debian/control: - build against libdb-dev (instead of libdb4.4-dev) * merged the apt--DoListUpdate branch, this provides a common interface - for apt-get update like operations for the frontends and also provides + for "apt-get update" like operations for the frontends and also provides hooks to run stuff in APT::Update::{Pre,Post}-Invoke [ Chris Cheney ] -- cgit v1.2.3-70-g09d2 From f0983ff2091df782027a2e344cbd9e3df43c1450 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 7 Jan 2008 18:45:30 +0100 Subject: * apt-pkg/acquire-worker.cc, methods/connect.cc: - consider a ResolveError a transient-network problem --- apt-pkg/acquire-worker.cc | 1 + methods/connect.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 739c9e32c..1a754dae9 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -325,6 +325,7 @@ bool pkgAcquire::Worker::RunMessages() // set some status if(LookupTag(Message,"FailReason") == "Timeout" || LookupTag(Message,"FailReason") == "TmpResolveFailure" || + LookupTag(Message,"FailReason") == "ResolveFailure" || LookupTag(Message,"FailReason") == "ConnectionRefused") Owner->Status = pkgAcquire::Item::StatTransientNetworkError; diff --git a/methods/connect.cc b/methods/connect.cc index 8c2ac6d56..aef7db389 100644 --- a/methods/connect.cc +++ b/methods/connect.cc @@ -164,6 +164,7 @@ bool Connect(string Host,int Port,const char *Service,int DefPort,int &Fd, DefPort = 0; continue; } + Owner->SetFailExtraMsg("\nFailReason: ResolveFailure"); return _error->Error(_("Could not resolve '%s'"),Host.c_str()); } -- cgit v1.2.3-70-g09d2