"[Tutorial]Building RPM package using GNU Hello - Fedora 23/24"

Published: Mon 25 July 2016

In content.

[Tutorial]Building RPM package using GNU Hello - Fedora 23/24

This tutorial was written to guide users in creating RPM package using GNU Hello source.

  • 1) run # dnf install fedora-packager @development-tools
  • 2) run # usermod -a -G mock
  • 3) run the command from user-space (hint: '$') $ rpmdev-setuptree
  • 4) change directory into ~/rpmbuild/SOURCES and download the source: $ wget http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz
  • 5) change directory into ~/rpmbuild/SPECS and run rpmdev-newspec hello
  • 6) open ```hello.spec`` file in editor of your choice and dump following configuration:

[code lang=text] Name: hello Version: 2.10 Release: 1%{?dist} Summary: The "Hello World" program from GNU

License: GPLv3+ URL: http://ftp.gnu.org/gnu/%{name} Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.gz

BuildRequires: gettext

Requires(post): info Requires(preun): info

%description The "Hello World" program, done with all bells and whistles of a proper FOSS project, including configuration, build, internationalization, help files, etc.

%prep %autosetup

%build %configure make %{?_smp_mflags}

%install %make_install %find_lang %{name} rm -f %{buildroot}/%{_infodir}/dir

%post /sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun if [ $1 = 0 ] ; then /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || : fi

%files -f %{name}.lang %{_mandir}/man1/hello.1.* %{_infodir}/hello.info.* %{_bindir}/hello


%changelog * Mon Jul 25 2016 vgnshlvnz 2.10-1 - Initial version of the package [/code]

  • 7) run following command: rpmbuild -ba hello.spec This would start building source, binary and debugging packages. Should you see no errors, it simply means you have completed the process successfully.

To make sure there are no warnings , errors, run following command: $ rpmlint hello.spec ../SRPMS/hello* ../RPMS/*/hello* If there are no warnings or errors, we've succeeded. Otherwise, use rpmlint -i or rpmlint -I to see a more verbose description of the rpmlint diagnostics.

To check that the package build will succeed in the Fedora restricted build environment, check it with mock. The default mock configuration builds the package against Rawhide - the Fedora development branch. mock --verbose ../SRPMS/hello-2.10-1.fc23.src.rpm

Even if you run into warnings or errors, do not worry, go back to RPMS and SRPMS folders and install those RPMS manually. It should install successfully.

Once it is installed, you will see hello program available in your path. Running hello --version will tell you if you have did the right thing (for now).

Reference: 1) https://fedoraproject.org/wiki/How_to_create_a_GNU_Hello_RPM_package 2) https://fedoraproject.org/wiki/How_to_create_an_RPM_package