summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--package.xml1
-rw-r--r--rpminfo.c2
-rw-r--r--tests/007-rpmdbinfo.phpt10
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="/">
diff --git a/rpminfo.c b/rpminfo.c
index 83e270d..53e4c6a 100644
--- a/rpminfo.c
+++ b/rpminfo.c
@@ -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