diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-21 12:12:50 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-21 12:12:50 +0000 |
commit | 0fc7dbe78c18fa28190b5cb6939f2fdef7ab731b (patch) | |
tree | 24553654082cc8ff9eaa464a3809f7ea4e8bbe3e | |
parent | d494971f6bfe48ccaa1dfb9811535048e05d2d36 (diff) | |
download | perl-URPM-0fc7dbe78c18fa28190b5cb6939f2fdef7ab731b.tar perl-URPM-0fc7dbe78c18fa28190b5cb6939f2fdef7ab731b.tar.gz perl-URPM-0fc7dbe78c18fa28190b5cb6939f2fdef7ab731b.tar.bz2 perl-URPM-0fc7dbe78c18fa28190b5cb6939f2fdef7ab731b.tar.xz perl-URPM-0fc7dbe78c18fa28190b5cb6939f2fdef7ab731b.zip |
get disttag from @info@ now in get_fullname_parts()
-rw-r--r-- | URPM.xs | 36 |
1 files changed, 12 insertions, 24 deletions
@@ -157,36 +157,24 @@ newSVpv_utf8(const char *s, STRLEN len) static void get_fullname_parts(URPM__Package pkg, char **name, char **version, char **release, char **arch, char **eos) { char *_version = NULL, *_release = NULL, *_arch = NULL, *_eos = NULL; - int distepoch = 0; - char *tmp; - /* search through provides for distepoch */ - if ((tmp = pkg->provides)) { - do { - if((_eos = strchr(tmp, '@'))) - *_eos = 0; - - if((tmp = strchr(tmp, '[')) && - (tmp = strchr(tmp, '-')) && - (tmp = strchr(tmp, ':'))) - distepoch = 1; - if(_eos) { - *_eos++ = '@'; - tmp = _eos; - } - } while(!distepoch && _eos != NULL); - /* XXX: filename at end of line, don't bother to support it, just make sure - * for it not to cause crash... - */ - if ((tmp = strrchr(pkg->info, '.')) && !strcmp(tmp, ".rpm")) - distepoch = 0; - } + int i, disttag = 0; + char *tmp = pkg->info; + for (i = 0; i < 4 && tmp != NULL; i++) + tmp = strchr(++tmp, '@'); + if (tmp++ != NULL && *tmp != '@') + disttag = 1; + /* XXX: filename at end of line, don't bother to support it, just make sure + * for it not to cause crash... + */ + if ((tmp = strrchr(pkg->info, '.')) && !strcmp(tmp, ".rpm")) + disttag = 0; if ((_eos = strchr(pkg->info, '@')) != NULL) { *_eos = 0; /* mark end of string to enable searching backwards */ if ((_arch = strrchr(pkg->info, '.')) != NULL) { *_arch = 0; if ((release != NULL || version != NULL || name != NULL) && (_release = strrchr(pkg->info, '-')) != NULL) { - if (distepoch) { + if (disttag) { tmp = _release; while(tmp != _arch) { backup_char(tmp++); |