diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-01-23 22:25:16 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-01-23 22:25:16 +0000 |
commit | 6e4adb6528ec6cd62cc68eee9ce754fc44ad81da (patch) | |
tree | 355af27b974b72481ed63112d7ecbf5381ea6f55 | |
parent | cb154006b79ba10970befb0bf7824586455bcf90 (diff) | |
download | perl-URPM-6e4adb6528ec6cd62cc68eee9ce754fc44ad81da.tar perl-URPM-6e4adb6528ec6cd62cc68eee9ce754fc44ad81da.tar.gz perl-URPM-6e4adb6528ec6cd62cc68eee9ce754fc44ad81da.tar.bz2 perl-URPM-6e4adb6528ec6cd62cc68eee9ce754fc44ad81da.tar.xz perl-URPM-6e4adb6528ec6cd62cc68eee9ce754fc44ad81da.zip |
- fix evr extraction which broke for some packages with i586 synthesis
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | URPM.pm | 2 | ||||
-rw-r--r-- | URPM.xs | 57 |
3 files changed, 49 insertions, 13 deletions
@@ -1,5 +1,6 @@ Version 4.13 - 23 Jan 2011, by Per Øyvind Karlsen +- fix evr extraction which broke for some packages with i586 synthesis - fix parsing of disttag from synthesis - add regression checks for the fields extracted from synthesis @@ -13,7 +14,7 @@ Version 4.12 - 23 Jan 2011, by Per Øyvind Karlsen Version 4.11 - 22 Jan 2011, by Per Øyvind Karlsen - fix URPM::Resolve::*_overlap() for packages having disttag -- look for EVR of package at the first element @provides@ rather than the last +- look for EVR of package at the first element of @provides@ rather than the last - replace incorrect usage of URPM::rpmvercmp on NVRA with rpmEVRcompare in URPM::Resolve::provided_version_that_overlaps() & URPM::Resolve::_find_required_package__sort() @@ -11,7 +11,7 @@ use URPM::Resolve; use URPM::Signature; our @ISA = qw(DynaLoader); -our $VERSION = '4.12'; +our $VERSION = '4.13'; URPM->bootstrap($VERSION); @@ -318,10 +318,23 @@ get_fullname_parts_info(URPM__Package pkg, char **name, int *epoch, char **versi if (arch != NULL) *arch = pubkey ? "" : _arch; if (distepoch != NULL || disttag != NULL || release != NULL || version != NULL || name != NULL) { /* TODO: implement stricter patterns and different separator for disttag/distepoch */ - if ((_distepoch = strchr(strrchr(pkg->provides, '-'), ':')) != NULL) { - if ((tmp = strrchr(++_distepoch, ']'))) { + tmp = pkg->provides; + do { + if((tmp2 = strchr(tmp, '@'))) + *tmp2 = '\0'; + if((tmp = strrchr(tmp, ' ')) && (tmp = strrchr(tmp, '-'))) + _distepoch = strrchr(tmp, ':'); + if(tmp2) + *tmp2 = '@'; + } while(!_distepoch && tmp2 && (tmp = ++tmp2)); + if (!_distepoch) { + if((tmp = strrchr(pkg->provides, ' ')) && (tmp = strrchr(tmp, '-'))) + _distepoch = strrchr(tmp, ':'); + } + if (_distepoch != NULL) { + if ((tmp = strchr(++_distepoch, ']'))) { backup_char(tmp); - if (((tmp = strrchr(_eos, '-')) || (tmp = strrchr(pkg->info, '-'))) && ((tmp2 = strstr(tmp, _distepoch)))) { + if ((tmp = strrchr(pkg->info, '-')) && ((tmp2 = strstr(tmp, _distepoch)))) { backup_char(tmp++); _disttag = tmp; backup_char(tmp2); @@ -379,19 +392,38 @@ get_evr(URPM__Package pkg) { const char *evr = NULL; if(pkg->provides) { char *name = NULL; - char *tmp; + char *tmp = NULL, *tmp2 = NULL, *tmp3 = NULL; get_fullname_parts_info(pkg, &name, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + /* + * TODO: this function is way too awkward and complex now, need to change + * pattern & separator + */ if(name) { size_t namelen = strlen(name); char *needle = alloca(namelen+3); - snprintf(needle, namelen+3, "@%s[", name); + restore_chars(); + tmp = pkg->provides; + if(!strncmp(pkg->provides, needle+1, namelen+1)) { + tmp = evr = pkg->provides; + } + while(tmp && (tmp = strstr(tmp, needle))) { + if(evr && (tmp3 = strchr(evr, '@'))) + backup_char(tmp3); + if((tmp2 = strchr(++tmp, '@'))) + *tmp2 = '\0'; + if(evr == NULL || strlen(tmp) > strlen(evr)) { + evr = tmp; + } + if(tmp2) + *tmp2 = '@'; + } + if(!evr) + croak("unable to locate package name (%s) in @provides@%s", needle, pkg->provides); + evr = strchr(evr, ' '); - if((tmp = strstr(pkg->provides, needle)) == NULL) - tmp = strstr(pkg->provides, ++needle); - evr = strchr(tmp, ' '); - - tmp = strchr(++evr, ']'); + if(evr) + tmp = strchr(++evr, ']'); if(tmp) backup_char(tmp); } @@ -1934,10 +1966,13 @@ Pkg_compare_pkg(lpkg, rpkg) char *larch; char *revr; char *rarch; + char *tmp; CODE: if (lpkg == rpkg) RETVAL = 0; else { - levr = (char*)get_evr(lpkg); + tmp = (char*)get_evr(lpkg); + levr = alloca(strlen(tmp)); + stpcpy(levr, tmp); revr = (char*)get_evr(rpkg); if(levr == NULL || revr == NULL) { restore_chars(); |