RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Anders F. Björklund
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: xar                              Date:   20-Oct-2007 21:08:26
  Branch: HEAD                             Handle: 2007102020082501

  Modified files:
    xar                     ChangeLog
    xar/include             xar.h.in
    xar/lib                 bzxar.c lzmaxar.c zxar.c
    xar/src                 xar.1 xar.c

  Log:
    compression args from upstream

  Summary:
    Revision    Changes     Path
    1.7         +2  -0      xar/ChangeLog
    1.7         +17 -16     xar/include/xar.h.in
    1.6         +14 -1      xar/lib/bzxar.c
    1.3         +14 -1      xar/lib/lzmaxar.c
    1.6         +14 -1      xar/lib/zxar.c
    1.7         +4  -0      xar/src/xar.1
    1.11        +10 -0      xar/src/xar.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: xar/ChangeLog
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 ChangeLog
  --- xar/ChangeLog     20 Oct 2007 19:03:56 -0000      1.6
  +++ xar/ChangeLog     20 Oct 2007 19:08:25 -0000      1.7
  @@ -1,4 +1,6 @@
   devel
  +     2007-10-16 Rob Braun [EMAIL PROTECTED]
  +     * include/xar.h.in src/xar.c lib/io.c lib/lzmaxar.c lib/bzxar.c 
lib/archive.c lib/zxar.c: Added an option to pass arguments to the compression 
code.  This to allow specifying compression levels to gzip, bzip2, and lzma.
        * lib/io.c: Issue 41, fixed a bug where rsize was being used 
uninitialized.
        * lib/io.c: Issue 42, log a warning and continue if archived-checksum 
doesn't appear when archiving a file.
        * lib/archive.c: Issue 43, free the buffer in xar_extract_tobuffersz() 
if there is an error extracting the file.
  @@ .
  patch -p0 <<'@@ .'
  Index: xar/include/xar.h.in
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 xar.h.in
  --- xar/include/xar.h.in      2 Oct 2007 21:51:55 -0000       1.6
  +++ xar/include/xar.h.in      20 Oct 2007 19:08:25 -0000      1.7
  @@ -104,22 +104,23 @@
   #define XAR_OPT_VAL_SHA1 "sha1"
   #define XAR_OPT_VAL_MD5  "md5"
   
  -#define XAR_OPT_COMPRESSION "compression" /* set the file compression type */
  -#define XAR_OPT_VAL_GZIP    "gzip"
  -#define XAR_OPT_VAL_BZIP    "bzip2"
  -#define XAR_OPT_VAL_LZMA    "lzma"
  -
  -#define XAR_OPT_RSIZE       "rsize"       /* Read io buffer size */
  -
  -#define XAR_OPT_COALESCE    "coalesce"    /* Coalesce identical heap blocks 
*/
  -#define XAR_OPT_LINKSAME    "linksame"    /* Hardlink identical files */
  -
  -#define XAR_OPT_PROPINCLUDE "prop-include" /* File property to include */
  -#define XAR_OPT_PROPEXCLUDE "prop-exclude" /* File property to exclude */
  -
  -#define XAR_OPT_SAVESUID    "savesuid"     /* Preserve setuid/setgid bits */
  -#define XAR_OPT_VAL_TRUE    "true"
  -#define XAR_OPT_VAL_FALSE   "false"
  +#define XAR_OPT_COMPRESSION    "compression" /* set the file compression 
type */
  +#define XAR_OPT_COMPRESSIONARG "compression-arg" /* set the compression opts 
*/
  +#define XAR_OPT_VAL_GZIP       "gzip"
  +#define XAR_OPT_VAL_BZIP       "bzip2"
  +#define XAR_OPT_VAL_LZMA       "lzma"
  +
  +#define XAR_OPT_RSIZE          "rsize"       /* Read io buffer size */
  +
  +#define XAR_OPT_COALESCE       "coalesce"    /* Coalesce identical heap 
blocks */
  +#define XAR_OPT_LINKSAME       "linksame"    /* Hardlink identical files */
  +
  +#define XAR_OPT_PROPINCLUDE    "prop-include" /* File property to include */
  +#define XAR_OPT_PROPEXCLUDE    "prop-exclude" /* File property to exclude */
  +
  +#define XAR_OPT_SAVESUID       "savesuid"     /* Preserve setuid/setgid bits 
*/
  +#define XAR_OPT_VAL_TRUE       "true"
  +#define XAR_OPT_VAL_FALSE      "false"
   
   /* xar signing algorithms */
   #define XAR_SIG_SHA1RSA              1
  @@ .
  patch -p0 <<'@@ .'
  Index: xar/lib/bzxar.c
  ============================================================================
  $ cvs diff -u -r1.5 -r1.6 bzxar.c
  --- xar/lib/bzxar.c   2 Oct 2007 21:51:56 -0000       1.5
  +++ xar/lib/bzxar.c   20 Oct 2007 19:08:25 -0000      1.6
  @@ -44,6 +44,7 @@
   #include <stdlib.h>
   #include <string.h>
   #include <sys/types.h>
  +#include <errno.h>
   #ifdef HAVE_LIBBZ2
   #include <bzlib.h>
   #endif
  @@ -174,6 +175,7 @@
   
        /* on first run, we init the context and check the compression type */
        if( !BZIP2_CONTEXT(context) ) {
  +             int level = 9;
                *context = calloc(1,sizeof(struct _bzip_context));
                
                opt = xar_opt_get(x, XAR_OPT_COMPRESSION);
  @@ -182,8 +184,19 @@
                
                if( strcmp(opt, XAR_OPT_VAL_BZIP) != 0 )
                        return 0;
  +
  +             opt = xar_opt_get(x, XAR_OPT_COMPRESSIONARG);
  +             if( opt ) {
  +                     int tmp;
  +                     errno = 0;
  +                     tmp = strtol(opt, NULL, 10);
  +                     if( errno == 0 ) {
  +                             if( (level >= 0) && (level <= 9) )
  +                                     level = tmp;
  +                     }
  +             }
                
  -             BZ2_bzCompressInit(&BZIP2_CONTEXT(context)->bz, 9, 0, 30);
  +             BZ2_bzCompressInit(&BZIP2_CONTEXT(context)->bz, level, 0, 30);
                BZIP2_CONTEXT(context)->bzipcompressed = 1;
        }else if( !BZIP2_CONTEXT(context)->bzipcompressed ){
                /* once the context has been initialized, then we have already
  @@ .
  patch -p0 <<'@@ .'
  Index: xar/lib/lzmaxar.c
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 lzmaxar.c
  --- xar/lib/lzmaxar.c 14 Oct 2007 08:22:54 -0000      1.2
  +++ xar/lib/lzmaxar.c 20 Oct 2007 19:08:25 -0000      1.3
  @@ -44,6 +44,7 @@
   #include <stdlib.h>
   #include <string.h>
   #include <sys/types.h>
  +#include <errno.h>
   #ifdef HAVE_LIBLZMA
   #include <lzma.h>
   #endif
  @@ -188,6 +189,7 @@
   
        /* on first run, we init the context and check the compression type */
        if( !LZMA_CONTEXT(context) ) {
  +             int level = preset_level; /* RPM5: use preset_level instead of 
9 */
                *context = calloc(1,sizeof(struct _lzma_context));
                
                opt = xar_opt_get(x, XAR_OPT_COMPRESSION);
  @@ -196,6 +198,17 @@
                
                if( strcmp(opt, XAR_OPT_VAL_LZMA) != 0 )
                        return 0;
  +
  +             opt = xar_opt_get(x, XAR_OPT_COMPRESSIONARG);
  +             if( opt ) {
  +                     int tmp;
  +                     errno = 0;
  +                     tmp = strtol(opt, NULL, 10);
  +                     if( errno == 0 ) {
  +                             if( (level >= 0) && (level <= 9) )
  +                                     level = tmp;
  +                     }
  +             }
                
                lzma_init_encoder();
                LZMA_CONTEXT(context)->options.check = LZMA_CHECK_CRC64;
  @@ -210,7 +223,7 @@
   #endif
                LZMA_CONTEXT(context)->options.filters[0].options = NULL;
                LZMA_CONTEXT(context)->options.filters[1].id = LZMA_FILTER_LZMA;
  -             LZMA_CONTEXT(context)->options.filters[1].options = 
(lzma_options_lzma *)(lzma_preset_lzma + preset_level - 1);
  +             LZMA_CONTEXT(context)->options.filters[1].options = 
(lzma_options_lzma *)(lzma_preset_lzma + level - 1);
                /* Terminate the filter options array. */
                LZMA_CONTEXT(context)->options.filters[2].id = UINT64_MAX;
                LZMA_CONTEXT(context)->lzma = LZMA_STREAM_INIT_VAR;
  @@ .
  patch -p0 <<'@@ .'
  Index: xar/lib/zxar.c
  ============================================================================
  $ cvs diff -u -r1.5 -r1.6 zxar.c
  --- xar/lib/zxar.c    2 Oct 2007 21:51:56 -0000       1.5
  +++ xar/lib/zxar.c    20 Oct 2007 19:08:25 -0000      1.6
  @@ -45,6 +45,7 @@
   #include <string.h>
   #include <sys/types.h>
   #include <zlib.h>
  +#include <errno.h>
   #include "xar.h"
   #include "filetree.h"
   #include "io.h"
  @@ -162,6 +163,7 @@
   
        /* on first run, we init the context and check the compression type */
        if( !GZIP_CONTEXT(context) ) {
  +             int level = Z_BEST_COMPRESSION;
                *context = calloc(1,sizeof(struct _gzip_context));
                
                opt = xar_opt_get(x, XAR_OPT_COMPRESSION);
  @@ -170,8 +172,19 @@
                
                if( strcmp(opt, XAR_OPT_VAL_GZIP) != 0 )
                        return 0;
  +
  +             opt = xar_opt_get(x, XAR_OPT_COMPRESSIONARG);
  +             if( opt ) {
  +                     int tmp;
  +                     errno = 0;
  +                     tmp = strtol(opt, NULL, 10);
  +                     if( errno == 0 ) {
  +                             if( (level >= 0) && (level <= 9) )
  +                                     level = tmp;
  +                     }
  +             }
                
  -             deflateInit(&GZIP_CONTEXT(context)->z, Z_BEST_COMPRESSION);
  +             deflateInit(&GZIP_CONTEXT(context)->z, level);
                GZIP_CONTEXT(context)->gzipcompressed = 1;
                if( *inlen == 0 )
                        return 0;
  @@ .
  patch -p0 <<'@@ .'
  Index: xar/src/xar.1
  ============================================================================
  $ cvs diff -u -r1.6 -r1.7 xar.1
  --- xar/src/xar.1     2 Oct 2007 21:51:56 -0000       1.6
  +++ xar/src/xar.1     20 Oct 2007 19:08:26 -0000      1.7
  @@ -42,6 +42,10 @@
   \-z
   Synonym for \-\-compression=gzip
   .TP
  +\-\-compression-args=<arguments>
  +Specifies arguments to the compression engine selected.
  +gzip, bzip2, and lzma all take a single integer argument between 0 and 9 
specifying the compression level to use.
  +.TP
   \-\-dump\-toc=<filename>
   Has xar dump the xml header into the specified file.  "-" can be specified 
to mean stdout.
   .TP
  @@ .
  patch -p0 <<'@@ .'
  Index: xar/src/xar.c
  ============================================================================
  $ cvs diff -u -r1.10 -r1.11 xar.c
  --- xar/src/xar.c     2 Oct 2007 21:51:56 -0000       1.10
  +++ xar/src/xar.c     20 Oct 2007 19:08:26 -0000      1.11
  @@ -61,6 +61,7 @@
   static char *Toccksum = NULL;
   static char *Compression = NULL;
   static char *Rsize = NULL;
  +static char *CompressionArg = NULL;
   
   static int Err = 0;
   static int List = 0;
  @@ -183,6 +184,9 @@
        if( Compression )
                xar_opt_set(x, XAR_OPT_COMPRESSION, Compression);
   
  +     if( CompressionArg )
  +             xar_opt_set(x, XAR_OPT_COMPRESSIONARG, CompressionArg);
  +
        if( Coalesce )
                xar_opt_set(x, XAR_OPT_COALESCE, "true");
   
  @@ -669,6 +673,8 @@
        fprintf(stderr, "\t                      Default: gzip\n");
        fprintf(stderr, "\t-j               Synonym for 
\"--compression=bzip2\"\n");
        fprintf(stderr, "\t-z               Synonym for 
\"--compression=gzip\"\n");
  +     fprintf(stderr, "\t--compression-args=arg Specifies arguments to be 
passed\n");
  +     fprintf(stderr, "\t                       to the compression 
engine.\n");
        fprintf(stderr, "\t--list-subdocs   List the subdocuments in the xml 
header\n");
        fprintf(stderr, "\t--extract-subdoc=name Extracts the specified 
subdocument\n");
        fprintf(stderr, "\t                      to a document in cwd named 
<name>.xml\n");
  @@ -729,6 +735,7 @@
                {"distribution", 0, 0, 14},
                {"keep-existing", 0, 0, 15},
                {"keep-setuid", 0, 0, 16},
  +             {"compression-args", 1, 0, 17},
                { 0, 0, 0, 0}
        };
   
  @@ -890,6 +897,9 @@
                case 16 :
                        SaveSuid++;
                        break;
  +             case 17 :
  +                     CompressionArg = optarg;
  +                     break;
                case 'c':
                case 'x':
                case 't':
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to