Commit 0fc5dd77 authored by Peter Couvares's avatar Peter Couvares
Browse files

applied Steffen's patches for debian packaging

parent 4f61c123
glue (1.39.2-4) unstable; urgency=low
* build using debhelper 7 and python2
-- Steffen Grunewald <steffen.grunewald@aei.mpg.de> Thu, 14 Jun 2012 09:05:00 +0200
glue (1.39.2-1) unstable; urgency=low
* Obey debian/pyversions (build for 2.6 and up only)
......
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#!/usr/bin/make -f
DH_VERBOSE=1
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
PYTHON2=$(shell pyversions -vr)
#PYTHON3=$(shell py3versions -vr)
PACKAGE = python-glue
%:
dh $@ --buildsystem=python_distutils --with=python2
#dh $@ --buildsystem=python_distutils --with=python2,python3
#PREFIX = /opt/lscsoft/glue
PREFIX = /usr
#test-python%:
# python$* setup.py test -vv
# list of pythonX.Y available for release used for building
PYVERS=$(shell pyversions -r)
#PYVERS=$(shell pyversions -s)
#override_dh_auto_test: $(PYTHON2:%=test-python%) #$(PYTHON3:%=test-python%)
CFLAGS = -Wall -g
override_dh_auto_install:
dh_auto_install
#for python in $(PYTHON3): do python$$python setup.py install --install-layout=deb --root=debian/tmp ; done
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
# $() expands to list of clean-pythonX.Y
clean: $(PYVERS:%=clean-%)
rm -f build-python* configure-stamp
clean-%:
dh_testdir
#dh_testroot
# -$(MAKE) clean
$* setup.py clean --all
-rm -rf build
dh_clean
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
touch configure-stamp
# $() expands to list of build-pythonX.Y
build: $(PYVERS:%=build-%)
build-%:
dh_testdir
# $(MAKE)
# moved to install
# $* setup.py build
touch $@
# $() expands to list of install-pythonX.Y
install: build $(PYVERS:%=install-%)
# dh_testdir
# dh_testroot
# dh_clean -k
# dh_installdirs
# for some nasty reasons, setup.py replaces shebang lines with pythonX.Y call
# revert that!
set -e; \
# fix executable name as setup.py inserts pythonX.Y
for i in `find debian/$(PACKAGE)/$(PREFIX)/bin -type f`; do \
echo $$i; \
if head -n1 $$i | grep -q '^#!.*python[0-9]\..' ; then \
sed -i '1s/python[0-9]\../python/' $$i; \
fi ; \
done
# do we still need that? dh_fixperms might take care of those...
set -e; \
for i in `find debian -mindepth 2 -type f ! -perm 755`; do \
if head -n1 $$i | grep -q '^#!' ; then \
chmod +x $$i; \
fi ; \
done
# overwrite env scripts
for env in $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/etc/glue-user-env.* ; do \
cp $$env $$env.ORIG ; \
done
cp -p debian/glue-user-env.* $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/etc/
# if building with prefix /usr, move config files to /etc
if [ "$(PREFIX)" = "/usr" ]; then \
mkdir -p $(CURDIR)/debian/$(PACKAGE)/etc/ ; \
mv -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/etc/* $(CURDIR)/debian/$(PACKAGE)/etc/ ; \
rmdir $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/etc ; \
fi
rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/python*/*/glue/__init__.py*
rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/python*/*/glue/segments.py*
rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/python*/*/glue/__segments.so*
rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/python*/*/glue/iterutils.py*
rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/python*/*/glue/git_version.py*
# exclude from main package:
rm -rf $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/etc
rm -rf $(CURDIR)/debian/$(PACKAGE)/etc
rm -rf $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/var
#rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/share/nmi/lalsuite-build*
rm -rf $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/share/nmi
rm -f $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/python*/glue/cbcwebpage.py*
#
# clean up .pyo files
find $(CURDIR)/debian/*/$(PREFIX)/lib/python* -name '*.pyo' | xargs -r rm -f
# do not remove .pyc files
#find $(CURDIR)/debian/*/$(PREFIX)/lib/python* -name '*.pyc' | xargs -r rm -f
install-%:
# Add here commands to install the package into debian/$(PACKAGE).
# $(MAKE) DESTDIR=$(CURDIR)/debian/$(PACKAGE) install
mkdir -p $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/share/doc/$(PACKAGE)
CFLAGS="$(CFLAGS)" \
$* setup.py build
CFLAGS="$(CFLAGS)" \
$* setup.py install -O1 \
--root=$(CURDIR)/debian/$(PACKAGE) \
--prefix=$(PREFIX)
# --skip-build
# --record=$(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/share/doc/$(PACKAGE)/INSTALLED_FILES
# Split off some stuff to $(PACKAGE)-common and $(PACKAGE)-segments, remove from main tree
# *.install cannot handle this because of %exclude rules!
mkdir -p $(CURDIR)/debian/$(PACKAGE)-segments/$(PREFIX)/lib/
(cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/glue/segments.py*' | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-segments/$(PREFIX)/lib/
(cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/glue/__segments.so*' | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-segments/$(PREFIX)/lib/
#cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/src/segments' -type d | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-segments/$(PREFIX)/lib/
#cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/test' -type d | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-segments/$(PREFIX)/lib/
mkdir -p $(CURDIR)/debian/$(PACKAGE)-common/$(PREFIX)/lib
(cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/glue/__init__.py*' | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-common/$(PREFIX)/lib/
(cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/glue/iterutils.py*' | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-common/$(PREFIX)/lib/
(cd $(CURDIR)/debian/$(PACKAGE)/$(PREFIX)/lib/; find python* -wholename '*/glue/git_version.py*' | xargs tar cf -) | tar xf - -C $(CURDIR)/debian/$(PACKAGE)-common/$(PREFIX)/lib/
#
$* setup.py clean --all
binary: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
# dh_install
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
# dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
dh_makeshlibs
dh_installdeb
LD_LIBRARY_PATH=$(PREFIX)/lib dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
.PHONY: build clean binary install configure
# remove pyversions file
override_dh_clean:
dh_clean
rm -f debian/pyversions
ls -l debian
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment