rpmlint icon indicating copy to clipboard operation
rpmlint copied to clipboard

Add support for %autopatch/%apply_patch

Open voxik opened this issue 5 years ago • 6 comments

Using %autopatch/%apply_patch [1], the patches are detected as not applied. It would be nice to provide support for this RPM feature.

voxik avatar Sep 09 '20 15:09 voxik

Or even better, forcing %autosetup -p1 instead of %setup -q.

mcepl avatar May 10 '22 19:05 mcepl

Can you please provide more context for this? I would like to implement it, but don't know what's expected?

marxin avatar May 11 '22 07:05 marxin

This is mostly task for py2pack/pyp2rpm or stuff like that, but whenever I create new SPEC file I immediately change %setup -q to %autosetup -p1, because a) it is more convenient and it guarantees consistency of patches, b) what OP wrote here: it checks that there are no forgotten patches and all patches are ready to be applied. Thus I would argue %autopatch -p1/%autosetup -p1 makes better SPEC files and it is in the scope of rpmlint.

mcepl avatar May 11 '22 09:05 mcepl

Thanks for the explanation. I tend to close this issue then.

marxin avatar May 11 '22 10:05 marxin

I wrongly interpreted what @mcepl wrote, sorry.

marxin avatar May 11 '22 10:05 marxin

I think we can close this one, the missing patch check is now there and there are a lot of tests, for example: https://github.com/rpm-software-management/rpmlint/blob/main/test/test_speccheck.py#L42-L44

And I've been testing and rpmlint detects when %autopatch is used, that could be the initial reported issue.

danigm avatar Oct 13 '22 11:10 danigm

@marxin: There is an issue where

%patch -P1 -p1

Is not detected as applying Patch1, it is only detected as:

%patch -P 1 -p1

Example: %patch -P1 -p1 in https://download.copr.fedorainfracloud.org/results/bkaindl/uftrace/fedora-rawhide-x86_64/05749047-uftrace/uftrace.spec

Results in uftrace.spec: W: patch-not-applied Patch1: gethostbyname.patch in https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2180989-uftrace/fedora-rawhide-x86_64/05749104-uftrace/fedora-review/review.txt

The only difference is the space between -P and 1.

bernhardkaindl avatar Apr 08 '23 22:04 bernhardkaindl