diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2010-12-14 02:58:13 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2010-12-14 02:58:13 +0000 |
commit | cd7e2cc75134d36309db8836da1f95feda0a46bc (patch) | |
tree | 46a06797f2bbb2d2fb090a73d7c86221e04f589c | |
parent | b3c587f4cdaf7bb50e4f7145c13064647193fec6 (diff) | |
download | perl-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.xs | 27 |
1 files changed, 12 insertions, 15 deletions
@@ -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_ |