commit: bb2446132941352a1026e94df1cffcd664889fa6
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 21 20:50:16 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Jun 21 20:50:16 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bb244613
qlist: fix subslot matching
If the user hasn't request matching against a subslot, make sure we
ignore it when checking the package's SLOT value.
qlist.c | 7 +++++--
tests/qlist/dotest | 3 +++
tests/qlist/list16.good | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/qlist.c b/qlist.c
index a5b17af..d238259 100644
--- a/qlist.c
+++ b/qlist.c
@@ -183,8 +183,11 @@ qlist_match(q_vdb_pkg_ctx *pkg_ctx, const char *name,
depend_atom **name_atom, b
}
if (uslot) {
- /* require exact match on SLOTs */
- if (strncmp(pkg_ctx->slot, uslot, uslot_len) != 0 ||
pkg_ctx->slot[uslot_len] != '\0')
+ /* Require exact match on SLOTs. If the user didn't include a
subslot,
+ * then ignore it when checking the package's value. */
+ if (strncmp(pkg_ctx->slot, uslot, uslot_len) != 0 ||
+ (pkg_ctx->slot[uslot_len] != '\0' &&
+ pkg_ctx->slot[uslot_len] != '/'))
return false;
}
diff --git a/tests/qlist/dotest b/tests/qlist/dotest
index ddcd761..317a282 100755
--- a/tests/qlist/dotest
+++ b/tests/qlist/dotest
@@ -67,6 +67,9 @@ test 14 0 "qlist -ICSS"
# no matches
test 15 1 "qlist -Iv lajsdflkjasdflkjasdfljasdf"
+# match test w/out sub-SLOT
+test 16 0 "qlist -ICSS cat/sub-2:1"
+
cleantmpdir
end
diff --git a/tests/qlist/list16.good b/tests/qlist/list16.good
new file mode 100644
index 0000000..9c27e9c
--- /dev/null
+++ b/tests/qlist/list16.good
@@ -0,0 +1 @@
+cat/sub:1/1234