5.4. Layout of the source package

There are two types of Debian source packages:

  • the so-called native packages, where there is no distinction between the original sources and the patches applied for Debian

  • the (more common) packages where there’s an original source tarball file accompanied by another file that contains the changes made by Debian

For the native packages, the source package includes a Debian source control file (.dsc) and the source tarball (.tar.{gz,bz2,xz}). A source package of a non-native package includes a Debian source control file, the original source tarball (.orig.tar.{gz,bz2,xz}) and the Debian changes (.diff.gz for the source format “1.0” or .debian.tar.{gz,bz2,xz} for the source format “3.0 (quilt)”).

With source format “1.0”, whether a package is native or not was determined by dpkg-source at build time. Nowadays it is recommended to be explicit about the desired source format by putting either “3.0 (quilt)” or “3.0 (native)” in debian/source/format. The rest of this section relates only to non-native packages.

The first time a version is uploaded that corresponds to a particular upstream version, the original source tar file must be uploaded and included in the .changes file. Subsequently, this very same tar file should be used to build the new diffs and .dsc files, and will not need to be re-uploaded.

By default, dpkg-genchanges and dpkg-buildpackage will include the original source tar file if and only if the current changelog entry has a different upstream version from the preceding entry. This behavior may be modified by using -sa to always include it or -sd to always leave it out.

If no original source is included in the upload, the original source tar-file used by dpkg-source when constructing the .dsc file and diff to be uploaded must be byte-for-byte identical with the one already in the archive.

Please notice that, in non-native packages, permissions on files that are not present in the *.orig.tar.{gz,bz2,xz} will not be preserved, as diff does not store file permissions in the patch. However, when using source format “3.0 (quilt)”, permissions of files inside the debian directory are preserved since they are stored in a tar archive.