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:   17-Jun-2007 18:31:35
  Branch: rpm-4_5                          Handle: 2007061717313500

  Modified files:           (Branch: rpm-4_5)
    rpm                     CHANGES
    rpm/build               parsePrep.c

  Log:
    - pass -F fnum to patch (#243720).

  Summary:
    Revision    Changes     Path
    1.1360.2.22 +1  -0      rpm/CHANGES
    2.69.2.1    +29 -15     rpm/build/parsePrep.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.1360.2.21 -r1.1360.2.22 CHANGES
  --- rpm/CHANGES       17 Jun 2007 14:41:57 -0000      1.1360.2.21
  +++ rpm/CHANGES       17 Jun 2007 16:31:35 -0000      1.1360.2.22
  @@ -1,4 +1,5 @@
   4.4.9 -> 4.5:
  +    - jbj: pass -F fnum to patch (#243720).
       - jbj: refactor _free() from rpmlib.h -> rpmio.h.
       - jbj: add _rpmhome macro, revector helper paths through _rpmhome.
       - jbj: hack a version into magic install path. better needs to be done.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/build/parsePrep.c
  ============================================================================
  $ cvs diff -u -r2.69 -r2.69.2.1 parsePrep.c
  --- rpm/build/parsePrep.c     25 May 2007 17:35:56 -0000      2.69
  +++ rpm/build/parsePrep.c     17 Jun 2007 16:31:35 -0000      2.69.2.1
  @@ -62,36 +62,39 @@
    * @param db         saved file suffix (i.e. patch --suffix argument)
    * @param reverse    include -R?
    * @param removeEmpties      include -E?
  + * @param fuzz               include -F?
    * @return           expanded %patch macro (NULL on error)
    */
   /[EMAIL PROTECTED]@*/
   /[EMAIL PROTECTED]@*/
   static char *doPatch(Spec spec, int c, int strip, const char *db,
  -                  int reverse, int removeEmpties)
  +                  int reverse, int removeEmpties, int fuzz)
        /[EMAIL PROTECTED] rpmGlobalMacroContext, h_errno, fileSystem, 
internalState @*/
        /[EMAIL PROTECTED] rpmGlobalMacroContext, fileSystem, internalState @*/
   {
       const char *fn, *Lurlfn;
       static char buf[BUFSIZ];
  -    char args[BUFSIZ];
  +    char args[BUFSIZ], *t = args;
       struct Source *sp;
       rpmCompressedMagic compressed = COMPRESSED_NOT;
       int urltype;
   
  -    args[0] = '\0';
  +    *t = '\0';
       if (db) {
   #if HAVE_OLDPATCH_21 == 0
  -     strcat(args, "-b ");
  +     t = stpcpy(t, "-b ");
   #endif
  -     strcat(args, "--suffix ");
  -     strcat(args, db);
  -    }
  -    if (reverse) {
  -     strcat(args, " -R");
  -    }
  -    if (removeEmpties) {
  -     strcat(args, " -E");
  +     t = stpcpy( stpcpy(t, "--suffix "), db);
       }
  +    if (fuzz) {
  +     t = stpcpy(t, "-F ");
  +     sprintf(t, "%10.10d", fuzz);
  +     t += strlen(t);
  +    }
  +    if (reverse)
  +     t = stpcpy(t, " -R");
  +    if (removeEmpties)
  +     t = stpcpy(t, " -E");
   
       for (sp = spec->sources; sp != NULL; sp = sp->next) {
        if ((sp->flags & RPMFILE_PATCH) && (sp->num == c))
  @@ -453,7 +456,7 @@
                fileSystem, internalState  @*/
   {
       char *opt_b;
  -    int opt_P, opt_p, opt_R, opt_E;
  +    int opt_P, opt_p, opt_R, opt_E, opt_F;
       char *s;
       char buf[BUFSIZ], *bp;
       int patch_nums[1024];  /* XXX - we can only handle 1024 patches! */
  @@ -501,6 +504,17 @@
                        spec->lineNum, spec->line);
                return RPMERR_BADSPEC;
            }
  +     } else if (!strcmp(s, "-F")) {
  +         /* fuzz factor */
  +         const char * fnum = strtok(NULL, " \t\n");
  +         char * end = NULL;
  +         opt_F = (fnum ? strtol(fnum, &end, 10) : 0);
  +         if (! opt_F || *end) {
  +             rpmError(RPMERR_BADSPEC,
  +                     _("line %d: Bad arg to %%patch -F: %s\n"),
  +                     spec->lineNum, spec->line);
  +             return RPMERR_BADSPEC;
  +         }
        } else if (!strncmp(s, "-p", sizeof("-p")-1)) {
            /* unfortunately, we must support -pX */
            if (! strchr(" \t\n", s[2])) {
  @@ -539,14 +553,14 @@
       /* All args processed */
   
       if (! opt_P) {
  -     s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E);
  +     s = doPatch(spec, 0, opt_p, opt_b, opt_R, opt_E, opt_F);
        if (s == NULL)
            return RPMERR_BADSPEC;
        appendLineStringBuf(spec->prep, s);
       }
   
       for (x = 0; x < patch_index; x++) {
  -     s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E);
  +     s = doPatch(spec, patch_nums[x], opt_p, opt_b, opt_R, opt_E, opt_F);
        if (s == NULL)
            return RPMERR_BADSPEC;
        appendLineStringBuf(spec->prep, s);
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to