The rm %{buildroot}/%{_infodir}/dir command in the "Installing files" section (more specifically, removing a specific directory because of texinfo) fails because there is no such directory.
rm %{buildroot}/%{_infodir}/dir
Notes: - Built on aarch64
Output (from fedpkg --release f37 mockbuild):
fedpkg --release f37 mockbuild
gcc -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I. -Ilib -I./lib -Isrc -I./src -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -c -o src/hello.o src/hello.c make[2]: Leaving directory '/builddir/build/BUILD/hello-2.10' make[2]: Entering directory '/builddir/build/BUILD/hello-2.10' gcc -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I. -Ilib -I./lib -Isrc -I./src -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLI BCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -c -o lib/quotearg.o lib/quotearg.c make[2]: Leaving directory '/builddir/build/BUILD/hello-2.10' make[2]: Entering directory '/builddir/build/BUILD/hello-2.10' rm -f lib/libhello.a ar cru lib/libhello.a lib/c-ctype.o lib/c-strcasecmp.o lib/c-strncasecmp.o lib/close-stream.o lib/closeout.o lib/dirname.o lib/basename.o lib/dirname-lgpl.o lib/basename-lgpl.o lib/stripslash.o lib/exitfail.o lib/localcharset.o lib/progname.o lib/quotearg.o lib/strnlen1.o lib/unistd.o lib/wctype-h.o lib/xmalloc.o lib/xalloc-die.o lib/xstrndup.o ranlib lib/libhello.a make[2]: Leaving directory '/builddir/build/BUILD/hello-2.10' make[2]: Entering directory '/builddir/build/BUILD/hello-2.10' gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -o hello src/hello.o ./lib/libhello.a make[2]: Leaving directory '/builddir/build/BUILD/hello-2.10' + RPM_EC=0 ++ jobs -p + exit 0 Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.yFCoMR + umask 022 + cd /builddir/build/BUILD + '[' /builddir/build/BUILDROOT/hello-2.10-1.fc37.aarch64 '!=' / ']' + rm -rf /builddir/build/BUILDROOT/hello-2.10-1.fc37.aarch64 ++ dirname /builddir/build/BUILDROOT/hello-2.10-1.fc37.aarch64 + mkdir -p /builddir/build/BUILDROOT + mkdir /builddir/build/BUILDROOT/hello-2.10-1.fc37.aarch64 + CFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection' + export CFLAGS + CXXFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection' + export CXXFLAGS + FFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib64/gfortran/modules' + export FFLAGS + FCFLAGS='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -I/usr/lib64/gfortran/modules' + export FCFLAGS + LDFLAGS='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes' + export LDFLAGS + LT_SYS_LIBRARY_PATH=/usr/lib64: + export LT_SYS_LIBRARY_PATH + CC=gcc + export CC + CXX=g++ + export CXX + cd hello-2.10 + rm /builddir/build/BUILDROOT/hello-2.10-1.fc37.aarch64/usr/share/info/dir rm: cannot remove '/builddir/build/BUILDROOT/hello-2.10-1.fc37.aarch64/usr/share/info/dir': No such file or directory RPM build errors: error: Bad exit status from /var/tmp/rpm-tmp.yFCoMR (%install) Bad exit status from /var/tmp/rpm-tmp.yFCoMR (%install) Finish: rpmbuild hello-2.10-1.fc37.src.rpm Finish: build phase for hello-2.10-1.fc37.src.rpm ERROR: Exception(/home/user/hello/hello-2.10-1.fc37.src.rpm) Config(fedora-37-aarch64) 0 minutes 39 seconds INFO: Results and/or logs in: /home/user/hello/results_hello/2.10/1.fc37 INFO: Cleaning up build root ('cleanup_on_failure=True') Start: clean chroot Finish: clean chroot ERROR: Command failed: # /usr/bin/systemd-nspawn -q -M 39ba5f361f934b13a88ce4538eec39ca -D /var/lib/mock/fedora-37-aarch64/root -a -u mockbuild --capability=cap_ipc_lock --bind=/tmp/mock-resolv.5lywjcbq:/etc/resolv.conf --bind=/dev/btrfs-control --bind=/dev/mapper/control --bind=/dev/loop-control --bind=/dev/loop0 --bind=/dev/loop1 --bind=/dev/loop2 --bind=/dev/loop3 --bind=/dev/loop4 --bind=/dev/loop5 --bind=/dev/loop6 --bind=/dev/loop7 --bind=/dev/loop8 --bind=/dev/loop9 --bind=/dev/loop10 --bind=/dev/loop11 --console=pipe --setenv=TERM=vt100 --setenv=SHELL=/bin/bash --setenv=HOME=/builddir --setenv=HOSTNAME=mock --setenv=PATH=/usr/bin:/bin:/usr/sbin:/sbin --setenv=PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007" --setenv=PS1=<mock-chroot> \s-\v\$ --setenv=LANG=C.UTF-8 --resolv-conf=off bash --login -c /usr/bin/rpmbuild -bb --target aarch64 --nodeps /builddir/build/SPECS/hello.spec Could not execute mockbuild: Failed to execute command.
Spec:
Name: hello Version: 2.10 Release: 1%{?dist} Summary: Produces a familiar, friendly greeting License: GPLv3+ URL: https://www.gnu.org/software/hello/ Source: https://ftp.gnu.org/gnu/hello/hello-%{version}.tar.gz BuildRequires: gcc BuildRequires: make BuildRequires: gettext %description The GNU Hello program produces a familiar, friendly greeting. Yes, this is another implementation of the classic program that prints “Hello, world!” when you run it. %prep %autosetup %build %configure %make_build %install #rm %{buildroot}/%{_infodir}/dir # due the slash in the middle resulting in a double slash in the actual path, it was removed. rm %{buildroot}%{_infodir}/dir %find_lang ${name} %make_install #%files %files -f %{names}.lang %{_bindir}/hello %{_mandir}/man1/hello.1.* %{_infodir}/hello.info.* %license COPYING %doc AUTHORS ChangeLog NEWS README THANKS TODO %check make check %changelog * Sat Oct 23 2021 Patricia Packager <patricia@example.com> - 2.10-1 - Initial version of the package
OK so I tried the spec in the section named "A Complete hello.spec File" and... it works
Looking more at the spec file and the documentation, the rm command was done after %make_install, not %install. The documentation describes the rm command to be put after the %install section, not %make_install. %make_install is also not mentioned anywhere other than in the spec files themselves.
rm
%make_install
%install
I guess this is an issue with the documentation being incorrect (and also somewhat inconsistent).
I'm not sure if this should be in a new issue, but I've found another minor issue: In the "Checking the result with rpmlint" section, it tells you to run fedpkg --release rawhide lint when it should be fedpkg --release f36 lint (f36 is replaced as necessary as per said documentation), otherwise the file-not-utf8 error will not appear since the package for the rawhide release version was never built (if you followed the docs).
fedpkg --release rawhide lint
fedpkg --release f36 lint
file-not-utf8
Thank you for taking the time to report the problems you found, and for even investigating how to fix them!
No, there is no reason the make individual issues about each and every problem when they are small and on the same page as in here.
Right, %make_install comes from rpmdev-newspec. Maybe it would make sense not to use that tool, and instead build the specfile by hand and explain each section's purpose and content when they are added. Opinions welcome on which approach is better!
rpmdev-newspec
The pull request has been merged, so I close this issue now.
Metadata Update from @oturpe: - Issue status updated to: Closed (was: Open)