aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM.xs27
1 files changed, 12 insertions, 15 deletions
diff --git a/URPM.xs b/URPM.xs
index 079aa15..067ae39 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -41,6 +41,7 @@
#include <rpmbuild.h>
#include <rpmgi.h>
#include <rpmlog.h>
+#include <rpmconstant.h>
#include "xfile.h"
@@ -1532,21 +1533,17 @@ static void *rpmRunTransactions_callback(__attribute__((unused)) const void *h,
int rpmtag_from_string(char *tag)
{
- if (!strcmp(tag, "name"))
- return RPMTAG_NAME;
- else if (!strcmp(tag, "whatprovides"))
- return RPMTAG_PROVIDENAME;
- else if (!strcmp(tag, "whatrequires"))
- return RPMTAG_REQUIRENAME;
- else if (!strcmp(tag, "whatconflicts"))
- return RPMTAG_CONFLICTNAME;
- else if (!strcmp(tag, "group"))
- return RPMTAG_GROUP;
- else if (!strcmp(tag, "triggeredby"))
- return RPMTAG_TRIGGERNAME;
- else if (!strcmp(tag, "path"))
- return RPMTAG_BASENAMES;
- else croak("unknown tag [%s]", tag);
+ static rpmconst c = NULL;
+ static const char context[] = "rpmtag";
+
+ if(c == NULL) {
+ c = rpmconstNew();
+ if(!rpmconstInitToContext(c, context))
+ croak("unknown context [%s]", context);
+ }
+ if(rpmconstFindName(c, tag, 0))
+ return rpmconstValue(c);
+ else croak("unknown tag [%s]", tag);
}
MODULE = URPM PACKAGE = URPM::Package PREFIX = Pkg_