Draft RPM packaging guidelines



OK, I've been working on putting some RPM packaging guidelines together
over the past couple of weeks.  Since I see that there are all kinds of
people here looking for something to do, I thought I'd post what I have
on RPM guidelines so far.  I'm including both the SGML source (it's
named .xml, but don't let that fool you), and the HTML output as a
tar.gz.  The links in the HTML don't work, yet, but they will soon.
Enjoy, let me know what you think so far.  Thanks,
    Greg


-- 
Troll, troll, troll your post
Gently down the feed
Merrily, merrily troll along
A life is what you need...
<!DOCTYPE Article PUBLIC "-//OASIS//DTD DocBook V3.1//EN">

<article id="index">

 <artheader>
  <title>GNOME RPM spec file packaging guidelines</title>

  <author>
   <firstname>Gregory</firstname>
   <surname>Leblanc</surname>
   <affiliation>
    <orgname>GNOME</orgname>
    <orgdiv>GNOME Packaing Project</orgdiv>
    <address><email>gleblanc cu-portland edu</email></address>
   </affiliation>
  </author>

  <abstract>
   <para>This document attempts to outline the guidelines that GPP
   spec files should adhere to.  These guidelines are designed to make
   spec files that will function on at least Red Hat 6.x and 7.x.
   They should also function on Red Hat-like systems with only minor
   adjustments.  For systems that use RPM but aren't Red Hat-like,
   these spec files should serve as a good starting point.</para>

   <para>Some knowledge of writing RPM spec files is assumed.  The
   book Maximum RPM has a good intro to some of the concepts and
   syntax used in RPM spec files.</para>
  </abstract>

 </artheader>

 <section id="preamble">
  <title>SPEC file preamble</title>

  <para>The first section of the spec file is the preamble.  This
  contains lots of general information about the package, such as the
  name, version, source location, and so on.  Since the GNOME project
  uses autoconf and automake to help ensure that our programs are
  portable, we've tried to leverage this into our spec files.  We use
  autoconf to replace the version number, and to help up manage
  package dependancy versions.</para>

  <informalexample>
   <programlisting role="specfile">
<systemitem class="macro">%define</systemitem> localstatedir   <link linkend="localstatedir">/var/lib</link>

Summary:         <link linkend="summary"><replaceable>The core programs for the GNOME GUI desktop environment.</replaceable></link>
Name: 		 <link linkend="name"><replaceable>gnome-core</replaceable></link>
Version: 	 <systemitem class="macro">%ver</systemitem>
Release: 	 <systemitem class="macro">%rel</systemitem>
License: 	 <link linkend="license"><replaceable>LGPL</replaceable></link>
Group: 		 <link linkend="group"><replaceable>System Environment/Base</replaceable></link>
Source:          <link linkend="source"><replaceable>ftp://ftp.gnome.org/pub/sources/gnome-core/gnome-core-%{ver}.tar.gz</replaceable></link>
BuildRoot: 	 <link linkend="buildroot"><replaceable>%{_tmmpath}/%{name}-%{version}-buildroot</replaceable></link>
URL: 		 <link linkend="url"><replaceable>http://www.gnome.org</replaceable></link>
Prereq: 	 <link linkend="prereq"><replaceable>/sbin/install-info</replaceable></link>
Requires:        <link linkend="requires"><replaceable>gtk+ >= @GTK_REQUIRED@, gdk-pixbuf >= @GDK_PIXBUF_REQUIRED@</replaceable></link>
Requires:        <link linkend="requires"><replaceable>libglade >= @LIBGLADE_REQUIRED@, libxml</replaceable></link>
Requires:        <link linkend="requires"><replaceable>gnome-libs >= @GNOME_LIBS_REQUIRED@</replaceable></link>
Requires:        <link linkend="requires"><replaceable>ORBit >= @ORBIT_REQUIRED@</replaceable></link>
Requires:        <link linkend="requires"><replaceable>control-center >= @CONTROL_CENTER_REQUIRED@</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>gtk+-devel >= @GTK_REQUIRED@, libxml-devel</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>gdk-pixbuf-devel >= @GDK_PIXBUF_REQUIRED@</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>libglade-devel >= @LIBGLADE_REQUIRED@</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>scrollkeeper >= @SCROLLKEEPER_REQUIRED@</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>gnome-libs-devel >= @GNOME_LIBS_REQUIRED@</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>ORBit-devel >= @ORBIT_REQUIRED@</replaceable></link>
BuildRequires:   <link linkend="buildrequires"><replaceable>control-center-devel >= CONTROL_CENTER_REQUIRED@</replaceable></link>

</programlisting>
  </informalexample>
   <formalpara id="localstatedir">
    <title>localstatedir</title>

    <para>This line forces <varname>localstatedir</varname> to be set
    to <filename class="directory">/var/lib</filename>.  This
    directory isn't set to FHS compliance by RPM, so we're forced to
    override it here.</para>
   </formalpara>

   <formalpara id="summary">
    <title>Summary</title>

    <para>This should be a short summary of what the program or
    package does.  Including the name of the package here is
    redundant, so don't do that.</para>
   </formalpara>

   <formalpara id="name">
    <title>Name</title>

    <para>This specified the name of the package.  It is
    case-sensitive, and should match the name of the tarball created
    when you run 'make dist'.</para>
   </formalpara>

   <formalpara id="license">
    <title>License</title>

    <para>This is the license that the package is distributed under.
    Probably GPL or LGPL for most GNOME packages.  Many older spec
    files erroneously call this field <quote>Copyright</quote>.
    Please correct this when you see it.</para>
   </formalpara>

   <formalpara id="group">
    <title>Group</title>

    <para>This should be one of the canonical groups from
    <filename>/usr/share/doc/rpm-<replaceable>VERSION</replaceable>/GROUPS</filename>.
    Please don't make up new groups.</para>
   </formalpara>

   <formalpara id="source">
    <title>Source</title>

    <para>You can have multiple <quote>Source</quote> lines.  You
    should start numbering sources at 0.  A tag of simply
    <quote>Source</quote> implies 0.  You should include a complete
    URL to the source package whenever possible.</para>
   </formalpara>

   <formalpara id="buildroot">
    <title>BuildRoot</title>

    <para>Make sure you use the special <systemitem
    class="macro">%{_tmppath}</systemitem> macro, and not hardcode
    <filename class="directory">/tmp</filename> or <filename
    class="directory">/var/tmp</filename>. The user may have
    configured RPM to put temporary files elsewhere. Use the name and
    version macros so that you can build two different versions of the
    package at the same time without collisions.</para>
   </formalpara>

   <formalpara id="url">
    <title>URL</title>

    <para>Use this tag for the package's homepage, if it has one.</para>
   </formalpara>

   <formalpara id="prereq">
    <title>PreReq</title>

    <para>This lists files or packages that are required to be present
    <emphasis>before</emphasis> the package can be installed.  This is
    very important if you're using other programs in <systemitem
    class="macro">%pre</systemitem> or <systemitem
    class="macro">%post</systemitem> sections.</para>
   </formalpara>

   <formalpara id="requires">
    <title>Requires</title>

    <para>If this package requires other packages to be installed in
    order to function properly, they should be listed here.  Note the
    <varname>@GTK_REQUIRED@</varname>, which is defined in
    <filename>configure.in</filename>.  This ensures that the version
    required by the <filename>configure</filename> script is the same
    as the version required by RPM.  You can specify files here by
    their full path, for example <filename>/sbin/ldconfig</filename>.</para>
   </formalpara>

   <formalpara id="buildrequires">
    <title>BuildRequires</title>

    <para>This is similar to the PreReq tag, except that it applies to
    the build of this package.  So, if the package needs some other
    package installed the time that <filename>configure</filename> is
    run, it should be listed on the BuildRequires line</para>
   </formalpara>

 </section>

</article>

Attachment: rpm-packaging-guidelines-html.tar.gz
Description: GNU Zip compressed data



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