Home > Uncategorized > RPM-Writing

RPM-Writing

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

Installed:
bodhi-client.noarch 0:0.8.0-1.fc15
bzr.i686 0:2.3.4-1.fc15
fedora-easy-karma.noarch 0:0-0.15.20110825git36efb338.fc15
fedora-packager.noarch 0:0.5.9.2-2.fc15
koji.noarch 0:1.6.0-2.fc15
mercurial.i686 0:1.9.1-1.fc15
mock.noarch 0:1.1.12-1.fc15
plague-client.noarch 0:0.4.5.8-2.fc15

Dependency Installed:
GitPython.noarch 0:0.2.0-0.6.beta1.fc15
fedora-cert.noarch 0:0.5.9.2-2.fc15
fedpkg.noarch 0:0.5.9.2-2.fc15
libyubikey.i686 0:1.7-1.fc15
pigz.i686 0:2.1.6-2.fc15
plague-common.noarch 0:0.4.5.8-2.fc15
python-bunch.noarch 0:1.0.0-3.fc15
python-decoratortools.noarch 0:1.8-2.fc15
python-enchant.i686 0:1.3.1-8.fc15
python-fedora.noarch 0:0.3.24-3.fc15
python-krbV.i686 0:1.0.90-4.fc15
python-magic.i686 0:5.07-4.fc15
python-offtrac.noarch 0:0.0.3-3.fc15
python-paramiko.noarch 0:1.7.7.1-1.fc15
rpmlint.noarch 0:1.2-1.fc15
ykpers.i686 0:1.4.1-1.fc15

Complete!,

[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 ~/rpmbuild/SOURCES directory.

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:

Name:           spell
Version:        1.1
Release:        1%{?dist}
Summary:        Linguistics checking program

License:        GPLv3+
URL:            http://savannah.gnu.org/projects/spell/
Source0:        http://ftp.gnu.org/gnu/spell/spell-1.1.tar.gz

#BuildRequires:
#Requires:
BuildArchitectures: noarch

%description
A spell checking program which prints each misspelled word on a new line.

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
#rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

%files
%doc README COPYING INSTALL

%changelog
* Fri Sep 23 2011 Nick Lambert <nlambert@learn.senecac.on.ca> – 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

 

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: