another simpler, cleaner angle
[sfa.git] / Makefile.debian
index 1c78bf5..24967ad 100644 (file)
@@ -1,39 +1,24 @@
-# $Id: Makefile,v 1.6 2008/10/29 01:01:35 ghantoos Exp $
-#
-
-PYTHON=`which python`
-DESTDIR=/
-BUILDIR=$(CURDIR)/debian/sfa
 PROJECT=sfa
-VERSION=0.2.0
+VERSION=$(shell python -c "from sfa.util.version import version_tag; print version_tag" | sed -e s,-,.,)
+DATE=$(shell date -u +"%a, %d %b %Y %T")
+DEBIAN_TARBALL=../$(PROJECT)_$(VERSION).orig.tar.bz2
 
-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"
+debian: deban/changelog debian.source debian.package
 
-source:
-       $(PYTHON) setup.py sdist $(COMPILE)
+force:
 
-install:
-       $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
+debian/changelog: debian/changelog.in
+       sed -e "s|@VERSION@|$(VERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
 
-buildrpm:
-       $(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
+# TARBALL is passed from the main build (/build/Makefile) to the 'make debian' call
+debian.source: force 
+       rsync -a $(TARBALL) $(DEBIAN_TARBALL)
 
-builddeb:
-       rm -f sfaadmin sfascan sfi  
-       # build the source package in the parent directory
-       # then rename it to project_version.orig.tar.gz
-       $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ --prune
-       rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
-       # build the package
-       dpkg-buildpackage -i -I -rfakeroot
+debian.package:
+       debuild -uc -us --source-option=--include-binaries --source-option=-isession
 
-clean:
-       $(PYTHON) setup.py clean
-       $(MAKE) -f $(CURDIR)/debian/rules clean
-       rm -rf build/ MANIFEST
+debian.clean:
+       $(MAKE) -f debian/rules clean
+       rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
        find . -name '*.pyc' -delete
+