Notes on Packaging Akara for Debian
I followed Ghantoos' instructions since those seemed the closest fit for Akara, with some modifications and clarifications.
Assumptions
- Amara is already installed (see TBDs below).
That any remnants of old Akara installs have been removed (check ~/.config and ~/.local). Also check echo $PYTHONPATH and if you want to be really thorough:
python -c "import sys, pprint; pprint.pprint(sys.path)" #Exhaustive Python search path
Setup
Pull the latest Akara source, or download a package and extract. The directory containing setup.py will be the assumed home directory for these instructions.
Make sure you've got a version of cdbs whose python-distutils.mk file specifies the use of "--prefix=/usr" as an argument to "setup.py install". I just manually added the argument to avoid having to futz with pinning. Without this setting, the deb package will include files under ~/.local/.
The Files
Makefile
PYTHON=`which python`
DESTDIR=/
BUILDIR=$(CURDIR)/debian/akara
PROJECT=akara
VERSION=2.0.1
all:
@echo "make source - Create source package"
@echo "make install - Install on local system"
@echo "make buildrpm - Generate a rpm package"
@echo "make builddeb - Generate a deb package"
@echo "make clean - Get rid of scratch and byte files"
source:
$(PYTHON) setup.py sdist $(COMPILE)
install:
$(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
buildrpm:
$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
builddeb:
# build the source package in the parent directory
# then rename it to project_version.orig.tar.gz
$(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
# build the package
dpkg-buildpackage -i -I -rfakeroot
clean:
$(PYTHON) setup.py clean
$(MAKE) -f $(CURDIR)/debian/rules clean
rm -rf build/ MANIFEST
find . -name '*.pyc' -deletedebian/control
Source: akara
Section: web
Priority: optional
Maintainer: Mark Baker <mark@zepheira.com>
Build-Depends: debhelper (>=7.0.0), python-support (>= 0.6), cdbs (>= 0.4.49), python-all-dev
XS-Python-Version: >=2.5
Standards-Version: 3.8.4
Package: akara
Homepage: http://www.xml3k.org/Akara/
XB-Python-Version: >=2.5
Architecture: all
Essential: no
Depends: ${misc:Depends}, ${python:Depends}
Description: A Web framework for RESTful data servicesdebian/compat
7
debian/pycompat
2
debian/copyright (pulled from Akara's main init.py )
Copyright 2009-2010 Uche Ogbuji and Zepheira LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.debian/changelog
- Follow Ghantoos' instructions
debian/rules (don't forget to make executable and to use tabs for indentation)
# -*- makefile -*-
DEB_PYTHON_SYSTEM := pysupport
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
clean::
rm -rf build build-stamp configure-stamp build/ MANIFEST
dh_clean
Build the package
Execute
$ make builddeb
The .deb package will be located in ../
Still TBD
- Either include Amara, or else package separately and mark as a dependence
- Yes, we'll definitely need this. python-amara as a separate, dependent package --Uche
- Synch versions between Akara and the deb package
- Change name to python-akara ?
- I think yes --Uche
- Move akara.conf into /etc
- Yes, please
- GPG signing ?
- pre/post scripts to stop/start akara
Resources
http://wiki.pylonshq.com/display/pylonscookbook/Creating+a+Debian+package+from+your+Pylons+project
http://blog.garethj.com/2009/06/building-deb-packages-for-python-applications/
http://www.ibm.com/developerworks/linux/library/l-debpkg.html
"stdeb - Python to Debian source package conversion utility"
