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:   12-May-2008 20:30:24
  Branch: HEAD                             Handle: 2008051218302400

  Modified files:
    rpm                     CHANGES rpmpopt.in
    rpm/rpmio               rpmrepo.c

  Log:
    - jbj: rpmrepo: achieve {primary,filelists,other}.xml spew parity w 
createrepo.
    - jbj: rpmrepo: compute origin *.rpm file digest while reading.

  Summary:
    Revision    Changes     Path
    1.2341      +2  -0      rpm/CHANGES
    1.46        +38 -8      rpm/rpmio/rpmrepo.c
    2.64        +3  -3      rpm/rpmpopt.in
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2340 -r1.2341 CHANGES
  --- rpm/CHANGES       12 May 2008 18:17:56 -0000      1.2340
  +++ rpm/CHANGES       12 May 2008 18:30:24 -0000      1.2341
  @@ -1,5 +1,7 @@
   
   5.1.0 -> 5.2a0:
  +    - jbj: rpmrepo: achieve {primary,filelists,other}.xml spew parity w 
createrepo.
  +    - jbj: rpmrepo: compute origin *.rpm file digest while reading.
       - jbj: preserve stat(2) & digest through headerReload().
       - jbj: get rid of copy-n-paste typos, add "l" type markers to rpmtag.h.
       - jbj: add RPMTAG_PACKAGEDIGEST extension as RPM_STRING_TYPE.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmrepo.c
  ============================================================================
  $ cvs diff -u -r1.45 -r1.46 rpmrepo.c
  --- rpm/rpmio/rpmrepo.c       4 May 2008 13:16:45 -0000       1.45
  +++ rpm/rpmio/rpmrepo.c       12 May 2008 18:30:24 -0000      1.46
  @@ -144,6 +144,7 @@
   /[EMAIL PROTECTED]@*/
       ARGV_t directories;
       int ftsoptions;
  +    uint32_t pkgalgo;
       uint32_t algo;
       int compression;
   /[EMAIL PROTECTED]@*/
  @@ -189,19 +190,20 @@
   static const char repomd_xml_fini[] = "</repomd>\n";
   
   /* XXX todo: wire up popt aliases and bury the --queryformat glop 
externally. */
  +/* XXX todo: change to "... installed=\"%{SIZE}\" ..." */
   /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/
   static const char primary_xml_qfmt[] = "\
   <package type=\"rpm\">\
   \n  <name>%{NAME:cdata}</name>\
   \n  <arch>%{ARCH:cdata}</arch>\
   \n  <version epoch=\"%|EPOCH?{%{EPOCH}}:{0}|\" ver=\"%{VERSION:cdata}\" 
rel=\"%{RELEASE:cdata}\"/>\
  -\n  <checksum type=\"sha\" pkgid=\"NO\">%|HDRID?{%{HDRID}}|</checksum>\
  +\n  <checksum type=\"sha\" 
pkgid=\"YES\">%|PACKAGEDIGEST?{%{PACKAGEDIGEST}}|</checksum>\
   \n  <summary>%{SUMMARY:cdata}</summary>\
   \n  <description>%{DESCRIPTION:cdata}</description>\
   \n  <packager>%|PACKAGER?{%{PACKAGER:cdata}}:{}|</packager>\
   \n  <url>%|URL?{%{URL:cdata}}:{}|</url>\
   \n  <time file=\"%{PACKAGETIME}\" build=\"%{BUILDTIME}\"/>\
  -\n  <size package=\"%{SIZE}\" installed=\"%{SIZE}\" 
archive=\"%{ARCHIVESIZE}\"/>\
  +\n  <size package=\"%{PACKAGESIZE}\" installed=\"%{PACKAGESIZE}\" 
archive=\"%{ARCHIVESIZE}\"/>\
   \n  <location href=\"%{PACKAGEORIGIN:bncdata}\"/>\
   \n  <format>\
   %|license?{\
  @@ -275,7 +277,7 @@
   
   /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/
   static const char filelists_xml_qfmt[] = "\
  -<package pkgid=\"%|HDRID?{%{HDRID}}:{XXX}|\" name=\"%{NAME:cdata}\" 
arch=\"%{ARCH:cdata}\">\
  +<package pkgid=\"%|PACKAGEDIGEST?{%{PACKAGEDIGEST}}|\" 
name=\"%{NAME:cdata}\" arch=\"%{ARCH:cdata}\">\
   \n  <version epoch=\"%|EPOCH?{%{EPOCH}}:{0}|\" ver=\"%{VERSION:cdata}\" 
rel=\"%{RELEASE:cdata}\"/>\
   %|filesxmlentry2?{\
   [\
  @@ -287,7 +289,7 @@
   
   /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/
   static const char other_xml_qfmt[] = "\
  -<package pkgid=\"%|HDRID?{%{HDRID}}:{XXX}|\" name=\"%{NAME:cdata}\" 
arch=\"%{ARCH:cdata}\">\
  +<package pkgid=\"%|PACKAGEDIGEST?{%{PACKAGEDIGEST}}|\" 
name=\"%{NAME:cdata}\" arch=\"%{ARCH:cdata}\">\
   \n  <version epoch=\"%|EPOCH?{%{EPOCH}}:{0}|\" ver=\"%{VERSION:cdata}\" 
rel=\"%{RELEASE:cdata}\"/>\
   %|changelogname?{\
   [\
  @@ -531,12 +533,13 @@
   static struct rpmrepo_s __rpmrepo = {
       .pretty  = 1,
   #if defined(WITH_SQLITE)
  -    .database        = 1,
  +    .database        = 0,
   #endif
       .tempdir = ".repodata",
       .finaldir        = "repodata",
       .olddir  = ".olddata",
       .markup  = ".xml",
  +    .pkgalgo = PGPHASHALGO_SHA1,
       .algo    = PGPHASHALGO_SHA1,
       .primary = {
        .type   = "primary",
  @@ -601,7 +604,13 @@
        /[EMAIL PROTECTED] fileSystem, internalState @*/
   {
       static size_t ncols = 80 - 1;    /* XXX TIOCGWINSIZ */
  -    size_t nb = fprintf(stdout, "\r%s: %d/%d - %s", __progname, current, 
total, item);
  +    const char * bn;
  +    size_t nb;
  +    if ((bn = strrchr(item, '/')) != NULL)
  +     bn++;
  +    else
  +     bn = item;
  +    nb = fprintf(stdout, "\r%s: %d/%d - %s", __progname, current, total, bn);
       if (nb < ncols)
        fprintf(stderr, "%*s", (int)(ncols - nb), "");
       ncols = nb;
  @@ -939,10 +948,31 @@
       Header h = NULL;
   
       if (fd != NULL) {
  +     uint32_t algo = repo->pkgalgo;
  +     rpmRC rpmrc;
  +
  +     if (algo != PGPHASHALGO_NONE)
  +         fdInitDigest(fd, algo, 0);
  +
        /* XXX what if path needs expansion? */
  -     rpmRC rpmrc = rpmReadPackageFile(repo->ts, fd, path, &h);
  +     rpmrc = rpmReadPackageFile(repo->ts, fd, path, &h);
  +     if (algo != PGPHASHALGO_NONE) {
  +         char buffer[128 * 1024];
  +         while (Fread(buffer, sizeof(buffer[0]), sizeof(buffer), fd) > 0)
  +             {};
  +         if (Ferror(fd)) {
  +             fprintf(stderr, _("%s: Fread(%s) failed: %s\n"),
  +                     __progname, path, Fstrerror(fd));
  +             rpmrc = RPMRC_FAIL;
  +         } else {
  +             static int asAscii = 1;
  +             const char *digest = NULL;
  +             fdFiniDigest(fd, algo, &digest, NULL, asAscii);
  +             (void) headerSetDigest(h, digest);
  +             digest = _free(digest);
  +         }
  +     }
   
  -    /* XXX todo: read the payload and collect the blessed file digest. */
        (void) Fclose(fd);
   
        switch (rpmrc) {
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmpopt.in
  ============================================================================
  $ cvs diff -u -r2.63 -r2.64 rpmpopt.in
  --- rpm/rpmpopt.in    4 May 2008 13:16:44 -0000       2.63
  +++ rpm/rpmpopt.in    12 May 2008 18:30:24 -0000      2.64
  @@ -2,7 +2,7 @@
   # \verbatim
   #
   # @USRLIBRPM@/@configure_input@
  -# $Id: rpmpopt.in,v 2.63 2008/05/04 13:16:44 jbj Exp $
  +# $Id: rpmpopt.in,v 2.64 2008/05/12 18:30:24 jbj Exp $
   #
   # This file *should not be modified*. Local customizations
   # belong in /etc/popt, not here. This file will be replaced
  @@ -108,13 +108,13 @@
   \n  <name>%{NAME:cdata}</name>\
   \n  <arch>%{ARCH:cdata}</arch>\
   \n  <version epoch="%|EPOCH?{%{EPOCH}}:{0}|" ver="%{VERSION:cdata}" 
rel="%{RELEASE:cdata}"/>\
  -\n  <checksum type="sha" pkgid="NO">%|HDRID?{%{HDRID}}|</checksum>\
  +\n  <checksum type="sha" pkgid="NO">%|HDRID?{%{HDRID}}:{XXX}|</checksum>\
   \n  <summary>%{SUMMARY:cdata}</summary>\
   \n  <description>%{DESCRIPTION:cdata}</description>\
   \n  <packager>%|PACKAGER?{%{PACKAGER:cdata}}:{}|</packager>\
   \n  <url>%|URL?{%{URL:cdata}}:{}|</url>\
   \n  <time file="%{PACKAGETIME}" build="%{BUILDTIME}"/>\
  -\n  <size package="%{SIZE}" installed="%{SIZE}" archive="%{ARCHIVESIZE}"/>\
  +\n  <size package="%{PACKAGESIZE}" installed="%{SIZE}" 
archive="%{ARCHIVESIZE}"/>\
   \n  <location href="%{PACKAGEORIGIN:bncdata}"/>\
   \n  <format>\
   %|license?{\
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to