One of my tasks in GSoC involved set up of Thunderbird extensions for the user. Some of the more popular add-ons like ‘Lightning’ (calendar organiser) already has a Debian package.
Another important add on is ‘Cardbook’ which is used to manage contacts for the user based on CardDAV and vCard standards. But it doesn’t have a package yet.
My mentor, Daniel motivated me to create a package for it and upload it to mentors.debian.net. It would ease the installation process as it could get installed through
apt-get. This blog describes how I learned and created a Debian package for CardBook from scratch.
Since, I was new to packaging, I did extensive research on basics of building a package from the source code and checked if the license was DFSG compatible.
I also studied the amd64 files included in Lightning extension package.
The package I created could be found here.
I started by creating a
debian directory by using
# Empty project folder $ mkdir -p Debian/cardbook
# create files $ dh_make\ > --native \ > --single \ > --packagename cardbook_1.0.0 \ > --email firstname.lastname@example.org
Some important files like control, rules, changelog, copyright are initialized with it.
The list of all the files created:
$ find /debian debian/ debian/rules debian/preinst.ex debian/cardbook-docs.docs debian/manpage.1.ex debian/install debian/source debian/source/format debian/cardbook.debhelper.lo debian/manpage.xml.ex debian/README.Debian debian/postrm.ex debian/prerm.ex debian/copyright debian/changelog debian/manpage.sgml.ex debian/cardbook.default.ex debian/README debian/cardbook.doc-base.EX debian/README.source debian/compat debian/control debian/debhelper-build-stamp debian/menu.ex debian/postinst.ex debian/cardbook.substvars debian/files
I gained an understanding of Dpkg package management program in Debian and its use to install, remove and manage packages.
I build an empty package with
dpkg commands. This created an empty package with four files namely
.dsc file contains the changes made and signature
.deb is the main package file which can be installed
.tar.gz (tarball) contains the source package
The process also created the README and changelog files in
/usr/share. They contain the essential notes about the package like description, author and version.
I installed the package and checked the installed package contents. My new package mentions the version, architecture and description!
$ dpkg -L cardbook /usr /usr/share /usr/share/doc /usr/share/doc/cardbook /usr/share/doc/cardbook/README.Debian /usr/share/doc/cardbook/changelog.gz /usr/share/doc/cardbook/copyright
After successfully creating an empty package, I added the actual CardBook add-on files inside the package. The CardBook’s codebase is hosted here on Gitlab. I included all the source files inside another directory and told the build package command which files to include in the package.
I did this by creating a file
debian/install using vi editor and listed the directories that should be installed. In this process I spent some time learning to use Linux terminal based text editors like vi. It helped me become familiar with editing, creating new files and shortcuts in vi.
Once, this was done, I updated the package version in the changelog file to document the changes that I have made.
$ dpkg -l | grep cardbook ii cardbook 1.1.0 amd64 Thunderbird add-on for address book
After rebuilding it, dependencies and detailed description can be added if necessary. The Debian control file can be edited to add the additional package requirements and dependencies.
Without creating a local repository, CardBook could be installed with:
$ sudo dpkg -i cardbook_1.1.0.deb
To actually test the installation for the package, I decided to build a local Debian repository. Without it, the
apt-get command would not locate the package, as it is not in uploaded in Debian packages on net.
For configuring a local Debian repository, I copied my packages (.deb) to
Packages.gz file placed in a
To make it work, I learned about the apt configuration and where it looks for files.
I researched for a way to add my file location in apt-config. Finally I could accomplish the task by adding
*.list file with package’s path in APT and updating ‘apt-cache’ afterwards.
Hence, the latest CardBook version could be successfully installed by
apt-get install cardbook
My mentor, Daniel helped me a lot during this process and guided me how to proceed further with the package. He told me to use Lintian for fixing common packaging error and then using dput to finally upload the CardBook package.
Lintian is a Debian package checker which finds policy violations and bugs. It is one of the most widely used tool by Debian Maintainers to automate checks for Debian policies before uploading the package.
I have uploaded the second updated version of the package in a separate branch of the repository on Salsa here inside Debian directory.
I installed Lintian from backports and learned to use it on a package to fix errors. I researched on the abbreviations used in its errors and how to show detailed response from lintian commands
$ lintian -i -I --show-overrides cardbook_1.2.0.changes
Initially on running the command on the
.changes file, I was surprised to see that a large number of errors, warnings and notes were displayed!
I spend some days to fix some errors related to Debian package policy violations. I had to dig into every policy and Debian rules carefully to eradicate a simple error. For this I referred various sections on Debian Policy Manual and Debian Developer’s Reference.
I am still working on making it flawless and hope to upload it on mentors.debian.net soon!
It would be grateful if people from the Debian community who use Thunderbird could help fix these errors.