aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs36
1 files changed, 12 insertions, 24 deletions
diff --git a/URPM.xs b/URPM.xs
index a67599f..a83b1e3 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -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++);