~crass/python-messaging/rename-debian

128 by Andrew Bird
Add easy package build for deb and rpm
1
SHELL = /bin/bash
2
3
VERSION := $(shell python -c 'from messaging import VERSION; print "%s.%s.%s" % VERSION')
4
SOURCES := $(shell rpmbuild --eval '%{_topdir}' 2>/dev/null)/SOURCES
5
PMV := python-messaging-$(VERSION)
6
7
all:
135 by Andrew Bird
Makefile tweak to allow us to pick different debian directories
8
	@echo Usage: make deb \[TARGET=ubuntu-lucid\] \| rpm
128 by Andrew Bird
Add easy package build for deb and rpm
9
145 by Andrew Bird
Add test target to Makefile
10
test:
11
	nosetests -v -w . messaging/test
12
128 by Andrew Bird
Add easy package build for deb and rpm
13
rpm:
14
	@if [ ! -d $(SOURCES) ] ;\
15
	then\
16
		echo 'SOURCES does not exist, are you running on a non RPM based system?';\
17
		exit 1;\
18
	fi
19
20
	tar -zcvf $(SOURCES)/$(PMV).tar.gz --exclude=.git --transform="s/^\./$(PMV)/" .
21
	rpmbuild -ba python-messaging.spec
22
23
deb:
24
	@if [ ! -d /var/lib/dpkg ] ;\
25
	then\
26
		echo 'Debian package directory does not exist, are you running on a non Debian based system?';\
27
		exit 1;\
28
	fi
29
135 by Andrew Bird
Makefile tweak to allow us to pick different debian directories
30
	@if [ -d packaging/debian/$(TARGET)/debian ] ;\
31
	then\
32
		PKGSOURCE=$(TARGET);\
33
	else\
34
		PKGSOURCE=generic;\
35
	fi;\
36
	tar -C packaging/debian/$$PKGSOURCE -cf - debian | tar -xf -
37
128 by Andrew Bird
Add easy package build for deb and rpm
38
	@if ! head -1 debian/changelog | grep -q $(VERSION) ;\
39
	then\
40
		echo Changelog and package version are different;\
41
		exit 1;\
42
	fi
43
135 by Andrew Bird
Makefile tweak to allow us to pick different debian directories
44
	dpkg-buildpackage -rfakeroot