diff options
author | Remi Collet <remi@remirepo.net> | 2020-03-13 08:43:41 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-03-13 08:43:41 +0100 |
commit | 4f467f39aeb02bb2a2f2df9c7a697601aca84db8 (patch) | |
tree | 5ee3d5be4020d6d4deadc319b542e98312cb4209 | |
parent | cb84354da288ca88d3ad4f5757e44e8e7e004f41 (diff) |
allow 'rpmdbinfo' to search on NEVR (instead of name only)
-rw-r--r-- | package.xml | 1 | ||||
-rw-r--r-- | rpminfo.c | 2 | ||||
-rw-r--r-- | tests/007-rpmdbinfo.phpt | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/package.xml b/package.xml index af5a4f3..23053b6 100644 --- a/package.xml +++ b/package.xml @@ -29,6 +29,7 @@ Available functions: <notes> - improve search logic, use index when exists and no search mode - add 'full' parameter to rpmdbsearch +- allow 'rpmdbinfo' to search on NEVR (instead of name only) </notes> <contents> <dir name="/"> @@ -267,7 +267,7 @@ PHP_FUNCTION(rpmdbinfo) rpmtsOpenDB(ts, O_RDONLY); db = rpmtsGetRdb(ts); - di = rpmdbInitIterator(db, RPMTAG_NAME, name, len); + di = rpmdbInitIterator(db, RPMDBI_LABEL, name, len); if (!di) { // Not found rpmtsCloseDB(ts); diff --git a/tests/007-rpmdbinfo.phpt b/tests/007-rpmdbinfo.phpt index 6fe3116..c568dd9 100644 --- a/tests/007-rpmdbinfo.phpt +++ b/tests/007-rpmdbinfo.phpt @@ -6,6 +6,14 @@ Check for rpmdbinfo function <?php var_dump(rpmdbinfo('doesntexistsinrpmdb')); var_dump(rpmdbinfo('bash')); + +$k = rpmdbinfo('kernel'); +var_dump(count($k) > 0); // multiple kernels +$n = $k[0]['Name'] . '-' . $k[0]['Version'] . '-' . $k[0]['Release']; + +$k = rpmdbinfo($n); // single kernel with NEVR +var_dump(count($k) ==1); + ?> Done --EXPECTF-- @@ -25,4 +33,6 @@ array(1) { string(%d) "%s" } } +bool(true) +bool(true) Done |