spec file for rpms
Todd Zullinger
tmz at pobox.com
Tue Sep 23 01:07:46 UTC 2008
Phil Meyer wrote:
> Both vim and emacs will create a basic spec for you by simply
> editing a non existant spec file.
I'm a fan of rpmdev-newspec, as Paul mentioned. This creates a nice
template that you can fill in and have a nice, clean specfile. (As a
bonus, if/when you decide to share your package with the rest of us,
it will be formatted as Fedora package reviewers are accustomed to
seeing.)
> There are tools to watch 'make install' to discover what happens and
> duplicate it for a %files section for a spec file, but using those
> tools is a separate art form in itself.
Let rpm do the work for you. With an empty %files section, rpmbuild
will complain that files were found in the buildroot¹ that were not
listed. From there, you can add these files (or shell-style globs) to
the %files section. Most spec files tend to have fairly short
%files sections. For example, the paperkey package looks like this:
%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1.gz
If this was your first spec file and you didn't know about the %{}
macros, it could be written using the full paths.
> You will want some references:
>
> http://www.rpm.org/max-rpm/index.html
>
> http://docs.fedoraproject.org/drafts/rpm-guide-en/
> Look for the section called: Creating the spec file
Agreed, these are both worth having handy as references.
> One last piece of advice:
> Always run rpmbuild as your user, and NOT root. If your .spec file
> needs root to do something, you are doing it wrong. :)
Is it worth mentioning that building packages as root has been known
to kill kittens and other small mammals?
¹ Despite the name, the buildroot is the location where rpm installs
the package.
--
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sometimes I wonder whether the world is being run by smart people who
are putting us on or by imbeciles who really mean it.
-- Mark Twain
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080922/3b94611b/attachment-0001.sig>
More information about the fedora-list
mailing list