From Fedora Project Wiki
(Created page with "{{draft}} {{DISPLAYTITLE:Guidelines for Naming Fedora Packages}} <div style="float: right;" class="toclimit-2">__TOC__</div> {{admon/note|"Binary" packages|Throughout this g...")
 
 
(48 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{draft}}
{{draft}}


{{DISPLAYTITLE:Guidelines for Naming Fedora Packages}}
{{DISPLAYTITLE:Guidelines for Versioning Fedora Packages}}
<div style="float: right;" class="toclimit-2">__TOC__</div>
<div style="float: right;" class="toclimit-2">__TOC__</div>


{{admon/note|"Binary" packages|Throughout this guideline, the term "binary package" refers to the result of building a source package (using rpmbuild or mock, for example) even though it may contain no actual binaries.}}
In Fedora we want to ensure that there is always an upgrade path from Fedora release to Fedora release and from Fedora release to the packages in updates.  To do that we need to make sure the packages in the newer Fedora releases have an equal or higher <code>Epoch:Version-Release</code> (EVR) than the ones in older releases.  For example, Fedora-13 ships with <code>foo-1.0-1.fc13</code> and Fedora-14 ships with <code>foo-1.0-2.fc14</code>.  This example shows that the Fedora-14 package will properly upgrade the Fedora-13 package.


== Versioning guidelines have moved ==
A more complex example.  Fedora-13 ships with <code>foo-1.0-1.fc13</code> and Fedora-14 ships with <code>foo-1.0-2.fc14</code>.  Fedora-13 gets an updated foo package: <code>foo-1.0.1-1.fc13</code>.  This update is EVR higher than the package Fedora-13 shipped with so that's goodHowever, it is also EVR higher than what Fedora-14 shipped with so we need to make a Fedora-14 update at the same time, likely: <code>foo-1.0.1-1.fc14</code>.  making that update means that someone updating from Fedora-13 with updates enabled will get the correct package on Fedora-14 with updates enabled.
This document previously contained information on both naming and versioningThe versioning guidelines are now at [[Packaging:Versioning]].


== Common Character Set for Package Naming ==
The one time where we temporarily break the upgrade path is from released Fedora to rawhide.  It is allowable to temporarily have a higher EVR in a released Fedora vs rawhide in cases where we need to get a fix out to users of the Fedora releases quickly (for instance, for a security issue) but the fixed package does not currently build in rawhide (for instance, because of a change in a dependent library that requires porting effort).  The changes should be checked into Fedora's SCM for rawhide although there is not yet a build and getting a rawhide build that restores the upgrade path should be a priority.
While Fedora is an international community, for consistency and usability, there needs to be a common character set for package naming.


Specifically, all Fedora packages must be named using only the following ASCII characters. These characters are displayed here:
<code>rpm</code>'s understanding of what package is newer comes from the values of the <code>Epoch</code>, <code>Version</code>, and <code>Release</code> tags.  The next few sections explain what values to use in those tags to ensure that the EVR consistently increases.


<pre>
=== Version Tag ===
abcdefghijklmnopqrstuvwxyz
The Version field in the spec is where the maintainer should put the current version of the software being packaged.
ABCDEFGHIJKLMNOPQRSTUVWXYZ
If the version is non-numeric (contains tags that are not numbers), you may need to include the additional non-numeric characters.
0123456789-._+
</pre>


But do check [[#Separators]] for additional restrictions on using the <code>-._+</code> characters.
There are four cases where the version contains non-numeric characters:


=== General Naming ===
* Pre-release packages: Packages released as "pre-release" versions, prior to a "final" version. Example tags include "alpha", "beta", "rc", "cvs". Details can be found here: [[#Pre-Release_Packages|  Pre-Release Packages]]


Package names should be in lower case and use dashes in preference to
* Post-release packages: Packages released after a "final" version. These packages contain the same numeric version as the "final" version, but have an additional non-numeric identifier. Details can be found here: [[#Post-Release Packages| Post-Release Packages]]
underscores. You can take some cues from the name of the upstream tarball,  
the project name from which this software came, and the name which has been used for this
package by other distributions/packagers in the past. You can also request
guidance from the upstream developers. Do not just blindly follow those
examples, however, as package names should strive to be consistent within
Fedora more than consistent between distributions.


Additionally, it is possible that the upstream name does not fall into the
* Snapshot packages: Packages built from cvs or subversion snapshots. These packages could be either "pre" or "post" release packages. Details can be found here: [[#Snapshot_PackagesSnapshot Packages]]  
[[#CommonCharacterSet|  Common Character Set]] . If this is the case, refer to:  
[[#TransliterationWhen Upstream Naming is outside of the specified character
set]] .


Also remember to check whether the type of package you are packaging has
==== Basic versioning rules ====
specific rules for naming. [[Packaging:NamingGuidelines#Font_Packages |Font
packages]] and the various sorts of
[[Packaging:NamingGuidelines#Addon_Packages_.28General.29 |addon packages]],
for instance.


=== Separators ===
* RPM splits versions in to sections which are compared piece by piece
When naming packages for Fedora, the maintainer must use the dash '-' as the delimiter for name parts. The maintainer must NOT use an underscore '_', a plus '+', or a period '.' as a delimiter.  Version numbers used in compat libraries do not need to omit the dot '.' or change it into a dash '-' (see [[#MultiplePackages| Multiple packages with the same base name]] for more info on this case).


There are a few exceptions to the no underscore '_' rule.
* Version/Release strings allowed to have ASCII letters (<code>a-zA-Z</code>), digits (<code>0-9</code>) and separators (<code>._+~</code>)
* httpd, pam, and SDL addon packages are excluded, refer to "'''[[#AddonHttpdPamSDL|  Addon Packages (httpd, pam and SDL)]] '''".
* packages that are locale specific, and use the locale in the name are excluded, refer to "'''[[#AddonLocale|  Addon Packages (locale)]] '''".
* Compat packages where the base package name ends in a digit.  refer to "'''[[#MultiplePackages| Multiple packages with the same base name]]'''"
* packages where the upstream name naturally contains an underscore are excluded from this. Examples of these packages include:
<pre>
arptables_jf
dhcpv6_client
java_cup
knm_new
libart_lgpl
lm_sensors
microcode_ctl
nss_db
nss_ldap
sg3_utils
tcp_wrappers
</pre>


If in doubt, ask on devel@lists.fedoraproject.org.
* Tilde (<code>~</code>) is special separator and has special meaning/handling


=== When Upstream Naming is outside of the specified character set ===
* Separators are ignored by RPM's comparison - <code>1+0 == 1.0</code>
Fedora recognizes that the task of converting text to the specified ASCII character set (aka transliteration) is difficult. Accordingly, when the upstream name is outside of the specified ASCII character set, the Fedora package maintainer should first contact the upstream for that software and ask them for a transliteration of the name for Fedora to use.


If (and only if) the upstream is unable, unwilling, or unavailable to provide a transliterated name, the Fedora packager must choose to either perform their own transliteration, or withdraw the package from consideration in Fedora.
* Letters are sorted '''before''' digits - <code>a < 1</code>


When deciding how to transliterate a package name, the Fedora packager should look to see what (if any) other distributions have done for that package's name, and take that into account.
* Letters are compared by their ASCII value - <code>a (97) > A (65)</code>


=== Extra Provides ===
* Additional character makes version being higher - <code>1.1 < 1.10</code>, <code>1.0 < 1.0.0</code>
Transliterated packages may Provide: the original, non-transliterated name, but are not required to do so.


== Conflicting Package Names ==
* Tilde (<code>~</code>) makes version being lower - <code>1.0 > 1.0~</code>, <code>1.0 > 1.0~rc1</code>
Conflicting package names, even if they differ by case alone, are not allowed. Please see [[Packaging:Conflicts#Conflicting Package Names]] for more details.


== Multiple packages with the same base name ==
* Zero (<code>0</code>) after separator handled natively - <code>1.0 == 1.000</code>
For many reasons, it is sometimes advantageous to keep multiple versions of a package in Fedora to be installed simultaneously. When doing so, the package name should reflect this fact. One package should use the base name with no versions and all other addons should note their version in the name.


'''Example:'''
<BR>The python-sqlalchemy package occasionally has multiple versions in Fedora for backwards compatibility.<BR>
The most current version of python-sqlalchemy has <code>Name: python-sqlalchemy</code> <BR>
The previous version of python-sqlalchemy has <code>Name: python-sqlalchemy0.5</code> <BR>
Removing the dot in the version number may be optionally done and is seen frequently in older packages.  Keeping the dot is preferred in new packages as it is less ambiguous what version foo1.1.6 refers to than foo116.<BR>
Note that we do not use delimiters in the name in this situation.  We attach the version number to the name. 


=== Underscores ===
Note that after <code>~</code> or <code>+</code>, there should never be a leading digit. Especially in the case of <code>+</code>, where it is considered equivalent to other separators, it is important to use only letters at the beginning so that RPM's version comparison considers it lower than a successive formal release.
There is one time when a delimiter between a compat package's base name and the version are necessary.  When the compat package's base name ends in a digit the version '''MUST''' be separated from the rest of the package with an underscore.


'''Example'''
For example:
<BR>We want to have a backwards compatible version of the v8 package in Fedora.<BR>
* <code>1.0+1 == 1.0.1</code>
The most current version of v8 has <code>Name: v8</code> <BR>
* <code>1.0+git < 1.0.1</code>
The previous version of v8 has <code>Name: v8_3.13</code> <BR>
Note that "v8" and "3.13" are separated by an underscore.  This makes the package name much more readable than <code>v83.13</code>.


==== Non-Numeric Versions ====
There are three cases in which non-numeric versions occur in the Version field:


=== Documentation Packages with Embedded OS versioning ===
* Pre-release packages
Documentation packages (as approved by the Fedora Documentation Project) can be named with the OS version number in the package name to allow parallel installation of multiple versions, in cases where the documentation is specific to a release of Fedora and there is value in having multiple versions simultaneously installed.
* Post-release packages
* Snapshot packages


== Case Sensitivity ==
===== Pre-Release Packages =====
In Fedora packaging, the maintainer should use his/her best judgement when considering how to name the package. While case sensitivity is not a mandatory requirement, case should only be used where necessary. Keep in mind to respect the wishes of the upstream maintainers. If they refer to their application as "ORBit", you should use "ORBit" as the package name, and not "orbit". However, if they do not express any preference of case, you should default to lowercase naming.<BR>
Non-numeric versioned "pre-release" packages can be problematic so they must be treated with care.
<BR>
These are cases where the upstream "pre-release" version has letters rather than simple numbers in their version. Often they have tags like alpha, beta, rc, or letters like a and b denoting that it is a version before the "final" number. We need to follow a special scheme to ensure proper ordering in the Version field.
The exception to this is for perl module packaging. The CPAN Group and Type should be capitalized in the name, as if they were proper nouns . (Refer to '''[[#AddonPerl|  Addon Packages (perl modules)]] ''' for details.)


== Renaming/replacing existing packages ==
Version Tag for Pre-Release Packages:
See: [[Packaging:Guidelines#Renaming.2FReplacing_Existing_Packages]]
<code>%{X}~%{alphatag}</code>


== Documentation Subpackages ==
Where <code>%{X}</code> is the software version that the pre-release will become, and <code>%{alphatag}</code> is the string indicating the pre-release state.
Large documentation files should go in a subpackage. This subpackage must be named with the format: <code>%{name}-doc</code> .
In this case, the tilde '~' is used as not only a separator, but also an indicator for RPM to consider it lower than a package that just has <code>%{X}</code> in the Version field.
The definition of large is left up to the packager's best judgement, but is not restricted to size. Large can refer to either size or quantity.


== Font Packages ==
{{admon/note|Non-sortable "alphatags"|If during usage of tilde or any other separators you see that it will introduce downgrade (e.g. <code>1~prerelease -> 1~alpha</code>) - prepend a letter '''and''' separator (preferably <code>.</code>) (e.g. <code>1~z.alpha</code>).}}
Packages containing fonts must be named '''[foundryname-]projectname[-fontfamilyname]-fonts''', in lowercase. For a full explanation, see [[Packaging/FontsPolicy#Naming]].


== Addon Packages ==
====== Examples ======
If a new package is considered an "addon" package that enhances or adds a new functionality to an existing Fedora package without being useful on its own, its name should reflect this fact.<BR>
<BR>
The new package ("child") should prepend the "parent" package in its name, in the format: <code>%{parent}-%{child}</code>.


'''Examples:'''
{| class="mw-collapsible mw-collapsed wikitable"
<pre>
|+ '''Example (mozilla pre-release)'''
gnome-applet-netmon (netmon applet for gnome, relies on gnome)
|-
php-adodb (adodb functionality for php, relies on php)
! Source Archive !! Description
python3-twisted (the twisted module for python3, relies on python3)
|-
xmms-cdread (direct cd read functionality for xmms, relies on xmms)
|style=white-space:nowrap| <code>mozilla-1.4a.tar.gz</code> || (this is a pre-release, version 1.4a of mozilla)
</pre>
|-
| <code>mozilla-1.4.tar.gz</code> || (this is what the 1.4 release will actually look like)
|-
! Name-Version-Release !! Explanation
|-
| <code>mozilla-1.4~a-1%{?dist}</code> || (so, this is the acceptable Fedora <code>%{name}-%{version}-%{release}</code>)
|-
| <code>mozilla-1.4-1%{?dist}</code> || (and this is what the 1.4 release Fedora <code>%{name}-%{version}-%{release}</code> should be)
|}


When the addon package is a language binding, note that the language itself is always the parent.  Thus, a lua binding for the "randomdb" database would be <code>lua-randomdb</code>, not <code>randomdb-lua</code>. Also note that some packages may have grandfathered names using the opposite ordering.
{| class="mw-collapsible mw-collapsed wikitable"
|+ '''Example (alsa-lib pre-release)'''
|-
! Source Archive !! Description
|-
|style=white-space:nowrap| <code>alsa-lib-0.9.2beta1.tar.gz</code> || (this is a beta release of alsa-lib, version 0.9.2beta1)
|-
! Name-Version-Release !! Explanation
|-
| <code>alsa-lib-0.9.2~beta1-1%{?dist}</code> || (this is the correct Fedora <code>%{name}-%{version}-%{release}</code>)
|-
| <code>alsa-lib-0.9.2~beta1-2%{?dist}</code> || (this is an incremented Fedora <code>%{name}-%{version}-%{release}</code>.)
|}


There are some exceptions to this general addon package naming policy, and they are noted below.<BR>
{| class="mw-collapsible mw-collapsed wikitable"
|+ '''Example (kismet pre-release svn checkout)'''
|-
! Name-Version-Release !! Explanation
|-
|style=white-space:nowrap| <code>kismet-0~svn20040110-1%{?dist}</code> || (this is a pre-release, svn checkout of kismet)
|-
| <code>kismet-0~svn20040110-2%{?dist}</code> || (this is a bugfix to the previous package)
|-
| <code>kismet-0~svn20040204-1%{?dist}</code> || (this is a new svn checkout, note the reset of the Release)
|-
| <code>kismet-1.0-1%{?dist}</code> || (this is the formal release of kismet 1.0)
|}


=== httpd, pam, and SDL ===
{| class="mw-collapsible mw-collapsed wikitable"
Packages that rely on Apache httpd, pam, or SDL as a parent use a slightly different naming scheme.
|+ '''Upgrade Path Example (mozilla)'''
pam and SDL addons use the format: <code>%{parent}_%{child}</code>, with an underscore "_" as a delimiter.
|-
Apache httpd addons use the format: <code>mod_%{child}</code>, with an underscore "_" as a delimiter.
! Name-Version-Release !! Explanation
This naming scheme is usually the same as used for the source tarball name.<BR>
|-
|style=white-space:nowrap| <code>mozilla-1.4~a-1%{?dist}</code> || (this is the Fedora package for 1.4a, as [[#PreReleaseExampleMozilla|above]])
|-
| <code>mozilla-1.4~a-2%{?dist}</code> || (this is the first patch on top of 1.4a)
|-
| <code>mozilla-1.4~a-3%{?dist}</code> || (this is another new patch on top of 1.4a)
|-
| <code>mozilla-1.4~b-1%{?dist}</code> || (this is the first build after upgrade to 1.4b)
|-
| <code>mozilla-1.4~b-2%{?dist}</code> || (this is a new patch on top of 1.4b)
|-
| <code>mozilla-1.4-1%{?dist}</code> || (this is after moving to 1.4 "final", and to a normal version)
|-
| <code>mozilla-1.4-2%{?dist}</code> || (this is a new patch on top of 1.4 "final")
|}


'''Examples:'''
{| class="mw-collapsible mw-collapsed wikitable"
<pre>
|+ '''Upgrade Path Example (alsa-lib)'''
mod_perl (perl components for Apache httpd, relies on httpd)
|-
pam_krb5 (krb5 components for pam, relies on pam)
! Name-Version-Release !! Explanation
SDL_gfx (Additional graphics components for SDL, relies on SDL)
|-
SDL_ttf (TrueType font rendering support for SDL, relies on SDL)
|style=white-space:nowrap| <code>alsa-lib-0.9.2~beta1-1%{?dist}</code> || (this is the Fedora package for 0.9.2beta1, as [[#PreReleaseExampleAlsaLib|above]])
</pre>
|-
| <code>alsa-lib-0.9.2~beta1-2%{?dist}</code> || (this is a new patch on top of 0.9.2beta1)
|-
| <code>alsa-lib-0.9.2~beta2-1%{?dist}</code> || (this is after upgrading to 0.9.2beta2)
|-
| <code>alsa-lib-0.9.2~beta3-1%{?dist}</code> || (this is after upgrading to 0.9.2beta3)
|-
| <code>alsa-lib-0.9.2~beta3-2%{?dist}</code> || (this is a new patch on top of 0.9.2beta3)
|-
| <code>alsa-lib-0.9.2~rc1-1%{?dist}</code> || (this is after upgrading to 0.9.2rc1)
|-
| <code>alsa-lib-0.9.2~rc2-1%{?dist}</code> || (this is after upgrading to 0.9.2rc2)
|-
| <code>alsa-lib-0.9.2-1%{?dist}</code> || (this is after upgrading to 0.9.2 "final", version becomes normal)
|-
| <code>alsa-lib-0.9.2-2%{?dist}</code> || (this is a new patch on top of 0.9.2 "final")
|}


=== Eclipse plugins ===
===== Post-Release Packages =====
Eclipse plugin packages MUST be named <code>eclipse-<projectname></code>. For example, a package of the AnyEdit plugin for Eclipse would be named <code>eclipse-anyedit</code>.
Like pre-release packages, non-numeric versioned "post-release" packages can be problematic and also must be treated with care. These fall under two generic categories:


=== emacs components ===
* Properly ordered simple versions. These are usually due to quick bugfix releases, such as openssl-0.9.6b  or gkrellm-2.1.7a. As new versions come out, the non-numeric tag is properly incremented (e.g. openssl-0.9.6c) or the numeric version is increased and the non-numeric tag is dropped (openssl-0.9.7). No special handling is required here.
Packages of emacs add-on components (code that adds additional functionality to emacs compatible editors) have their own naming
* When upstream uses versions that attempt to have meaning to humans instead of being easy for a computer to order. For example, GA1, CR2, PR3. In this case, the non-numeric string can be put in the Version: field using the following syntax: <code>%{X}+%{posttag}</code>
scheme. It is often the case that a component will add functionality to several different compatible editors, such as GNU
Emacs and XEmacs (and possibly development versions of these editors). The package name should take into account the upstream name of the
emacs component.


Where a component adds functionality to more than one emacs compatible editor, the package name should be of the form emacs-common-$NAME. In this
In this syntax, <code>%{X}</code> is the base software version, and <code>%{posttag}</code> is the string that came from the version. Here, the plus '+' is used as the delimiter between the base version number and the non-numeric version string.
case, the main package should contain only files common to all emacs compatible editors, and the code specific to each should be placed in a
subpackage reflecting the specific editor $EDITOR-$NAME eg. xemacs-$NAME, emacs-$NAME (the latter being the package specific to GNU Emacs). An
example of this scheme can be found in the package emacs-common-muse.


Where a component is designed to add functionality to only a single emacs compatible editor, the main package name should reflect this by being
It is important to be careful with the post-release scheme, to ensure that package ordering is correct.
called $EDITOR-$NAME. An example of this situation can be found in the package emacs-auctex, which is built only for GNU Emacs.


Also, packagers using the post-release scheme should put a comment in their spec file with a brief description of the upstream conventions for naming/versioning that are being worked around.


'''Examples:'''
{{admon/note|Non-sortable "posttags"|If during usage of plus or any other separators you see that it will introduce downgrade (e.g. <code>1+GA1 -> 1+CP1</code>) - prepend a letter '''and''' separator (preferably <code>.</code>) (e.g. <code>1+p.CP1</code>).}}
<pre>
emacs-common-muse (muse component for all emacs compatible editors)
xemacs-muse (muse component subpackage that provides XEmacs specific files)
emacs-autex (autex component only for GNU Emacs)
</pre>


=== erlang modules ===
===== Snapshot Packages =====
Packages of erlang modules (thus they rely on erlang as a parent) have their own naming scheme. They should take into account the upstream name of the erlang module. This makes a package name format of <code>erlang-$NAME</code>. When in doubt, use the name of the module that you use when importing it into a script.


'''Example: '''
Snapshot packages contain data about where the snapshot came from as well as
<pre>
ordering information for rpm.  The information about the snapshot will be
erlang-esdl (erlang module named esdl)
called <code>%{checkout}</code> in this section.
</pre>


=== GAP ===
<code>%{checkout}</code> consists of a short (2-5 characters) string identifying the type
See the [[Packaging:GAP#Naming|GAP guidelines]] for the proper naming of GAP addon packages.
of revision control system or that this is a snapshot, the date that the snapshot
is made in <code>YYYYMMDD</code> format, and optionally, up to 13 characters (ASCII)
alphanumeric characters that could be useful in finding
the revision in the revision control system.


=== gnome shell extensions ===
For instance, if you create a snapshot from a git repository on January 2,
Packages that extend gnome shell should begin with the prefix <code>gnome-shell-extension-</code>.  In particular, this prefix should not be pluralized (ie: it should '''not''' be <code>gnome-shell-extensions</code>).
2011 with git hash <code>9e88d7e9efb1bcd5b41a408037bb7cfd47220a64</code>, <code>%{checkout}</code>
string could be any of the following:


=== OCaml modules ===
<pre>
OCaml modules, libraries and syntax extensions should be named ocaml-foo.  Examples include: ocaml-extlib, ocaml-ssl.
snap20110102
git20110102
git20110102.9e88d7e
</pre>


This naming does not apply to applications written in OCaml, which can be given their normal name.  Examples include: mldonkey, virt-top, cduce.
The reason for ordering the word before the numbers is to ensure that
RPM sorts it lower than a successive version since letters are lower than numbers.
This is especially important in the post-release case, since <code>+</code> is equivalent
to a standard separator.


=== LibreOffice extensions ===
If the snapshot package is considered a "pre-release package",
Packages of LibreOffice extensions (thus they rely on LibreOffice as a parent) have their own naming scheme. They must take into account the upstream name of the LibreOffice extension. This makes a package name format of <code>libreoffice-$NAME</code>.
follow the guidelines listed in Pre-Release Packages for snapshot packages,
using the <code>%{checkout}</code> that you decide on above. (For instance, in
<code>kismet-0~svn20040204-</code>, <code>svn20040204</code> is the <code>%{checkout}</code>)


If the snapshot is a "post-release package", follow the
guidelines in the Post-Release Packages section.  Where the <code>%{posttag}</code> in
that section is the <code>%{checkout}</code> string you decided on above.


=== perl modules ===
Example (post-release cvs):
Packages of perl modules (thus they rely on perl as a parent) use a slightly different naming scheme. They should be named perl-CPANDIST where CPANDIST is the name of the packaged CPAN module distribution (which is almost always also the unit of perl module packaging).  In the rare cases when a CPAN module distribution needs to be split into smaller subpackages eg. due to dependencies, the extra subpackages should be named perl-CPANDIST-Something.<BR>
 
'''Examples: '''
<pre>
<pre>
perl-Archive-Zip (Archive-Zip is the CPAN distribution name)
kismet-1.0-1%{?dist} (this is the formal release of kismet 1.0)
perl-Cache-Cache (Cache-Cache is the CPAN distribution name)
kismet-1.0-2%{?dist} (this is a bugfix build to the 1.0 release)
kismet-1.0+cvs20050515-1%{?dist} (move to a post-release cvs checkout, note the reset of the Release section)
kismet-1.0+cvs20050515-2%{?dist} (bugfix to the post-release cvs checkout)
kismet-1.0+cvs20050517-1%{?dist} (new cvs checkout, note the reset of the release tag)
</pre>
</pre>


=== php modules ===
===== Example (complex pre-release and post-release scheme) =====
For details on the PHP naming scheme, see [[Packaging/PHP#NamingScheme]] .
 
=== Python modules ===
Python packaging is complicated by the fact that there are two partially incompatible
language versions in use, here called Python2 and Python3.  However, the
common case is for one source package to produce a binary package for each
Python version, and this results in a naming convention where the source package
does not generally produce a binary package of the same name.
 
The package name should reflect the upstream name of the Python module, and
should generally take into account the name of the module used when importing
it in Python scripts.  This name will be prefixed depending on the type of the package.
 
Note that when a module that has a dot in its name, the [[#Separators| usual rule]]
about changing "." to "-" applies.
 
=== Python source package naming ===
Source packages for Python modules should be named using the <code>python-</code> prefix.
 
'''Examples: '''
<pre>
<pre>
python-psycopg  (python module named psycopg)
foo-1.1.0~BETA-1%{?dist} (this is a prerelease, first beta)
python-PyQt4 (python module named PyQt4)
foo-1.1.0~BETA1-1%{?dist} (this is a prerelease, second beta)
foo-1.1.0~BETA2-1%{?dist} (this is a prerelease, third beta)
foo-1.1.0~CR1-1%{?dist} (this is a prerelease, candidate release 1)
foo-1.1.0~CR2-1%{?dist} (this is a prerelease, candidate release 2)
foo-1.1.0-1%{?dist} (final release)
foo-1.1.0+GA1-1%{?dist} (post release, GA1)
foo-1.1.0+p.CP1-1%{?dist} (post release, CP1, after GA1)
foo-1.1.0+p.CP2-1%{?dist} (post release, CP2, after CP1)
foo-1.1.0+p.SP1-1%{?dist} (post release, SP1, after CP2)
foo-1.1.0+p.SP1_CP1-1%{?dist} (post release, SP1_CP1, after SP1)
</pre>
</pre>


However, it does occur that two separately maintained modules have the same
==== Unexpected non-sortable releases ====
name but are targeted against different versions of Python.  In this case,
If (and only if) a release version changes convention in such a way that there's no way to handle an upgrade sanely, it may be necessary to use <code>Epoch</code> to ensure the current package is considered newer than the previous package. In such cases, the packager should try to convince upstream to be more reasonable with their release versioning.
source package for the software targeted at Python2 should take a
<code>python2-</code> prefix, and the source package for the Python3 version
should have a name beginning with <code>python3-</code>.


==== Python2 binary package naming ====
=== Release Tag ===
Python2 binary packages should be named using a <code>python2-</code> prefix.
The release tag of packages must consist of a positive integer release number and a %{?dist} tag: <code>42%{?dist}</code>.  When a minor change (spec file changed, patch added/removed) occurs, or a package is rebuilt to use newer headers or libraries, the release number is incremented. If a major change (new version of the software being packaged) occurs, the version number is changed to reflect the new software version, and the release number is reset to 1.  It is important to follow these guidelines because automated tools will occasionally be used to increment releases and rebuild packages.


==== Python3 binary package naming ====
==== The %{?dist} Tag ====
Python3 binary packages shoud be named with a prefix of <code>python3-</code>.
Use of the <code>%{?dist}</code> tag in the Release field is mandatory.
Please refer to the [[Packaging:DistTag]] documentation for the details on the appropriate way to do this.


==== Outdated Python package naming conventions ====
==== Minor release bumps for old branches ====
Previously there were two other conventions for Python package naming, and some
Sometimes, you may find yourself in a situation where an older branch needs a fix, but the newer branches are fine. For example, if foo = 1.0-1%{?dist} in F20 and F21, and only F20 needs a fix. Normally, you would need to bump the release in each of the branches to ensure that F20 < F21, but that is a waste of time and energy for the newer branches which do not need to be touched.
packages using these naming rules persist in Fedora.


* Python2 module binary packages were named using a <code>python-</code> prefix.
In this case, you can add an extra digit (prefixed by a period) to the very end of the release tag in the F20 branch, instead of bumping it the usual way.
Example: <BR>
<pre>


* Python module packages with names containing "py" were not required to use any prefix.
Release: 1%{?dist}
</pre>


Neither of these may be used for new Python packages.
<pre>
 
=== R modules ===
Packages of R modules (thus they rely on R as a parent) have their own naming scheme. They should take into account the upstream name of the R module. This makes a package name format of <code>R-$NAME</code>. When in doubt, use the name of the module that you type to import it in R.


'''Examples: '''
Release: 1%{?dist}.1
<pre>
R-mAr (R module named mAr)
R-RScaLAPACK (R module named RScaLAPACK)
R-waveslim (R module named waveslim)
</pre>
</pre>


=== Sugar Activities ===
This will make a <code>foo-1.0-1.fc20.1</code> package, which is still less than the <code>foo-1.0-1.fc21</code> package in the F21 branch.
The name for all packaged Sugar activities must be prefixed with sugar-. For more details, see [[Packaging/SugarActivityGuidelines]] .


=== Tcl/Tk extensions ===
As necessary, the last digit (the minor release bump) can be incremented on a per-branch basis as needed. However, this must never be used in rawhide, because it is always unnecessary there. Simply increment the appropriate portion of Release: in rawhide.
The name for all packaged Tcl/Tk extensions must be prefixed with tcl-. This rule applies even for Tcl/Tk packages that are already prefixed with tcl in the name. For more details, see [[Packaging/Tcl#NamingConventions]].
 
=== locales ===
If a package adds a locale to an existing parent package, then it can use an underscore in the locale.
 
'''Examples: '''
<pre>
ttfonts-zh_TW (adds zh_TW locale fonts in ttfonts family)
ttfonts-zh_CN (adds zh_CN locale fonts in ttfonts family)
</pre>


=== TeX ===
As Fedora has switched TeX environments in the past, TeX packages should not
be named after the TeX environment (TeX Live or teTeX) but instead should
carry the prefix "tex-".


== Authorship ==
'''BE CAREFUL WITH THIS!''' You always want to make sure that packages in branches can be upgraded to packages in more recent branches. Or to put it simply, F20< FC21 < F22. There is a tool in the rpmdevtools package called <code>rpmdev-vercmp</code>. This tool will prompt you for two sets of Epoch, Version, and Release, then tell you which is considered newer by rpm.
The original author of these guidelines was [[TomCallaway|Tom 'spot' Callaway]]. They are now maintained by the [[Packaging_Committee|Packaging Committee]] with input from the Fedora community.


[[Category: Packaging guidelines drafts]]
[[Category: Packaging guidelines drafts]]

Latest revision as of 17:49, 4 March 2017

Warning.png
This page is a draft only
It is still under construction and content may change. Do not rely on the information on this page.


In Fedora we want to ensure that there is always an upgrade path from Fedora release to Fedora release and from Fedora release to the packages in updates. To do that we need to make sure the packages in the newer Fedora releases have an equal or higher Epoch:Version-Release (EVR) than the ones in older releases. For example, Fedora-13 ships with foo-1.0-1.fc13 and Fedora-14 ships with foo-1.0-2.fc14. This example shows that the Fedora-14 package will properly upgrade the Fedora-13 package.

A more complex example. Fedora-13 ships with foo-1.0-1.fc13 and Fedora-14 ships with foo-1.0-2.fc14. Fedora-13 gets an updated foo package: foo-1.0.1-1.fc13. This update is EVR higher than the package Fedora-13 shipped with so that's good. However, it is also EVR higher than what Fedora-14 shipped with so we need to make a Fedora-14 update at the same time, likely: foo-1.0.1-1.fc14. making that update means that someone updating from Fedora-13 with updates enabled will get the correct package on Fedora-14 with updates enabled.

The one time where we temporarily break the upgrade path is from released Fedora to rawhide. It is allowable to temporarily have a higher EVR in a released Fedora vs rawhide in cases where we need to get a fix out to users of the Fedora releases quickly (for instance, for a security issue) but the fixed package does not currently build in rawhide (for instance, because of a change in a dependent library that requires porting effort). The changes should be checked into Fedora's SCM for rawhide although there is not yet a build and getting a rawhide build that restores the upgrade path should be a priority.

rpm's understanding of what package is newer comes from the values of the Epoch, Version, and Release tags. The next few sections explain what values to use in those tags to ensure that the EVR consistently increases.

Version Tag

The Version field in the spec is where the maintainer should put the current version of the software being packaged. If the version is non-numeric (contains tags that are not numbers), you may need to include the additional non-numeric characters.

There are four cases where the version contains non-numeric characters:

  • Pre-release packages: Packages released as "pre-release" versions, prior to a "final" version. Example tags include "alpha", "beta", "rc", "cvs". Details can be found here: Pre-Release Packages
  • Post-release packages: Packages released after a "final" version. These packages contain the same numeric version as the "final" version, but have an additional non-numeric identifier. Details can be found here: Post-Release Packages
  • Snapshot packages: Packages built from cvs or subversion snapshots. These packages could be either "pre" or "post" release packages. Details can be found here: Snapshot Packages

Basic versioning rules

  • RPM splits versions in to sections which are compared piece by piece
  • Version/Release strings allowed to have ASCII letters (a-zA-Z), digits (0-9) and separators (._+~)
  • Tilde (~) is special separator and has special meaning/handling
  • Separators are ignored by RPM's comparison - 1+0 == 1.0
  • Letters are sorted before digits - a < 1
  • Letters are compared by their ASCII value - a (97) > A (65)
  • Additional character makes version being higher - 1.1 < 1.10, 1.0 < 1.0.0
  • Tilde (~) makes version being lower - 1.0 > 1.0~, 1.0 > 1.0~rc1
  • Zero (0) after separator handled natively - 1.0 == 1.000


Note that after ~ or +, there should never be a leading digit. Especially in the case of +, where it is considered equivalent to other separators, it is important to use only letters at the beginning so that RPM's version comparison considers it lower than a successive formal release.

For example:

  • 1.0+1 == 1.0.1
  • 1.0+git < 1.0.1

Non-Numeric Versions

There are three cases in which non-numeric versions occur in the Version field:

  • Pre-release packages
  • Post-release packages
  • Snapshot packages
Pre-Release Packages

Non-numeric versioned "pre-release" packages can be problematic so they must be treated with care. These are cases where the upstream "pre-release" version has letters rather than simple numbers in their version. Often they have tags like alpha, beta, rc, or letters like a and b denoting that it is a version before the "final" number. We need to follow a special scheme to ensure proper ordering in the Version field.

Version Tag for Pre-Release Packages: %{X}~%{alphatag}

Where %{X} is the software version that the pre-release will become, and %{alphatag} is the string indicating the pre-release state. In this case, the tilde '~' is used as not only a separator, but also an indicator for RPM to consider it lower than a package that just has %{X} in the Version field.

Note.png
Non-sortable "alphatags"
If during usage of tilde or any other separators you see that it will introduce downgrade (e.g. 1~prerelease -> 1~alpha) - prepend a letter and separator (preferably .) (e.g. 1~z.alpha).
Examples
Example (mozilla pre-release)
Source Archive Description
mozilla-1.4a.tar.gz (this is a pre-release, version 1.4a of mozilla)
mozilla-1.4.tar.gz (this is what the 1.4 release will actually look like)
Name-Version-Release Explanation
mozilla-1.4~a-1%{?dist} (so, this is the acceptable Fedora %{name}-%{version}-%{release})
mozilla-1.4-1%{?dist} (and this is what the 1.4 release Fedora %{name}-%{version}-%{release} should be)
Example (alsa-lib pre-release)
Source Archive Description
alsa-lib-0.9.2beta1.tar.gz (this is a beta release of alsa-lib, version 0.9.2beta1)
Name-Version-Release Explanation
alsa-lib-0.9.2~beta1-1%{?dist} (this is the correct Fedora %{name}-%{version}-%{release})
alsa-lib-0.9.2~beta1-2%{?dist} (this is an incremented Fedora %{name}-%{version}-%{release}.)
Example (kismet pre-release svn checkout)
Name-Version-Release Explanation
kismet-0~svn20040110-1%{?dist} (this is a pre-release, svn checkout of kismet)
kismet-0~svn20040110-2%{?dist} (this is a bugfix to the previous package)
kismet-0~svn20040204-1%{?dist} (this is a new svn checkout, note the reset of the Release)
kismet-1.0-1%{?dist} (this is the formal release of kismet 1.0)
Upgrade Path Example (mozilla)
Name-Version-Release Explanation
mozilla-1.4~a-1%{?dist} (this is the Fedora package for 1.4a, as above)
mozilla-1.4~a-2%{?dist} (this is the first patch on top of 1.4a)
mozilla-1.4~a-3%{?dist} (this is another new patch on top of 1.4a)
mozilla-1.4~b-1%{?dist} (this is the first build after upgrade to 1.4b)
mozilla-1.4~b-2%{?dist} (this is a new patch on top of 1.4b)
mozilla-1.4-1%{?dist} (this is after moving to 1.4 "final", and to a normal version)
mozilla-1.4-2%{?dist} (this is a new patch on top of 1.4 "final")
Upgrade Path Example (alsa-lib)
Name-Version-Release Explanation
alsa-lib-0.9.2~beta1-1%{?dist} (this is the Fedora package for 0.9.2beta1, as above)
alsa-lib-0.9.2~beta1-2%{?dist} (this is a new patch on top of 0.9.2beta1)
alsa-lib-0.9.2~beta2-1%{?dist} (this is after upgrading to 0.9.2beta2)
alsa-lib-0.9.2~beta3-1%{?dist} (this is after upgrading to 0.9.2beta3)
alsa-lib-0.9.2~beta3-2%{?dist} (this is a new patch on top of 0.9.2beta3)
alsa-lib-0.9.2~rc1-1%{?dist} (this is after upgrading to 0.9.2rc1)
alsa-lib-0.9.2~rc2-1%{?dist} (this is after upgrading to 0.9.2rc2)
alsa-lib-0.9.2-1%{?dist} (this is after upgrading to 0.9.2 "final", version becomes normal)
alsa-lib-0.9.2-2%{?dist} (this is a new patch on top of 0.9.2 "final")
Post-Release Packages

Like pre-release packages, non-numeric versioned "post-release" packages can be problematic and also must be treated with care. These fall under two generic categories:

  • Properly ordered simple versions. These are usually due to quick bugfix releases, such as openssl-0.9.6b or gkrellm-2.1.7a. As new versions come out, the non-numeric tag is properly incremented (e.g. openssl-0.9.6c) or the numeric version is increased and the non-numeric tag is dropped (openssl-0.9.7). No special handling is required here.
  • When upstream uses versions that attempt to have meaning to humans instead of being easy for a computer to order. For example, GA1, CR2, PR3. In this case, the non-numeric string can be put in the Version: field using the following syntax: %{X}+%{posttag}

In this syntax, %{X} is the base software version, and %{posttag} is the string that came from the version. Here, the plus '+' is used as the delimiter between the base version number and the non-numeric version string.

It is important to be careful with the post-release scheme, to ensure that package ordering is correct.

Also, packagers using the post-release scheme should put a comment in their spec file with a brief description of the upstream conventions for naming/versioning that are being worked around.

Note.png
Non-sortable "posttags"
If during usage of plus or any other separators you see that it will introduce downgrade (e.g. 1+GA1 -> 1+CP1) - prepend a letter and separator (preferably .) (e.g. 1+p.CP1).
Snapshot Packages

Snapshot packages contain data about where the snapshot came from as well as ordering information for rpm. The information about the snapshot will be called %{checkout} in this section.

%{checkout} consists of a short (2-5 characters) string identifying the type of revision control system or that this is a snapshot, the date that the snapshot is made in YYYYMMDD format, and optionally, up to 13 characters (ASCII) alphanumeric characters that could be useful in finding the revision in the revision control system.

For instance, if you create a snapshot from a git repository on January 2, 2011 with git hash 9e88d7e9efb1bcd5b41a408037bb7cfd47220a64, %{checkout} string could be any of the following:

snap20110102
git20110102
git20110102.9e88d7e

The reason for ordering the word before the numbers is to ensure that RPM sorts it lower than a successive version since letters are lower than numbers. This is especially important in the post-release case, since + is equivalent to a standard separator.

If the snapshot package is considered a "pre-release package", follow the guidelines listed in Pre-Release Packages for snapshot packages, using the %{checkout} that you decide on above. (For instance, in kismet-0~svn20040204-, svn20040204 is the %{checkout})

If the snapshot is a "post-release package", follow the guidelines in the Post-Release Packages section. Where the %{posttag} in that section is the %{checkout} string you decided on above.

Example (post-release cvs):

kismet-1.0-1%{?dist} (this is the formal release of kismet 1.0)
kismet-1.0-2%{?dist} (this is a bugfix build to the 1.0 release)
kismet-1.0+cvs20050515-1%{?dist} (move to a post-release cvs checkout, note the reset of the Release section)
kismet-1.0+cvs20050515-2%{?dist} (bugfix to the post-release cvs checkout)
kismet-1.0+cvs20050517-1%{?dist} (new cvs checkout, note the reset of the release tag)
Example (complex pre-release and post-release scheme)
foo-1.1.0~BETA-1%{?dist} (this is a prerelease, first beta)
foo-1.1.0~BETA1-1%{?dist} (this is a prerelease, second beta)
foo-1.1.0~BETA2-1%{?dist} (this is a prerelease, third beta)
foo-1.1.0~CR1-1%{?dist} (this is a prerelease, candidate release 1)
foo-1.1.0~CR2-1%{?dist} (this is a prerelease, candidate release 2)
foo-1.1.0-1%{?dist} (final release)
foo-1.1.0+GA1-1%{?dist} (post release, GA1)
foo-1.1.0+p.CP1-1%{?dist} (post release, CP1, after GA1)
foo-1.1.0+p.CP2-1%{?dist} (post release, CP2, after CP1)
foo-1.1.0+p.SP1-1%{?dist} (post release, SP1, after CP2)
foo-1.1.0+p.SP1_CP1-1%{?dist} (post release, SP1_CP1, after SP1)

Unexpected non-sortable releases

If (and only if) a release version changes convention in such a way that there's no way to handle an upgrade sanely, it may be necessary to use Epoch to ensure the current package is considered newer than the previous package. In such cases, the packager should try to convince upstream to be more reasonable with their release versioning.

Release Tag

The release tag of packages must consist of a positive integer release number and a %{?dist} tag: 42%{?dist}. When a minor change (spec file changed, patch added/removed) occurs, or a package is rebuilt to use newer headers or libraries, the release number is incremented. If a major change (new version of the software being packaged) occurs, the version number is changed to reflect the new software version, and the release number is reset to 1. It is important to follow these guidelines because automated tools will occasionally be used to increment releases and rebuild packages.

The %{?dist} Tag

Use of the %{?dist} tag in the Release field is mandatory. Please refer to the Packaging:DistTag documentation for the details on the appropriate way to do this.

Minor release bumps for old branches

Sometimes, you may find yourself in a situation where an older branch needs a fix, but the newer branches are fine. For example, if foo = 1.0-1%{?dist} in F20 and F21, and only F20 needs a fix. Normally, you would need to bump the release in each of the branches to ensure that F20 < F21, but that is a waste of time and energy for the newer branches which do not need to be touched.

In this case, you can add an extra digit (prefixed by a period) to the very end of the release tag in the F20 branch, instead of bumping it the usual way. Example:


Release: 1%{?dist}

Release: 1%{?dist}.1

This will make a foo-1.0-1.fc20.1 package, which is still less than the foo-1.0-1.fc21 package in the F21 branch.

As necessary, the last digit (the minor release bump) can be incremented on a per-branch basis as needed. However, this must never be used in rawhide, because it is always unnecessary there. Simply increment the appropriate portion of Release: in rawhide.


BE CAREFUL WITH THIS! You always want to make sure that packages in branches can be upgraded to packages in more recent branches. Or to put it simply, F20< FC21 < F22. There is a tool in the rpmdevtools package called rpmdev-vercmp. This tool will prompt you for two sets of Epoch, Version, and Release, then tell you which is considered newer by rpm.