004aeb321df39669e9165f507a961c5c4e4e3e66
[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.7.8
38 * Bugfix: Issues with checking for new conversations
39
40 0.7.7
41 * On change between available/away, start state_machine at max rather than min, reducing overhead
42 * Added a check for voicemails on missed/rejected calls (checks 3 times, 1 minute apart each)
43 * Adjusted default polling times to be more battery cautious for our n8x0 friends who can't change things right now
44 * Bugfix: Some of the derived polling settings had bugs
45 * Bugfix: Setting text polling to infinite would still have polling done if one sent a text
46
47 0.7.6
48 * On login, polling now starts at the max time rather than the min, reducing overhead
49 * Bugfix: Polling configuration wasn't actually hooked up to anything
50 * Debug Prompt: Made it so you can either reset one or all state machines (Rather than just all)
51
52 0.7.5
53 * Fixing a polling time bug introduced when making polling configurable
54
55 0.7.4
56 * Fixing a bug with deny-lists
57
58 0.7.3
59 * Fixing bug with being able to configure polling times
60
61 0.7.2
62 * Added a Deny list
63 * Added option to make GV Contacts optional
64 * Added a limit, where if a state machine period is longer than it, than we set the period to infinite
65 * Delayed when we say the connection is disconnected to hopefully help random issues
66 * Tweaked how The One Ring shows up in the addressbook (Maemo 5)
67 * Made polling configurable
68 * Delayed auto-disconnect in case the user is just switching network connections (Maemo 4.1)
69 * Bugfix: Removed superfluous blank message from debug prompt
70 * Bugfix: Moved some more (very minor, very rarely used) timeouts to second resolution reducing overhead
71 * Bugfix: debug prompt commands handled command validation poorly
72 * Debug Prompt: Added a "version" command
73 * Debug Prompt: Added a "get_polling" command to find out what the actual polling periods are
74 * Debug Prompt: Added a "grab_log" command which is a broken but means to offer the log file through a file transfer
75 * Debug Prompt: Added a "save_log" command to help till grab_log works and for where file transfers aren't supported by clients
76
77 0.7.1
78 * Reducing the race window where GV will mark messages as read accidently
79 * Modified some things blindly "because thats what Butterfly does"
80 * Modified some support files to mimic other plugins on Maemo 5 PR1.1
81 * Added link to bug tracker and moved all bugs and enhancements to it
82 * Switched contacts to being away by default upon user feedback
83 * Adjusting handling of call states to at least allow the option of clients to provide clearer information to the user
84 * Fixing some bugs with handling a variety of phone number formats
85 * Removed a hack that changed the number being called, most likely put in place in a bygone era
86
87 0.7.0
88 * Initial beta release for Maemo 5
89 * Late Alpha for Maemo 4.1 with horrible consequences like crashing RTComm
90
91 0.1.0
92 * Pre-Alpha Development Release
93 """
94
95
96 __postinstall__ = """#!/bin/sh -e
97
98 gtk-update-icon-cache -f /usr/share/icons/hicolor
99 rm -f ~/.telepathy-theonering/theonering.log
100 """
101
102 def find_files(path):
103         for root, dirs, files in os.walk(path):
104                 for file in files:
105                         if file.startswith("src!"):
106                                 fileParts = file.split("!")
107                                 unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
108                                 assert unused == "src"
109                                 relPath = os.sep.join(relPathParts)
110                                 yield relPath, file, newName
111
112
113 def unflatten_files(files):
114         d = {}
115         for relPath, oldName, newName in files:
116                 if relPath not in d:
117                         d[relPath] = []
118                 d[relPath].append((oldName, newName))
119         return d
120
121
122 def build_package(distribution):
123         try:
124                 os.chdir(os.path.dirname(sys.argv[0]))
125         except:
126                 pass
127
128         py2deb.Py2deb.SECTIONS = py2deb.SECTIONS_BY_POLICY[distribution]
129         p = py2deb.Py2deb(__appname__)
130         if distribution == "debian":
131                 p.prettyName = constants.__pretty_app_name__
132         else:
133                 p.prettyName = "Google Voice plugin for Conversations and Calls"
134         p.description = __description__
135         p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=The%%20One%%20Ring"
136         #p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
137         p.author = __author__
138         p.mail = __email__
139         p.license = "lgpl"
140         p.section = {
141                 "debian": "comm",
142                 "diablo": "user/network",
143                 "fremantle": "user/network",
144                 "mer": "user/network",
145         }[distribution]
146         p.depends = ", ".join([
147                 "python (>= 2.5) | python2.5",
148                 "python-dbus | python2.5-dbus",
149                 "python-gobject | python2.5-gobject",
150                 "python-telepathy | python2.5-telepathy",
151         ])
152         p.depends += {
153                 "debian": "",
154                 "diablo": ", python2.5-conic, account-plugin-haze",
155                 "fremantle": ", account-plugin-haze",
156                 "mer": "",
157         }[distribution]
158         p.arch = "all"
159         p.urgency = "low"
160         p.distribution = "diablo fremantle mer debian"
161         p.repository = "extras"
162         p.changelog = __changelog__
163         p.postinstall = __postinstall__
164         p.icon = {
165                 "debian": "26x26-theonering.png",
166                 "diablo": "26x26-theonering.png",
167                 "fremantle": "64x64-theonering.png", # Fremantle natively uses 48x48
168                 "mer": "64x64-theonering.png",
169         }[distribution]
170         for relPath, files in unflatten_files(find_files(".")).iteritems():
171                 fullPath = "/usr/lib/theonering"
172                 if relPath:
173                         fullPath += os.sep+relPath
174                 p[fullPath] = list(
175                         "|".join((oldName, newName))
176                         for (oldName, newName) in files
177                 )
178         p["/usr/share/dbus-1/services"] = ["org.freedesktop.Telepathy.ConnectionManager.theonering.service"]
179         if distribution in ("debian", ):
180                 p["/usr/share/mission-control/profiles"] = ["theonering.profile.%s|theonering.profile"% distribution]
181         elif distribution in ("diablo", "fremantle", "mer"):
182                 p["/usr/share/osso-rtcom"] = ["theonering.profile.%s|theonering.profile"% distribution]
183         p["/usr/lib/telepathy"] = ["telepathy-theonering"]
184         p["/usr/share/telepathy/managers"] = ["theonering.manager"]
185         p["/usr/share/icons/hicolor/26x26/hildon"] = ["26x26-theonering.png|im-theonering.png"]
186
187         if distribution == "debian":
188                 print p
189                 print p.generate(
190                         version="%s-%s" % (__version__, __build__),
191                         changelog=__changelog__,
192                         build=True,
193                         tar=False,
194                         changes=False,
195                         dsc=False,
196                 )
197                 print "Building for %s finished" % distribution
198         else:
199                 print p
200                 print p.generate(
201                         version="%s-%s" % (__version__, __build__),
202                         changelog=__changelog__,
203                         build=False,
204                         tar=True,
205                         changes=True,
206                         dsc=True,
207                 )
208                 print "Building for %s finished" % distribution
209
210
211 if __name__ == "__main__":
212         if len(sys.argv) > 1:
213                 try:
214                         import optparse
215                 except ImportError:
216                         optparse = None
217
218                 if optparse is not None:
219                         parser = optparse.OptionParser()
220                         (commandOptions, commandArgs) = parser.parse_args()
221         else:
222                 commandArgs = None
223                 commandArgs = ["diablo"]
224         build_package(commandArgs[0])