From 60dac3270f26147cd747c25168b6bc32ff125733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20V=C3=A4th?= Date: Sat, 6 Feb 2016 13:03:20 +0100 Subject: [PATCH] Reintroduce extended version globbing --- ChangeLog | 5 ++++- po/de.po | 6 +----- po/ru.po | 7 +------ src/portage/mask.cc | 19 +++++++++++++++---- src/portage/mask.h | 3 ++- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index bed35953..0903cf69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,8 +3,11 @@ *eix-0.31.7 Martin Väth : - Support EAPI and (optionally) REQUIRED_USE - - Extend MATCH_ALGORITHM_EXACT default to let a pure number match + - Extend MATCH_ALGORITHM_EXACT default value to let a pure number match exactly by default (useful for EAPI matching) + - Reintroduce extended version globbing to match portage: + https://github.com/vaeth/eix/issues/21 + https://bugs.gentoo.org/show_bug.cgi?id=572178 - Fix metadata-{flat,assign} confusion - Fix: version parsing must omit [ https://github.com/vaeth/eix/issues/20 diff --git a/po/de.po b/po/de.po index c2a2f50c..df78de5f 100644 --- a/po/de.po +++ b/po/de.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: eix\n" "Report-Msgid-Bugs-To: https://github.com/vaeth/eix/issues/\n" -"POT-Creation-Date: 2016-01-11 19:53+0100\n" +"POT-Creation-Date: 2016-02-06 12:56+0100\n" "PO-Revision-Date: 2014-10-29 21:03+0100\n" "Last-Translator: Andre Jaenisch \n" "Language-Team: German\n" @@ -8353,10 +8353,6 @@ msgstr "Versionsangabe fehlt" msgid "a wildcard is only valid with the = operator" msgstr "Ein Wildcard ist nur mit dem =-Operator zulässig" -#: src/portage/mask.cc -msgid "a wildcard is only valid as the last symbol" -msgstr "Ein Wildcard ist nur als letztes Zeichen zulässig" - #: src/portage/set_stability.cc msgid "internal error: SetStability calculates wrong index" msgstr "Interner Fehler: SetStability berechnet falschen Index" diff --git a/po/ru.po b/po/ru.po index 44ba035c..e3874a17 100644 --- a/po/ru.po +++ b/po/ru.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: eix\n" "Report-Msgid-Bugs-To: https://github.com/vaeth/eix/issues/\n" -"POT-Creation-Date: 2016-01-11 19:53+0100\n" +"POT-Creation-Date: 2016-02-06 12:56+0100\n" "PO-Revision-Date: 2013-05-20 00:30+0200\n" "Last-Translator: Artem Vorotnikov \n" "Language-Team: русский <>\n" @@ -7234,11 +7234,6 @@ msgstr "Отсутствует указание версии" msgid "a wildcard is only valid with the = operator" msgstr "Шаблон поиска имеет смысл только с оператором =" -# fuzzy -#: src/portage/mask.cc -msgid "a wildcard is only valid as the last symbol" -msgstr "Шаблон поиска имеет смысл только as the last symbol" - #: src/portage/set_stability.cc msgid "internal error: SetStability calculates wrong index" msgstr "внутренняя ошибка: SetStability рассчитывает неверный индекс" diff --git a/src/portage/mask.cc b/src/portage/mask.cc index c136f16b..e25208ad 100644 --- a/src/portage/mask.cc +++ b/src/portage/mask.cc @@ -214,12 +214,20 @@ GCC_DIAG_ON(sign-conversion) *errtext = _("a wildcard is only valid with the = operator"); return parsedError; } - if(unlikely((wildcard + 1 != end) && + if(unlikely(((wildcard + 1 != end) + || (end == NULLPTR)) && ((end != NULLPTR) || (wildcard[1] != '\0')))) { - *errtext = _("a wildcard is only valid as the last symbol"); - return parsedError; + // Wildcard is not the last symbol: + m_operator = maskOpGlobExt; + if(end != NULLPTR) { + m_glob.assign(p, end); + } else { + m_glob.assign(p); + } + return parsedOK; + } else { + m_operator = maskOpGlob; } - m_operator = maskOpGlob; end = wildcard; } GCC_DIAG_OFF(sign-conversion) @@ -279,6 +287,9 @@ bool Mask::test(const ExtendedVersion *ev) const { case maskOpGlob: return (BasicVersion::compare_right_maybe_shorter(*ev, *this) == 0); + case maskOpGlobExt: + return (fnmatch(m_glob.c_str(), ev->getFull().c_str(), 0) == 0); + case maskOpLess: return (BasicVersion::compare(*this, *ev) > 0); diff --git a/src/portage/mask.h b/src/portage/mask.h index 2b6c9aaf..91c7f0ad 100644 --- a/src/portage/mask.h +++ b/src/portage/mask.h @@ -53,7 +53,7 @@ class Mask : public BasicVersion { maskOpAll, maskOpEqual, maskOpLess, maskOpLessEqual, maskOpGreaterEqual, maskOpGreater, - maskOpRevisions, maskOpGlob, + maskOpRevisions, maskOpGlob, maskOpGlobExt, maskIsSet } Operator; @@ -69,6 +69,7 @@ class Mask : public BasicVersion { std::string m_slotname; std::string m_subslotname; std::string m_reponame; + std::string m_glob; ///< the glob string for MaskOpGlobExt bool m_test_slot; ///< must we match a slot? bool m_test_subslot; ///< must we match a subslot? bool m_test_reponame; ///< must we match a reponame?