summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2010-10-15 17:59:12 +0200
committerMichael Vogt <mvo@debian.org>2010-10-15 17:59:12 +0200
commit0750e90da1a52d90b50aad1bf7252e787a5b4a42 (patch)
tree4af79f0dcf8cf2fb6c184fc4379e95419fbd4533
parent5a66868c039f3ca0307816d52d393eb9c6f6d682 (diff)
parent915f0520645f68dda1aea1ddfd7e7a413e1f3e09 (diff)
merged from lp:~pitti/apt/compressed-indexes
-rw-r--r--apt-pkg/deb/debindexfile.cc44
-rwxr-xr-xtest/test-indexes.sh8
2 files changed, 43 insertions, 9 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index a89a2574f..af1209ccb 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -149,11 +149,20 @@ bool debSourcesIndex::Exists() const
/* */
unsigned long debSourcesIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile("Sources"), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
- return f.Size();
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
+
+ return size;
}
/*}}}*/
@@ -269,11 +278,20 @@ bool debPackagesIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debPackagesIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile("Packages"), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
- return f.Size();
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
+
+ return size;
}
/*}}}*/
// PackagesIndex::Merge - Load the index file into a cache /*{{{*/
@@ -460,12 +478,20 @@ bool debTranslationsIndex::Exists() const
/* This is really only used for progress reporting. */
unsigned long debTranslationsIndex::Size() const
{
+ unsigned long size = 0;
+
+ /* we need to ignore errors here; if the lists are absent, just return 0 */
+ _error->PushToStack();
+
FileFd f = FileFd (IndexFile(Language), FileFd::ReadOnlyGzip);
+ if (!f.Failed())
+ size = f.Size();
- if (f.Failed())
- return 0;
+ if (_error->PendingError() == true)
+ size = 0;
+ _error->RevertToStack();
- return f.Size();
+ return size;
}
/*}}}*/
// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/
diff --git a/test/test-indexes.sh b/test/test-indexes.sh
index dad3e1fb2..17363718d 100755
--- a/test/test-indexes.sh
+++ b/test/test-indexes.sh
@@ -135,6 +135,14 @@ echo "deb-src $TEST_SOURCE" >> etc/apt/sources.list
echo "RootDir \"$WORKDIR\";" > apt_config
export APT_CONFIG=`pwd`/apt_config
+echo "==== no indexes ===="
+echo '--- apt-get check works without indexes'
+[ -z `$APT_GET check` ]
+echo '--- apt-cache policy works without indexes'
+$APT_CACHE policy bash >/dev/null
+echo '--- apt-cache show works without indexes'
+! LC_MESSAGES=C $APT_CACHE show bash 2>&1| grep -q 'E: No packages found'
+
echo "===== uncompressed indexes ====="
check_update
check_indexes