configurable compression type/level for package payloads.
authorjbj <devnull@localhost>
Tue, 11 Jan 2000 16:13:16 +0000 (16:13 +0000)
committerjbj <devnull@localhost>
Tue, 11 Jan 2000 16:13:16 +0000 (16:13 +0000)
CVS patchset: 3516
CVS date: 2000/01/11 16:13:16

CHANGES
build/pack.c
macros.in

diff --git a/CHANGES b/CHANGES
index 44e5c45..2198a9b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -40,6 +40,7 @@
        - updated sv.po (goeran@uddeborg.pp.se) (#8349).
        - configurable PATH for install %pre/%post et al scriptlets.
        - use only %_install_langs, not LINGUAS/LANG when deciding to install.
+       - configurable compression type/level for package payloads.
 
 3.0.2 -> 3.0.3
        - add --eval to find result of macro expansion.
index b58ef29..8f06c9f 100644 (file)
@@ -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;
 }
index d66e67e..0185891 100644 (file)
--- a/macros.in
+++ b/macros.in
@@ -1,4 +1,4 @@
-# $Id: macros.in,v 1.41 2000/01/11 15:22:35 jbj Exp $
+# $Id: macros.in,v 1.42 2000/01/11 16:13:16 jbj Exp $
 #==============================================================================
 # Macro naming conventions (preliminary):
 #
 #
 #%packager
 
+#      Compression type and level for package payloads.
+#              "w9.gzdio"      gzip level 9 (default).
+#              "w9.bzdio"      bzip2 level 9 (experimental, at your own risk).
+#
+#%_payload_compression w9.gzdio
+
 #      The signature to use and the location of configuration files for
 #      signing packages with PGP.
 #