Merge lp:~gingerchris/endroid/package-version into lp:endroid

Proposed by ChrisD
Status: Merged
Approved by: ChrisD
Approved revision: 119
Merged at revision: 104
Proposed branch: lp:~gingerchris/endroid/package-version
Merge into: lp:endroid
Diff against target: 297 lines (+130/-47)
13 files modified
README (+1/-1)
debian/changelog (+12/-0)
debian/conffiles (+0/-1)
debian/control (+1/-1)
debian/endroid.install (+0/-1)
debian/postinst (+11/-0)
etc/init/endroid.conf (+5/-0)
gen_version.sh (+10/-0)
makedeb (+52/-0)
setup.py (+29/-29)
src/endroid.sh (+2/-6)
src/endroid/__init__.py (+1/-1)
src/endroid/plugins/version.py (+6/-7)
To merge this branch: bzr merge lp:~gingerchris/endroid/package-version
Reviewer Review Type Date Requested Status
Matthew Hall Approve
Review via email: mp+282621@code.launchpad.net

Commit message

1.4.8 release: Improvements to installation/release process and various bug fixes
  * Fix bug in DB update function
  * Improve exception logging
  * Add makedeb script to make it easier to build and install debs
  * Remove need for manual service restart when upgrading
  * Only list rooms that a user is allowed in
  * Fix various bugs in plugins
  * Fix up lintian errors/warnings

Description of the change

Collection of changes:

Make it easier to build a deb from the package:
 - Added a makedeb script - which optionally installs the package if 'install' specified
 - Added a gen_version.sh script that generates detailed version information (moved from src/endroid.sh)
   - remove generation of version code from setup.py (it wasn't effective and is superseded by makedeb)

Make updating the version number easier:
 - Make setup.py get its version from endroid.__version__ (so 1 fewer place to update)

Remove need to restart endroid when installed
 - Add a postinst script that restarts the service

Fix up deb lintian warnings/errors:
 - Increase debian/control Standards-Version
 - Remove the empty endroid.db file (and references to it) that was being installed to /var/lib/endroid/db/ - which is not the default location for the file (default is ~/.endroid/endroid.db)

Other changes
 - Improved information returned by the version plugin to capitalise on version number changes
 - Added respawn to the default init config
 - Typo

And finally; bump the version to 1.4.8.

To post a comment you must log in.
119. By Chris Davidson <email address hidden>

minor changes to makedeb

Revision history for this message
Matthew Hall (matt.hall) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2013-09-10 15:38:23 +0000
3+++ README 2016-01-14 16:24:13 +0000
4@@ -11,7 +11,7 @@
5 ** Endroid is an extensible XMPP bot, built with a plugin architecture
6 ** The endroid.sh script in the src directory may be used to start EnDroid easily, e.g. for testing
7
8-* Example confiuration
9+* Example configuration
10 ** You should register a Jabber ID for your EnDroid, e.g. at https://register.jabber.org/
11 ** Put config in ~/.endroid/endroid.conf see etc/endroid.conf for an example config file.
12
13
14=== modified file 'debian/changelog'
15--- debian/changelog 2016-01-04 14:09:46 +0000
16+++ debian/changelog 2016-01-14 16:24:13 +0000
17@@ -1,3 +1,15 @@
18+endroid (1.4.8) trusty; urgency=medium
19+
20+ * Fix bug in DB update function
21+ * Improve exception logging
22+ * Add makedeb script to make it easier to build and install debs
23+ * Remove need for manual service restart when upgrading
24+ * Only list rooms that a user is allowed in
25+ * Fix various bugs in plugins
26+ * Fix up lintian errors/warnings
27+
28+ -- Chris Davidson <chdavids@ensoft-sandbox.cisco.com> Thu, 14 Jan 2016 16:16:42 +0000
29+
30 endroid (1.4.7) trusty; urgency=low
31
32 * Enhance the ldapauth plugin to support LDAP directories that do not
33
34=== removed file 'debian/conffiles'
35--- debian/conffiles 2014-04-05 19:53:27 +0000
36+++ debian/conffiles 1970-01-01 00:00:00 +0000
37@@ -1,1 +0,0 @@
38-/var/lib/endroid/db/endroid.db
39
40=== modified file 'debian/control'
41--- debian/control 2014-08-11 09:02:24 +0000
42+++ debian/control 2016-01-14 16:24:13 +0000
43@@ -3,7 +3,7 @@
44 Section: misc
45 Priority: optional
46 Build-Depends: debhelper (>= 9),python,python-setuptools
47-Standards-Version: 3.9.3
48+Standards-Version: 3.9.5
49
50 Package: endroid
51 Architecture: all
52
53=== modified file 'debian/endroid.install'
54--- debian/endroid.install 2014-04-05 19:53:27 +0000
55+++ debian/endroid.install 2016-01-14 16:24:13 +0000
56@@ -5,7 +5,6 @@
57 bin/endroid_remote usr/bin/
58 bin/spelunk_hi5s usr/sbin/
59 lib/wokkel-0.7.1-py2.7.egg usr/lib/endroid/dependencies
60-var/endroid.db var/lib/endroid/db
61 doc/EnDroid.png usr/share/endroid/media/
62 resources/httpinterface/index.html usr/share/endroid/templates/httpinterface/
63 resources/httpinterface/notfound.html usr/share/endroid/templates/httpinterface/
64
65=== added file 'debian/postinst'
66--- debian/postinst 1970-01-01 00:00:00 +0000
67+++ debian/postinst 2016-01-14 16:24:13 +0000
68@@ -0,0 +1,11 @@
69+#! /bin/sh -e
70+
71+if which service >/dev/null 2>&1; then
72+ service endroid restart
73+elif which invoke-rc.d >/dev/null 2>&1; then
74+ invoke-rc.d endroid restart
75+else
76+ /etc/init.d/endroid restart
77+fi
78+
79+#DEBHELPER#
80
81=== modified file 'etc/init/endroid.conf'
82--- etc/init/endroid.conf 2014-10-14 10:17:13 +0000
83+++ etc/init/endroid.conf 2016-01-14 16:24:13 +0000
84@@ -5,3 +5,8 @@
85 start on net-device-up
86 stop on stopping network
87 stop on starting shutdown
88+
89+# Respawn if endroid exits
90+respawn
91+# Only respawn max 10 times in 5s period, otherwise fail
92+respawn limit 10 5
93
94=== added file 'gen_version.sh'
95--- gen_version.sh 1970-01-01 00:00:00 +0000
96+++ gen_version.sh 2016-01-14 16:24:13 +0000
97@@ -0,0 +1,10 @@
98+#!/bin/bash
99+
100+#
101+# This script generates version information for Endroid
102+#
103+
104+ENDROID_VERSION_INFO="src/endroid/version_info.py"
105+CURRENT_LOCATION="$( cd $( dirname "$0" ) && pwd )"
106+echo "Generating version info from ${CURRENT_LOCATION} at ${CURRENT_LOCATION}/${ENDROID_VERSION_INFO}"
107+cd ${CURRENT_LOCATION} && bzr version-info --python > ${ENDROID_VERSION_INFO} && cd -
108
109=== added file 'makedeb'
110--- makedeb 1970-01-01 00:00:00 +0000
111+++ makedeb 2016-01-14 16:24:13 +0000
112@@ -0,0 +1,52 @@
113+#!/bin/bash -e
114+
115+#
116+# This script uses Debhelper to build the endroid Debian package and
117+# optionally install it
118+#
119+
120+# Find the location of this script
121+CURRENT_LOCATION="$( cd $( dirname "$0" ) && pwd )"
122+
123+#
124+# Generate the version info
125+#
126+${CURRENT_LOCATION}/gen_version.sh
127+
128+#
129+# Work out what the resulting deb file will be called
130+# Why doesn't debuild just have an output argument!!!
131+#
132+ENDROID_VERSION=`dpkg-parsechangelog --show-field Version`
133+ENDROID_DEB_FILE="endroid_${ENDROID_VERSION}_all.deb"
134+ENDROID_DEB="../${ENDROID_DEB_FILE}"
135+
136+# Delete the file if it exists
137+stat ${ENDROID_DEB} || true
138+rm ${ENDROID_DEB} || true
139+
140+# Call debuild with the following options:
141+# -uc -us : Don't attempt to sign anything
142+# -tc : Clean the source tree after building
143+# -I : Exclude undesired files/dirs from the package (e.g. CVS control
144+# files, backup files)
145+#
146+# During development it can be useful to run this command without the -tc
147+# option, allowing inspection of the build directory contents.
148+debuild -uc -us -tc -I
149+
150+#
151+# Now install the deb if that has been requested
152+#
153+if [[ $# -ge 1 && "$1" == "install" ]] ; then
154+ if [[ -e ${ENDROID_DEB} ]] ; then
155+ # Go ahead and install it
156+ echo "Installing ${ENDROID_DEB}"
157+ stat ${ENDROID_DEB}
158+ dpkg -i ${ENDROID_DEB}
159+ else
160+ echo "${ENDROID_DEB} doesn't appear to exist - aborting install"
161+ exit 2
162+ fi
163+fi
164+
165
166=== modified file 'setup.py'
167--- setup.py 2016-01-04 14:09:46 +0000
168+++ setup.py 2016-01-14 16:24:13 +0000
169@@ -3,36 +3,36 @@
170 # EnDroid setup file
171 #
172
173+import re
174
175 from distutils.core import setup
176
177
178-try:
179- # Generate the version_info module, used so that endroid
180- # knows what version it is at
181- import os
182- import bzrlib.branch
183- import bzrlib.version_info_formats.format_python
184- this_dir = os.path.dirname(os.path.realpath(__file__))
185- the_branch = bzrlib.branch.Branch.open(this_dir)
186- version_info = bzrlib.version_info_formats.format_python.PythonVersionInfoBuilder(the_branch)
187- version_info_file = os.path.join(this_dir, 'src', 'endroid', 'version_info.py')
188- with open(version_info_file, 'w') as f:
189- version_info.generate(f)
190-except (ImportError, OSError, Exception) as e:
191- print("Failed to get version info: {}".format(e))
192-
193-
194-setup(name='endroid',
195- version="1.4.7",
196- description='EnDroid: a modular XMPP bot',
197- url='http://open.ensoft.co.uk/EnDroid',
198- packages=[
199- 'endroid',
200- 'endroid.plugins',
201- 'endroid.plugins.compute',
202- 'endroid.plugins.sms',
203- ],
204- package_dir={'endroid': 'src/endroid'},
205- requires=['treq', 'wokkel', 'twisted']
206- )
207+# Get the version from the endroid package
208+ver_re = re.compile(r"\s*__version__\s*=\s*[\"'](?P<version>[^\"']+)")
209+version_file = 'src/endroid/__init__.py'
210+
211+version = None
212+with open(version_file, 'r') as f:
213+ for line in f.readlines():
214+ m = ver_re.match(line)
215+ if m:
216+ version = m.group('version')
217+ break
218+
219+if version is None:
220+ print("Failed to find version number from {}, aborting setup".format(version_file))
221+else:
222+ setup(name='endroid',
223+ version=version,
224+ description='EnDroid: a modular XMPP bot',
225+ url='http://open.ensoft.co.uk/EnDroid',
226+ packages=[
227+ 'endroid',
228+ 'endroid.plugins',
229+ 'endroid.plugins.compute',
230+ 'endroid.plugins.sms',
231+ ],
232+ package_dir={'endroid': 'src/endroid'},
233+ requires=['treq', 'wokkel', 'twisted']
234+ )
235
236=== modified file 'src/endroid.sh'
237--- src/endroid.sh 2014-09-17 00:07:09 +0000
238+++ src/endroid.sh 2016-01-14 16:24:13 +0000
239@@ -16,11 +16,7 @@
240 export PYTHONPATH="${ENDROID}/lib/wokkel-0.7.1-py2.7.egg":"${ENDROID}/src/":"${ENDROID_PLUGINS}":"${PYTHONPATH}"
241 echo "Setting PYTHONPATH=${PYTHONPATH}"
242 ENDROID_VERSION_INFO="${ENDROID}/src/endroid/version_info.py"
243-echo "Generating version info from ${ENDROID} at ${ENDROID_VERSION_INFO}"
244-cd ${ENDROID} && bzr version-info --python > ${ENDROID_VERSION_INFO}
245+# Generate the version information for debugging purposes
246+${ENDROID}/gen_version.sh
247 echo "Running endroid at ${ENDROID} with plugins at ${ENDROID_PLUGINS}"
248 python -m endroid "$@"
249-# Now cleanup the version info
250-echo "Cleaning up version info file (${ENDROID_VERSION_INFO})"
251-rm ${ENDROID_VERSION_INFO}
252-
253
254=== modified file 'src/endroid/__init__.py'
255--- src/endroid/__init__.py 2014-09-18 16:36:42 +0000
256+++ src/endroid/__init__.py 2016-01-14 16:24:13 +0000
257@@ -31,7 +31,7 @@
258 import endroid.manhole
259
260
261-__version__ = (1, 2)
262+__version__ = "1.4.8"
263
264 LOGGING_FORMAT = '%(asctime)-8s %(name)-20s %(levelname)-8s %(message)s'
265 LOGGING_DATE_FORMAT = '%Y-%m-%d %H:%M:%S'
266
267=== modified file 'src/endroid/plugins/version.py'
268--- src/endroid/plugins/version.py 2014-09-17 21:50:37 +0000
269+++ src/endroid/plugins/version.py 2016-01-14 16:24:13 +0000
270@@ -4,6 +4,7 @@
271 # Created by Chris Davidson
272 # -----------------------------------------
273
274+import endroid
275
276 from endroid.plugins.command import CommandPlugin, command
277
278@@ -24,11 +25,9 @@
279
280 @command()
281 def version(self, msg, args):
282- if self.version_info is None:
283- reply = ("I'm sorry I don't appear to know what version I'm "
284- "running.")
285- else:
286- reply = ("I'm currently running version {revno} commited on "
287- "{date} and built on {build_date} (rev "
288- "{revision_id})".format(**self.version_info))
289+ reply = "I'm running Endroid verson {}.".format(endroid.__version__)
290+ if self.version_info is not None:
291+ reply += (" More specifically revno {revno} commited on "
292+ "{date} and built on {build_date} (rev "
293+ "{revision_id})".format(**self.version_info))
294 msg.reply(reply)
295
296=== removed directory 'var'
297=== removed file 'var/endroid.db'

Subscribers

People subscribed via source and target branches