From d4977de584cc3558d2a124c278d9ed33e02eda7b Mon Sep 17 00:00:00 2001 From: Erik Troan Date: Fri, 7 Jul 2000 19:34:25 +0000 Subject: round package sizes up based on a 4k block size for files --- utils/genhdlist.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'utils') diff --git a/utils/genhdlist.c b/utils/genhdlist.c index 45244cd1f..a8c243a29 100644 --- a/utils/genhdlist.c +++ b/utils/genhdlist.c @@ -28,6 +28,8 @@ int onePass(FD_t outfd, const char * dirName, int cdNum) { int_32 size; DIR * dir; struct stat sb; + int_32 * fileSizes; + int fileCount; sprintf(subdir, "%s/RedHat/RPMS", dirName); @@ -95,6 +97,23 @@ int onePass(FD_t outfd, const char * dirName, int cdNum) { headerAddEntry(h, FILESIZE_TAG, RPM_INT32_TYPE, &size, 1); + /* Recaclulate the package size based on a 4k block size */ + if (headerGetEntry(h, RPMTAG_FILESIZES, NULL, + (void **) &fileSizes, &fileCount)) { + int fileNum; + int newSize = 0; + int * p; + + for (fileNum = 0; fileNum < fileCount; fileNum++) + newSize += ((fileSizes[fileNum] + 4093) / 4096) * 4096; + + headerGetEntry(h, RPMTAG_SIZE, NULL, &p, NULL); + + headerRemoveEntry(h, RPMTAG_SIZE); + headerAddEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, + &newSize, 1); + } + if (cdNum > -1) headerAddEntry(h, CDNUM_TAG, RPM_INT32_TYPE, &cdNum, 1); -- cgit