aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--URPM.xs15
2 files changed, 13 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 6513b5b..a10a538 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+- support querying size of 4gb+ packages
- use 64bit for package size on 32bit too (mga#19571)
Version 5.09 - 16 October 2016
diff --git a/URPM.xs b/URPM.xs
index 0800993..26dcd79 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -214,8 +214,17 @@ get_int(const Header header, rpmTag tag) {
}
static uint64_t
+get_int2(const Header header, rpmTag newtag, rpmTag oldtag) {
+ struct rpmtd_s val;
+
+ if (!headerGet(header, newtag, &val, HEADERGET_DEFAULT))
+ headerGet(header, oldtag, &val, HEADERGET_DEFAULT);
+ return rpmtdGetNumber(&val);
+}
+
+static uint64_t
get_filesize(const Header h) {
- return headerGetNumber(h, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */
+ return get_int2(h, RPMTAG_LONGSIGSIZE, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */
}
static int
@@ -762,7 +771,7 @@ pack_header(const URPM__Package pkg) {
const char *nvr = headerGetAsString(pkg->h, RPMTAG_NVR);
const char *arch = get_arch(pkg->h);
p += 1 + snprintf(buff, sizeof(buff), "%s.%s@%llu@%llu@%s", nvr, arch,
- get_int(pkg->h, RPMTAG_EPOCH), get_int(pkg->h, RPMTAG_SIZE),
+ get_int(pkg->h, RPMTAG_EPOCH), get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE),
get_name(pkg->h, RPMTAG_GROUP));
pkg->info = memcpy(malloc(p-buff), buff, p-buff);
}
@@ -1770,7 +1779,7 @@ Pkg_size(pkg)
} else
RETVAL = 0;
} else if (pkg->h)
- RETVAL = get_int(pkg->h, RPMTAG_SIZE);
+ RETVAL = get_int2(pkg->h, RPMTAG_LONGSIZE, RPMTAG_SIZE);
else
RETVAL = 0;
OUTPUT: