aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2010-12-14 02:58:13 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2010-12-14 02:58:13 +0000
commitcd7e2cc75134d36309db8836da1f95feda0a46bc (patch)
tree46a06797f2bbb2d2fb090a73d7c86221e04f589c
parentb3c587f4cdaf7bb50e4f7145c13064647193fec6 (diff)
downloadperl-URPM-cd7e2cc75134d36309db8836da1f95feda0a46bc.tar
perl-URPM-cd7e2cc75134d36309db8836da1f95feda0a46bc.tar.gz
perl-URPM-cd7e2cc75134d36309db8836da1f95feda0a46bc.tar.bz2
perl-URPM-cd7e2cc75134d36309db8836da1f95feda0a46bc.tar.xz
perl-URPM-cd7e2cc75134d36309db8836da1f95feda0a46bc.zip
make rpmtag_from_string() lookup constant names using librpmconstant to provide access to all tags
-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_