summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-06-07 09:52:46 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-06-07 09:52:46 +0200
commit89b70b5a5c80b15d928b6593604bacc02a1b9a51 (patch)
treeabdfe8b4ac425748ac44cda8e675ca5496042082
parentd4c5f11f8ef619ec56ae1e532416bb3817442b1c (diff)
* apt-pkg/cachefile, cmdline/apt-get.cc:
- move the code that does the work from apt-get.cc to pkgCacheFile::ListUpdate()
-rw-r--r--apt-pkg/cachefile.cc46
-rw-r--r--apt-pkg/cachefile.h3
-rw-r--r--cmdline/apt-get.cc45
-rw-r--r--po/apt-all.pot110
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 <apt-pkg/configuration.h>
#include <apt-pkg/policy.h>
#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/acquire-item.h>
#include <apti18n.h>
/*}}}*/
@@ -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 <apt-pkg/depcache.h>
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/sourcelist.h>
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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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 ""