https://bugzilla.redhat.com/show_bug.cgi?id=1806999
--- Comment #5 from Weiping zwp10758@gmail.com --- (In reply to Artur Iwicki from comment #4)
Thanks your time to review my first package. I have update the spec and Makefile.
Spec URL: https://raw.githubusercontent.com/dublio/cputil/master/cputil.spec SRPM URL: https://github.com/dublio/cputil/releases/download/1.0/cputil-1.0-1.fc28.src...
Source0: https://github.com/dublio/cputil/releases/download/1.0/cputil-1.0.tar.gz
You can use %{version} as part of the Source URL so you don't have to edit it manually each time there's a new release.
OK, I modify it to: Source0: https://github.com/dublio/cputil/releases/download/%%7Bversion%7D/%%7Bname%7...
%install rm -rf $RPM_BUILD_ROOT
Don't do this. https://docs.fedoraproject.org/en-US/packaging-guidelines/#_tags_and_section...
OK, I remove it.
%build make %{?_smp_flags}
You should call the %{set_build_flags} macro before the "make" call.
OK, I add it.
# disable producing debuginfo for this package %global debug_package %{nil}
It's a very rare circumstance when this is truly needed - all Fedora executables are built with debuginfo enabled (and then stripped to produce a -debug package). See if adding the build-flags macro (as detailed above) helps. If not, you'll have to patch the Makefile to make it respect Fedora's CFLAGS (or just call gcc directly, since it's only one file). https://docs.fedoraproject.org/en-US/packaging-guidelines/Debuginfo/ #_useless_or_incomplete_debuginfo_packages_due_to_packaging_issues
OK, I remove this macro, now rpmbuild -ba will create 4 rpms: cputil-1.0-1.fc28.src.rpm cputil-1.0-1.fc28.x86_64.rpm cputil-debuginfo-1.0-1.fc28.x86_64.rpm cputil-debugsource-1.0-1.fc28.x86_64.rpm
The reason why I add this macro(debug_package %{nil}) is that, I found when I rpm -ql, there are some files in /usr/lib/.build_id/, Is it ok ?
[root@f28 cputil]# rpm -ql cputil-1.0-1.fc28.x86_64.rpm /usr/bin/cputil /usr/lib/.build-id /usr/lib/.build-id/a3 /usr/lib/.build-id/a3/2ae50aedd34f920bcc3da54bc3d871d29b52da /usr/share/man/man1/cputil.1.gz
Looking at the upstream Makefile:
cputil: cputil.o gcc -o cputil cputil.o -lpthread
GCC is no longer part of the default buildroot. You have to add "BuildRequires: gcc".
OK, thanks, I add it.
make prefix=$RPM_BUILD_ROOT mandir=$RPM_BUILD_ROOT/%{_mandir} bindir=$RPM_BUILD_ROOT/%{_bindir} install
Looking at the Makefile, the "prefix=$RPM_BUILD_ROOT" part is not needed.
OK, I remove it.
%files %{_mandir}/man1/cputil.1.gz
Do not assume that man pages will be gzipped. Use a wildcard instead. https://docs.fedoraproject.org/en-US/packaging-guidelines/#_manpages
OK, I change it to: %{_mandir}/man1/cputil.1*
Since this is your first Fedora package - consider submitting your packages to koji (the Fedora build system) for scratch builds. https://fedoraproject.org/wiki/Using_the_Koji_build_system#Scratch_Builds
The koji build repoter: https://koji.fedoraproject.org/koji/taskinfo?taskID=42616777
The build command and logs: [builder@f28 cputil-1.0]$ koji build --scratch rawhide cputil-1.0-1.fc28.src.rpm Uploading srpm: cputil-1.0-1.fc28.src.rpm [====================================] 100% 00:00:00 12.28 KiB 20.27 KiB/sec Created task: 42616777 Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=42616777 Watching tasks (this may be safely interrupted)... 42616777 build (rawhide, cputil-1.0-1.fc28.src.rpm): free 42616777 build (rawhide, cputil-1.0-1.fc28.src.rpm): free -> open (buildvm-13.phx2.fedoraproject.org) 42616780 rebuildSRPM (noarch): open (buildvm-06.phx2.fedoraproject.org) 42616780 rebuildSRPM (noarch): open (buildvm-06.phx2.fedoraproject.org) -> closed 0 free 1 open 1 done 0 failed 42616824 buildArch (cputil-1.0-1.fc33.src.rpm, armv7hl): open (buildvm-armv7-19.arm.fedoraproject.org) 42616826 buildArch (cputil-1.0-1.fc33.src.rpm, x86_64): open (buildhw-03.phx2.fedoraproject.org) 42616825 buildArch (cputil-1.0-1.fc33.src.rpm, i686): open (buildvm-31.phx2.fedoraproject.org) 42616829 buildArch (cputil-1.0-1.fc33.src.rpm, s390x): open (buildvm-s390x-18.s390.fedoraproject.org) 42616828 buildArch (cputil-1.0-1.fc33.src.rpm, ppc64le): free 42616827 buildArch (cputil-1.0-1.fc33.src.rpm, aarch64): free 42616828 buildArch (cputil-1.0-1.fc33.src.rpm, ppc64le): free -> open (buildvm-ppc64le-12.ppc.fedoraproject.org) 42616827 buildArch (cputil-1.0-1.fc33.src.rpm, aarch64): free -> open (buildvm-aarch64-13.arm.fedoraproject.org) 42616826 buildArch (cputil-1.0-1.fc33.src.rpm, x86_64): open (buildhw-03.phx2.fedoraproject.org) -> closed 0 free 6 open 2 done 0 failed 42616825 buildArch (cputil-1.0-1.fc33.src.rpm, i686): open (buildvm-31.phx2.fedoraproject.org) -> closed 0 free 5 open 3 done 0 failed 42616828 buildArch (cputil-1.0-1.fc33.src.rpm, ppc64le): open (buildvm-ppc64le-12.ppc.fedoraproject.org) -> closed 0 free 4 open 4 done 0 failed 42616824 buildArch (cputil-1.0-1.fc33.src.rpm, armv7hl): open (buildvm-armv7-19.arm.fedoraproject.org) -> closed 0 free 3 open 5 done 0 failed 42616827 buildArch (cputil-1.0-1.fc33.src.rpm, aarch64): open (buildvm-aarch64-13.arm.fedoraproject.org) -> closed 0 free 2 open 6 done 0 failed 42616829 buildArch (cputil-1.0-1.fc33.src.rpm, s390x): open (buildvm-s390x-18.s390.fedoraproject.org) -> closed 0 free 1 open 7 done 0 failed 42616777 build (rawhide, cputil-1.0-1.fc28.src.rpm): open (buildvm-13.phx2.fedoraproject.org) -> closed 0 free 0 open 8 done 0 failed
42616777 build (rawhide, cputil-1.0-1.fc28.src.rpm) completed successfully
Thanks very much Weiping