diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-01 10:02:03 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-01 10:02:03 +0000 |
commit | 4878adeab20a3bc78446090e2d28d1a78da91b54 (patch) | |
tree | fbc946a6c1ba716940b0321a0ec8b65c6d9cb91b | |
parent | 629a4de9e746a5887cd60e10e03eaf6aa25ccb87 (diff) | |
download | perl-URPM-4878adeab20a3bc78446090e2d28d1a78da91b54.tar perl-URPM-4878adeab20a3bc78446090e2d28d1a78da91b54.tar.gz perl-URPM-4878adeab20a3bc78446090e2d28d1a78da91b54.tar.bz2 perl-URPM-4878adeab20a3bc78446090e2d28d1a78da91b54.tar.xz perl-URPM-4878adeab20a3bc78446090e2d28d1a78da91b54.zip |
extract disttag & distepoch from new fields in @info@ of synthesis
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | URPM.pm | 2 | ||||
-rw-r--r-- | URPM.xs | 39 |
3 files changed, 19 insertions, 26 deletions
@@ -1,3 +1,7 @@ +Version 4.34 - 1 June 2011, by Per Øyvid Karlsen + +- extract disttag & distepoch from new fields in @info@ of synthesis + Version 4.33 - 31 May 2011, by Per Øyvind Karlsen - add disttag & distepoch to $state->{rejected} for assisting parsing of @@ -11,7 +11,7 @@ use URPM::Resolve; use URPM::Signature; our @ISA = qw(DynaLoader); -our $VERSION = '4.33'; +our $VERSION = '4.34'; URPM->bootstrap($VERSION); @@ -308,7 +308,8 @@ get_int(Header header, rpmTag tag) { */ static void get_fullname_parts(URPM__Package pkg, char **name, int *epoch, char **version, char **release, char **disttag, char **distepoch, char **arch, char **eos) { - char *_version = NULL, *_release = NULL, *_disttag = NULL, *_distepoch = NULL, *_arch = NULL, *_eos = NULL, *tmp = NULL, *tmp2 = NULL; + char *_version = NULL, *_release = NULL, *_disttag = NULL, *_distepoch = NULL, *_arch = NULL, *_eos = NULL, *tmp = NULL; + /* XXX: Could probably be written in a more generic way, only thing we * really want to do is to check for arch field, which will be missing in * the case of gpg-pubkey at least.. @@ -325,31 +326,19 @@ get_fullname_parts(URPM__Package pkg, char **name, int *epoch, char **version, c backup_char(_arch++); 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 ((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, ']'))) { + _disttag = _eos; + for (int i = 0; i < 3 && _disttag; i++, _disttag) + _disttag = strchr(++_disttag, '@'); + if (_disttag && (_distepoch = strchr(++_disttag, '@'))) + backup_char(_distepoch++); + /* currently not very useful as there's no additional fields, but we'll do this check + * so that adding any potential fields in the future shouldn't break anything + */ + if (_distepoch != NULL && (tmp = strchr(_distepoch, '@'))) + backup_char(tmp); + /* eliminate disttag from fullname so the parsing won't get messed up */ + if (_disttag != NULL && *_disttag && (tmp = strrchr(pkg->info, '-')) && !strncmp(tmp+1, _disttag, strlen(_disttag))) backup_char(tmp); - if ((tmp = strrchr(pkg->info, '-')) && ((tmp2 = strstr(tmp, _distepoch)))) { - backup_char(tmp++); - _disttag = tmp; - backup_char(tmp2); - } - } - } - } if (distepoch != NULL) *distepoch = _distepoch ? _distepoch : ""; if (disttag != NULL || release != NULL || version != NULL || name != NULL) { if (disttag != NULL) *disttag = _disttag ? _disttag : ""; |