1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
[[name-version]]
=== Package name and version
If the upstream source comes as *hello-0.9.12.tar.gz*, you can take *hello* as the upstream source package name and *0.9.12* as the upstream version.
include::caveat.txt[]
You must adjust the package name and upstream version accordingly for the Debian packaging.
In order to manage the package name and version information effectively under popular tools such as the *aptitude* command, it is a good idea to keep the length of package name to be equal or less than 30 characters; and the total length of version and revision to be equal or less than 14 characters. footnote:[For more than 90% of packages, the package name is equal or less than 24 characters; the upstream version is equal or less than 10 characters and the Debian revision is equal or less than 3 characters.]
In order to avoid name collisions, the user visible binary package name should not be chosen from any generic words.
// aptitude bug #62454 fixed :-)
If upstream does not use a normal versioning scheme such as *2.30.32* but uses some kind of date such as *11Apr29*, a random codename string, or a VCS hash value as part of the version, make sure to remove them from the upstream version. Such information can be recorded in the *debian/changelog* file. If you need to invent a version string, use the *YYYYMMDD* format such as *20110429* as upstream version. This ensures that the *dpkg* command interprets later versions correctly as upgrades. If you need to ensure a smooth transition to a normal version scheme such as *0.1* in the future, use the *0\~YYMMDD* format such as *0~110429* as upstream version, instead.
Version strings can be compared using the *dpkg* command as follows.
----
$ dpkg --compare-versions ver1 op ver2
----
The version comparison rule can be summarized as:
* Strings are compared from the head to the tail.
* Letters are larger than digits.
* Numbers are compared as integers.
* Letters are compared in ASCII code order.
There are special rules for period (*.*), plus (*+*), and tilde (*~*) characters, as follows.
----
0.0 < 0.5 < 0.10 < 0.99 < 1 < 1.0~rc1 < 1.0 < 1.0+b1 < 1.0+nmu1 < 1.1 < 2.0
----
One tricky case occurs when the upstream releases *hello-0.9.12-ReleaseCandidate-99.tar.gz* as the pre-release of *hello-0.9.12.tar.gz*. You can ensure the Debian package upgrade to work properly by renaming the upstream source to *hello-0.9.12~rc99.tar.gz*.
[[native]]
=== Native Debian package
The non-native Debian package in the ``*3.0 (quilt)*'' format is the most normal Debian source package format. The *debian/source/format* file should have ``*3.0 (quilt)*'' in it as described in *dpkg-source*(1). The above workflow and the following packaging examples always use this format.
A native Debian package is the rare Debian binary package format. It may be used only when the package is useful and valuable only for Debian. Thus, its use is generally discouraged.
CAUTION: A native Debian package is often accidentally built when its upstream tarball is not accessible from the *dpkg-buildpackage* command with its correct name 'package_version'.*orig.tar.gz* . This is a typical newbie mistake caused by making a symlink name with ``**-**'' instead of the correct one with ``**_**''.
A native Debian package has no separation between the *upstream code* and the *Debian changes* and consists only of the following:
* 'package_version'.*tar.gz* (copy or symlink of 'package-version'.*tar.gz* with *debian/** files.)
* 'package_version'.*dsc*
If you need to create a native Debian package, create it in the ``*3.0 (native)*'' format using *dpkg-source*(1).
TIP: Some people promote packaging even programs that have been written only for Debian in the non-native package format. The required tarball without *debian/** files needs to be manually generated in advance before the standard workflow in <<workflow>>. footnote:[Use of the ``*debmake -t ...*'' command or ``*git deborig -f HEAD*'' can help this workflow. See <<dt-option>> and *dgit-maint-merge*(7).] They claim that the use of non-native package format eases communication with the downstream distributions.
TIP: There is no need to create the tarball in advance if the native package format is used. The native Debian package can be created by setting the *debian/source/format* file to ``*3.0 (native)*'', setting the *debian/changelog* file to have the version without the Debian revision (*1.0* instead of *1.0-1*), and invoking the ``*dpkg-source -b .*'' command within the source tree. The tarball containing the source is generated by this.
|