summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/depend.cpp10
-rw-r--r--gentoobrowse-api/unittests/testDepend.cpp11
2 files changed, 16 insertions, 5 deletions
diff --git a/gentoobrowse-api/service/depend.cpp b/gentoobrowse-api/service/depend.cpp
index 6851eea..3d325d7 100644
--- a/gentoobrowse-api/service/depend.cpp
+++ b/gentoobrowse-api/service/depend.cpp
@@ -9,10 +9,10 @@ Gentoo::Utils::Lexer::PatternPtr Or_End(Gentoo::Utils::Lexer::regex("\\s*\\)\\s*
Gentoo::Utils::Lexer::PatternPtr AtomSpec(Gentoo::Utils::Lexer::regex("\\s*"
"([[:punct:]]+)?" // op
"([[:alnum:]-]+)\\/" // cat
- "([[:alnum:]]*((-?[[:alpha:]_+]+[[:digit:]]+)|[[:alpha:]_+]|(-[[:alpha:]_+]))+)" // package
+ "([^ ]+)" // package
"(-([0-9][.0-9]*[[:alpha:]]?\\*?((_(alpha|beta|pre|rc|p))?[[:digit:]]*)*(-r[[:digit:]]+)?))?" // version
"(:([^/ []+(\\/[^ []+)?))?" // slot
- "(\\[([^]]+)\\])?\\s*", G_REGEX_OPTIMIZE)); // use
+ "(\\[([^]]+)\\])?(\\s+|$)", (GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_UNGREEDY))); // use
const std::string InWhen("InWhen");
const std::string InOr("InOr");
@@ -68,9 +68,9 @@ namespace Portage {
iuo<std::string>(es->pattern->match(1)), // op
*es->pattern->match(2), // category
*es->pattern->match(3), // package
- iuo<std::string>(es->pattern->match(8)), // version
- iuo<std::string>(es->pattern->match(14)), // slot
- split<std::string>(es->pattern->match(17)) // use
+ iuo<std::string>(es->pattern->match(5)), // version
+ iuo<std::string>(es->pattern->match(11)), // slot
+ split<std::string>(es->pattern->match(14)) // use
));
} });
}
diff --git a/gentoobrowse-api/unittests/testDepend.cpp b/gentoobrowse-api/unittests/testDepend.cpp
index 646b593..942dbaf 100644
--- a/gentoobrowse-api/unittests/testDepend.cpp
+++ b/gentoobrowse-api/unittests/testDepend.cpp
@@ -308,3 +308,14 @@ BOOST_AUTO_TEST_CASE( thisThing )
BOOST_REQUIRE_EQUAL(*ds[0]->version, "1.0");
}
+BOOST_AUTO_TEST_CASE( thatThing )
+{
+ auto ds = Portage::Utils::Depend::parse("!sys-firmware/iwl3160-7260-bt-ucode");
+ BOOST_REQUIRE_EQUAL(ds.size(), 1);
+ BOOST_REQUIRE(ds[0]->op);
+ BOOST_REQUIRE_EQUAL(*ds[0]->op, "!");
+ BOOST_REQUIRE_EQUAL(ds[0]->category, "sys-firmware");
+ BOOST_REQUIRE_EQUAL(ds[0]->package, "iwl3160-7260-bt-ucode");
+ BOOST_REQUIRE(!ds[0]->version);
+}
+