Definite's Extractor

My findings on Life, Linux, Open Source, and so on.

[COPR] Why my patches are missing from custom build

Custom build script in COPR is a versatile. With a couple sed commands, you can modify Fedora SPEC files and port it to RHEL/CentOS Stream with a little effort.

However, when I was porting the keepassxc-2.7.X a few days ago, COPR keeps complaining xcb.patch is missing. While I myself does not need the patch for Wayland, I am curious why other packages are fine but not this one.

Eventually, it is because Patch0: xcb.patch was in conditional, like:

%if 0%{?el8}
Patch0: xcb.patch
%endif

The SRPM maker did not run under el8, thus Patch0 is not in SRPM.

Since my repo contains just EL8 and EL9 packages, I can simply make the conditional always say yes. So I put down following like in the script:

sed -i -e '/^%if 0%{[?]el8}/ s/0%{[?]el8}/1/' $PKG.spec

This solved the problem.

Leave a comment