[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Experienced package builders: please test my first RPM



On Mon, 2005-09-05 at 14:14 -0400, Tony Nelson wrote:
> I've written a tiny utility and packaged it in my first RPM.  I'd
> appreciate a couple of experienced packagers taking a look at it and
> telling me about any problems.  I'm new to Linux and so this is also my
> first tarball.  I also have only one machine, so the RPM and utility
> haven't even been tested on a second machine yet.  It should uninstall
> cleanly.  It may even be useful.
> 
> <http://georgeanelson.com/apropos2.htm>

Summary conventionally should start with a capital letter and not end
with a period.

You can shorten "BuildArchitectures" to "BuildArch".

Try to wrap the text in %description at 80 columns so it looks tidy on a
standard terminal display.

Don't mess with /etc/bashrc in scriptlets - this is error-prone and will
either get clobbered by an update of the "setup" package, or the user
will need to merge changes from .rpmnew/.rpmsave files. You can drop
alias definitions into files in /etc/profile.d to achieve the same
result.

Clean out the buildroot at the start of %install as well as in %clean.

Try to be consistent in the way you use variables and macros. For
instance, if you use ${RPM_BUILD_ROOT} in one place, try to avoid using
$RPM_BUILD_ROOT somewhere else; it makes no difference functionally but
it's neater.

Use %{_bindir} and other directory-specifying macros rather than
hardcoding paths.

Use the version and release tags in your changelog entries, not just
version.

Consider lining up the tags at the top of the spec file in two columns;
again, functionally it doesn't matter but I believe it improves
readability.

I would include the text of the GPL in your tarball and add it as %doc
in your RPM package.

Package seems to work OK :-)

I've attached a spec file incorporating these suggestions.

> Should I sign the package?  (I'd be new to that, also.)

Yes. Have you got a GPG key that's available on a public server?

Create the following entries in your ~/.rpmmacros file:
%_signature	gpg
%_gpg_name	8-digit keyid for your key

You can then use "rpm --resign *.rpm" to sign your packages.

Paul.
-- 
Paul Howarth <paul city-fan org>
Summary:        Apropos (man) replacement that only prints entries containing all search words
Name:           apropos2
Version:        1.0.0
Release:        2_GAN
Group:          System Environment/Base
BuildArch:      noarch
License:        GPL
URL:            http://georgeanelson.com/apropos2.htm
Source:         http://georgeanelson.com/apropos2-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
Requires:       man

%description
Replacement for apropos (in the man package) that prints only entries that
contain all the words being searched for. The original apropos command prints
all lines that match the first word, then all lines that match the second word,
and so on. Apropos2 is equivalent to:
"apropos word1 | grep word2 | ... | grep wordn"

%prep
%setup

cat > apropos2.sh <<EOF
# Use apropos2 in preference to apropos
alias apropos=%{_bindir}/apropos2
EOF

cat > apropos2.csh <<EOF
# Use apropos2 in preference to apropos
alias apropos %{_bindir}/apropos2
EOF

%build
#nothing -- no make

%install
rm --preserve-root -rf ${RPM_BUILD_ROOT}

install -m 755 -d           ${RPM_BUILD_ROOT}%{_bindir}
install -m 755 apropos2     ${RPM_BUILD_ROOT}%{_bindir}/
install -m 755 -d           ${RPM_BUILD_ROOT}%{_mandir}/man1
install -m 644 apropos2.1   ${RPM_BUILD_ROOT}%{_mandir}/man1/
install -m 755 -d           ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d
install -m 755 apropos2.sh  ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d/
install -m 755 apropos2.csh ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d/

%clean
rm --preserve-root -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%{_bindir}/apropos2
%{_mandir}/man1/apropos2.1*
%{_sysconfdir}/profile.d/apropos2.sh
%{_sysconfdir}/profile.d/apropos2.csh

%changelog
* Tue Sep  6 2005 Paul Howarth <paul city-fan org> - 1.0.0-2_GAN
- drop in alias setup in /etc/profile.d/ rather than messing with bashrc in
  scriptlets
- clean buildroot before %%install
- general spec file tidy-up

* Mon Sep 05 2005 George A. Nelson <tonynelson georgeanelson com> - 1.0.0-1_GAN
- initial version


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]