diff options
author | Erik Troan <ewt@redhat.com> | 2000-07-07 19:34:25 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2000-07-07 19:34:25 +0000 |
commit | d4977de584cc3558d2a124c278d9ed33e02eda7b (patch) | |
tree | b58a9f53ab6f8e2a18c141cdf72719bd132ca4ff /utils | |
parent | 594fae9dfebb7f8cda57f8e6e59185d442af183b (diff) | |
download | anaconda-d4977de584cc3558d2a124c278d9ed33e02eda7b.tar.gz anaconda-d4977de584cc3558d2a124c278d9ed33e02eda7b.tar.xz anaconda-d4977de584cc3558d2a124c278d9ed33e02eda7b.zip |
round package sizes up based on a 4k block size for files
Diffstat (limited to 'utils')
-rw-r--r-- | utils/genhdlist.c | 19 |
1 files changed, 19 insertions, 0 deletions
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); |