aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-03-08 06:25:20 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-03-08 06:25:20 +0000
commitdb06cd121f2efb95d678273031368101e08ae9b6 (patch)
tree0feb63b9d55d00ac039d35f2213457196fc28aec
parentc5f6ddcc09def76b630a83fa5ee387c30a8393c2 (diff)
downloadperl-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.xs39
1 files changed, 17 insertions, 22 deletions
diff --git a/URPM.xs b/URPM.xs
index 25d5ad3..e2434ab 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -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();