diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-03-08 06:25:20 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-03-08 06:25:20 +0000 |
commit | db06cd121f2efb95d678273031368101e08ae9b6 (patch) | |
tree | 0feb63b9d55d00ac039d35f2213457196fc28aec | |
parent | c5f6ddcc09def76b630a83fa5ee387c30a8393c2 (diff) | |
download | perl-URPM-db06cd121f2efb95d678273031368101e08ae9b6.tar perl-URPM-db06cd121f2efb95d678273031368101e08ae9b6.tar.gz perl-URPM-db06cd121f2efb95d678273031368101e08ae9b6.tar.bz2 perl-URPM-db06cd121f2efb95d678273031368101e08ae9b6.tar.xz perl-URPM-db06cd121f2efb95d678273031368101e08ae9b6.zip |
use a common convert_header() function in stead..
-rw-r--r-- | URPM.xs | 39 |
1 files changed, 17 insertions, 22 deletions
@@ -369,6 +369,19 @@ remap_suggests(Header header) { } } +static void +convert_header(Header header) { + if (header) { + if (headerIsEntry(header, RPMTAG_DISTEPOCH)) { + strip_distepoch(header, RPMTAG_PROVIDEVERSION); + strip_distepoch(header, RPMTAG_REQUIREVERSION); + strip_distepoch(header, RPMTAG_OBSOLETEVERSION); + strip_distepoch(header, RPMTAG_CONFLICTVERSION); + } + remap_suggests(header); + } +} + static int sigsize_to_filesize(int sigsize) { return sigsize + 440; /* 440 is the rpm header size (?) empirical, but works */ @@ -1462,11 +1475,7 @@ update_header(char *filename, URPM__Package pkg, __attribute__((unused)) int kee int32_t size; #endif - strip_distepoch(header, RPMTAG_PROVIDEVERSION); - strip_distepoch(header, RPMTAG_REQUIREVERSION); - strip_distepoch(header, RPMTAG_OBSOLETEVERSION); - strip_distepoch(header, RPMTAG_CONFLICTVERSION); - remap_suggests(header); + convert_header(header); basename = strrchr(filename, '/'); #ifndef RPM_ORG @@ -1497,13 +1506,7 @@ update_header(char *filename, URPM__Package pkg, __attribute__((unused)) int kee if (pkg->h && !(pkg->flag & FLAG_NO_HEADER_FREE)) pkg->h = headerFree(pkg->h); pkg->h = headerRead(fd, HEADER_MAGIC_YES); - if (pkg->h) { - strip_distepoch(pkg->h, RPMTAG_PROVIDEVERSION); - strip_distepoch(pkg->h, RPMTAG_REQUIREVERSION); - strip_distepoch(pkg->h, RPMTAG_OBSOLETEVERSION); - strip_distepoch(pkg->h, RPMTAG_CONFLICTVERSION); - remap_suggests(pkg->h); - } + convert_header(pkg->h); pkg->flag &= ~FLAG_NO_HEADER_FREE; Fclose(fd); @@ -3794,11 +3797,7 @@ Urpm_parse_hdlist__XS(urpm, filename, ...) struct s_Package pkg, *_pkg; SV *sv_pkg; - strip_distepoch(header, RPMTAG_PROVIDEVERSION); - strip_distepoch(header, RPMTAG_REQUIREVERSION); - strip_distepoch(header, RPMTAG_OBSOLETEVERSION); - strip_distepoch(header, RPMTAG_CONFLICTVERSION); - remap_suggests(header); + convert_header(header); memset(&pkg, 0, sizeof(struct s_Package)); pkg.flag = 1 + av_len(depslist); @@ -4161,11 +4160,7 @@ Urpm_stream2header(fp) if (pkg->h) { SV *sv_pkg; - strip_distepoch(pkg->h, RPMTAG_PROVIDEVERSION); - strip_distepoch(pkg->h, RPMTAG_REQUIREVERSION); - strip_distepoch(pkg->h, RPMTAG_OBSOLETEVERSION); - strip_distepoch(pkg->h, RPMTAG_CONFLICTVERSION); - remap_suggests(pkg->h); + convert_header(pkg->h); EXTEND(SP, 1); sv_pkg = sv_newmortal(); |