summaryrefslogtreecommitdiffstats
path: root/rpminfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'rpminfo.c')
-rw-r--r--rpminfo.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/rpminfo.c b/rpminfo.c
index ffe907a..45c25b5 100644
--- a/rpminfo.c
+++ b/rpminfo.c
@@ -292,7 +292,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_rpmdbsearch, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
-/* {{{ proto array rpmdbsearch(string pattern [, integer tag_name = RPM_TAG_NAME [, integer mode]])
+/* {{{ proto array rpmdbsearch(string pattern [, integer tag_name = RPMTAG_NAME [, integer mode]])
Search information from installed RPMs */
PHP_FUNCTION(rpmdbsearch)
{
@@ -425,6 +425,9 @@ PHP_FUNCTION(rpmvercmp)
*/
PHP_MINIT_FUNCTION(rpminfo)
{
+ const char *tagname;
+ rpmtd names;
+
REGISTER_STRING_CONSTANT("RPMVERSION", (char *)RPMVERSION, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("RPMSENSE_ANY", RPMSENSE_ANY, CONST_CS | CONST_PERSISTENT);
@@ -451,19 +454,17 @@ PHP_MINIT_FUNCTION(rpminfo)
REGISTER_LONG_CONSTANT("RPMSENSE_KEYRING", RPMSENSE_KEYRING, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("RPMSENSE_CONFIG", RPMSENSE_CONFIG, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_MATCH_DEFAULT", RPMMIRE_DEFAULT, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_MATCH_STRCMP", RPMMIRE_STRCMP, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_MATCH_REGEX", RPMMIRE_REGEX, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_MATCH_GLOB", RPMMIRE_GLOB, CONST_CS | CONST_PERSISTENT);
-
- REGISTER_LONG_CONSTANT("RPM_TAG_NAME", RPMTAG_NAME, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_INSTFILENAMES", RPMTAG_INSTFILENAMES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_REQUIRES", RPMTAG_REQUIRES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_PROVIDES", RPMTAG_PROVIDES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_RECOMMENDS", RPMTAG_RECOMMENDS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_SUGGESTS", RPMTAG_SUGGESTS, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_ENHANCES", RPMTAG_ENHANCES, CONST_CS | CONST_PERSISTENT);
- REGISTER_LONG_CONSTANT("RPM_TAG_SUPPLEMENTS", RPMTAG_SUPPLEMENTS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("RPMMIRE_DEFAULT", RPMMIRE_DEFAULT, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("RPMMIRE_STRCMP", RPMMIRE_STRCMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("RPMMIRE_REGEX", RPMMIRE_REGEX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("RPMMIRE_GLOB", RPMMIRE_GLOB, CONST_CS | CONST_PERSISTENT);
+
+ names = rpmtdNew();
+ rpmTagGetNames(names, 1);
+ while ((tagname = rpmtdNextString(names))) {
+ zend_register_long_constant(tagname, strlen(tagname), rpmTagGetValue(tagname+7), CONST_CS | CONST_PERSISTENT, module_number);
+ }
+ rpmtdFree(names);
return SUCCESS;
}