Skip to content

Commit

Permalink
Reintroduce extended version globbing
Browse files Browse the repository at this point in the history
  • Loading branch information
vaeth committed Feb 6, 2016
1 parent c32de25 commit 60dac32
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
5 changes: 4 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
*eix-0.31.7
Martin Väth <martin at mvath.de>:
- 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
Expand Down
6 changes: 1 addition & 5 deletions po/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: German\n"
Expand Down Expand Up @@ -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"
Expand Down
7 changes: 1 addition & 6 deletions po/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>\n"
"Language-Team: русский <>\n"
Expand Down Expand Up @@ -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 рассчитывает неверный индекс"
Expand Down
19 changes: 15 additions & 4 deletions src/portage/mask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/portage/mask.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Mask : public BasicVersion {
maskOpAll, maskOpEqual,
maskOpLess, maskOpLessEqual,
maskOpGreaterEqual, maskOpGreater,
maskOpRevisions, maskOpGlob,
maskOpRevisions, maskOpGlob, maskOpGlobExt,
maskIsSet
} Operator;

Expand All @@ -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?
Expand Down

0 comments on commit 60dac32

Please sign in to comment.