[Rpm-maint] [rpm-software-management/rpm] `%autopatch 1 2 3` does not work (#1766)
Vít Ondruch
notifications at github.com
Mon Aug 30 10:47:32 UTC 2021
rubygem-puma is [broken](https://bugzilla.redhat.com/show_bug.cgi?id=1987946) due to #1512. I was trying to apply this medicine:
~~~
$ git diff
diff --git a/rubygem-puma.spec b/rubygem-puma.spec
index 0a412ad..6b60e97 100644
--- a/rubygem-puma.spec
+++ b/rubygem-puma.spec
@@ -66,17 +66,12 @@ BuildArch: noarch
Documentation for %{name}.
%prep
-%setup -q -n %{gem_name}-%{version} -b 1 -b 3
+%autosetup -N -S git_am -n %{gem_name}-%{version} -b 1 -b 3
-%patch2 -p1
+%autopatch 2
pushd %{_builddir}
-%patch3 -p1
-
-# When removed, remove also the `BR: git` above.
-%global __scm git_am
-%{expand:%__scm_setup_%{__scm}}
-%apply_patch -p1 %{PATCH4}
+%autopatch 3 4
popd
%if %{with ragel}
~~~
but it fails:
~~~
... snip ...
Start: rpmbuild rubygem-puma-4.3.6-4.fc36.src.rpm
error: no such patch 2
2< (%error)
error: no such patch 3
2< (%error)
error: no such patch 4
2< (%error)
Building target platforms: x86_64
... snip ...
error: Bad exit status from /var/tmp/rpm-tmp.vWraR2 (%check)
RPM build errors:
no such patch 2
no such patch 3
no such patch 4
Bad exit status from /var/tmp/rpm-tmp.vWraR2 (%check)
~~~
I think the fix could be:
~~~diff
$ git diff
diff --git a/macros.in b/macros.in
index 22f675cdb..7c458f5d8 100644
--- a/macros.in
+++ b/macros.in
@@ -1252,7 +1252,7 @@ for i, p in ipairs(patches) do
bynum[patch_nums[i]] = p
end
for i, a in ipairs(arg) do
- local p = bynum[a]
+ local p = bynum[tonumber(a)]
if p then
print(rpm.expand("%__apply_patch -m %{basename:"..p.."} "..options..p.." "..i.."\\n"))
else
~~~
It would be nice if there was test case for this use case ...
Also, it would help if the rpmbuild finished right after the `%autopatch` failure and if the error messages were printed right away without being repeated at the end.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1766
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210830/6eede659/attachment.html>
More information about the Rpm-maint
mailing list