Re: rpmbuild questions

"Michael A. Peters" <[email protected]> Sun, 12 Oct 2008 05:09:01 -0700
Newsgroups gmane.linux.redhat.rpm.general
Message-ID <[email protected]>
Dave Pawson wrote:
> New to rpm's in general. I'm trying to help out with Klavaro,
> currently about 4 versions behind
> the Sourceforge version. FC9 has 1.1
> 
> 
> 
> $ rpm -qa klavaro
> klavaro-1.0.1-1.el5.rf.i386
> 
> current version is 1.1.6
> 
> 
> I've attempted a spec file, from the sources at
> http://klavaro.sourceforge.net/en/
> and it seems to be partially working.
> 
> I'm stuck on debugging it though.
> 
> I've built /usr/src/redhat/RPMS/i386/klavaro-debuginfo-1.1.6-1.fc9.i386.rpm
> 
> Questions.
> 
> How to find out if this is up to standard?
> How to properly test it please?
> I'm running FC9 on an i386 arch (I think!)
> 
> spec file below
> 
> %define version 1.1.6
> %define dist
> %define _tmppath /tmp
> %define release 1

Don't define %dist and %_tmppath in the spec file.
They should be defined in the users .rpmmacros file.

In the vast majority of cases, it is better to define version and 
release directly in the

Version:
Release:

> 
> 
> 
> Name:		klavaro
> Version:	%{version}
> Release:	1%{?dist}
> Summary:	Klavaro
> Prefix:         /usr

Don't define Prefix - except maybe for relocatable packages

> Provides:       klavaro

That is not necessary since it is the same as the package name

> Group:		Applications/Multimedia
> License:	gpl v2

If you want to keep rpmlint happy - that should be

License: GPLv2

> URL:		http://klavaro.sourceforge.net/en/
> Source0:	klavaro-%{version}.tar.bz2
> BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
> 
> #BuildRequires:	-
> #Requires:	-
> 
> %description
> is just another free touch typing tutor program. Built by %{packager}

The packager should not be in the description. If a user really wants to 
know, they can query the RPM database.

> 
> %prep
> %setup -q
> 
> 
> %build
> %configure
> make %{?_smp_mflags}
> 
> 
> %install
> rm -rf $RPM_BUILD_ROOT
> make install DESTDIR=$RPM_BUILD_ROOT
> 
> 
> %clean
> rm -rf $RPM_BUILD_ROOT
> 
> 
> %files
> %defattr(-,root,root,-)
> /usr/bin/klavaro
> /usr/bin/klavaro_helper

since you used %configure - those should be

%{_bindir}/klavaro
%{_bindir}/klavaro_helper


> /usr/share/klavaro/*

Should ve

%{_datadir}/klavaro

That way - the rpm owns the directory and all its contents

> /usr/share/locale/*

That's a big nono.

Up in the top of the spec - do

BuildRequires: gettext

Then in the install section -

%find_lang %{name}

Then for %files -

%files -f %{name}.lang

> /usr/share/man/*

That will result in the package owning directories it shouldn't.
Should be

%{_mandir}/man1/*
etc.

> 
> %doc

%doc usually goes just after the %defattr(-,root,root,-) though it 
doesn't have to.

It shouldn't be empty though, at a minimal it should have the GPL 
(typically called COPYING in the source tarball) - but if there is a 
README, ChangeLog, etc. - those should also be packaged with %doc

Since you are using fedora - see
http://fedoraproject.org/wiki/Packaging/Guidelines