summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/cachefilter-patterns.cc2
-rw-r--r--apt-pkg/deb/debindexfile.cc2
-rw-r--r--cmdline/apt-helper.cc32
-rw-r--r--po/ru.po61
-rwxr-xr-xtest/integration/test-apt-get-install-deb4
-rwxr-xr-xtest/integration/test-apt-patterns25
6 files changed, 91 insertions, 35 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc
index 5a58a9767..bc0eece30 100644
--- a/apt-pkg/cachefilter-patterns.cc
+++ b/apt-pkg/cachefilter-patterns.cc
@@ -501,7 +501,7 @@ BaseRegexMatcher::BaseRegexMatcher(std::string const &Pattern)
}
bool BaseRegexMatcher::operator()(const char *string)
{
- if (unlikely(pattern == NULL))
+ if (unlikely(pattern == nullptr) || string == nullptr)
return false;
else
return regexec(pattern, string, 0, 0, 0) == 0;
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 43317d314..e1698e151 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -189,7 +189,7 @@ bool debDebPkgFileIndex::GetContent(std::ostream &content, std::string const &de
while (isspace_ascii(Control[0]))
Control++;
- content << Control;
+ content << Control << '\n';
content << "Filename: " << debfile << "\n";
content << "Size: " << std::to_string(Buf.st_size) << "\n";
diff --git a/cmdline/apt-helper.cc b/cmdline/apt-helper.cc
index 97a4342f5..3d6a692e0 100644
--- a/cmdline/apt-helper.cc
+++ b/cmdline/apt-helper.cc
@@ -10,6 +10,7 @@
#include <apt-pkg/acquire-item.h>
#include <apt-pkg/acquire.h>
#include <apt-pkg/cmndline.h>
+#include <apt-pkg/cachefilter-patterns.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
@@ -257,6 +258,35 @@ static bool DropPrivsAndRun(CommandLine &CmdL) /*{{{*/
return ExecWait(pid, CmdL.FileList[1]);
}
/*}}}*/
+static bool AnalyzePattern(CommandLine &CmdL) /*{{{*/
+{
+ if (CmdL.FileSize() != 2)
+ return _error->Error("Expect one argument, a pattern");
+
+ try
+ {
+ auto top = APT::Internal::PatternTreeParser(CmdL.FileList[1]).parseTop();
+ top->render(std::cout) << "\n";
+ }
+ catch (APT::Internal::PatternTreeParser::Error &e)
+ {
+ std::stringstream ss;
+ ss << "input:" << e.location.start << "-" << e.location.end << ": error: " << e.message << "\n";
+ ss << CmdL.FileList[1] << "\n";
+ for (size_t i = 0; i < e.location.start; i++)
+ ss << " ";
+ for (size_t i = e.location.start; i < e.location.end; i++)
+ ss << "^";
+
+ ss << "\n";
+
+ _error->Error("%s", ss.str().c_str());
+ return false;
+ }
+
+ return true;
+}
+ /*}}}*/
static bool ShowHelp(CommandLine &) /*{{{*/
{
std::cout <<
@@ -278,6 +308,8 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{"auto-detect-proxy", &DoAutoDetectProxy, _("detect proxy using apt.conf")},
{"wait-online", &DoWaitOnline, _("wait for system to be online")},
{"drop-privs", &DropPrivsAndRun, _("drop privileges before running given command")},
+ {"analyze-pattern", &AnalyzePattern, _("analyse a pattern")},
+ {"analyse-pattern", &AnalyzePattern, nullptr},
{nullptr, nullptr, nullptr}};
}
/*}}}*/
diff --git a/po/ru.po b/po/ru.po
index 927f78aa2..b160d0f35 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -9,22 +9,23 @@
# Yuri Kozlov <kozlov.y@gmail.com>, 2004, 2005, 2006, 2007, 2008.
# Yuri Kozlov <yuray@komyakino.ru>, 2009, 2010, 2012, 2015, 2016.
# Lev Lamberov <dogsleg@debian.org>, 2018.
-# Aleksej Shilin <rootlexx@mail.ru>, 2017, 2018, 2019.
+# Алексей Шилин <rootlexx@mail.ru>, 2017-2020.
+#
msgid ""
msgstr ""
-"Project-Id-Version: apt 1.8.0\n"
+"Project-Id-Version: apt 2.0.0\n"
"Report-Msgid-Bugs-To: APT Development Team <deity@lists.debian.org>\n"
-"POT-Creation-Date: 2020-03-07 21:20+0100\n"
-"PO-Revision-Date: 2019-02-10 11:50+0300\n"
-"Last-Translator: Aleksej Shilin <rootlexx@mail.ru>\n"
-"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n"
+"POT-Creation-Date: 2020-03-21 08:10+0100\n"
+"PO-Revision-Date: 2020-03-09 22:43+0300\n"
+"Last-Translator: Алексей Шилин <rootlexx@mail.ru>\n"
+"Language-Team: русский <debian-l10n-russian@lists.debian.org>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Generator: Poedit 1.8.11\n"
+"X-Generator: Gtranslator 3.30.1\n"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
-"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"
+"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n"
#: apt-pkg/acquire-item.cc
msgid ""
@@ -736,26 +737,28 @@ msgstr ""
"системе nfs"
#: apt-pkg/contrib/fileutl.cc
-#, fuzzy, c-format
-#| msgid "Could not get lock %s"
+#, c-format
msgid "Could not get lock %s. It is held by process %d"
-msgstr "Не удалось получить файл блокировки %s"
+msgstr "Не удалось получить блокировку файла %s. Она удерживается процессом %d"
#: apt-pkg/contrib/fileutl.cc
#, c-format
msgid "Could not get lock %s. It is held by process %d (%s)"
msgstr ""
+"Не удалось получить блокировку файла %s. Она удерживается процессом %d (%s)"
#: apt-pkg/contrib/fileutl.cc
#, c-format
msgid "Could not get lock %s"
-msgstr "Не удалось получить файл блокировки %s"
+msgstr "Не удалось получить блокировку файла %s"
#: apt-pkg/contrib/fileutl.cc
msgid ""
"Be aware that removing the lock file is not a solution and may break your "
"system."
msgstr ""
+"Имейте в виду, что удаление файла блокировки не является решением и может "
+"сломать вашу систему."
#: apt-pkg/contrib/fileutl.cc
#, c-format
@@ -939,6 +942,8 @@ msgid ""
"%s: Credentials for %s match, but the protocol is not encrypted. Annotate "
"with %s:// to use."
msgstr ""
+"%s: Учётные данные для %s найдены, но используется нешифрованный протокол. "
+"Явно укажите %s:// для их использования."
#: apt-pkg/contrib/progress.cc
#, c-format
@@ -955,16 +960,14 @@ msgid "..."
msgstr "…"
#: apt-pkg/contrib/progress.cc
-#, fuzzy, c-format
-#| msgid "%c%s... %u%%"
+#, c-format
msgid "%c%s... %llu/%llus"
-msgstr "%c%s… %u%%"
+msgstr "%c%s… %llu/%lluс"
#: apt-pkg/contrib/progress.cc
-#, fuzzy, c-format
-#| msgid "%c%s... %u%%"
+#, c-format
msgid "%c%s... %llus"
-msgstr "%c%s… %u%%"
+msgstr "%c%s… %lluс"
#: apt-pkg/contrib/progress.cc
#, c-format
@@ -1015,10 +1018,9 @@ msgid "Unparsable control file"
msgstr "Не удалось разобрать содержимое файла control"
#: apt-pkg/deb/debindexfile.cc
-#, fuzzy, c-format
-#| msgid "Could not get lock %s"
+#, c-format
msgid "Could not read meta data from %s"
-msgstr "Не удалось получить файл блокировки %s"
+msgstr "Не удалось прочесть метаданные из %s"
#. TRANSLATOR: an identifier like Packages; Releasefile key indicating
#. a file like main/binary-amd64/Packages; another identifier like Contents;
@@ -1088,10 +1090,9 @@ msgid "Unable to parse package file %s (%d)"
msgstr "Невозможно разобрать содержимое файла пакета %s (%d)"
#: apt-pkg/deb/debsystem.cc
-#, fuzzy, c-format
-#| msgid "Waiting for headers"
+#, c-format
msgid "Waiting for cache lock: %s"
-msgstr "Ожидание заголовков"
+msgstr "Ожидание блокировки кэша: %s"
#: apt-pkg/deb/debsystem.cc
#, c-format
@@ -1624,8 +1625,6 @@ msgid "Unsupported file %s given on commandline"
msgstr "В командной строке указан неподдерживаемый файл %s"
#: apt-pkg/srcrecords.cc
-#, fuzzy
-#| msgid "You must put some 'source' URIs in your sources.list"
msgid "You must put some 'deb-src' URIs in your sources.list"
msgstr ""
"Вы должны заполнить sources.list, поместив туда URI источников пакетов с "
@@ -2539,6 +2538,8 @@ msgstr ""
msgid ""
"Invalid operator '%c' at offset %d, did you mean '%c%c' or '%c='? - in: %s"
msgstr ""
+"Неверный оператор «%1$c» по смещению %2$d в «%6$s»; возможно, вы имели в "
+"виду «%3$c%4$c» или «%5$c=»?"
#: apt-private/private-source.cc
#, c-format
@@ -2919,10 +2920,8 @@ msgid "Configure build-dependencies for source packages"
msgstr "настроить сборочные зависимости для пакета с исходным кодом"
#: cmdline/apt-get.cc
-#, fuzzy
-#| msgid "Building dependency tree"
msgid "Satisfy dependency strings"
-msgstr "Построение дерева зависимостей"
+msgstr "удовлетворить строки зависимостей"
#: cmdline/apt-get.cc
msgid "Erase downloaded archive files"
@@ -3225,10 +3224,8 @@ msgid "edit the source information file"
msgstr "редактировать файл с источниками пакетов"
#: cmdline/apt.cc
-#, fuzzy
-#| msgid "Failed to satisfy %s dependency for %s: %s"
msgid "satisfy dependency strings"
-msgstr "Невозможно удовлетворить зависимость типа %s для пакета %s: %s"
+msgstr "удовлетворить строки зависимостей"
#: dselect/install
msgid "Bad default setting!"
diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb
index 002c1aef8..7fa5ca3e7 100755
--- a/test/integration/test-apt-get-install-deb
+++ b/test/integration/test-apt-get-install-deb
@@ -168,12 +168,16 @@ createpkg 'trailing-newline' '' '
createpkg 'double-trailing-newline' '' '
'
+createpkg 'last-line-parse' '' 'Pre-Depends: pkg-as-it-should-be
+'
echo 'Package: /pkg-/
Pin: release a=experimental
Pin-Priority: 501' > rootdir/etc/apt/preferences.d/pinit
+testfailuremsg 'E: Unable to correct problems, you have held broken packages.' aptget install -q=0 ./incoming/pkg-last-line-parse_0_all.deb
testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb
+testsuccess aptget install ./incoming/pkg-last-line-parse_0_all.deb
testsuccess aptget install "$(readlink -f ./incoming/pkg-leading-newline_0_all.deb)"
testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb
testsuccess aptget install ./incoming/pkg-double-trailing-newline_0_all.deb
diff --git a/test/integration/test-apt-patterns b/test/integration/test-apt-patterns
index cdba76146..b55caf35b 100755
--- a/test/integration/test-apt-patterns
+++ b/test/integration/test-apt-patterns
@@ -26,6 +26,18 @@ insertpackage 'unstable' 'foreign' 'amd64' '2.0'
getoriginfromsuite() { echo -n 'meow'; }
setupaptarchive
+cat >> rootdir/var/lib/dpkg/status <<EOF
+
+Package: notinstalled
+Status: hold ok not-installed
+Architecture: amd64
+
+Package: nosection
+Status: install ok installed
+Architecture: amd64
+Version: 29
+EOF
+
testsuccess aptmark auto automatic1 automatic2
msgmsg "Check that commands understand patterns"
@@ -83,6 +95,7 @@ essential/now 1.0 i386 [installed,local]
foreign/unstable 2.0 amd64
manual1/now 1.0 i386 [installed,local]
manual2/now 1.0 i386 [installed,local]
+nosection/now 29 amd64 [installed,local]
not-obsolete/unstable 2.0 i386 [upgradable from: 1.0]" apt list "$pattern"
done
testsuccessequal "Listing..." apt list '?false'
@@ -115,12 +128,14 @@ N: There is 1 additional version. Please use the '-a' switch to see it" apt list
testsuccessequal "Listing...
foreign/unstable 2.0 amd64
+nosection/now 29 amd64 [installed,local]
not-obsolete/unstable 2.0 i386 [upgradable from: 1.0]" apt list '?not(?all-versions(?version(^1)))'
msgmsg "Package patterns"
testsuccessequal "Listing...
-foreign/unstable 2.0 amd64" apt list '?architecture(amd64)'
+foreign/unstable 2.0 amd64
+nosection/now 29 amd64 [installed,local]" apt list '?architecture(amd64)'
# XXX FIXME We should have support for foreign and native
testsuccessequal "Listing..." apt list '?architecture(foreign)'
@@ -159,6 +174,7 @@ dpkg/now 1.16.2+fake all [installed,local]
essential/now 1.0 i386 [installed,local]
manual1/now 1.0 i386 [installed,local]
manual2/now 1.0 i386 [installed,local]
+nosection/now 29 amd64 [installed,local]
not-obsolete/unstable 2.0 i386 [upgradable from: 1.0]" apt list '?installed'
testsuccessequal "Listing...
@@ -185,6 +201,9 @@ testsuccessequal "Listing...
available/unstable 1.0 all
essential/now 1.0 i386 [installed,local]" apt list '?section(asection)'
+testsuccessequal 'Listing...
+essential/now 1.0 i386 [installed,local]' apt list '~i !~M (~slibs|~sasection)'
+
testsuccessequal "Listing...
automatic1/now 1.0 i386 [installed,local]
automatic2/now 1.0 i386 [installed,local]" apt list '?source-package(^automatic$)'
@@ -202,8 +221,12 @@ not-obsolete/unstable 2.0 i386 [upgradable from: 1.0]" apt list '?version(2.0)'
testsuccessequal "Package: does-not-exist
State: not a real package (virtual)
+Package: notinstalled:amd64
+State: not a real package (virtual)
N: Can't select candidate version from package does-not-exist as it has no candidate
+N: Can't select candidate version from package notinstalled:amd64 as it has no candidate
N: Can't select versions from package 'does-not-exist' as it is purely virtual
+N: Can't select versions from package 'notinstalled:amd64' as it is purely virtual
N: No packages found" apt show '?virtual'
testsuccessequal "Listing..." apt list '?x-name-fnmatch(1)'