aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-04-26 18:09:52 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-04-26 18:09:52 +0000
commit232ac3445ab0a881d7c3ff7539859777e7b89126 (patch)
tree45cf849342b3ff6096800c985228c4dfa2d7723a
parent79b0d99bb642d4b25eea8b31b76bba9e5e71c4db (diff)
downloadperl-URPM-232ac3445ab0a881d7c3ff7539859777e7b89126.tar
perl-URPM-232ac3445ab0a881d7c3ff7539859777e7b89126.tar.gz
perl-URPM-232ac3445ab0a881d7c3ff7539859777e7b89126.tar.bz2
perl-URPM-232ac3445ab0a881d7c3ff7539859777e7b89126.tar.xz
perl-URPM-232ac3445ab0a881d7c3ff7539859777e7b89126.zip
add disttag & distepoch to @info@ if present
-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);
}