summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/pkgcache.cc15
-rw-r--r--debian/changelog4
-rwxr-xr-xtest/integration/test-bug-601016-description-translation91
3 files changed, 102 insertions, 8 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 324445fa7..616d400a2 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -891,18 +891,19 @@ pkgCache::DescIterator pkgCache::VerIterator::TranslatedDescription() const
for (std::vector<string>::const_iterator l = lang.begin();
l != lang.end(); l++)
{
- pkgCache::DescIterator DescDefault = DescriptionList();
- pkgCache::DescIterator Desc = DescDefault;
-
- for (; Desc.end() == false; Desc++)
+ pkgCache::DescIterator Desc = DescriptionList();
+ for (; Desc.end() == false; ++Desc)
if (*l == Desc.LanguageCode() ||
(*l == "en" && strcmp(Desc.LanguageCode(),"") == 0))
break;
- if (Desc.end() == true)
- Desc = DescDefault;
+ if (Desc.end() == true)
+ continue;
return Desc;
}
-
+ for (pkgCache::DescIterator Desc = DescriptionList();
+ Desc.end() == false; ++Desc)
+ if (strcmp(Desc.LanguageCode(), "") == 0)
+ return Desc;
return DescriptionList();
};
diff --git a/debian/changelog b/debian/changelog
index eb716b904..8ca3e164a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,8 +7,10 @@ apt (0.8.8) UNRELEASED; urgency=low
does - the sizes can differ since the direct gzip integration
* methods/{gzip,bzip2}.cc:
- use FileSize() to determine if the file is invalid (Closes: #600852)
+ * apt-pkg/pkgcache.cc:
+ - fallback always to a suitable description (Closes: #601016)
- -- David Kalnischkies <kalnischkies@gmail.com> Thu, 21 Oct 2010 16:53:10 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com> Tue, 26 Oct 2010 23:23:01 +0200
apt (0.8.7) unstable; urgency=low
diff --git a/test/integration/test-bug-601016-description-translation b/test/integration/test-bug-601016-description-translation
new file mode 100755
index 000000000..a31e42ee1
--- /dev/null
+++ b/test/integration/test-bug-601016-description-translation
@@ -0,0 +1,91 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture "i386"
+
+# we need a valid locale here, otherwise the language configuration
+# will be overridden by LC_ALL=C
+LOCALE="$(echo "$LANG" | cut -d'_' -f 1)"
+
+PACKAGESTANZA="Package: apt
+Priority: important
+Section: admin
+Installed-Size: 5984
+Maintainer: APT Development Team <deity@lists.debian.org>
+Architecture: i386
+Version: 0.8.7
+Filename: pool/main/a/apt/apt_0.8.7_i386.deb
+Size: 2140230
+MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08
+Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c"
+
+
+echo "$PACKAGESTANZA
+Description: Advanced front-end for dpkg" > aptarchive/Packages
+
+echo "Package: apt
+Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c
+Description-${LOCALE}: Mächtige Oberfläche für dpkg
+ Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
+ auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
+ APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
+ um Pakete zu installieren und Upgrades durchzuführen." | bzip2 > aptarchive/${LOCALE}.bz2
+
+# the $LOCALE translation file will not be included as it is a flat archive it came from and therefore
+# its name can not be guessed correctly… (in non-flat archives the files are called Translation-*)
+echo 'APT::Cache::Generate "false";' > rootdir/etc/apt/apt.conf.d/00nogenerate
+
+NOLONGSTANZA="$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+"
+
+ENGLISHSTANZA="$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+"
+
+LOCALESTANZA="$PACKAGESTANZA
+Description-${LOCALE}: Mächtige Oberfläche für dpkg
+ Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
+ auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
+ APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
+ um Pakete zu installieren und Upgrades durchzuführen.
+"
+
+testrun() {
+ echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
+ export LC_ALL=""
+ setupaptarchive
+ testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE}
+ testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE}
+ testequal "$LOCALESTANZA" aptcache show apt -o Acquire::Languages::="ww" -o Test=File-${LOCALE}
+ LC_ALL=C testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-${LOCALE}
+ export LC_ALL=""
+ echo "Acquire::Languages { \"ww\"; \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
+ testequal "$LOCALESTANZA" aptcache show apt -o Test=File-ww-${LOCALE}
+ echo "Acquire::Languages { \"ww\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
+ testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-ww
+}
+
+testrun
+
+echo "$PACKAGESTANZA
+Description: Advanced front-end for dpkg" > aptarchive/Packages
+
+echo "Package: apt
+Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c
+Description-en: Advanced front-end for dpkg
+ This is Debian's next generation front-end for the dpkg package manager.
+ It provides the apt-get utility and APT dselect method that provides a
+ simpler, safer way to install and upgrade packages." | bzip2 > aptarchive/en.bz2
+
+ENGLISHSTANZA="$PACKAGESTANZA
+Description-en: Advanced front-end for dpkg
+ This is Debian's next generation front-end for the dpkg package manager.
+ It provides the apt-get utility and APT dselect method that provides a
+ simpler, safer way to install and upgrade packages.
+"
+
+testrun