Re: Conditional Patch line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, September 5, 2022 Richard W.M. Jones wrote:
> I have a downstream patch[0] which -- I don't really understand why --
> breaks riscv64 builds but is necessary for primary Fedora arches.  Is
> it correct to do:
> 
>   %ifnarch riscv64
>   Patch123: downstream.patch
>   %endif
> 
> given that the package uses %autosetup and therefore doesn't have
> explicit %patch lines.
> 
> I think this means that if I build the SRPM on riscv64 then the
> downstream patch wouldn't be included, meaning that SRPM would then
> fail to build on other arches.  In this particular case that doesn't
> matter, but it feels wrong.  Is there a recommended way to do this
> (apart from fixing the patch)?

Yes, conditionalizing Source or Patch lines is a bad idea. This exact case is 
explicitly forbidden by the guidelines[1]. There is also a guidelines PR to 
forbid any type of Source/Patch conditionaliztion[2].

[1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/
#_no_arch_specific_sources_or_patches

[2]: https://pagure.io/packaging-committee/pull-request/1163

If you don't want to add %patchX for every Patch, you can use regular `%setup 
-q` together with %autopatch, which allows more granular control than 
`%autosetup`.

>From /usr/lib/rpm/macros:

```
# Apply patches using %autosetup configured SCM.
# Typically used with no arguments to apply all patches in the order
# introduced in the spec, but alternatively can be used to apply indvidual
# patches in arbitrary order by passing them as arguments.
# -v		Verbose
# -p<N>		Prefix strip (ie patch -p argument)
# -m<min>       Apply patches with number >= min only (if no arguments)
# -M<max>       Apply patches with number <= max only (if no arguments)
%autopatch(vp:m:M:) %{lua:
```

-- 
Maxwell G (@gotmax23)
Pronouns: He/Him/His

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux