~ubuntu-branches/ubuntu/saucy/moin/saucy

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher
  • Date: 2013-05-16 11:56:01 UTC
  • mfrom: (0.1.33 sid)
  • Revision ID: package-import@ubuntu.com-20130516115601-hdv4rmj5y8es086q
Tags: 1.9.5-5ubuntu1
* Merge from Debian unstable. Remaining changes:
* debian/control: 
  - remove python-xml from Suggests field, the package isn't in 
    sys.path any more.
  - demote fckeditor from Recommends to Suggests; the code was previously 
    embedded in moin, but it was also disabled, so there's no reason for us 
    to pull this in by default currently. Note: fckeditor has a number of 
    security problems and so this change probably needs to be carried 
    indefinitely.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/make -f
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
6
 
#
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.
11
 
#
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.
16
 
#
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/>.
19
 
 
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
24
 
 
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
28
 
 
29
 
# Use local fork handling variations in owner names and license strings
30
 
DEB_COPYRIGHT_CHECK_SCRIPT = debian/licensecheck
 
2
#-*- makefile -*-
31
3
 
32
4
pkg = python-moinmoin
33
 
 
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)
38
 
 
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
47
 
 
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))
53
10
 
54
 
SEDRULE_CONTENT = -e 's,__STATICPATH__,$(staticpath),g'
55
 
 
56
 
# just being lazy...
57
 
datadir = /usr/share/moin
58
 
 
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; \
64
 
        done
65
 
 
66
 
clean::
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$$//'`; \
69
 
                rm -f $$targetfile; \
70
 
        done
71
 
 
72
 
# Ensure proper hash-bang in Python scripts (Python Policy 0.9.0.0 §3.1)
73
 
binary-fixup/$(pkg)::
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),'
76
 
 
77
 
# Strip notes in underlay about editing only on moinmaster.
78
 
binary-fixup/$(pkg)::
79
 
        sh debian/process_language_pages debian/$(cdbs_curpkg)
80
 
 
81
 
# moin is modular, insert sub-commands description
82
 
common-build-indep::
 
11
build-arch build-indep: build-stamp
 
12
build-stamp:
 
13
        dh_testdir
83
14
        bash debian/tweak-moin-manpage debian/moin.1.template debian/moin.1
84
 
 
85
 
# Make sure scripts are executable
86
 
binary-fixup/$(pkg)::
87
 
        egrep -r -l -Z '^#! ?/usr/bin/(env )?python[[:print:]]*$$' debian/$(cdbs_curpkg)$(libdir) \
88
 
                | xargs -r -0 chmod a+x
89
 
 
90
 
# Include Moinmoin Desktop editions files.
91
 
binary-fixup/$(pkg)::
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
95
 
 
96
 
# Make sure translations are up-to-date
97
 
common-build-indep:: debian/stamp-update-translations
98
 
 
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
 
18
        touch build-stamp
102
19
 
103
 
clean::
 
20
clean:
 
21
        dh_testdir
 
22
        dh_testroot
 
23
        rm -rf build
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
108
 
 
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##*/}; \
114
 
        done
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; \
119
 
        done
120
 
 
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
126
 
 
127
 
# Move underlay to /usr/share/moin
128
 
install/$(pkg)::
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/
132
 
 
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
137
 
 
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
143
 
 
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
148
 
 
149
 
# Needed for our packaging
150
 
CDBS_BUILD_DEPENDS += , unzip, zip
151
 
 
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 '{}' ';'
 
33
        dh_clean
 
34
 
 
35
install: install-stamp
 
36
install-stamp: build-stamp
 
37
        dh_testdir
 
38
        dh_testroot
 
39
        dh_clean -k
 
40
        dh_installdirs
 
41
 
 
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/*
 
45
 
 
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),'
 
49
 
 
50
        # Strip notes in underlay about editing only on moinmaster.
 
51
        sh debian/process_language_pages debian/$(pkg)
 
52
 
 
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
 
56
 
 
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); \
 
60
            rm -rf $${HTDOCS}; \
 
61
            ln -s $(datadir)/htdocs $${HTDOCS} ; \
 
62
        done
 
63
 
 
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
 
67
 
 
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##*/}; \
 
71
        done
 
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; \
 
74
        done
 
75
 
 
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
 
79
 
 
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
 
83
 
 
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
 
87
 
 
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
 
92
 
 
93
        touch install-stamp
 
94
 
 
95
# Build architecture-dependent files here.
 
96
binary-arch: build install
 
97
# We have nothing to do by default.
 
98
 
 
99
# Build architecture-independent files here.
 
100
binary-indep: build install
 
101
        dh_testdir
 
102
        dh_testroot
 
103
        dh_install
 
104
        dh_installdocs
 
105
        dh_installexamples
 
106
        dh_installman
 
107
        dh_installchangelogs
 
108
        dh_python2
 
109
        dh_compress -X examples/
 
110
        dh_fixperms
 
111
        dh_installdeb
 
112
        dh_gencontrol
 
113
        dh_md5sums
 
114
        dh_builddeb
 
115
 
 
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