Skip to content

Commit

Permalink
Add warning for %autopatch not applying anything
Browse files Browse the repository at this point in the history
It is possible that the range given to %autopatch is not matching any
actual patches. Issue an warning to give the packager a chance to
realize that there is something fishy. Not turnng this into an error to
not break existing builds.

Resolves: rpm-software-management#3093
  • Loading branch information
ffesti committed Jul 2, 2024
1 parent 775acf1 commit 3bd1b72
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,9 @@ if #arg == 0 then
end
end
end
if #arg == 0 then
macros.warn({"autopatch: no matching patches in range"})
end
local options = rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")
local bynum = {}
for i, p in ipairs(patches) do
Expand Down
1 change: 1 addition & 0 deletions tests/data/SPECS/hello-autopatch.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Simple rpm demonstration.
%autosetup -N
%autopatch 0
%autopatch -m 1
%autopatch -m 2

%build
%make_build CFLAGS="$RPM_OPT_FLAGS"
Expand Down
8 changes: 5 additions & 3 deletions tests/rpmbuild.at
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,13 @@ RPMDB_INIT
RPMTEST_CHECK([

run rpmbuild \
-ba ${RPMDATA}/SPECS/hello-autopatch.spec
-ba ${RPMDATA}/SPECS/hello-autopatch.spec 2> >(grep warning >&2) | grep warning
],
[0],
[ignore],
[ignore])
[RPM build warnings:
],
[warning: autopatch: no matching patches in range
])
RPMTEST_CLEANUP

AT_SETUP([rpmbuild -ba find-lang])
Expand Down

0 comments on commit 3bd1b72

Please sign in to comment.