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

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   01-Mar-2008 00:59:43
  Branch: HEAD                             Handle: 2008022923594201

  Modified files:
    rpm                     CHANGES
    rpm/build               pack.c
    rpm/lib                 fsm.c psm.c rpmds.c
    rpm/rpmio               Makefile.am ar.c librpmio.vers tdeb.c

  Log:
    - jbj: permit ar(1) payloads (file names are truncated atm).

  Summary:
    Revision    Changes     Path
    1.2213      +1  -0      rpm/CHANGES
    2.286       +5  -0      rpm/build/pack.c
    2.145       +16 -2      rpm/lib/fsm.c
    2.289       +3  -1      rpm/lib/psm.c
    2.91        +3  -0      rpm/lib/rpmds.c
    1.142       +5  -5      rpm/rpmio/Makefile.am
    1.2         +29 -12     rpm/rpmio/ar.c
    2.53        +5  -0      rpm/rpmio/librpmio.vers
    1.2         +0  -7      rpm/rpmio/tdeb.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2212 -r1.2213 CHANGES
  --- rpm/CHANGES       29 Feb 2008 20:38:55 -0000      1.2212
  +++ rpm/CHANGES       29 Feb 2008 23:59:42 -0000      1.2213
  @@ -1,4 +1,5 @@
   5.0.0 -> 5.1a1:
  +    - jbj: permit ar(1) payloads (file names are truncated atm).
       - jbj: rpmmg: fix: avoid false failure using <pcreposix.h>.
       - jbj: macro: use popt rather than getopt(3), get rid of POSIXLY_CORRECT.
       - jbj: rpmio: splint fiddles.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/pack.c
  ============================================================================
  $ cvs diff -u -r2.285 -r2.286 pack.c
  --- rpm/build/pack.c  17 Feb 2008 02:52:11 -0000      2.285
  +++ rpm/build/pack.c  29 Feb 2008 23:59:42 -0000      2.286
  @@ -644,6 +644,11 @@
                /* XXX addition to header is too late to be displayed/sorted. */
                /* Add prereq on rpm version that understands tar payloads */
                (void) rpmlibNeedsFeature(h, "PayloadIsUstar", "4.4.4-1");
  +         } else
  +         if (!strcmp(payload_format, "ar")) {
  +             /* XXX addition to header is too late to be displayed/sorted. */
  +             /* Add prereq on rpm version that understands tar payloads */
  +             (void) rpmlibNeedsFeature(h, "PayloadIsAr", "5.1-1");
            }
   
            he->tag = RPMTAG_PAYLOADFORMAT;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/fsm.c
  ============================================================================
  $ cvs diff -u -r2.144 -r2.145 fsm.c
  --- rpm/lib/fsm.c     5 Feb 2008 08:11:18 -0000       2.144
  +++ rpm/lib/fsm.c     29 Feb 2008 23:59:43 -0000      2.145
  @@ -12,6 +12,7 @@
   
   #include "cpio.h"
   #include "tar.h"
  +#include "ar.h"
   
   #define      _RPMFI_INTERNAL
   #include "fsm.h"
  @@ -549,7 +550,17 @@
            fsm->headerWrite = &tarHeaderWrite;
            fsm->trailerWrite = &tarTrailerWrite;
            fsm->blksize = TAR_BLOCK_SIZE;
  -     } else  {
  +     } else
  +     if (afmt != NULL && !strcmp(afmt, "ar")) {
  +if (_fsm_debug < 0)
  +fprintf(stderr, "\tar vectors set\n");
  +         _fsmNext = &fsmNext;
  +         fsm->headerRead = &arHeaderRead;
  +         fsm->headerWrite = &arHeaderWrite;
  +         fsm->trailerWrite = &arTrailerWrite;
  +         fsm->blksize = 2;
  +     } else
  +     {
   if (_fsm_debug < 0)
   fprintf(stderr, "\tcpio vectors set\n");
            fsm->headerRead = &cpioHeaderRead;
  @@ -2372,7 +2383,10 @@
       case FSM_PAD:
        left = (fsm->blksize - (fdGetCpioPos(fsm->cfd) % fsm->blksize)) % 
fsm->blksize;
        if (left) {
  -         memset(fsm->rdbuf, 0, left);
  +         if (fsm->blksize == 2)
  +             fsm->rdbuf[0] = '\n';   /* XXX ar(1) pads with '\n' */
  +         else
  +             memset(fsm->rdbuf, 0, left);
            /* XXX DWRITE uses rdnb for I/O length. */
            fsm->rdnb = left;
            (void) fsmNext(fsm, FSM_DWRITE);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/psm.c
  ============================================================================
  $ cvs diff -u -r2.288 -r2.289 psm.c
  --- rpm/lib/psm.c     17 Feb 2008 18:24:16 -0000      2.288
  +++ rpm/lib/psm.c     29 Feb 2008 23:59:43 -0000      2.289
  @@ -2449,7 +2449,9 @@
        xx = headerGet(fi->h, he, 0);
        payload_format = he->p.str;
        if (!xx || payload_format == NULL
  -      || !(!strcmp(payload_format, "tar") || !strcmp(payload_format, 
"ustar"))) {
  +      || !(!strcmp(payload_format, "tar") || !strcmp(payload_format, 
"ustar"))
  +      || !(!strcmp(payload_format, "ar")))
  +     {
            payload_format = _free(payload_format);
            payload_format = xstrdup("cpio");
        }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmds.c
  ============================================================================
  $ cvs diff -u -r2.90 -r2.91 rpmds.c
  --- rpm/lib/rpmds.c   17 Feb 2008 18:24:16 -0000      2.90
  +++ rpm/lib/rpmds.c   29 Feb 2008 23:59:43 -0000      2.91
  @@ -1394,6 +1394,9 @@
       { "rpmlib(FileDigestParameterized)",    "4.4.6-1",
        (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
       N_("file digests can be other than MD5.") },
  +    { "rpmlib(PayloadIsAr)",         "5.1-1",
  +     (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
  +    N_("package payload can be in ar archive format.") },
       { NULL,                          NULL, 0,        NULL }
   };
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/Makefile.am
  ============================================================================
  $ cvs diff -u -r1.141 -r1.142 Makefile.am
  --- rpm/rpmio/Makefile.am     29 Feb 2008 19:25:37 -0000      1.141
  +++ rpm/rpmio/Makefile.am     29 Feb 2008 23:59:43 -0000      1.142
  @@ -4,7 +4,7 @@
   
   LINT = splint
   
  -EXTRA_DIST = ar.c tdeb.c tdir.c tfts.c tget.c tglob.c thkp.c thtml.c tinv.c 
tkey.c tmire.c tput.c trpmio.c tsw.c ttar.c lookup3.c tpw.c librpmio.vers 
testit.sh rpmgrep.1
  +EXTRA_DIST = tdeb.c tdir.c tfts.c tget.c tglob.c thkp.c thtml.c tinv.c 
tkey.c tmire.c tput.c trpmio.c tsw.c ttar.c lookup3.c tpw.c librpmio.vers 
testit.sh rpmgrep.1
   
   EXTRA_PROGRAMS = tdeb tdir tfts tget tglob thkp thtml tinv tkey tmacro 
tmagic tmire tput tpw trpmio tsw ttar dumpasn1 lookup3
   
  @@ -43,19 +43,19 @@
   
   pkgincdir = $(pkgincludedir)$(WITH_PATH_VERSIONED_SUFFIX)
   pkginc_HEADERS = \
  -     argv.h envvar.h fts.h mire.h rpmbc.h rpmcb.h rpmdav.h \
  +     ar.h argv.h envvar.h fts.h mire.h rpmbc.h rpmcb.h rpmdav.h \
        rpmhash.h rpmio.h rpmio-stub.h rpmlog.h rpmmacro.h rpmmg.h \
        rpmnss.h rpmpgp.h rpmsq.h rpmssl.h rpmsw.h rpmurl.h rpmxar.h \
        stringbuf.h ugid.h rpmuuid.h
   noinst_HEADERS = \
  -     ar.h md2.h md4.h poptIO.h rmd128.h rmd160.h rmd256.h rmd320.h sha224.h \
  +     md2.h md4.h poptIO.h rmd128.h rmd160.h rmd256.h rmd320.h sha224.h \
        salsa10.h salsa20.h tiger.h \
        LzmaDecode.h rpmhook.h rpmio_internal.h rpmlua.h
   
   usrlibdir = $(libdir)
   usrlib_LTLIBRARIES = librpmio.la
   librpmio_la_SOURCES = \
  -     argv.c digest.c fts.c getpass.c macro.c mire.c mount.c \
  +     ar.c argv.c digest.c fts.c getpass.c macro.c mire.c mount.c \
        md2.c md4.c poptIO.c rmd128.c rmd160.c rmd256.c rmd320.c sha224.c \
        salsa10.c salsa20.c tiger.c LzmaDecode.c \
        rpmbc.c rpmdav.c rpmhash.c rpmhook.c rpmio.c rpmio-stub.c \
  @@ -154,7 +154,7 @@
   rpmdigest_SOURCES = rpmdigest.c
   rpmdigest_LDADD = $(RPMIO_LDADD)
   
  -tdeb_SOURCES = tdeb.c ar.c
  +tdeb_SOURCES = tdeb.c
   tdeb_LDFLAGS = $(RPM_LDADD)
   
   tdir_SOURCES = tdir.c
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/ar.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 ar.c
  --- rpm/rpmio/ar.c    29 Feb 2008 19:25:37 -0000      1.1
  +++ rpm/rpmio/ar.c    29 Feb 2008 23:59:43 -0000      1.2
  @@ -5,7 +5,7 @@
   
   #include "system.h"
   
  -#include <rpmio.h>
  +#include <rpmio_internal.h>  /* XXX fdGetCpioPos AR_MAGIC */
   #include <rpmlib.h>
   
   #include "ar.h"
  @@ -93,6 +93,11 @@
   if (_ar_debug)
   fprintf(stderr, "    arHeaderRead(%p, %p)\n", fsm, st);
   
  +    /* XXX Read AR_MAGIC to beginning of ar(1) archive. */
  +    if (fdGetCpioPos(fsm->cfd) == 0) {
  +     (void) arRead(fsm, fsm->wrbuf, sizeof(AR_MAGIC)-1);
  +    }
  +
   top:
       rc = arRead(fsm, hdr, sizeof(*hdr));
       if (rc <= 0)     return -rc;
  @@ -179,32 +184,42 @@
   {
       FSM_t fsm = _fsm;
       arHeader hdr = (arHeader) fsm->rdbuf;
  +    size_t nb;
       int rc = 0;
   
   if (_ar_debug)
   fprintf(stderr, "    arHeaderWrite(%p, %p)\n", fsm, st);
   
  -    memset(hdr, 0, sizeof(*hdr));
  +    /* XXX Write AR_MAGIC to beginning of ar(1) archive. */
  +    if (fdGetCpioPos(fsm->cfd) == 0) {
  +     (void) arWrite(fsm, AR_MAGIC, sizeof(AR_MAGIC)-1);
  +    }
   
  -    memset(hdr->name, ' ', sizeof(*hdr->name));
  -    strncpy(hdr->name, fsm->path, sizeof(hdr->name));
  +    memset(hdr, ' ', sizeof(*hdr));
   
  -    sprintf(hdr->mtime, "%011o", (unsigned) (st->st_mtime & 037777777777));
  -    sprintf(hdr->uid, "%06o", (unsigned int)(st->st_uid & 07777777));
  -    sprintf(hdr->gid, "%06o", (unsigned int)(st->st_gid & 07777777));
  +    nb = strlen(fsm->path);
  +    if (nb >= sizeof(hdr->name))
  +     nb = sizeof(hdr->name)-1;
  +    strncpy(hdr->name, fsm->path, nb);
  +    hdr->name[nb] = '/';
  +
  +    sprintf(hdr->mtime, "%-12d", (unsigned) (st->st_mtime & 037777777777));
  +    sprintf(hdr->uid, "%-6d", (unsigned int)(st->st_uid & 07777777));
  +    sprintf(hdr->gid, "%-6d", (unsigned int)(st->st_gid & 07777777));
   
  -    sprintf(hdr->mode, "%07o", (unsigned int)(st->st_mode & 00007777));
  -    sprintf(hdr->filesize, "%011o", (unsigned) (st->st_size & 037777777777));
  +    sprintf(hdr->mode, "%-8o", (unsigned int)(st->st_mode & 07777777));
  +    sprintf(hdr->filesize, "%-10d", (unsigned) (st->st_size & 037777777777));
   
       strncpy(hdr->marker, AR_MARKER, sizeof(AR_MARKER)-1);
   
  +rc = sizeof(*hdr);
  +if (_ar_debug)
  +fprintf(stderr, "==> %p[%u] \"%.*s\"\n", hdr, (unsigned)rc, 
(int)sizeof(*hdr), (char *)hdr);
  +
       rc = arWrite(fsm, hdr, sizeof(*hdr));
       if (rc < 0)      return -rc;
       rc = 0;
   
  -    /* XXX Padding is unnecessary but shouldn't hurt. */
  -    rc = _fsmNext(fsm, FSM_PAD);
  -
       return rc;
   }
   
  @@ -216,5 +231,7 @@
   if (_ar_debug)
   fprintf(stderr, "    arTrailerWrite(%p)\n", fsm);
   
  +    rc = _fsmNext(fsm, FSM_PAD);
  +
       return rc;
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/librpmio.vers
  ============================================================================
  $ cvs diff -u -r2.52 -r2.53 librpmio.vers
  --- rpm/rpmio/librpmio.vers   27 Feb 2008 15:12:38 -0000      2.52
  +++ rpm/rpmio/librpmio.vers   29 Feb 2008 23:59:43 -0000      2.53
  @@ -6,6 +6,10 @@
       _Access;
       addMacro;
       appendStringBufAux;
  +    _ar_debug;
  +    arHeaderRead;
  +    arHeaderWrite;
  +    arTrailerWrite;
       argiAdd;
       argiCount;
       argiData;
  @@ -62,6 +66,7 @@
       __debug;
       delMacro;
       expandMacros;
  +    _fsmNext;
       Fclose;
       _Fclose;
       Fcntl;
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tdeb.c
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 tdeb.c
  --- rpm/rpmio/tdeb.c  29 Feb 2008 19:25:37 -0000      1.1
  +++ rpm/rpmio/tdeb.c  29 Feb 2008 23:59:43 -0000      1.2
  @@ -33,18 +33,11 @@
   
        fi = rpmfiNew(ts, NULL, RPMTAG_BASENAMES, 0);
   
  -     fi->fsm->headerRead = &arHeaderRead;
  -     fi->fsm->headerWrite = &arHeaderWrite;
  -     fi->fsm->trailerWrite = &arTrailerWrite;
  -     fi->fsm->blksize = 1;   /* XXX AR_BLOCKSIZE? */
  -
        psm = rpmpsmNew(ts, NULL, fi);
   
        ioflags = (mapflags & CPIO_PAYLOAD_CREATE) ? "w.ufdio" : "r.ufdio";
        psm->cfd = Fopen(fn, ioflags);
        if (psm->cfd != NULL && !Ferror(psm->cfd)) {
  -char buf[BUFSIZ];
  -Fread(buf, 1, sizeof(AR_MAGIC)-1, psm->cfd);
   
            fi->mapflags |= mapflags;
            fsmmode = (mapflags & CPIO_PAYLOAD_CREATE) ? FSM_PKGBUILD : 
FSM_PKGINSTALL;
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to