2
# -*- mode: makefile; coding: utf-8 -*-
3
# Copyright 2003-2010 Jonas Smedegaard <dr@jones.dk>
4
# Copyright 2009-2010 Frank Lin PIAT <fpiat@klabs.be>
5
# Description: Main Debian packaging script for MoinMoin
7
# This program is free software; you can redistribute it and/or
8
# modify it under the terms of the GNU General Public License as
9
# published by the Free Software Foundation; either version 2, or (at
10
# your option) any later version.
12
# This program is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
include /usr/share/cdbs/1/rules/upstream-tarball.mk
21
include /usr/share/cdbs/1/rules/utils.mk
22
include /usr/share/cdbs/1/class/python-distutils.mk
23
include /usr/share/cdbs/1/rules/debhelper.mk
25
DEB_UPSTREAM_URL = http://static.moinmo.in/files
26
DEB_UPSTREAM_TARBALL_BASENAME_MANGLE = s/~(alpha|beta|rc)/\1/
27
DEB_UPSTREAM_TARBALL_MD5 = adfa15e3e37cf26b4b014f209959e9d9
29
# Use local fork handling variations in owner names and license strings
30
DEB_COPYRIGHT_CHECK_SCRIPT = debian/licensecheck
32
4
pkg = python-moinmoin
34
libdir = /usr/share/moin/server
35
DEB_PYTHON_PRIVATE_MODULES_DIRS_$(pkg_data) = /usr/share/moin/data/plugin /usr/share/moin/server
36
# Grrr - this is needed thanks to broken defaults with new python policy!
37
DEB_PYTHON_DESTDIR = $(CURDIR)/debian/$(cdbs_curpkg)
39
DEB_MAKE_CHECK_TARGET = test
40
DEB_COMPRESS_EXCLUDE = .py
41
DEB_INSTALL_EXAMPLES_$(pkg) += wikiserver.py wikiconfig.py wiki/config debian/examples/*
42
DEB_INSTALL_DOCS_ALL += debian/README.Debian
43
DEB_INSTALL_DOCS_$(pkg) += docs/README.migration docs/INSTALL.html
44
DEB_INSTALL_DOCS_$(pkg) += docs/UPDATE.html docs/REQUIREMENTS
45
DEB_INSTALL_CHANGELOGS_ALL = docs/CHANGES
46
DEB_INSTALL_MANPAGES_$(pkg) += debian/moin-mass-migrate.8 debian/moin-update-wikilist.1 debian/moin.1
48
# Grab staticpath from some config file for use in our documentation
49
# (Make ignores exitlevel, so doublecheck result)
50
grep -q "url_prefix_static = '/moin_static' + version.release_short" MoinMoin/config/__init__.py || echo "Test failed"
5
datadir = /usr/share/moin
6
libdir = $(datadir)/server
7
python_all = pyversions -r | tr ' ' '\n' | xargs -t -I {} env {}
51
8
staticpath := $(shell sed -n -e "s|^\s*release_short\s*=\s*'\([^']*\)'.*|/moin_static\1|p" MoinMoin/version.py)
52
9
$(if $(staticpath),,$(error Failed to resolve staticpath))
54
SEDRULE_CONTENT = -e 's,__STATICPATH__,$(staticpath),g'
57
datadir = /usr/share/moin
59
# Create (and cleanup) files, expanding variables static per build
60
update-config:: pre-build
61
for file in `find debian -maxdepth 2 -type f -name '*.in' -not -name control.in -not -name control.in.in -not -name POTFILES.in`; do \
62
targetfile=`echo $$file | sed -e 's/\\.in$$//'`; \
63
sed $(SEDRULE_CONTENT) <$$file >$$targetfile; \
67
for file in `find debian -maxdepth 2 -type f -name '*.in' -not -name control.in -not -name control.in.in -not -name README.source.in -not -name POTFILES.in -not -name 'watch.in'`; do \
68
targetfile=`echo $$file | sed -e 's/\\.in$$//'`; \
72
# Ensure proper hash-bang in Python scripts (Python Policy 0.9.0.0 §3.1)
74
egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' debian/$(cdbs_curpkg)$(datadir)/server/* debian/$(cdbs_curpkg)/usr/share/doc/* \
75
| xargs -r -0 perl -pi -e 's,^#! ?/usr/bin/(env )?python[[:print:]]*$$,#!/usr/bin/python$(cdbs_python_nondefault_version),'
77
# Strip notes in underlay about editing only on moinmaster.
79
sh debian/process_language_pages debian/$(cdbs_curpkg)
81
# moin is modular, insert sub-commands description
11
build-arch build-indep: build-stamp
83
14
bash debian/tweak-moin-manpage debian/moin.1.template debian/moin.1
85
# Make sure scripts are executable
87
egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' debian/$(cdbs_curpkg)$(libdir) \
88
| xargs -r -0 chmod a+x
90
# Include Moinmoin Desktop editions files.
92
mkdir -p debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/examples/desktop-edition
93
cp wikiserver.py wikiconfig.py debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/examples/desktop-edition
94
chmod a+x debian/$(cdbs_curpkg)/usr/share/doc/$(cdbs_curpkg)/examples/wikiserver-init.sh
96
# Make sure translations are up-to-date
97
common-build-indep:: debian/stamp-update-translations
99
debian/stamp-update-translations: common-configure-indep
100
15
cd MoinMoin/i18n && make
101
touch debian/stamp-update-translations
16
$(python_all) setup.py build
17
sed s,__STATICPATH__,$(staticpath),g < debian/README.Debian.in > debian/README.Debian
104
24
cd MoinMoin/i18n && make clean
105
25
rm -f MoinMoin/i18n/meta.py
106
26
rm -f debian/stamp-update-translations
107
27
rm -f debian/moin.1
109
# Setup system wide farmconfig.
110
binary-fixup/$(pkg)::
111
mkdir -p debian/$(cdbs_curpkg)/etc/moin
112
for file in `find debian/$(cdbs_curpkg)$(datadir)/config/wikifarm -type f -print`; do \
113
sed -f debian/configtweaks.sed $$file > debian/$(cdbs_curpkg)/etc/moin/$${file##*/}; \
115
for file in `find debian/$(cdbs_curpkg)$(datadir)/server -type f -printf '%f\n'`; do \
116
cat debian/$(cdbs_curpkg)$(datadir)/server/$$file | sed -f debian/servertweaks.sed > debian/$(cdbs_curpkg)$(datadir)/server/$$file.new; \
117
chmod --reference=debian/$(cdbs_curpkg)$(datadir)/server/$$file debian/$(cdbs_curpkg)$(datadir)/server/$$file.new; \
118
mv -f debian/$(cdbs_curpkg)$(datadir)/server/$$file.new debian/$(cdbs_curpkg)$(datadir)/server/$$file; \
121
# Use systemwide word file as main dictionary
122
binary-fixup/$(pkg)::
123
mkdir -p debian/$(cdbs_curpkg)/usr/share/pyshared/MoinMoin/
124
ln -s /etc/moin/words debian/$(cdbs_curpkg)/usr/share/pyshared/MoinMoin/
125
ln -s /usr/share/dict/words debian/$(cdbs_curpkg)/etc/moin/words
127
# Move underlay to /usr/share/moin
129
mkdir -p debian/$(cdbs_curpkg)$(datadir)
130
mv debian/$(cdbs_curpkg)/usr/lib/python*/*-packages/MoinMoin/web/static/htdocs debian/$(cdbs_curpkg)$(datadir)
131
ln -s debian/$(cdbs_curpkg)$(datadir)/htdocs debian/$(cdbs_curpkg)/usr/lib/python*/*-packages/MoinMoin/web/static/
133
# Strip TwikiDrawPlugin as we need to compile from source
134
binary-fixup/$(pkg)::
135
rm -f debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/TWikiDrawPlugin/twikidraw.jar
136
echo "This applet has not yet been packaged for Debian. for now it is available at http://debian.jones.dk/auryn/pool-all/official/moin/twikidraw/" > debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/TWikiDrawPlugin/README
138
# Strip FCKeditor, as it's provided by packages fckeditor
139
binary-fixup/$(pkg)::
140
rm -rf debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/FCKeditor/*
141
echo "This applet is provided by Debian's fckeditor package." > debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/FCKeditor/README
142
echo "More info at /usr/share/doc/$(cdbs_curpkg)/README.Debian(.gz)" >> debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/FCKeditor/README
144
# Strip AnyWikiDrawForTWiki as needs to compile from source
145
binary-fixup/$(pkg)::
146
rm -rf debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/anywikidraw/*
147
echo "This applet has not yet been packaged for Debian." > debian/$(cdbs_curpkg)$(datadir)/htdocs/applets/anywikidraw/README
149
# Needed for our packaging
150
CDBS_BUILD_DEPENDS += , unzip, zip
152
# Needed (always, often or sometimes) at runtime
153
CDBS_DEPENDS += python-werkzeug, python-pygments, python-parsedatetime, python-recaptcha
154
CDBS_RECOMMENDS += , default-mta | mail-transport-agent, python-xapian, python-xappy
155
CDBS_RECOMMENDS += , libapache2-mod-wsgi | httpd-cgi
156
CDBS_SUGGESTS += , python-flup, fckeditor
157
CDBS_SUGGESTS += , python-4suite-xml, python-gdchart, python-docutils, python-pyxmpp, python-openid, python-tz, python-ldap, python-mysqldb
158
CDBS_SUGGESTS += , miscfiles | wordlist, antiword, catdoc, cifs-utils, poppler-utils | xpdf-utils, docbook-dsssl
28
rm -f debian/copyright_newhints debian/README.Debian
29
rm -f build-stamp install-stamp
30
find . -name '*.py[co]' -delete
31
find . -name __pycache__ -type d -empty -delete
32
find . -prune -name '*.egg-info' -exec rm -rf '{}' ';'
35
install: install-stamp
36
install-stamp: build-stamp
42
# Add here commands to install the package into debian/$(pkg)
43
$(python_all) setup.py install --prefix=/usr --root=debian/$(pkg) --install-layout=deb
44
sed -i '1 s,\(#!/usr/bin/python\).*,\1,' debian/*/usr/bin/*
46
# Ensure proper hash-bang in Python scripts (Python Policy 0.9.0.0 §3.1)
47
egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' debian/$(pkg)$(datadir)/server/* debian/$(pkg)/usr/share/doc/* debian/$(pkg)/usr/bin/moin \
48
| xargs -r -0 perl -pi -e 's,^#! ?/usr/bin/(env )?python[[:print:]]*$$,#!/usr/bin/python$(cdbs_python_nondefault_version),'
50
# Strip notes in underlay about editing only on moinmaster.
51
sh debian/process_language_pages debian/$(pkg)
53
# Make sure scripts are executable
54
egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' debian/$(pkg)$(libdir) \
55
| xargs -r -0 chmod a+x
57
# Move underlay to /usr/share/moin
58
for HTDOCS in debian/$(pkg)/usr/lib/python*/*-packages/MoinMoin/web/static/htdocs; do \
59
cp -a $${HTDOCS} debian/$(pkg)$(datadir); \
61
ln -s $(datadir)/htdocs $${HTDOCS} ; \
64
# Include Moinmoin Desktop editions files.
65
install -m 755 wikiserver.py wikiconfig.py debian/$(pkg)/usr/share/doc/$(pkg)/examples/desktop-edition
66
install -m 755 debian/examples/wikiserver-init.sh debian/$(pkg)/usr/share/doc/$(pkg)/examples/wikiserver-init.sh
68
# Setup system wide farmconfig.
69
for file in `find debian/$(pkg)$(datadir)/config/wikifarm -type f -print`; do \
70
sed -f debian/configtweaks.sed $$file > debian/$(pkg)/etc/moin/$${file##*/}; \
72
for file in `find debian/$(pkg)$(datadir)/server -type f -printf '%f\n'`; do \
73
sed -i -f debian/servertweaks.sed debian/$(pkg)$(datadir)/server/$$file; \
76
# Use systemwide word file as main dictionary
77
ln -s /etc/moin/words debian/$(pkg)/usr/share/pyshared/MoinMoin/
78
ln -s /usr/share/dict/words debian/$(pkg)/etc/moin/words
80
# Strip TwikiDrawPlugin as we need to compile from source
81
rm -f debian/$(pkg)$(datadir)/htdocs/applets/TWikiDrawPlugin/twikidraw.jar
82
echo "This applet has not yet been packaged for Debian. for now it is available at http://debian.jones.dk/auryn/pool-all/official/moin/twikidraw/" > debian/$(pkg)$(datadir)/htdocs/applets/TWikiDrawPlugin/README
84
# Strip AnyWikiDrawForTWiki as needs to compile from source
85
rm -rf debian/$(pkg)$(datadir)/htdocs/applets/anywikidraw/*
86
echo "This applet has not yet been packaged for Debian." > debian/$(pkg)$(datadir)/htdocs/applets/anywikidraw/README
88
# Strip FCKeditor, as it's provided by packages fckeditor
89
rm -rf debian/$(pkg)$(datadir)/htdocs/applets/FCKeditor/*
90
echo "This applet is provided by Debian's fckeditor package." > debian/$(pkg)$(datadir)/htdocs/applets/FCKeditor/README
91
echo "More info at /usr/share/doc/$(pkg)/README.Debian(.gz)" >> debian/$(pkg)$(datadir)/htdocs/applets/FCKeditor/README
95
# Build architecture-dependent files here.
96
binary-arch: build install
97
# We have nothing to do by default.
99
# Build architecture-independent files here.
100
binary-indep: build install
109
dh_compress -X examples/
116
binary: binary-indep binary-arch
117
build: build-arch build-indep
118
.PHONY: build-arch build-indep build clean binary-indep binary-arch binary