Preparation
Packaging software for Ubuntu/Debian can be simple or complex depend mostly on the level of quality and requirements that you decide to put on your package. Getdeb packaging requirements differ from Debain or Ubuntu packaging. If your primary goal is to incorporate your packages into Debian/Ubuntu official repositories you will need to check their own requirements.
Dependencies and why you must care about them
One of the most important aspects on building packages is the package dependencies identification. There are two types of dependencies:
Build dependencies: the list of packages which are required to build/compile a package. While these dependencies have no impact on the end users installation of the package, it is of great importance for other packagers/developers which may want to build the package on their own systems.
Install dependencies: the list of packages which are required for a given package to work. Such dependencies can range from system libraries to run time requirements like functions which depend on external commands. These dependencies are fundamental for end users, if a package does not list the correct dependencies it will lack some functionalities or not work at all
Some common procedures to identify dependencies are:
- Read the source documentation, most of the times the source comes with a README or INSTALL files which describes the software requirements, you will need to map those into package names
- Build and run the applications on a minimal system: Building the application on a minimal system guarantees that missing packages will be easily identified and you will add them to the dependencies list
Creating a "minimal" environment for package building
Building packages using your "regular" desktop system is strongly discouraged, instead you should use one of the several methods which allow to setup a minimal build environment, such environment can be used from your regular installation but it be software isolated. That way you will not need to install development packages on your desktop installation and you will keep the ability to track and test dependencies at each build. Some of the commonly used methods for building on a minimal environmental are:
Building with cowbuilder
Building with pbuilder
Building using schroot
If you want to learn how to manually create an schroot environment please check the schroot wiki page, otherwise use our script to automate the schroot image creation process, something which will take a few minutes.
Setting up a local APT cacher
Building on a clean environment will require development packages to be fetched for installation at each build, this will be a time and bandwidth consuming task, to minimize this problem we strongly advise to setup a local apt proxy. To install and setup the apt proxy:
sudo apt-get install apt-cacher
Then edit /etc/default/apt-cacher and set AUTOSTART to 1, and start it with:
sudo /etc/init.d/apt-cacher start
And change your sources.list to use the local cache:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig sudo sed -i "s/http:\/\//http:\/\/localhost:3142\/\//g" /etc/apt/sources.list
Using the schroot_build.py script
This script will create the schroot image with the required tools for building packages by just asking a few questions. Run the script with "sudo ./schroot_build.py", specify the installation target directory and distribution for the schroot environment. When the install process is over you will be instructed to add the schroot configuration entry into /etc/schroot/schroot.conf . The script is available here
Using the schroot for applications testing
You can use the schroot to run applications, for that you will just need to use schroot with "-p" to preserve the environment. you can run OpenGL applications as long you install the hardware accelerated drivers on your schroot session
Cleaning up unmanaged schroot sessions
After several builds and tests you may have created unmanaged sessions which will be kept using disk space and other important resources, you can check this by listing existing sessions with schroot -l --all-sessions, you can end all sessions with schroot -end-sessiona --all-sessions
