Source

trac-dvbcronrecording-plugin / GNUmakefile

Full commit
Guido Draheim 9e27589 






























Guido Draheim 56a3442 
Guido Draheim 9e27589 
Guido Draheim 56a3442 


Guido Draheim abfd546 
Guido Draheim 56a3442 
Guido Draheim ec16a93 
Guido Draheim 56a3442 
Guido Draheim ec16a93 
















Guido Draheim 56a3442 
Guido Draheim 9e27589 













Guido Draheim f1c8ba3 

Guido Draheim 9e27589 



Guido Draheim f1c8ba3 
Guido Draheim 9e27589 









Guido Draheim f1c8ba3 
Guido Draheim 9e27589 




































PKG = dvbcronrecording
SPECNAME = trac-$(PKG)-plugin

prefix=/usr
run: builds install
all: builds install restart
upd up: rpm update restart

msg msgchk:
	cd src && python setup.py copy_catalog
	cd src && python setup.py extract_messages
	cd src && python setup.py update_catalog
	cd src && python setup.py compile_catalog
	grep -B 2 'msgstr.*""' src/*/*/*/LC_MESSAGES/*.po | sed -e 's/^--$$//'
msgfmt:
	cd src && python setup.py copy_catalog
	cd src && python setup.py compile_catalog
	
# builds: msgfmt
builds: msgfmt
	: cd src && python setup.py --help build 
	cd src && python setup.py build --build-base=$(BUILDDIR)
	
install:
	: cd src && python setup.py --help install 
	cd src && sudo python setup.py build --build-base=$(BUILDDIR) \
	    install --prefix=$(prefix) --root=/
	
clean:
	cd src && sudo python setup.py clean --build-base=$(BUILDDIR)
	
tests unittest:
	cd src && python setup.py build --build-base=$(BUILDDIR) \
	   test $(CHECK)
check:
	PYTHONPATH=src \
	python src/tests/computer_test.py -vv $(CHECK)
test_%:
	@ func1=`grep "def $@" src/tests/computer_test.py \
	    | sed -e "s/.*def  *//" -e "s/[(].*//" -e q` \
	; func2=`grep "def $@" src/tests/computer_tests.py \
	    | sed -e "s/.*def  *//" -e "s/[(].*//" -e q` \
	; if test -n "$$func1" \
	; then echo $(MAKE) check CHECK=DvbComputerTests.$$func1 \
	;           $(MAKE) check CHECK=DvbComputerTests.$$func1 \
	; elif test -n "$$func2" \
	; then echo $(MAKE) checks CHECK=DvbGeneratedTests.$$func2 \
	;           $(MAKE) checks CHECK=DvbGeneratedTests.$$func2 \
	; else echo "unknown $@"; exit 1 \
	; fi

genchecks:
	PYTHONPATH=src \
	python src/tests/computer_test.py ... 
checks:
	PYTHONPATH=src \
	python src/tests/computer_tests.py -vv $(CHECK)


RPMROOT=$(shell pwd)/rpm
BUILDDIR = $(RPMROOT)/build
RPMTEMP = '--define=_tmpath $(RPMROOT)/tmp'
RPMBUILD =  rpmbuild '--define=_topdir $(RPMROOT)' \
                     '--define=_builddir $(BUILDDIR)' \
                $(RPMBUILDOPTIONS)

# setuptools sdist is broken for package_data in 0.6c11 vs python 2.6.5, known bug!
# It does simply not work - so use "make dist" instead of "setup.py sdist"
sdist:
	test -d $(RPMROOT)/SOURCES || mkdir -p $(RPMROOT)/SOURCES
	cd src && python setup.py sdist --dist-dir $(RPMROOT)/SOURCES -v -v 
dist: msgfmt
	: cd src && \
	: python setup.py sdist --build-base=$(BUILDDIR) \
	   --dist-dir SOURCES -v -v $X
	test -d $(RPMROOT)/SOURCES || mkdir -p $(RPMROOT)/SOURCES
	cd src && tar czvf $(RPMROOT)/SOURCES/$(PKG).tgz *.py *.cfg *.txt *.spec $(PKG)/
	ls -l $(RPMROOT)/SOURCES/$(PKG).tgz
	@ version=`cat src/$(SPECNAME).spec | sed -e '/define _version/!d' -e 's/.*_version //'` \
	; echo mv $(RPMROOT)/SOURCES/$(PKG).tgz $(RPMROOT)/SOURCES/$(PKG)-$$version.tgz \
	;      mv $(RPMROOT)/SOURCES/$(PKG).tgz $(RPMROOT)/SOURCES/$(PKG)-$$version.tgz

rpm: dist
	test -d $(RPMROOT)/RPMS || mkdir $(RPMROOT)/RPMS
	test -d $(RPMROOT)/SRPMS || mkdir $(RPMROOT)/SRPMS
	test -d $(RPMROOT)/BUILD || mkdir $(RPMROOT)/BUILD
	test -d $(RPMROOT)/SPECS || mkdir $(RPMROOT)/SPECS
	- test -d $(BUILDDIR)/$(PKG) && rm -rf $(BUILDDIR)/*
	cp src/$(SPECNAME).spec $(RPMROOT)/SPECS/$(SPECNAME).spec
	revision=`LANG=C hg summary| sed -e '/parent:/!d' -e 's/parent: *//' -e 's/:.*//'` \
	; if [ -n "$$revision" ]; then set -x \
	;   sed -i -e "s/revision 0/revision $$revision/"  $(RPMROOT)/SPECS/$(SPECNAME).spec \
	; else today=`date +%Y%m%d` \
	;   sed -i -e "s/revision 0/revision 0.$$today/"  $(RPMROOT)/SPECS/$(SPECNAME).spec \
	; fi
	$(RPMBUILD) -ba $(RPMROOT)/SPECS/$(SPECNAME).spec

update:
	@ spec="$(RPMROOT)/SPECS/$(SPECNAME).spec" \
	; version=`cat "$$spec" | sed -e '/define _version/!d' -e 's/.*_version *//'` \
	; package=`cat "$$spec" | sed -e '/Name:/!d' -e 's/Name: *//'` \
	; rev=`cat "$$spec" | sed -e '/define revision/!d' -e 's/.*revision *//' -e 's/ .*//'` \
	; echo rpm -U --force $(RPMROOT)/RPMS/noarch/$$package-$$version.$$rev*.noarch.rpm \
	;      rpm -U --force $(RPMROOT)/RPMS/noarch/$$package-$$version.$$rev*.noarch.rpm
	   
trac restart:
	sudo /sbin/service tracd restart

OSC_ROOT = /my/own/osc
OSC_PROJECT = home:guidod:trac12
OSC_PACKAGE = trac-dvbcronrecording-plugin
OSC = $(OSC_ROOT)/$(OSC_PROJECT)/$(OSC_PACKAGE)
osc: dist
	@ version=`cat src/$(SPECNAME).spec | sed -e '/define _version/!d' -e 's/.*_version //'` \
	; tarball="$(RPMROOT)/SOURCES/$(PKG)-$$version.tgz" \
	; specpath="$(RPMROOT)/SPECS/$(SPECNAME).spec" \
	; if [ -f "$$tarball" ]; then set -x \
	;    (cd $(OSC) && osc rm *.tgz) \
	;    cp -v "$$tarball" $(OSC)/ \
	;    (cd $(OSC) && osc add `basename "$$tarball"` \
	;    cp -v "$$specpath" $(OSC)/$(SPECNAME).spec \
	;    (cd $(OSC) && osc ci -m "update $$version") \
	; else : \
	;    echo "failed to find $$tarball" \
	; fi	  

.PHONY: osc trac restart update install dist sdist msgfmt