In this lab my goal is to create an RPM package from source. Essentially the opposite of what I did in my previous blog post (Download and install an RPM package).
My first step was to ensure I had the required packages in order to perform the building commands.
[root@localhost tarBalls]# yum groupinstall “Fedora Packager” -y
[root@localhost tarBalls]# yum install rpmlint yum-utils -y
Loaded plugins: langpacks, presto, refresh-packagekit
Setting up Install Process
Package rpmlint-1.2-1.fc15.noarch already installed and latest version
Package yum-utils-1.1.31-2.fc15.noarch already installed and latest version
Nothing to do
After installation of those packages I have to create the build environment with ‘rpmbuild-setuptree’ which creates the ~/rpmbuild and ~/.rpmmacros directories.
Now I’m able to begin the actual package building. I copy the previously downloaded tarballs to the
I move to the ~/rpmbuild/SPECS directory and create a new spec file for my tarball:
[root@localhost SPECS]# rpmdev-newspec spell-1.1
Now I edit the spell.spec file and fill in the meta data
Here’s a snippet of my spell.spec file:
Summary: Linguistics checking program
A spell checking program which prints each misspelled word on a new line.
#rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%doc README COPYING INSTALL
* Fri Sep 23 2011 Nick Lambert <email@example.com> – 1.1-1
– Built source as an RPM.
Some issues I had while altering this spec file were:
- The summary could not contain the name of the program itself, so I opted to call it a “Linguistics checking program”.
- I originally entered GPLv2 as the license which I learned was incorrect. I promptly changed that to GPLv3+.
- My first build attempt failed because of the following error: “find: `/root/rpmbuild/BUILDROOT/spell-1.1-1.fc15.i386′: No such file or directory” To remedy this I simply commented out the “#rm -rf $RPM_BUILD_ROOT” line thus ensuring that directory would exist. I’m not certain if this was the correct way to correct this error, though it did work..
Next I moved to testing with rpmlint:
My first test with rpmlint returned with some errors and warnings
[root@localhost SPECS]# rpmlint ../SRPMS/spell-1.1-1.fc15.src.rpm
spell.src: E: no-changelogname-tag
1 packages and 0 specfiles checked; 1 errors, 0 warnings.
To fix this I added the %changelog section to my spec file and then re-built it.
Running rpmlint on the SRPM file returns no warnings..
Running rpmlint on the RPMS file returned 1 warning:
[root@localhost SPECS]# rpmlint ../RPMS/noarch/spell-1.1-1.fc15.noarch.rpm
spell.noarch: W: no-documentation
1 packages and 0 specfiles checked; 0 errors, 1 warnings.
To remedy this, I added the documation portion to the spec file.
To download my SRPMS of spell go here: http://matrix.senecac.on.ca/~nlambert/spell-1.1-1.fc15.noarch.rpm
To download my RPMS of spell go here: http://matrix.senecac.on.ca/~nlambert/spell-1.1-1.fc15.src.rpm