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

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   30-May-2009 00:54:12
  Branch: HEAD                             Handle: 2009052922541002

  Modified files:
    rpm                     CHANGES
    rpm/build               build.c rpmspec.h
    rpm/rpmio               rpmdigest.c rpmsw.c rpmsw.h tdir.c tfts.c tget.c
                            tglob.c
    rpm/tools               rpmdigest.c rpmgrep.c rpmmtree.c

  Log:
    - rpmsw: add an output FILE * argument.
    - build: put a stopwatch on build scriptlets.

  Summary:
    Revision    Changes     Path
    1.3003      +2  -0      rpm/CHANGES
    2.132       +15 -0      rpm/build/build.c
    2.81        +4  -0      rpm/build/rpmspec.h
    2.13        +3  -3      rpm/rpmio/rpmdigest.c
    2.20        +4  -4      rpm/rpmio/rpmsw.c
    2.12        +3  -2      rpm/rpmio/rpmsw.h
    2.17        +1  -1      rpm/rpmio/tdir.c
    2.28        +1  -1      rpm/rpmio/tfts.c
    1.19        +2  -2      rpm/rpmio/tget.c
    2.16        +1  -1      rpm/rpmio/tglob.c
    2.15        +3  -3      rpm/tools/rpmdigest.c
    2.4         +2  -2      rpm/tools/rpmgrep.c
    2.10        +3  -3      rpm/tools/rpmmtree.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.3002 -r1.3003 CHANGES
  --- rpm/CHANGES       29 May 2009 22:11:35 -0000      1.3002
  +++ rpm/CHANGES       29 May 2009 22:54:10 -0000      1.3003
  @@ -1,5 +1,7 @@
   
   5.2b1 -> 5.3a1
  +    - jbj: rpmsw: add an output FILE * argument.
  +    - jbj: build: put a stopwatch on build scriptlets.
       - jbj: rpmio: wrap posix_fallocate(3) / fallocate(2) (for rpmdb 
creation).
       - jbj: eliminate useless rebuilddb legacy "sanity check" hysteria.
       - jbj: display rebuilddb progress using ps(1) and top(1).
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/build.c
  ============================================================================
  $ cvs diff -u -r2.131 -r2.132 build.c
  --- rpm/build/build.c 3 Aug 2008 14:00:58 -0000       2.131
  +++ rpm/build/build.c 29 May 2009 22:54:11 -0000      2.132
  @@ -103,6 +103,7 @@
       const char **argv = NULL;
       FILE * fp = NULL;
       urlinfo u = NULL;
  +    void * sw = NULL;
   
       FD_t fd;
       FD_t xfd;
  @@ -116,6 +117,7 @@
       case RPMBUILD_PREP:
        name = "%prep";
        iob = spec->prep;
  +     sw = &spec->sw_prep;
        mTemplate = "%{__spec_prep_template}";
        mPost = "%{__spec_prep_post}";
        mCmd = "%{__spec_prep_cmd}";
  @@ -123,6 +125,7 @@
       case RPMBUILD_BUILD:
        name = "%build";
        iob = spec->build;
  +     sw = &spec->sw_build;
        mTemplate = "%{__spec_build_template}";
        mPost = "%{__spec_build_post}";
        mCmd = "%{__spec_build_cmd}";
  @@ -130,6 +133,7 @@
       case RPMBUILD_INSTALL:
        name = "%install";
        iob = spec->install;
  +     sw = &spec->sw_install;
        mTemplate = "%{__spec_install_template}";
        mPost = "%{__spec_install_post}";
        mCmd = "%{__spec_install_cmd}";
  @@ -137,6 +141,7 @@
       case RPMBUILD_CHECK:
        name = "%check";
        iob = spec->check;
  +     sw = &spec->sw_check;
        mTemplate = "%{__spec_check_template}";
        mPost = "%{__spec_check_post}";
        mCmd = "%{__spec_check_cmd}";
  @@ -264,6 +269,10 @@
       buildCmd = rpmExpand(mCmd, " ", buildScript, NULL);
       (void) poptParseArgvString(buildCmd, &argc, &argv);
   
  +    /* Start the stopwatch on a build scriptlet. */
  +    if (sw != NULL)
  +     (void) rpmswEnter(sw, 0);
  +
       if (what != RPMBUILD_TRACK)              /* support "%track" 
script/section */
        rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd);
       if (!(child = fork())) {
  @@ -281,6 +290,12 @@
   
       pid = waitpid(child, &status, 0);
   
  +    /* End the stopwatch on a build scriptlet. */
  +    if (sw != NULL) {
  +     (void) rpmswExit(sw, 0);
  +     rpmswPrint(scriptName, sw, NULL);
  +    }
  +
       if (!WIFEXITED(status) || WEXITSTATUS(status)) {
        rpmlog(RPMLOG_ERR, _("Bad exit status from %s (%s)\n"),
                 scriptName, name);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/rpmspec.h
  ============================================================================
  $ cvs diff -u -r2.80 -r2.81 rpmspec.h
  --- rpm/build/rpmspec.h       24 May 2009 19:45:26 -0000      2.80
  +++ rpm/build/rpmspec.h       29 May 2009 22:54:11 -0000      2.81
  @@ -174,12 +174,16 @@
   
   /*...@only@*/
       rpmiob prep;             /*!< %prep scriptlet. */
  +    struct rpmop_s sw_prep;
   /*...@only@*/
       rpmiob build;            /*!< %build scriptlet. */
  +    struct rpmop_s sw_build;
   /*...@only@*/
       rpmiob install;          /*!< %install scriptlet. */
  +    struct rpmop_s sw_install;
   /*...@only@*/
       rpmiob check;            /*!< %check scriptlet. */
  +    struct rpmop_s sw_check;
   /*...@only@*/
       rpmiob clean;            /*!< %clean scriptlet. */
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmdigest.c
  ============================================================================
  $ cvs diff -u -r2.12 -r2.13 rpmdigest.c
  --- rpm/rpmio/rpmdigest.c     11 Apr 2009 14:47:13 -0000      2.12
  +++ rpm/rpmio/rpmdigest.c     29 May 2009 22:54:11 -0000      2.13
  @@ -359,9 +359,9 @@
   
       rpmswExit(&dc_totalops, 0);
       if (_rpmsw_stats) {
  -     rpmswPrint(" total:", &dc_totalops);
  -     rpmswPrint("  read:", &dc_readops);
  -     rpmswPrint("digest:", &dc_digestops);
  +     rpmswPrint(" total:", &dc_totalops, NULL);
  +     rpmswPrint("  read:", &dc_readops, NULL);
  +     rpmswPrint("digest:", &dc_digestops, NULL);
       }
   
       optCon = rpmioFini(optCon);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsw.c
  ============================================================================
  $ cvs diff -u -r2.19 -r2.20 rpmsw.c
  --- rpm/rpmio/rpmsw.c 18 Jan 2009 04:13:43 -0000      2.19
  +++ rpm/rpmio/rpmsw.c 29 May 2009 22:54:11 -0000      2.20
  @@ -301,13 +301,13 @@
       return usecs;
   }
   
  -void rpmswPrint(const char * name, /*...@null@*/ rpmop op)
  -        /*...@globals fileSystem @*/
  -        /*...@modifies fileSystem @*/
  +void rpmswPrint(const char * name, rpmop op, FILE * fp)
   {
       static unsigned int scale = (1000 * 1000);
  +    if (fp == NULL)
  +     fp = stderr;
       if (op != NULL && op->count > 0)
  -        fprintf(stderr, "   %s %8d %6lu.%06lu MB %6lu.%06lu secs\n",
  +        fprintf(fp, "   %s %8d %6lu.%06lu MB %6lu.%06lu secs\n",
                   name, op->count,
                   (unsigned long)op->bytes/scale, (unsigned 
long)op->bytes%scale,
                   op->usecs/scale, op->usecs%scale);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/rpmsw.h
  ============================================================================
  $ cvs diff -u -r2.11 -r2.12 rpmsw.h
  --- rpm/rpmio/rpmsw.h 7 Jul 2008 16:50:21 -0000       2.11
  +++ rpm/rpmio/rpmsw.h 29 May 2009 22:54:11 -0000      2.12
  @@ -144,10 +144,11 @@
    * Print operation statistics.
    * @param name                       operation name
    * @param op                 operation statistics
  + * @param fp                 file handle (NULL uses stderr)
    */
  -void rpmswPrint(const char * name, /*...@null@*/ rpmop op)
  +void rpmswPrint(const char * name, /*...@null@*/ rpmop op, /*...@null@*/ 
FILE * fp)
           /*...@globals fileSystem @*/
  -        /*...@modifies fileSystem @*/;
  +        /*...@modifies fp, fileSystem @*/;
   
   #ifdef __cplusplus
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tdir.c
  ============================================================================
  $ cvs diff -u -r2.16 -r2.17 tdir.c
  --- rpm/rpmio/tdir.c  12 Jul 2008 22:23:40 -0000      2.16
  +++ rpm/rpmio/tdir.c  29 May 2009 22:54:11 -0000      2.17
  @@ -46,7 +46,7 @@
   
   fprintf(stderr, "===== %s: %d entries\n", dn, nentries);
       if (_rpmsw_stats)
  -     rpmswPrint("opendir:", op);
  +     rpmswPrint("opendir:", op, NULL);
       return rc;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tfts.c
  ============================================================================
  $ cvs diff -u -r2.27 -r2.28 tfts.c
  --- rpm/rpmio/tfts.c  12 Jul 2008 17:41:29 -0000      2.27
  +++ rpm/rpmio/tfts.c  29 May 2009 22:54:11 -0000      2.28
  @@ -166,7 +166,7 @@
   fprintf(stderr, "===== (%d/%d) dirs/files in:\n", fts->ndirs, fts->nfiles);
       argvPrint(NULL, fts->paths, NULL);
       if (_rpmsw_stats)
  -     rpmswPrint("fts:", op);
  +     rpmswPrint("fts:", op, NULL);
   
       return rc;
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tget.c
  ============================================================================
  $ cvs diff -u -r1.18 -r1.19 tget.c
  --- rpm/rpmio/tget.c  11 Jul 2008 22:00:23 -0000      1.18
  +++ rpm/rpmio/tget.c  29 May 2009 22:54:11 -0000      1.19
  @@ -99,11 +99,11 @@
       int rc = 0;
   
       if (tget->sop) {
  -     rpmswPrint("stat:", tget->sop);
  +     rpmswPrint("stat:", tget->sop, NULL);
        tget->sop = _free(tget->sop);
       }
       if (tget->gop) {
  -     rpmswPrint(" get:", tget->gop);
  +     rpmswPrint(" get:", tget->gop, NULL);
        tget->gop = _free(tget->gop);
       }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/rpmio/tglob.c
  ============================================================================
  $ cvs diff -u -r2.15 -r2.16 tglob.c
  --- rpm/rpmio/tglob.c 12 Jul 2008 19:17:28 -0000      2.15
  +++ rpm/rpmio/tglob.c 29 May 2009 22:54:11 -0000      2.16
  @@ -36,7 +36,7 @@
       xx = rpmswExit(op, 0);
   
       if (_rpmsw_stats)
  -     rpmswPrint("glob:", op);
  +     rpmswPrint("glob:", op, NULL);
       return rc;
   }
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmdigest.c
  ============================================================================
  $ cvs diff -u -r2.14 -r2.15 rpmdigest.c
  --- rpm/tools/rpmdigest.c     16 Jan 2009 20:47:11 -0000      2.14
  +++ rpm/tools/rpmdigest.c     29 May 2009 22:54:12 -0000      2.15
  @@ -1000,9 +1000,9 @@
   
       rpmswExit(&dc->totalops, 0);
       if (_rpmsw_stats) {
  -     rpmswPrint(" total:", &dc->totalops);
  -     rpmswPrint("  read:", &dc->readops);
  -     rpmswPrint("digest:", &dc->digestops);
  +     rpmswPrint(" total:", &dc->totalops, NULL);
  +     rpmswPrint("  read:", &dc->readops, NULL);
  +     rpmswPrint("digest:", &dc->digestops, NULL);
       }
   
       optCon = rpmioFini(optCon);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmgrep.c
  ============================================================================
  $ cvs diff -u -r2.3 -r2.4 rpmgrep.c
  --- rpm/tools/rpmgrep.c       9 May 2009 15:51:08 -0000       2.3
  +++ rpm/tools/rpmgrep.c       29 May 2009 22:54:12 -0000      2.4
  @@ -1600,8 +1600,8 @@
   
       xx = rpmswExit(&grep_totalops, 0);
       if (_rpmsw_stats) {
  -     rpmswPrint(" total:", &grep_totalops);
  -     rpmswPrint("  read:", &grep_readops);
  +     rpmswPrint(" total:", &grep_totalops, NULL);
  +     rpmswPrint("  read:", &grep_readops, NULL);
       }
   
       optCon = rpmioFini(optCon);
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/tools/rpmmtree.c
  ============================================================================
  $ cvs diff -u -r2.9 -r2.10 rpmmtree.c
  --- rpm/tools/rpmmtree.c      11 Apr 2009 14:47:13 -0000      2.9
  +++ rpm/tools/rpmmtree.c      29 May 2009 22:54:12 -0000      2.10
  @@ -3807,9 +3807,9 @@
   
       (void) rpmswExit(&dc_totalops, 0);
       if (_rpmsw_stats) {
  -        rpmswPrint(" total:", &dc_totalops);
  -        rpmswPrint("  read:", &dc_readops);
  -        rpmswPrint("digest:", &dc_digestops);
  +        rpmswPrint(" total:", &dc_totalops, NULL);
  +        rpmswPrint("  read:", &dc_readops, NULL);
  +        rpmswPrint("digest:", &dc_digestops, NULL);
       }
   
   exit:
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to