diff options
-rw-r--r-- | build/parsePrep.c | 9 | ||||
-rw-r--r-- | build/rpmbuild_internal.h | 2 | ||||
-rw-r--r-- | build/spec.c | 1 | ||||
-rw-r--r-- | tests/data/SPECS/hello-patch.spec | 20 | ||||
-rw-r--r-- | tests/rpmbuild.at | 5 |
5 files changed, 31 insertions, 6 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c index cc97303d3..f8e09a8c7 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -346,10 +346,8 @@ static rpmRC doPatchMacro(rpmSpec spec, const char *line) /* Convert %patchN to %patch -PN to simplify further processing */ if (! strchr(" \t\n", line[6])) { - rpmlog(RPMLOG_WARNING, - _("%%patchN is deprecated, use %%patch N (or %%patch -P N):\n%s"), - line); rasprintf(&buf, "%%patch -P %s", line + 6); + spec->numConverted++; } poptParseArgvString(buf ? buf : line, &argc, &argv); @@ -449,6 +447,11 @@ int parsePrep(rpmSpec spec) } } + if (spec->numConverted) + rpmlog(RPMLOG_WARNING, + _("%%patchN is deprecated (%i usages found), " + "use %%patch N (or %%patch -P N)\n"), spec->numConverted); + exit: argvFree(saveLines); diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h index cc3afc0a7..3094b9217 100644 --- a/build/rpmbuild_internal.h +++ b/build/rpmbuild_internal.h @@ -151,6 +151,8 @@ struct rpmSpec_s { StringBuf parsed; /*!< parsed spec contents */ Package packages; /*!< Package list. */ + + int numConverted; /*!< no. of automatic %patchN conversions */ }; #define PACKAGE_NUM_DEPS 12 diff --git a/build/spec.c b/build/spec.c index 1a59266ac..c43124c49 100644 --- a/build/spec.c +++ b/build/spec.c @@ -231,6 +231,7 @@ rpmSpec newSpec(void) spec->numSources = 0; spec->autonum_patch = -1; spec->autonum_source = -1; + spec->numConverted = 0; spec->sourceRpmName = NULL; spec->sourcePkgId = NULL; diff --git a/tests/data/SPECS/hello-patch.spec b/tests/data/SPECS/hello-patch.spec new file mode 100644 index 000000000..9f5b6cef2 --- /dev/null +++ b/tests/data/SPECS/hello-patch.spec @@ -0,0 +1,20 @@ +Name: hello +Version: 1.0 +Release: 1 +Group: Testing +License: GPL +Summary: Simple rpm demonstration. + +Source0: hello-1.0.tar.gz +Patch0: hello-1.0-install.patch +Patch1: hello-1.0-modernize.patch + +%description +Simple rpm demonstration. + +%prep +%setup -q +%patch0 -p1 -b .install +%patch1 -p1 -b .modernize + +%changelog diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at index 92a531e8e..8f79c1d07 100644 --- a/tests/rpmbuild.at +++ b/tests/rpmbuild.at @@ -354,12 +354,11 @@ AT_SETUP([rpmbuild with deprecated patch]) AT_KEYWORDS([build]) RPMDB_INIT AT_CHECK([ -runroot rpmbuild -bp --quiet /data/SPECS/hello2-suid.spec +runroot rpmbuild -bp --quiet /data/SPECS/hello-patch.spec ], [0], [ignore], -[warning: %patchN is deprecated, use %patch N (or %patch -P N): -%patch0 -p1 -b .modernize +[warning: %patchN is deprecated (2 usages found), use %patch N (or %patch -P N) ]) AT_CLEANUP |