This is a DRAFT!!!
This is a tutorial how to create a Debian package for Astropy Affiliated Packages. The tutorial consists of three parts:
Note that there is a Sprint Meeting in Heidelberg at 2015-08-14 where we organize a packaging tutorial.
3. Upload and advanced packaging
Only Debian Developers (DD) and Debian Maintainers (DM) can upload packages into the Debian repository. Debian Developers can also upload packages for others if they think that the package meets the Debian guidelines. This process is called "sponsoring".
The usual way to find a sponsor for you package is to file a bug against the "sponsorship-requests" pseudopackage. However, for packages that are maintained by the debian-astro team, there is a simpler approach: Just announce that you have the package ready in the debian-astro mailing list. We will quickly pick up your package from the git repository, review it and (if needed) discuss further changes. If the package is ready, we will upload it for you.
Automated tests can ensure that the package builds and works correctly. There are two different types of tests in Debian:
- Build time tests, and
- Debian CI tests
Build time tests are processed during the package build process. Usually, pybuild tries to find and run them automatically. You need, however, to specify the packages that are required for the test (f.e python-nose and python3-nose) as additional build dependency.
If the tests are not found automatically, you can specify them manually in debian/rules:
PYTHON2:=$(shell pyversions -vr) PYTHON3:=$(shell py3versions -vr) override_dh_auto_test: for PYTHON in $(PYTHON2) $(PYTHON3); do \ PYTHONPATH=$$(pwd) python$$PYTHON test/TestRecipe.py \ || exit $$? ; \ done
Debian CI tests are processed whenever a dependency of the package changes. They are a good tool to make sure that the package will work when new versions of other packages are installed. These tests are specified in the directory debian/tests/. Basically, there is one script for each test, and a file debian/tests/control with the information about dependencies.
For wcsaxes, the file debian/tests/control is the following:
Tests: python-cpl Depends: python-cpl, libcpl-dev, autoconf, automake, libtool Tests: python3-cpl Depends: python3-cpl, libcpl-dev, autoconf, automake, libtool
It specifies two tests, one for the Python 2 package, and one for the Python 3 package. The script file debian/tests/python-wcsaxes is
cp -r test/* "$ADTTMP" cd "$ADTTMP" # Run the tests exec python -Wignore TestRecipe.py -v 2>&1
The [?DebianCi] page shows how this file is processed.
For some packages, the author may ask to cite a certain reference when referring to the package. These references are collected in a file upstream/metadata. The file format is described in UpstreamMetadata. This file also contains other information, like
- a git repository for upstream development,
- where to submit bug reports upstream etc.
As an example, the upstream/metadata from the python-cpl package is shown here:
Contact: firstname.lastname@example.org Name: python-cpl Reference: Author: Streicher, O., and Weilbacher, P. M. Title: Python Bindings for the Common Pipeline Library Journal: Astronomical Data Analysis Software and Systems XXI Year: 2012 Volume: 461 Pages: 853 URL: http://adsabs.harvard.edu/abs/2012ASPC..461..853S Repository: https://github.com/olebole/python-cpl
- bug reports
- reproducible builds
There is quite a lot documentation available that you can check for further information. The most important pages are
Debian New Maintainers' Guide -- tutorial for simple package
Debian Packaging Tutorial -- slides-based overview of Debian packaging
Developers Reference -- advanced guide etc.
The policies describe the basic rules to follow when packaging: