Speeding up login through cookies
[theonering] / support / builddeb.py
1 #!/usr/bin/python2.5
2
3 import os
4 import sys
5
6 try:
7         import py2deb
8 except ImportError:
9         import fake_py2deb as py2deb
10
11 import constants
12
13
14 __appname__ = constants.__app_name__
15 __description__ = """Send/receive texts and initiate GV callbacks all through Conversations and Phone
16 Features:
17 .
18 * Send Texts and Receive both Texts and Voicemail through your chat window (buggy on Maemo 4.1)
19 .
20 * Initiate Google Voice callbacks from the dialpad or your contacts
21 .
22 * Access to all of your Google Voice contacts (Maemo 4.1 only for now)
23 .
24 * Reduce battery drain by setting your status to "Away"
25 .
26 * Block incoming calls by switching your status to "Hidden"
27 .
28 Note: Google and Google Voice are probably trademarks of Google.  This software nor the author has any affiliation with Google
29 .
30 Homepage: http://theonering.garage.maemo.org
31 """
32 __author__ = "Ed Page"
33 __email__ = "eopage@byu.net"
34 __version__ = constants.__version__
35 __build__ = constants.__build__
36 __changelog__ = """
37 0.8.12
38 * Re-using handles to hopefully reduce potential funky issues
39 * Fixing a bug where the conversation cache was lost when switching networks, causing old messages to be displayed as new
40
41 0.8.11
42 * Various improvements to gathering debug information to assist with several outstanding issues
43
44 0.8.10
45 * More improvements to the logging
46
47 0.8.9
48 * For now removing "removing of old conversations" in case that is contributing to people's problems
49 * Attempting to use the messages actual time stamp rather than the time when we received it
50 * Adding a bit of paranoia to marking messages as read
51 * Added lots of debugging help
52
53 0.8.8
54 * Switching to a non-blocking system so TOR can remain responsive to MC and avoid being leaked in the first place
55
56 0.8.7
57 * Adding some logging to help track down some issues
58
59 0.8.6
60 * Switched to a 10 second timeout without connections before closing TOR
61 * Reduced the numbr of conversations cached
62 * Forcing system contacts to be enabled but only calls are working for now
63 * Bugfix: Reduced windows of hitting "Network Failure" when transitioning between networks
64
65 0.8.5
66 * Bugfix: User's locale differs from google's causes errors
67 * Bugfix: Reducing the times we ignore the cache of past conversations
68 * Bugfix: The One Ring does not work on desktop systems with Empathy 2.28
69
70 0.8.4
71 * Reduced time allowed for disconnect due to RTComm not putting TOR on hold, causing miss of callback
72 * Doubled the timed disconnects time
73 * Cleaning up things to better match the latest Empathy
74 * Bugfix: Random "General Error"s when making a call
75
76 0.8.3
77 * "Hold" support for calls, so that initiating a callback does not block incoming calls
78 * Increased the auto-cleanup timeout from 5 seconds to 10 seconds
79
80 0.8.2
81 * Improved debug logs, removing noise
82 * Reduced allotted disconnect time from 5 seconds to 2
83 * Auto-cleanup resources when client only does phase 1 of 2 connection creation phases
84 * Added 26x26 and 64x64 variants of icons to hopefully fix issues on Maemo 4.1
85
86 0.8.1
87 * Canceling of outbound calls
88 * Bugfix: Removing race condition with disconnect.  I introduced it expecting it to help but it hurts more than it helps
89
90 0.8.0
91 * Basic avatar support to distinguish phone types
92 * Tweaks to hopefully improve behavior
93
94 0.7.14
95 * Bugfix: Polling state machines weren't properly resetting (maybe thats why I had such good battery life)
96 * Bugfix: On Maemo 4.1 there are still some empty windows created
97 * Bugfix: Obscure alias bug no one should hit with The One Ring
98 * Bugfix: Another obscure bug causing possibly no negative side-effects
99
100 0.7.13
101 * Bugfix: Cancelling timeouts
102
103 0.7.12
104 * Bugfix: In 0.7.11 I messed up refreshing messages
105 * Bugfix: DND support has been broken for a while
106 * Bugfix: Auto-disconnect on Maemo 4.1 couldn't have worked for a while
107 * Bugfix: Handling missed calls had .. issues
108 * Bugfix: Issues when making a call introduced in 0.7.11
109 * Etc with the bug fixes (all too small to list)
110
111 0.7.11
112 * Bugfix: Attempting to improve the behavior of calls by reducing potential RTComm errors
113 * Bugfix: Issues with weird unexpected disconnect issues
114 * Bugfix: I guess I made a mistake in registering for system signals, whoops
115 * Bugfix: Following more closely the Telepathy spec by doing connects and disconnects asynchronously
116
117 0.7.10
118 * Increased the network timeout when connecting to GV
119 * Bugfix: On connection failure, the connection would be left around, preventing future connections
120
121 0.7.9
122 * Bugfix: Disconnect/Reconnect issues seem to be lessoned for me (What I previously thought was a bugfix turned out to cause several bugs.)
123
124 0.7.8
125 * Bugfix: Issues with checking for new conversations
126
127 0.7.7
128 * On change between available/away, start state_machine at max rather than min, reducing overhead
129 * Added a check for voicemails on missed/rejected calls (checks 3 times, 1 minute apart each)
130 * Adjusted default polling times to be more battery cautious for our n8x0 friends who can't change things right now
131 * Bugfix: Some of the derived polling settings had bugs
132 * Bugfix: Setting text polling to infinite would still have polling done if one sent a text
133
134 0.7.6
135 * On login, polling now starts at the max time rather than the min, reducing overhead
136 * Bugfix: Polling configuration wasn't actually hooked up to anything
137 * Debug Prompt: Made it so you can either reset one or all state machines (Rather than just all)
138
139 0.7.5
140 * Fixing a polling time bug introduced when making polling configurable
141
142 0.7.4
143 * Fixing a bug with deny-lists
144
145 0.7.3
146 * Fixing bug with being able to configure polling times
147
148 0.7.2
149 * Added a Deny list
150 * Added option to make GV Contacts optional
151 * Added a limit, where if a state machine period is longer than it, than we set the period to infinite
152 * Delayed when we say the connection is disconnected to hopefully help random issues
153 * Tweaked how The One Ring shows up in the addressbook (Maemo 5)
154 * Made polling configurable
155 * Delayed auto-disconnect in case the user is just switching network connections (Maemo 4.1)
156 * Bugfix: Removed superfluous blank message from debug prompt
157 * Bugfix: Moved some more (very minor, very rarely used) timeouts to second resolution reducing overhead
158 * Bugfix: debug prompt commands handled command validation poorly
159 * Debug Prompt: Added a "version" command
160 * Debug Prompt: Added a "get_polling" command to find out what the actual polling periods are
161 * Debug Prompt: Added a "grab_log" command which is a broken but means to offer the log file through a file transfer
162 * Debug Prompt: Added a "save_log" command to help till grab_log works and for where file transfers aren't supported by clients
163
164 0.7.1
165 * Reducing the race window where GV will mark messages as read accidently
166 * Modified some things blindly "because thats what Butterfly does"
167 * Modified some support files to mimic other plugins on Maemo 5 PR1.1
168 * Added link to bug tracker and moved all bugs and enhancements to it
169 * Switched contacts to being away by default upon user feedback
170 * Adjusting handling of call states to at least allow the option of clients to provide clearer information to the user
171 * Fixing some bugs with handling a variety of phone number formats
172 * Removed a hack that changed the number being called, most likely put in place in a bygone era
173
174 0.7.0
175 * Initial beta release for Maemo 5
176 * Late Alpha for Maemo 4.1 with horrible consequences like crashing RTComm
177
178 0.1.0
179 * Pre-Alpha Development Release
180 """
181
182
183 __postinstall__ = """#!/bin/sh -e
184
185 gtk-update-icon-cache -f /usr/share/icons/hicolor
186 rm -f ~/.telepathy-theonering/theonering.log
187 """
188
189 def find_files(path):
190         for root, dirs, files in os.walk(path):
191                 for file in files:
192                         if file.startswith("src!"):
193                                 fileParts = file.split("!")
194                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
195                                 assert unused == "src"
196                                 relPath = os.sep.join(relPathParts)
197                                 yield relPath, file, newName
198
199
200 def unflatten_files(files):
201         d = {}
202         for relPath, oldName, newName in files:
203                 if relPath not in d:
204                         d[relPath] = []
205                 d[relPath].append((oldName, newName))
206         return d
207
208
209 def build_package(distribution):
210         try:
211                 os.chdir(os.path.dirname(sys.argv[0]))
212         except:
213                 pass
214
215         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
216         p = py2deb.Py2deb(__appname__)
217         if distribution == "debian":
218                 p.prettyName = constants.__pretty_app_name__
219         else:
220                 p.prettyName = "Google Voice plugin for Conversations and Calls"
221         p.description = __description__
222         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring"
223         #p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
224         p.author = __author__
225         p.mail = __email__
226         p.license = "lgpl"
227         p.section = {
228                 "debian": "comm",
229                 "diablo": "user/network",
230                 "fremantle": "user/network",
231         }[distribution]
232         p.depends = ", ".join([
233                 "python (>= 2.5) | python2.5",
234                 "python-dbus | python2.5-dbus",
235                 "python-gobject | python2.5-gobject",
236                 "python-telepathy | python2.5-telepathy",
237         ])
238         p.depends += {
239                 "debian": "",
240                 "diablo": ", python2.5-conic, account-plugin-haze",
241                 "fremantle": ", account-plugin-haze",
242         }[distribution]
243         p.arch = "all"
244         p.urgency = "low"
245         p.distribution = "diablo fremantle debian"
246         p.repository = "extras"
247         p.changelog = __changelog__
248         p.postinstall = __postinstall__
249         p.icon = "32-tor_handset.png"
250         for relPath, files in unflatten_files(find_files(".")).iteritems():
251                 fullPath = "/usr/lib/theonering"
252                 if relPath:
253                         fullPath += os.sep+relPath
254                 p[fullPath] = list(
255                         "|".join((oldName, newName))
256                         for (oldName, newName) in files
257                 )
258         p["/usr/share/dbus-1/services"] = ["org.freedesktop.Telepathy.ConnectionManager.theonering.service"]
259         if distribution in ("debian", ):
260                 p["/usr/share/mission-control/profiles"] = ["theonering.profile.%s|theonering.profile"% distribution]
261         elif distribution in ("diablo", "fremantle"):
262                 p["/usr/share/osso-rtcom"] = ["theonering.profile.%s|theonering.profile"% distribution]
263         p["/usr/lib/telepathy"] = ["telepathy-theonering"]
264         p["/usr/share/telepathy/managers"] = ["theonering.manager"]
265         if distribution in ("debian", ):
266                 iconBasePath = "/usr/share/icons/gnome/%s/apps"
267         elif distribution in ("diablo", "fremantle"):
268                 iconBasePath = "/usr/share/icons/hicolor/%s/hildon"
269         p[iconBasePath % "26x26"] = ["26-tor_handset.png|im-theonering.png"]
270         p[iconBasePath % "32x32"] = ["32-tor_handset.png|im-theonering.png"]
271         p[iconBasePath % "64x64"] = ["64-tor_handset.png|im-theonering.png"]
272         p["/usr/share/theonering"] = [
273                 "32-tor_handset.png|tor_handset.png",
274                 "32-tor_phone.png|tor_phone.png",
275                 "32-tor_question.png|tor_question.png",
276                 "32-tor_self.png|tor_self.png",
277         ]
278
279         if distribution == "debian":
280                 print p
281                 print p.generate(
282                         version="%s-%s" % (__version__, __build__),
283                         changelog=__changelog__,
284                         build=True,
285                         tar=False,
286                         changes=False,
287                         dsc=False,
288                 )
289                 print "Building for %s finished" % distribution
290         else:
291                 print p
292                 print p.generate(
293                         version="%s-%s" % (__version__, __build__),
294                         changelog=__changelog__,
295                         build=False,
296                         tar=True,
297                         changes=True,
298                         dsc=True,
299                 )
300                 print "Building for %s finished" % distribution
301
302
303 if __name__ == "__main__":
304         if len(sys.argv) > 1:
305                 try:
306                         import optparse
307                 except ImportError:
308                         optparse = None
309
310                 if optparse is not None:
311                         parser = optparse.OptionParser()
312                         (commandOptions, commandArgs) = parser.parse_args()
313         else:
314                 commandArgs = None
315                 commandArgs = ["diablo"]
316         build_package(commandArgs[0])