Michal Čihař - Debian repository howto

Debian repository howto

Structure of repository is simmilar to official repositories - packages are stored in pool, package lists in dists. So here is apt-ftparchive configuration for my setup:

Dir {
   ArchiveDir "/home/debbuild/packages";
   CacheDir "/home/debbuild/ftparchive/";
};

Default {
   Packages::Compress ". gzip bzip2";
   Sources::Compress ". gzip bzip2";
   Contents::Compress ". gzip bzip2";
};

TreeDefault {
   BinCacheDB "packages-$(SECTION)-$(ARCH).db";
   Directory "pool/$(SECTION)";
   Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
   SrcDirectory "pool/$(SECTION)";
   Sources "$(DIST)/$(SECTION)/source/Sources";
   Contents "$(DIST)/Contents-$(ARCH)";
};

Tree "dists/unstable" {
    Sections "mc gammu slovnik";
    Architectures "i386 source";
}

Using this configuration file, we can generate package lists and content lists (for searching using apt-file):

apt-ftparchive generate configuration_file

I want my archive to be signed, so it is necessary to create Release file (it's also useful when somebody wants to use pinning). With help of apt-ftparchive, it's also an easy task. First we need to specify information about repository into configuration file:

APT::FTPArchive::Release::Codename "sid";
APT::FTPArchive::Release::Origin "Michal Čihař";
APT::FTPArchive::Release::Components "mc slovnik gammu";
APT::FTPArchive::Release::Label "Unofficial packages";
APT::FTPArchive::Release::Architectures "i386 all";
APT::FTPArchive::Release::Suite "unstable";

Now we can generate Release, content of this file is printed by issuing:

apt-ftparchive -c configuration_for_release release /home/debbuild/packages/dists/unstable & \
     /home/debbuild/packages/dists/unstable/Release

Final step is to sign this file using GnuPG, so that users of APT 0.6 and newer can verify origin of packages:

gpg --output Release.gpg -ba Release