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

  Server: rpm5.org                         Name:   Alexey Tourbin
  Root:   /v/rpm/cvs                       Email:  [EMAIL PROTECTED]
  Module: rpm                              Date:   05-Jul-2008 00:03:26
  Branch: HEAD                             Handle: 2008070422032600

  Modified files:
    rpm/build               files.c

  Log:
    build/files.c (processBinaryFiles): break early on errors
    
    They say "when you must fail, fail noisily and as soon as possible".
    So I change processBinaryFiles() as follows:
    
    1) When processing a package, if a fatal error occurs, I simply
    break the loop with RPMRC_FAIL.  Other stages for the current
    package are skipped, and other sub-packages are simply not processed
    at all.  (This is actually how older rpm versions behaved.)
    
    2) If a fatal error occurs, extra checks are skipped.  This now
    includes only checkFiles() check for unpackaged files.  (More
    checks to be implemented.)

  Summary:
    Revision    Changes     Path
    1.326       +19 -12     rpm/build/files.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/build/files.c
  ============================================================================
  $ cvs diff -u -r1.325 -r1.326 files.c
  --- rpm/build/files.c 4 Jul 2008 16:49:32 -0000       1.325
  +++ rpm/build/files.c 4 Jul 2008 22:03:26 -0000       1.326
  @@ -2853,7 +2853,6 @@
       HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
       Package pkg;
       rpmRC res = RPMRC_OK;
  -    int xx;
       
       check_fileList = newStringBuf();
       
  @@ -2866,19 +2865,28 @@
        (void) headerMacrosLoad(pkg->header);
   
        he->tag = RPMTAG_NVRA;
  -     xx = headerGet(pkg->header, he, 0);
  +     rc = headerGet(pkg->header, he, 0);
        rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), he->p.str);
        he->p.ptr = _free(he->p.ptr);
                   
  -     if ((xx = processPackageFiles(spec, pkg, installSpecialDoc, test)))
  +     if ((rc = processPackageFiles(spec, pkg, installSpecialDoc, test))) {
            res = RPMRC_FAIL;
  +         (void) headerMacrosUnload(pkg->header);
  +         break;
  +     }
   
        /* Finalize package scriptlets before extracting dependencies. */
  -     if ((rc = processScriptFiles(spec, pkg)))
  +     if ((rc = processScriptFiles(spec, pkg))) {
            res = rc;
  +         (void) headerMacrosUnload(pkg->header);
  +         break;
  +     }
   
  -     if ((xx = rpmfcGenerateDepends(spec, pkg)))
  +     if ((rc = rpmfcGenerateDepends(spec, pkg))) {
            res = RPMRC_FAIL;
  +         (void) headerMacrosUnload(pkg->header);
  +         break;
  +     }
   
        /* XXX this should be earlier for deps to be entirely sorted. */
        providePackageNVR(pkg->header);
  @@ -2886,13 +2894,12 @@
        (void) headerMacrosUnload(pkg->header);
       }
   
  -    /* Now we have in fileList list of files from all packages.
  -     * We pass it to a script which does the work of finding missing
  -     * and duplicated files.
  -     */
  -    
  -    if (checkFiles(check_fileList) > 0) {
  -     if (res == RPMRC_OK)
  +    if (res == RPMRC_OK) {
  +     /* Now we have in fileList list of files from all packages.
  +      * We pass it to a script which does the work of finding missing
  +      * and duplicated files.
  +      */
  +     if (checkFiles(check_fileList) > 0)
            res = RPMRC_FAIL;
       }
       
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                [email protected]

Reply via email to