aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-04-26 18:09:16 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-04-26 18:09:16 +0000
commite2d15a0086b95fef38d67cdcddd24359fdca061d (patch)
tree797b76118940925255c8e45c8b5b39b3dfa917e7
parentf2e2bbd3209fbc3b317c5bb8956943e4a4d57023 (diff)
downloadperl-URPM-e2d15a0086b95fef38d67cdcddd24359fdca061d.tar
perl-URPM-e2d15a0086b95fef38d67cdcddd24359fdca061d.tar.gz
perl-URPM-e2d15a0086b95fef38d67cdcddd24359fdca061d.tar.bz2
perl-URPM-e2d15a0086b95fef38d67cdcddd24359fdca061d.tar.xz
perl-URPM-e2d15a0086b95fef38d67cdcddd24359fdca061d.zip
add disttag & distepoch to @info@
-rw-r--r--URPM.xs13
1 files changed, 12 insertions, 1 deletions
diff --git a/URPM.xs b/URPM.xs
index ee3a97d..bb098b0 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1030,14 +1030,25 @@ pack_header(URPM__Package pkg) {
char buff[1024];
char *p = buff;
const char *group = get_name(pkg->h, RPMTAG_GROUP);
+ const char *disttag = get_name(pkg->h, RPMTAG_DISTTAG);
+ const char *distepoch = get_name(pkg->h, RPMTAG_DISTEPOCH);
const char *nvra = headerFormat(pkg->h,
"%{NAME}-%{VERSION}-%{RELEASE}%|DISTTAG?{-%{DISTTAG}%|DISTEPOCH?"
"{%{DISTEPOCH}}|}|.%|ARCH?{%|SOURCERPM?{%{ARCH}}:{src}|}:{}|",
NULL
);
- p += 1 + snprintf(buff, sizeof(buff), "%s@%d@%d@%s", nvra,
+ p += snprintf(buff, sizeof(buff), "%s@%d@%d@%s", nvra,
get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE),
group);
+ if (*disttag || *distepoch) {
+ p = stpcpy(p, "@");
+ if (*disttag)
+ p = stpcpy(p, disttag);
+ p = stpcpy(p, "@");
+ if (*distepoch)
+ p = stpcpy(p, distepoch);
+ }
+ *++p = '\0';
pkg->info = memcpy(malloc(p-buff), buff, p-buff);
_free(nvra);
}