Don't treat %patch numberless if -P parameter is present
authorJindrich Novy <jnovy@redhat.com>
Wed, 24 Sep 2008 16:39:43 +0000 (18:39 +0200)
committerJindrich Novy <jnovy@redhat.com>
Wed, 24 Sep 2008 16:39:43 +0000 (18:39 +0200)
build/parsePrep.c

index 2be0693..bfef325 100644 (file)
@@ -431,7 +431,10 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line)
     if (! strchr(" \t\n", line[6])) {
        rasprintf(&buf, "%%patch -P %s", line + 6);
     } else {
-       rasprintf(&buf, "%%patch -P %d %s", INT_MAX, line + 6); /* INT_MAX denotes not numbered %patch */
+       if (strstr(line+6, " -P") == NULL)
+           rasprintf(&buf, "%%patch -P %d %s", INT_MAX, line + 6); /* INT_MAX denotes not numbered %patch */
+       else
+           buf = strdup(line); /* it is not numberless patch because -P is present */
     }
     poptParseArgvString(buf, &argc, &argv);
     free(buf);