COPR reapplies the same patch for EPEL9

Hello. I was trying to rebuild a package on COPR. The COPR build succeeded for most platforms except EPEL9.

According to the logs, the same patch is applied 3 times in the prep phase

+ echo 'Patch #0 (include_stdint.patch):'
Patch #0 (include_stdint.patch):
+ /usr/bin/patch --no-backup-if-mismatch -p0 --fuzz=0
patching file src/main/cpp/archive_utils.h
patching file src/main/cpp/util/logging.h
Patch #0 (include_stdint.patch):
+ echo 'Patch #0 (include_stdint.patch):'
+ /usr/bin/patch --no-backup-if-mismatch -p0 --fuzz=0
patching file src/main/cpp/archive_utils.h
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/main/cpp/archive_utils.h.rej
patching file src/main/cpp/util/logging.h
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/main/cpp/util/logging.h.rej
error: Bad exit status from /var/tmp/rpm-tmp.YdvJJz (%prep)

This error is very odd to me. My spec file only tries to apply the patch once. All other platforms in the same build succeeded.

I’m not sure why that happened. I did a local build with fedpkg mockbuild and Centos Stream 9, and the build succeeded without any errors. The same problem occurred when I rebuilt the package, so it is reproducible. Does anyone know why that happened? Thanks!

Have you tried with %patch -P0?
Different versions of rpm support different versions of the spec syntac. IIRC %patch 0 is the most recent one whereas %patch -P0 should be the most universal not-deprecated form.

2 Likes

Thank you! This change solved the problem.

1 Like