Creating an RPM package on Fedora 17

For a list of all files created: Click Here

Setting up the computer:
First install the development tools: yum groupinstall “Development Tools” “Development Libraries”
Then you need to install the fedora packager: yum install “@fedora packager”
Next you need to setup the rpmbuild directory, this can be done using the command: rpmdev-setuptree
This will create a directory structure under ~/rpmbuild/

The which command
Downloaded which-2.20.tar.gz from http://carlo17.home.xs4all.nl/which/ and placed the file inside the ~/rpmbuild/SOURCES
Then change your directory to ~/rpmbuild/SPECS and run the command: rpmdev-newspec which
This will create a new spec file called which.spec
Some changes need to be made in this file, filling in the information asked. Also you need to specify, under %files, the files that are needed to be unpacked from the package.

———————————————
Name:           which
Version:        2.20
Release:        1%{?dist}
Summary:        which command/program

License:        GPL3
URL:            http://carlo17.home.xs4all.nl/which/
Source0:        http://carlo17.home.xs4all.nl/which/which-2.20.tar.gz

%files
%doc README COPYING AUTHORS EXAMPLES
%{_bindir}/which
%{_mandir}/man1/*
%{_infodir}/*
———————————————

Finally you can run the command: rpmbuild -ba ~/rpmbuild/SPECS/which.spec
Now it should build the package and put a .rpm file and a debug .rpm file in ~/rpmbuild/RPMS/ and one .srpm file in ~/rpmbuild/SRPMS/

Build errors from rpmlint:

———————————————
which.x86_64: E: no-changelogname-tag
which.x86_64: E: info-dir-file /usr/share/info/dir
which.x86_64: E: info-files-without-install-info-postin /usr/share/info/dir
which.x86_64: E: info-files-without-install-info-postun /usr/share/info/dir
which.x86_64: E: info-files-without-install-info-postin /usr/share/info/which.info.gz
which.x86_64: E: info-files-without-install-info-postun /usr/share/info/which.info.gz
1 packages and 0 specfiles checked; 6 errors, 0 warnings.
———————————————

To fix the errors that reference info-files you need to add two scriptlets below to the .spec file:

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

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

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

Those fixed every error except the info-dir-file and the no-changelogname-tag. The info-dir-file can be fixed by adding a rm -rf %{buildroot}/%{_infodir}/dir command after the %make_install. In order to fix the no-changelogname-tag just add a changelog tag after

———————————————
%changelog
* Sun Sep 16 2012 Andrew Oatley-Willis <acoatley-willis@myseneca.ca> 2.20-1
– Initial Packaging
———————————————

The SRPM showed no errors when checked, and neither did the .spec file. The debuginfo binary rpm shows up with a few errors all relating to “E: incorrect-fsf-address” which refers to an outdated free software foundation license which should probably not be replaced. At this point, the which command has been packaged and almost completely error free.

The macchanger command

Downloaded macchanger from http://www.alobbs.com/macchanger/ version 1.5.0 and created a new spec file with: rpmdev-newspec macchanger
Filled in information inside the spec file and added a changelog tag.

———————————————
Name:           macchanger
Version:        1.5.0
Release:        1%{?dist}
Summary:        Change mac address

License:        GPLv2
URL:            http://www.alobbs.com/macchanger/
Source0:        ftp://ftp.gnu.org/gnu/macchanger/macchanger-1.5.0.tar.gz
———————————————

Then ran the command: rpmbuild -ba macchanger.spec in order to see which files were created. Then filled them inside the spec file like so:

———————————————
%files
%doc COPYING README
%{_bindir}/*
%{_infodir}/*
%{_mandir}/man1/*
%{_datadir}/macchanger/
———————————————

At this point rpmbuild -ba macchanger.spec was built successfully. Then switched to checking errors with rpmlint which showed up with errors:
———————————————
[acoatley-willis@Andrew-SBR x86_64]$ rpmlint macchanger-1.5.0-1.fc17.x86_64.rpm
macchanger.x86_64: E: incorrect-fsf-address /usr/share/doc/macchanger-1.5.0/COPYING
macchanger.x86_64: E: info-files-without-install-info-postin /usr/share/info/macchanger.info.gz
macchanger.x86_64: E: info-files-without-install-info-postun /usr/share/info/macchanger.info.gz
macchanger.x86_64: E: info-dir-file /usr/share/info/dir
macchanger.x86_64: E: info-files-without-install-info-postin /usr/share/info/dir
macchanger.x86_64: E: info-files-without-install-info-postun /usr/share/info/dir
1 packages and 0 specfiles checked; 6 errors, 0 warnings.
———————————————

In order to fix the errors that say “info-files”, install-info must be used to update texinfo pages:

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

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

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

For the info-dir-file error, rm the following file after the %make_install:

———————————————
%make_install
rm -rf %{rootbuild}/%{_infodir}/dir
———————————————

At this point on the build, and rpmlint check there is only a single error which is “incorrect-fsf-address” inside the license file COPYING. This is most likely the wrong address or something simple like that. Everything is functional with no other errors in any of the binary rpms, the src rpm, or the spec file.

Advertisements

About oatleywillisa

Computer Networking Student
This entry was posted in SBR600. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s