summaryrefslogtreecommitdiff
path: root/build/pack.c
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-01-11 16:13:16 +0000
committerjbj <devnull@localhost>2000-01-11 16:13:16 +0000
commit483793a8776118bc968485f83a880e0cedb0fe24 (patch)
tree458240de94bd86b3bccf2d22a60dcfea9ae93bd7 /build/pack.c
parent2e2da920eaf13d75d4694cfe12a5b324871d13bf (diff)
downloadlibrpm-tizen-483793a8776118bc968485f83a880e0cedb0fe24.tar.gz
librpm-tizen-483793a8776118bc968485f83a880e0cedb0fe24.tar.bz2
librpm-tizen-483793a8776118bc968485f83a880e0cedb0fe24.zip
configurable compression type/level for package payloads.
CVS patchset: 3516 CVS date: 2000/01/11 16:13:16
Diffstat (limited to 'build/pack.c')
-rw-r--r--build/pack.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/build/pack.c b/build/pack.c
index b58ef2918..8f06c9f6e 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -274,7 +274,7 @@ int writeRPM(Header h, const char *fileName, int type,
rc = RPMERR_NOSPACE;
} else { /* Write the archive and get the size */
if (csa->cpioList != NULL) {
- rc = cpio_doio(fd, csa, "w9.gzdio");
+ rc = cpio_doio(fd, csa, "%{_payload_compression}");
} else if (Fileno(csa->cpioFdIn) >= 0) {
rc = cpio_copy(fd, csa);
} else {
@@ -416,12 +416,15 @@ int writeRPM(Header h, const char *fileName, int type,
return 0;
}
-static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmode)
+static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmodeMacro)
{
FD_t cfd;
int rc;
const char *failedFile = NULL;
+ const char *fmode = rpmExpand(fmodeMacro, NULL);
+ if (!(fmode && fmode[0] == 'w'))
+ fmode = xstrdup("w9.gzdio");
(void) Fflush(fdo);
cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
rc = cpioBuildArchive(cfd, csa->cpioList, csa->cpioCount, NULL, NULL,
@@ -435,6 +438,7 @@ static int cpio_doio(FD_t fdo, CSA_t * csa, const char * fmode)
Fclose(cfd);
if (failedFile)
xfree(failedFile);
+ xfree(fmode);
return rc;
}