build-system icon indicating copy to clipboard operation
build-system copied to clipboard

Redirect errors during parsing spec files into logs

Open anfimovdm opened this issue 8 months ago • 0 comments

Sometimes we can fall into parsing spec files silently to users, and detailed info about parsing spec files can be found in the service logs. For example: mock_build_srpm.log

RPM build errors:
error: Bad file: /builddir/build/SOURCES/negativo-nvidia.repo: No such file or directory
error: Bad file: /builddir/build/SOURCES/almalinux-nvidia.repo: No such file or directory
    Bad file: /builddir/build/SOURCES/negativo-nvidia.repo: No such file or directory
    Bad file: /builddir/build/SOURCES/almalinux-nvidia.repo: No such file or directory
Child return code was: 1

logs from journal:

May 26 12:42:29 builder01 python3[3780286]: error: source 0 defined multiple times
May 26 12:42:29 builder01 python3[3780286]: error: source 0 defined multiple times

Probably, we can somehow redirect errors via rpm binding or maybe using contextlib.redirect_stderr or something else

anfimovdm avatar May 26 '25 18:05 anfimovdm