diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-10-18 03:42:32 +0200 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2016-10-18 17:59:30 +0200 |
commit | dab9efd9109587ef9b130ca1de05ae8533fa7928 (patch) | |
tree | 8c51b3d63ee1e8c61fe98984d9465e3f860d571a | |
parent | 64e3770177e8368a555654dee602d26b4c1afdbe (diff) | |
download | perl-URPM-dab9efd9109587ef9b130ca1de05ae8533fa7928.tar perl-URPM-dab9efd9109587ef9b130ca1de05ae8533fa7928.tar.gz perl-URPM-dab9efd9109587ef9b130ca1de05ae8533fa7928.tar.bz2 perl-URPM-dab9efd9109587ef9b130ca1de05ae8533fa7928.tar.xz perl-URPM-dab9efd9109587ef9b130ca1de05ae8533fa7928.zip |
(get_int2) try new 64bit tag else old 32bit tag
thus enabling to report size of >4Gb packages (however insane this is):
rpmlib uses the old small tag for small packages and the new big tag for
big packages (mga#19571)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | URPM.xs | 15 |
2 files changed, 13 insertions, 3 deletions
@@ -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 @@ -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: |