Merge lp:~mandel/ubuntuone-windows-installer/add_env_set_up into lp:ubuntuone-windows-installer/beta

Proposed by Manuel de la Peña
Status: Merged
Approved by: Rick McBride
Approved revision: 87
Merged at revision: 88
Proposed branch: lp:~mandel/ubuntuone-windows-installer/add_env_set_up
Merge into: lp:ubuntuone-windows-installer/beta
Prerequisite: lp:~mandel/ubuntuone-windows-installer/implement_sso_service_calls
Diff against target: 2185 lines (+1750/-25)
14 files modified
.bzrignore (+2/-2)
install/UbuntuOneXP.wxs (+844/-0)
main.build (+37/-16)
src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs (+41/-0)
src/Canonical.Ubuntu.SSO/Keyring.cs (+56/-1)
src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs (+46/-0)
src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs (+3/-0)
src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs (+0/-2)
src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml (+3/-3)
src/UbuntuOneClient.Tests/ProgramFixture.cs (+1/-0)
src/UbuntuOneClient/objects.xml (+40/-1)
utils/BaseDirectory.py (+173/-0)
utils/env_setup.bat (+236/-0)
utils/logger.py (+268/-0)
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/add_env_set_up
Reviewer Review Type Date Requested Status
Rick McBride (community) Approve
John Lenton (community) Approve
Review via email: mp+37005@code.launchpad.net

Description of the change

Fixes wix project for windows XP as well as provides an script that will allow to set up the devel environment.

To post a comment you must log in.
87. By Manuel de la Peña

Fixed issue when downloading easy_install, missing url.

Revision history for this message
John Lenton (chipaca) :
review: Approve
Revision history for this message
Rick McBride (rmcbride) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-09-30 09:36:24 +0000
+++ .bzrignore 2010-09-30 09:36:24 +0000
@@ -1,6 +1,6 @@
11
2install/UbuntuOne.wixobj2*.wixobj
3install/UbuntuOne.wixpdb3*.wixpdb
4install/build_results4install/build_results
5src/UbuntuOne.5.1.ReSharper.user5src/UbuntuOne.5.1.ReSharper.user
6src/UbuntuOne.sln.cache6src/UbuntuOne.sln.cache
77
=== renamed file 'install/UbuntuOne.wxs' => 'install/UbuntuOne7.wxs'
=== added file 'install/UbuntuOneXP.wxs'
--- install/UbuntuOneXP.wxs 1970-01-01 00:00:00 +0000
+++ install/UbuntuOneXP.wxs 2010-09-30 09:36:24 +0000
@@ -0,0 +1,844 @@
1<?xml version="1.0" encoding="windows-1252"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
3<!--
4This file contains the wix installer definition that will be used to install Ubuntu One
5on windows machines. The installer ensures that all the required dependencies that the
6application requires are present in the system allowing the user to forget about dependecies
7-->
8 <Product Name="Ubuntu One"
9 Id="13b7ee30-849c-11df-8395-0800200c9a66"
10 UpgradeCode="1f5dcd90-849c-11df-8395-0800200c9a66"
11 Language="1033"
12 Codepage="1252"
13 Version="1.0.0"
14 Manufacturer="Canonical Ltd.">
15
16 <Package Id="*"
17 Keywords="Installer"
18 Description="Ubuntu One is the personal cloud service that
19 simplifies your digital life. Imagine buying music and getting
20 it delivered to the computers of your choice. Or synchronizing your
21 files and notes and accessing them from anywhere.
22 Or consolidating your computer and mobile phone contacts and safely
23 sharing documents and pictures with them"
24 Comments="UbuntuOne is a registered trademark of Canonical Ltd."
25 Manufacturer="Canonical Ltd."
26 InstallerVersion="350"
27 Languages="1033"
28 Compressed="yes"
29 SummaryCodepage="1252" />
30
31 <Media Id="1"
32 Cabinet="UbuntuOne.cab"
33 EmbedCab="yes" />
34
35 <Property Id="UBUNTUONECLIENT_START_VIA_REGISTRY">1</Property>
36
37 <Directory Id="TARGETDIR"
38 Name="SourceDir">
39 <Directory Id="ProgramMenuFolder"
40 Name="Programs" />
41 <Directory Id="DesktopFolder"
42 Name="Desktop" />
43 <Directory Id="CommonAppDataFolder"
44 Name="CommonAppDataFolder">
45 <Directory Id="StoreageProtocol"
46 Name="ubuntuone-storageprotocol">
47 <Component Id="UbuntuOneGoDaddyCAComponent"
48 Guid="84f40170-b5a1-11df-8d81-0800200c9a66">
49 <File Id="UbuntuOne_Go_Daddy_CA"
50 Name="UbuntuOne-Go_Daddy_CA.pem"
51 DiskId="1"
52 Source="build_results\data\UbuntuOne-Go_Daddy_CA.pem"
53 KeyPath="yes"/>
54 </Component>
55 <Component Id="UbuntuOneGoDaddyClass2CAComponent"
56 Guid="89d14680-b5a1-11df-8d81-0800200c9a66">
57 <File Id="UbuntuOne_Go_Daddy_Class_2_CA"
58 Name="UbuntuOne-Go_Daddy_Class_2_CA.pem"
59 DiskId="1"
60 Source="build_results\data\UbuntuOne-Go_Daddy_Class_2_CA.pem"
61 KeyPath="yes"/>
62 </Component>
63 </Directory>
64 </Directory>
65 <Directory Id="ProgramFilesFolder"
66 Name="ProgramFilesFolder">
67 <Directory Id="Canonical"
68 Name="Canonical">
69 <Directory Id="U1Installdir"
70 Name="UbuntuOne">
71 <Directory Id="DaemonDir"
72 Name="Daemon">
73 <Component Id="DaemonCommonLibComponent"
74 Guid="a609b650-94b5-11df-981c-0800200c9a66">
75 <File Id="Canonical.UbuntuOne.Common.dll"
76 Name="Canonical.UbuntuOne.Common.dll"
77 DiskId="1"
78 Source="build_results\Daemon\Canonical.UbuntuOne.Common.dll"
79 KeyPath="yes"/>
80 </Component>
81 <Component Id="DaemonCommonPdbComponent"
82 Guid="c4ddb5e0-94b5-11df-981c-0800200c9a66">
83 <File Id="Canonical.UbuntuOne.Common.pdb"
84 Name="Canonical.UbuntuOne.Common.pdb"
85 DiskId="1"
86 Source="build_results\Daemon\Canonical.UbuntuOne.Common.pdb"
87 KeyPath="yes"/>
88 </Component>
89 <Component Id="DaemonProgramComponent"
90 Guid="f2d91a70-94b5-11df-981c-0800200c9a66">
91 <File Id="Canonical.UbuntuOne.ProcessDispatcher.exe"
92 Name="Canonical.UbuntuOne.ProcessDispatcher.exe"
93 DiskId="1"
94 Source="build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe"
95 KeyPath="yes"/>
96 <!-- Install, start and stop service using the msi -->
97 <ServiceInstall Id="ProcessDispatcher.exe"
98 Name="UbuntuOne"
99 DisplayName="Ubuntu One Sync Daemon"
100 Type="ownProcess"
101 Interactive="no"
102 Start="auto"
103 Vital="yes"
104 ErrorControl="ignore"
105 Description="Provides a central process that manages the Ubuntu One sync daemon." />
106 <ServiceControl Id="ProcessDispatcherControl"
107 Name="UbuntuOne"
108 Start="install"
109 Stop="uninstall"
110 Remove="uninstall"
111 Wait="yes" />
112 </Component>
113 <Component Id="DaemonProgramComponentConfig"
114 Guid="6ac2f100-94bb-11df-981c-0800200c9a66">
115 <File Id="Canonical.UbuntuOne.ProcessDispatcher.exe.config"
116 Name="Canonical.UbuntuOne.ProcessDispatcher.exe.config"
117 DiskId="1"
118 Source="build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.exe.config"
119 KeyPath="yes"/>
120 </Component>
121 <Component Id="DaemonProgramPdbComponent"
122 Guid="052b3280-94b6-11df-981c-0800200c9a66">
123 <File Id="Canonical.UbuntuOne.ProcessDispatcher.pdb"
124 Name="Canonical.UbuntuOne.ProcessDispatcher.pdb"
125 DiskId="1"
126 Source="build_results\Daemon\Canonical.UbuntuOne.ProcessDispatcher.pdb"
127 KeyPath="yes"/>
128 </Component>
129 <Component Id="CommonLoggingComponent"
130 Guid="24d7ded0-94b6-11df-981c-0800200c9a66">
131 <File Id="Common.Logging.dll"
132 Name="Common.Logging.dll"
133 DiskId="1"
134 Source="build_results\Daemon\Common.Logging.dll"
135 KeyPath="yes"/>
136 </Component>
137 <Component Id="CommonLoggingLog4NetComponent"
138 Guid="6ac0e8b0-967d-11df-981c-0800200c9a66">
139 <File Id="Common.Logging.Log4Net.dll"
140 Name="Common.Logging.Log4Net.dll"
141 DiskId="1"
142 Source="build_results\Daemon\Common.Logging.Log4Net.dll"
143 KeyPath="yes"/>
144 </Component>
145 <Component Id="DotUpdaterLib"
146 Guid="af217c90-967d-11df-981c-0800200c9a66">
147 <File Id="DotUpdater.dll"
148 Name="DotUpdater.dll"
149 DiskId="1"
150 Source="build_results\Daemon\DotUpdater.dll"
151 KeyPath="yes"/>
152 </Component>
153 <Component Id="Log4NetComponent"
154 Guid="0eafc310-94b7-11df-981c-0800200c9a66">
155 <File Id="log4net.dll"
156 Name="log4net.dll"
157 DiskId="1"
158 Source="build_results\Daemon\log4net.dll"
159 KeyPath="yes"/>
160 </Component>
161 <Component Id="SpringAopComponent"
162 Guid="5431cc80-94b7-11df-981c-0800200c9a66">
163 <File Id="Spring.Aop.dll"
164 Name="Spring.Aop.dll"
165 DiskId="1"
166 Source="build_results\Daemon\Spring.Aop.dll"
167 KeyPath="yes"/>
168 </Component>
169 <Component Id="SpringAopConfigComponent"
170 Guid="668e92f0-94b7-11df-981c-0800200c9a66">
171 <File Id="Spring.Aop.xml"
172 Name="Spring.Aop.xml"
173 DiskId="1"
174 Source="build_results\Daemon\Spring.Aop.xml"
175 KeyPath="yes"/>
176 </Component>
177 <Component Id="SpringCoreComponent"
178 Guid="7780a5d0-94b7-11df-981c-0800200c9a66">
179 <File Id="Spring.Core.dll"
180 Name="Spring.Core.dll"
181 DiskId="1"
182 Source="build_results\Daemon\Spring.Core.dll"
183 KeyPath="yes"/>
184 </Component>
185 <Component Id="SpringCoreConfigComponent"
186 Guid="8149fd00-94b7-11df-981c-0800200c9a66">
187 <File Id="Spring.Core.xml"
188 Name="Spring.Core.xml"
189 DiskId="1"
190 Source="build_results\Daemon\Spring.Core.xml"
191 KeyPath="yes"/>
192 </Component>
193 <Component Id="SpringServicesComponent"
194 Guid="fd27e7a0-98ce-11df-981c-0800200c9a66">
195 <File Id="Spring.Services.dll"
196 Name="Spring.Services.dll"
197 DiskId="1"
198 Source="build_results\Daemon\Spring.Services.dll"
199 KeyPath="yes"/>
200 </Component>
201 <Component Id="SpringServicesConfigComponent"
202 Guid="33b757b0-98cf-11df-981c-0800200c9a66">
203 <File Id="Spring.Services.xml"
204 Name="Spring.Services.xml"
205 DiskId="1"
206 Source="build_results\Daemon\Spring.Services.xml"
207 KeyPath="yes"/>
208 </Component>
209 <Component Id="SpringDataComponent"
210 Guid="e1736390-aac1-11df-94e2-0800200c9a66">
211 <File Id="Spring.Data.dll"
212 Name="Spring.Data.dll"
213 DiskId="1"
214 Source="build_results\Daemon\Spring.Data.dll"
215 KeyPath="yes"/>
216 </Component>
217 <Component Id="SymstemDataSQLiteComponent"
218 Guid="43573410-aac2-11df-94e2-0800200c9a66">
219 <File Id="System.Data.SQLite.DLL"
220 Name="System.Data.SQLite.DLL"
221 DiskId="1"
222 Source="build_results\Daemon\System.Data.SQLite.DLL"
223 KeyPath="yes"/>
224 </Component>
225 <Directory Id="DaemonConfigDir"
226 Name="Config">
227 <Component Id="DaemonConfigLog4Net"
228 Guid="306252c0-967e-11df-981c-0800200c9a66">
229 <File Id="log4net.config"
230 Name="log4net.config"
231 DiskId="1"
232 Source="build_results\Daemon\Config\log4net.config"
233 KeyPath="yes"/>
234 </Component>
235 <Component Id="ServiceModelBehavioursConfig"
236 Guid="5f9a6390-98cf-11df-981c-0800200c9a66">
237 <File Id="serviceModel.behaviours.config"
238 Name="serviceModel.behaviours.config"
239 DiskId="1"
240 Source="build_results\Daemon\Config\serviceModel.behaviours.config"
241 KeyPath="yes"/>
242 </Component>
243 <Component Id="ServiceModelBindingsConfig"
244 Guid="65aca630-98cf-11df-981c-0800200c9a66">
245 <File Id="serviceModel.bindings.config"
246 Name="serviceModel.bindings.config"
247 DiskId="1"
248 Source="build_results\Daemon\Config\serviceModel.bindings.config"
249 KeyPath="yes"/>
250 </Component>
251 <Component Id="ServiceModelServicesConfig"
252 Guid="6a7e5280-98cf-11df-981c-0800200c9a66">
253 <File Id="serviceModel.services.config"
254 Name="serviceModel.services.config"
255 DiskId="1"
256 Source="build_results\Daemon\Config\serviceModel.services.config"
257 KeyPath="yes"/>
258 </Component>
259 </Directory>
260 </Directory>
261 <Directory Id="ClientDir"
262 Name="Client">
263 <!-- Auto-start via Registry -->
264 <Component Id="UbuntuOneClietnAutostart"
265 Guid="e3b224c0-9fa4-11df-981c-0800200c9a66">
266 <RegistryValue Id="UbunntuOneClient.rst"
267 Root="HKCU"
268 Key="Software\Microsoft\Windows\CurrentVersion\Run"
269 Name="Ubuntu One Client"
270 Value="[ClientDir]UbuntuOneClient.exe"
271 Type="string"/>
272 <Condition>UBUNTUONECLIENT_START_VIA_REGISTRY</Condition>
273 </Component>
274 <Component Id="AvalonLib"
275 Guid="99106520-9f9b-11df-981c-0800200c9a66">
276 <File Id="AvalonLibrary.dll"
277 Name="AvalonLibrary.dll"
278 DiskId="1"
279 Source="build_results\Client\AvalonLibrary.dll"
280 KeyPath="yes"/>
281 </Component>
282 <Component Id="UbuntuSSO"
283 Guid="c3de3ad0-c8f8-11df-bd3b-0800200c9a66">
284 <File Id="Canonical.Ubuntu.SSO.dll"
285 Name="Canonical.Ubuntu.SSO.dll"
286 DiskId="1"
287 Source="build_results\Client\Canonical.Ubuntu.SSO.dll"
288 KeyPath="yes"/>
289 </Component>
290 <Component Id="UbuntuSSOViews"
291 Guid="f12d0bb0-c8f8-11df-bd3b-0800200c9a66">
292 <File Id="Canonical.Ubuntu.SSO.Views.dll"
293 Name="Canonical.Ubuntu.SSO.Views.dll"
294 DiskId="1"
295 Source="build_results\Client\Canonical.Ubuntu.SSO.Views.dll"
296 KeyPath="yes"/>
297 </Component>
298 <Component Id="Newtonsoft.Json"
299 Guid="1a3ad780-c8f9-11df-bd3b-0800200c9a66">
300 <File Id="Newtonsoft.Json.dll"
301 Name="Newtonsoft.Json.dll"
302 DiskId="1"
303 Source="build_results\Client\Newtonsoft.Json.dll"
304 KeyPath="yes"/>
305 </Component>
306 <Component Id="UbuntuOneClientLib"
307 Guid="98ceabc0-9f9c-11df-981c-0800200c9a66">
308 <File Id="Canonical.UbuntuOne.Client.dll"
309 Name="Canonical.UbuntuOne.Client.dll"
310 DiskId="1"
311 Source="build_results\Client\Canonical.UbuntuOne.Client.dll"
312 KeyPath="yes"/>
313 </Component>
314 <Component Id="UbuntuOneClientLibPdb"
315 Guid="af68a6b0-9f9c-11df-981c-0800200c9a66">
316 <File Id="Canonical.UbuntuOne.Client.pdb"
317 Name="Canonical.UbuntuOne.Client.pdb"
318 DiskId="1"
319 Source="build_results\Client\Canonical.UbuntuOne.Client.pdb"
320 KeyPath="yes"/>
321 </Component>
322 <Component Id="UbuntuOneClientViewsLib"
323 Guid="ae68f9e0-9fb0-11df-981c-0800200c9a66">
324 <File Id="Canonical.UbuntuOne.Client.Views.dll"
325 Name="Canonical.UbuntuOne.Client.Views.dll"
326 DiskId="1"
327 Source="build_results\Client\Canonical.UbuntuOne.Client.Views.dll"
328 KeyPath="yes"/>
329 </Component>
330 <Component Id="UbuntuOneClientViewsLibPdb"
331 Guid="b4d54360-9fb0-11df-981c-0800200c9a66">
332 <File Id="Canonical.UbuntuOne.Client.Views.pdb"
333 Name="Canonical.UbuntuOne.Client.Views.pdb"
334 DiskId="1"
335 Source="build_results\Client\Canonical.UbuntuOne.Client.Views.pdb"
336 KeyPath="yes"/>
337 </Component>
338 <Component Id="UbuntuOneCommonLib"
339 Guid="cadc1620-9f9c-11df-981c-0800200c9a66">
340 <File Id="Canonical.UbuntuOne.Common.dll_client"
341 Name="Canonical.UbuntuOne.Common.dll"
342 DiskId="1"
343 Source="build_results\Client\Canonical.UbuntuOne.Common.dll"
344 KeyPath="yes"/>
345 </Component>
346 <Component Id="UbuntuOneCommonLibPdb"
347 Guid="eca5af00-9f9c-11df-981c-0800200c9a66">
348 <File Id="Canonical.UbuntuOne.Common.pdb_client"
349 Name="Canonical.UbuntuOne.Common.pdb"
350 DiskId="1"
351 Source="build_results\Client\Canonical.UbuntuOne.Common.pdb"
352 KeyPath="yes"/>
353 </Component>
354 <Component Id="CommonLoggingComponentClient"
355 Guid="12de88e0-9f9d-11df-981c-0800200c9a66">
356 <File Id="Common.Logging.dll_client"
357 Name="Common.Logging.dll"
358 DiskId="1"
359 Source="build_results\Client\Common.Logging.dll"
360 KeyPath="yes"/>
361 </Component>
362 <Component Id="CommonLoggingLog4NetComponentClient"
363 Guid="1a06f670-9f9d-11df-981c-0800200c9a66">
364 <File Id="Common.Logging.Log4Net.dll_client"
365 Name="Common.Logging.Log4Net.dll"
366 DiskId="1"
367 Source="build_results\Client\Common.Logging.Log4Net.dll"
368 KeyPath="yes"/>
369 </Component>
370 <Component Id="DotUpdaterLibClient"
371 Guid="31a4a5c0-9f9d-11df-981c-0800200c9a66">
372 <File Id="DotUpdater.dll_client"
373 Name="DotUpdater.dll"
374 DiskId="1"
375 Source="build_results\Client\DotUpdater.dll"
376 KeyPath="yes"/>
377 </Component>
378 <Component Id="Log4NetComponentClient"
379 Guid="5d2630b0-9f9d-11df-981c-0800200c9a66">
380 <File Id="log4net.dll_client"
381 Name="log4net.dll"
382 DiskId="1"
383 Source="build_results\Client\log4net.dll"
384 KeyPath="yes"/>
385 </Component>
386 <Component Id="SpringAopComponentClient"
387 Guid="8fbaf380-9f9d-11df-981c-0800200c9a66">
388 <File Id="Spring.Aop.dll_client"
389 Name="Spring.Aop.dll"
390 DiskId="1"
391 Source="build_results\Client\Spring.Aop.dll"
392 KeyPath="yes"/>
393 </Component>
394 <Component Id="SpringAopConfigComponentClient"
395 Guid="94fffb10-9f9d-11df-981c-0800200c9a66">
396 <File Id="Spring.Aop.xml_client"
397 Name="Spring.Aop.xml"
398 DiskId="1"
399 Source="build_results\Client\Spring.Aop.xml"
400 KeyPath="yes"/>
401 </Component>
402 <Component Id="SpringCoreComponentClient"
403 Guid="9a6a16d0-9f9d-11df-981c-0800200c9a66">
404 <File Id="Spring.Core.dll_client"
405 Name="Spring.Core.dll"
406 DiskId="1"
407 Source="build_results\Client\Spring.Core.dll"
408 KeyPath="yes"/>
409 </Component>
410 <Component Id="SpringCoreConfigComponentClient"
411 Guid="9fa7cb60-9f9d-11df-981c-0800200c9a66">
412 <File Id="Spring.Core.xml_client"
413 Name="Spring.Core.xml"
414 DiskId="1"
415 Source="build_results\Client\Spring.Core.xml"
416 KeyPath="yes"/>
417 </Component>
418 <Component Id="UbuntuOneClient"
419 Guid="bb893ee0-9f9d-11df-981c-0800200c9a66">
420 <File Id="UbuntuOneClient.exe"
421 Name="UbuntuOneClient.exe"
422 DiskId="1"
423 Source="build_results\Client\UbuntuOneClient.exe"
424 KeyPath="yes"/>
425 </Component>
426 <Component Id="UbuntuOneClientConfig"
427 Guid="da9e3f10-9f9d-11df-981c-0800200c9a66">
428 <File Id="UbuntuOneClient.exe.config"
429 Name="UbuntuOneClient.exe.config"
430 DiskId="1"
431 Source="build_results\Client\UbuntuOneClient.exe.config"
432 KeyPath="yes"/>
433 </Component>
434 <Component Id="UbuntuOneClientPdb"
435 Guid="fad020f0-9f9d-11df-981c-0800200c9a66">
436 <File Id="UbuntuOneClient.pdb"
437 Name="UbuntuOneClient.pdb"
438 DiskId="1"
439 Source="build_results\Client\UbuntuOneClient.pdb"
440 KeyPath="yes"/>
441 </Component>
442 <Directory Id="ClientConfigDir"
443 Name="Config">
444 <Component Id="ClientConfigLog4Net"
445 Guid="40cf49a0-9f9e-11df-981c-0800200c9a66">
446 <File Id="log4net.config_client"
447 Name="log4net.config"
448 DiskId="1"
449 Source="build_results\Client\Config\log4net.config"
450 KeyPath="yes"/>
451 </Component>
452 </Directory>
453 <Directory Id="U1SyncExecutable"
454 Name="U1Sync">
455 <Component Id="CTypesComponent"
456 Guid="cc878310-b1ee-11df-94e2-0800200c9a66">
457 <File Id="_ctypes.pyd"
458 Name="_ctypes.pyd"
459 DiskId="1"
460 Source="build_results\u1sync\_ctypes.pyd"
461 KeyPath="yes"/>
462 </Component>
463 <Component Id="HLibComponent"
464 Guid="15848270-b1ef-11df-94e2-0800200c9a66">
465 <File Id="_hashlib.pyd"
466 Name="_hashlib.pyd"
467 DiskId="1"
468 Source="build_results\u1sync\_hashlib.pyd"
469 KeyPath="yes"/>
470 </Component>
471 <Component Id="SocketComponent"
472 Guid="37e5a060-b1ef-11df-94e2-0800200c9a66">
473 <File Id="_socket.pyd"
474 Name="_socket.pyd"
475 DiskId="1"
476 Source="build_results\u1sync\_socket.pyd"
477 KeyPath="yes"/>
478 </Component>
479 <Component Id="SSLComponent"
480 Guid="5df98d20-b1ef-11df-94e2-0800200c9a66">
481 <File Id="_ssl.pyd"
482 Name="_ssl.pyd"
483 DiskId="1"
484 Source="build_results\u1sync\_ssl.pyd"
485 KeyPath="yes"/>
486 </Component>
487 <Component Id="SysLoaderComponent"
488 Guid="85d149f0-b1ef-11df-94e2-0800200c9a66">
489 <File Id="_win32sysloader.pyd"
490 Name="_win32sysloader.pyd"
491 DiskId="1"
492 Source="build_results\u1sync\_win32sysloader.pyd"
493 KeyPath="yes"/>
494 </Component>
495 <Component Id="Bz2Component"
496 Guid="252ce1e0-b1f0-11df-94e2-0800200c9a66">
497 <File Id="bz2.pyd"
498 Name="bz2.pyd"
499 DiskId="1"
500 Source="build_results\u1sync\bz2.pyd"
501 KeyPath="yes"/>
502 </Component>
503 <Component Id="Libeay32Component"
504 Guid="252d08e9-b1f0-11df-94e2-0800200c9a66">
505 <File Id="LIBEAY32.dll"
506 Name="LIBEAY32.dll"
507 DiskId="1"
508 Source="build_results\u1sync\LIBEAY32.dll"
509 KeyPath="yes"/>
510 </Component>
511 <Component Id="LibraryComponent"
512 Guid="252d08ea-b1f0-11df-94e2-0800200c9a66">
513 <File Id="library.zip"
514 Name="library.zip"
515 DiskId="1"
516 Source="build_results\u1sync\library.zip"
517 KeyPath="yes"/>
518 </Component>
519 <Component Id="U1SyncMainComponent"
520 Guid="252d08eb-b1f0-11df-94e2-0800200c9a66">
521 <File Id="main.exe"
522 Name="main.exe"
523 DiskId="1"
524 Source="build_results\u1sync\main.exe"
525 KeyPath="yes"/>
526 </Component>
527 <Component Id="OpenSSLCryptoComponent"
528 Guid="bb15b4b1-b1f5-11df-94e2-0800200c9a66">
529 <File Id="OpenSSL.crypto.pyd"
530 Name="OpenSSL.crypto.pyd"
531 DiskId="1"
532 Source="build_results\u1sync\OpenSSL.crypto.pyd"
533 KeyPath="yes"/>
534 </Component>
535 <Component Id="OpenSSLRandComponent"
536 Guid="bb15b4b2-b1f5-11df-94e2-0800200c9a66">
537 <File Id="OpenSSL.rand.pyd"
538 Name="OpenSSL.rand.pyd"
539 DiskId="1"
540 Source="build_results\u1sync\OpenSSL.rand.pyd"
541 KeyPath="yes"/>
542 </Component>
543 <Component Id="OpenSSLSSLComponent"
544 Guid="bb15b4b3-b1f5-11df-94e2-0800200c9a66">
545 <File Id="OpenSSL.SSL.pyd"
546 Name="OpenSSL.SSL.pyd"
547 DiskId="1"
548 Source="build_results\u1sync\OpenSSL.SSL.pyd"
549 KeyPath="yes"/>
550 </Component>
551 <Component Id="PoyexpactComponent"
552 Guid="bb15b4b5-b1f5-11df-94e2-0800200c9a66">
553 <File Id="pyexpat.pyd"
554 Name="pyexpat.pyd"
555 DiskId="1"
556 Source="build_results\u1sync\pyexpat.pyd"
557 KeyPath="yes"/>
558 </Component>
559 <Component Id="Python26Component"
560 Guid="bb15dbc0-b1f5-11df-94e2-0800200c9a66">
561 <File Id="python26.dll"
562 Name="python26.dll"
563 DiskId="1"
564 Source="build_results\u1sync\python26.dll"
565 KeyPath="yes"/>
566 </Component>
567 <Component Id="PythonCom26Component"
568 Guid="bb15dbc1-b1f5-11df-94e2-0800200c9a66">
569 <File Id="pythoncom26.dll"
570 Name="pythoncom26.dll"
571 DiskId="1"
572 Source="build_results\u1sync\pythoncom26.dll"
573 KeyPath="yes"/>
574 </Component>
575 <Component Id="PyWinTypeComponent"
576 Guid="bb15dbc2-b1f5-11df-94e2-0800200c9a66">
577 <File Id="pywintypes26.dll"
578 Name="pywintypes26.dll"
579 DiskId="1"
580 Source="build_results\u1sync\pywintypes26.dll"
581 KeyPath="yes"/>
582 </Component>
583 <Component Id="SelectComponent"
584 Guid="bb15dbc3-b1f5-11df-94e2-0800200c9a66">
585 <File Id="select.pyd"
586 Name="select.pyd"
587 DiskId="1"
588 Source="build_results\u1sync\select.pyd"
589 KeyPath="yes"/>
590 </Component>
591 <Component Id="Ssleay32Component"
592 Guid="bb15dbc4-b1f5-11df-94e2-0800200c9a66">
593 <File Id="SSLEAY32.dll"
594 Name="SSLEAY32.dll"
595 DiskId="1"
596 Source="build_results\u1sync\SSLEAY32.dll"
597 KeyPath="yes"/>
598 </Component>
599 <Component Id="TwistedComponent"
600 Guid="bb15dbc5-b1f5-11df-94e2-0800200c9a66">
601 <File Id="twisted.python._initgroups.pyd"
602 Name="twisted.python._initgroups.pyd"
603 DiskId="1"
604 Source="build_results\u1sync\twisted.python._initgroups.pyd"
605 KeyPath="yes"/>
606 </Component>
607 <Component Id="UnicodeDataComponent"
608 Guid="bb15dbc6-b1f5-11df-94e2-0800200c9a66">
609 <File Id="unicodedata.pyd"
610 Name="unicodedata.pyd"
611 DiskId="1"
612 Source="build_results\u1sync\unicodedata.pyd"
613 KeyPath="yes"/>
614 </Component>
615 <Component Id="W9xpopenComponent"
616 Guid="bb15dbc7-b1f5-11df-94e2-0800200c9a66">
617 <File Id="w9xpopen.exe"
618 Name="w9xpopen.exe"
619 DiskId="1"
620 Source="build_results\u1sync\w9xpopen.exe"
621 KeyPath="yes"/>
622 </Component>
623 <Component Id="Win32ApiComponent"
624 Guid="bb15dbc8-b1f5-11df-94e2-0800200c9a66">
625 <File Id="win32api.pyd"
626 Name="win32api.pyd"
627 DiskId="1"
628 Source="build_results\u1sync\win32api.pyd"
629 KeyPath="yes"/>
630 </Component>
631 <Component Id="Win32EventComponent"
632 Guid="bb15dbca-b1f5-11df-94e2-0800200c9a66">
633 <File Id="win32event.pyd"
634 Name="win32event.pyd"
635 DiskId="1"
636 Source="build_results\u1sync\win32event.pyd"
637 KeyPath="yes"/>
638 </Component>
639 <Component Id="Win32EventLogComponent"
640 Guid="bb15dbcb-b1f5-11df-94e2-0800200c9a66">
641 <File Id="win32evtlog.pyd"
642 Name="win32evtlog.pyd"
643 DiskId="1"
644 Source="build_results\u1sync\win32evtlog.pyd"
645 KeyPath="yes"/>
646 </Component>
647 <Component Id="Win32FileComponent"
648 Guid="bb15dbcc-b1f5-11df-94e2-0800200c9a66">
649 <File Id="win32file.pyd"
650 Name="win32file.pyd"
651 DiskId="1"
652 Source="build_results\u1sync\win32file.pyd"
653 KeyPath="yes"/>
654 </Component>
655 <Component Id="Win32PipeComponent"
656 Guid="bb15dbcd-b1f5-11df-94e2-0800200c9a66">
657 <File Id="win32pipe.pyd"
658 Name="win32pipe.pyd"
659 DiskId="1"
660 Source="build_results\u1sync\win32pipe.pyd"
661 KeyPath="yes"/>
662 </Component>
663 <Component Id="Win32ProcessComponent"
664 Guid="bb15dbce-b1f5-11df-94e2-0800200c9a66">
665 <File Id="win32process.pyd"
666 Name="win32process.pyd"
667 DiskId="1"
668 Source="build_results\u1sync\win32process.pyd"
669 KeyPath="yes"/>
670 </Component>
671 <Component Id="Win32SecurityComponent"
672 Guid="bb15dbcf-b1f5-11df-94e2-0800200c9a66">
673 <File Id="win32security.pyd"
674 Name="win32security.pyd"
675 DiskId="1"
676 Source="build_results\u1sync\win32security.pyd"
677 KeyPath="yes"/>
678 </Component>
679 <Component Id="Win32UIComponent"
680 Guid="bb15dbd0-b1f5-11df-94e2-0800200c9a66">
681 <File Id="win32ui.pyd"
682 Name="win32ui.pyd"
683 DiskId="1"
684 Source="build_results\u1sync\win32ui.pyd"
685 KeyPath="yes"/>
686 </Component>
687 <Component Id="Win32WnetComponent"
688 Guid="bb15dbd1-b1f5-11df-94e2-0800200c9a66">
689 <File Id="win32wnet.pyd"
690 Name="win32wnet.pyd"
691 DiskId="1"
692 Source="build_results\u1sync\win32wnet.pyd"
693 KeyPath="yes"/>
694 </Component>
695 <Component Id="ZopeInterfaceComponent"
696 Guid="bb15dbd3-b1f5-11df-94e2-0800200c9a66">
697 <File Id="zope.interface._zope_interface_coptimizations.pyd"
698 Name="zope.interface._zope_interface_coptimizations.pyd"
699 DiskId="1"
700 Source="build_results\u1sync\zope.interface._zope_interface_coptimizations.pyd"
701 KeyPath="yes"/>
702 </Component>
703 </Directory>
704 </Directory>
705 </Directory>
706 </Directory>
707 </Directory>
708 </Directory>
709
710 <!-- Provide the different features to be installed -->
711 <Feature Id="UbuntuOneCore"
712 Level="1"
713 Title="Ubuntu One"
714 Description="Ubuntu One is the personal cloud service that simplifies your digital life.">
715 <!-- common data -->
716 <ComponentRef Id="UbuntuOneGoDaddyCAComponent" />
717 <ComponentRef Id="UbuntuOneGoDaddyClass2CAComponent" />
718 <!-- Daemon components -->
719 <ComponentRef Id="DaemonCommonLibComponent" />
720 <ComponentRef Id="DaemonCommonPdbComponent" />
721 <ComponentRef Id="CommonLoggingComponent" />
722 <ComponentRef Id="CommonLoggingLog4NetComponent" />
723 <ComponentRef Id="DotUpdaterLib" />
724 <ComponentRef Id="Log4NetComponent" />
725 <ComponentRef Id="SpringAopComponent" />
726 <ComponentRef Id="SpringAopConfigComponent" />
727 <ComponentRef Id="SpringCoreComponent" />
728 <ComponentRef Id="SpringCoreConfigComponent" />
729 <ComponentRef Id="SpringServicesComponent" />
730 <ComponentRef Id="SpringServicesConfigComponent" />
731 <ComponentRef Id="DaemonProgramComponent" />
732 <ComponentRef Id="DaemonProgramComponentConfig" />
733 <ComponentRef Id="DaemonProgramPdbComponent" />
734 <ComponentRef Id="DaemonConfigLog4Net" />
735 <ComponentRef Id="ServiceModelBehavioursConfig" />
736 <ComponentRef Id="ServiceModelBindingsConfig" />
737 <ComponentRef Id="ServiceModelServicesConfig" />
738 <ComponentRef Id="SpringDataComponent" />
739 <ComponentRef Id="SymstemDataSQLiteComponent" />
740 <!-- Client components -->
741 <ComponentRef Id="AvalonLib" />
742 <ComponentRef Id="UbuntuOneClientLib" />
743 <ComponentRef Id="UbuntuOneClientLibPdb" />
744 <ComponentRef Id="UbuntuOneClientViewsLib" />
745 <ComponentRef Id="UbuntuOneClientViewsLibPdb" />
746 <ComponentRef Id="UbuntuOneCommonLib" />
747 <ComponentRef Id="UbuntuOneCommonLibPdb" />
748 <ComponentRef Id="CommonLoggingComponentClient" />
749 <ComponentRef Id="CommonLoggingLog4NetComponentClient" />
750 <ComponentRef Id="DotUpdaterLibClient" />
751 <ComponentRef Id="Log4NetComponentClient" />
752 <ComponentRef Id="SpringAopComponentClient" />
753 <ComponentRef Id="SpringAopConfigComponentClient" />
754 <ComponentRef Id="SpringCoreComponentClient" />
755 <ComponentRef Id="SpringCoreConfigComponentClient" />
756 <ComponentRef Id="UbuntuOneClient" />
757 <ComponentRef Id="UbuntuOneClientConfig" />
758 <ComponentRef Id="UbuntuOneClientPdb" />
759 <ComponentRef Id="ClientConfigLog4Net" />
760 <!-- Client auto start -->
761 <ComponentRef Id="UbuntuOneClietnAutostart" />
762 <!-- U1Sync pacakge -->
763 <ComponentRef Id="CTypesComponent" />
764 <ComponentRef Id="HLibComponent" />
765 <ComponentRef Id="SocketComponent" />
766 <ComponentRef Id="SSLComponent" />
767 <ComponentRef Id="SysLoaderComponent" />
768 <ComponentRef Id="Bz2Component" />
769 <ComponentRef Id="Libeay32Component" />
770 <ComponentRef Id="LibraryComponent" />
771 <ComponentRef Id="U1SyncMainComponent" />
772 <ComponentRef Id="OpenSSLCryptoComponent" />
773 <ComponentRef Id="OpenSSLRandComponent" />
774 <ComponentRef Id="OpenSSLSSLComponent" />
775 <ComponentRef Id="PoyexpactComponent" />
776 <ComponentRef Id="Python26Component" />
777 <ComponentRef Id="PythonCom26Component" />
778 <ComponentRef Id="PyWinTypeComponent" />
779 <ComponentRef Id="SelectComponent" />
780 <ComponentRef Id="Ssleay32Component" />
781 <ComponentRef Id="TwistedComponent" />
782 <ComponentRef Id="UnicodeDataComponent" />
783 <ComponentRef Id="W9xpopenComponent" />
784 <ComponentRef Id="Win32ApiComponent" />
785 <ComponentRef Id="Win32EventComponent" />
786 <ComponentRef Id="Win32EventLogComponent" />
787 <ComponentRef Id="Win32FileComponent" />
788 <ComponentRef Id="Win32PipeComponent" />
789 <ComponentRef Id="Win32ProcessComponent" />
790 <ComponentRef Id="Win32SecurityComponent" />
791 <ComponentRef Id="Win32UIComponent" />
792 <ComponentRef Id="Win32WnetComponent" />
793 <ComponentRef Id="ZopeInterfaceComponent" />
794 <ComponentRef Id="UbuntuSSO" />
795 <ComponentRef Id="UbuntuSSOViews" />
796 <ComponentRef Id="Newtonsoft.Json" />
797 </Feature>
798
799 <UI Id="WixUI_Minimal_No_License">
800 <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
801 <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
802 <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
803
804 <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
805 <Property Id="WixUI_Mode" Value="Minimal" />
806
807 <DialogRef Id="ErrorDlg" />
808 <DialogRef Id="FatalError" />
809 <DialogRef Id="FilesInUse" />
810 <DialogRef Id="MsiRMFilesInUse" />
811 <DialogRef Id="PrepareDlg" />
812 <DialogRef Id="ProgressDlg" />
813 <DialogRef Id="ResumeDlg" />
814 <DialogRef Id="UserExit" />
815 <DialogRef Id="WelcomeDlg" />
816
817 <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
818
819 <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
820
821 <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="PrepareDlg">1</Publish>
822
823 <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
824 <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
825 <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
826
827 <Property Id="ARPNOMODIFY" Value="1" />
828 </UI>
829
830 <UIRef Id="WixUI_Common" />
831 <UIRef Id="WixUI_Minimal_No_License"/>
832 <UIRef Id="WixUI_ErrorProgressText" />
833
834 <!-- UI settings, to be defined by the design team -->
835
836 <!-- <WixVariable Id="WixUIBannerBmp" Value="path\banner.bmp" />
837 <WixVariable Id="WixUIDialogBmp" Value="path\dialog.bmp" />
838 <WixVariable Id="WixUIExclamationIco" Value="path\exclamation.ico" />
839 <WixVariable Id="WixUIInfoIco" Value="path\information.ico" />
840 <WixVariable Id="WixUINewIco" Value="path\new.ico" />
841 <WixVariable Id="WixUIUpIco" Value="path\up.ico" /> -->
842
843 </Product>
844</Wix>
0\ No newline at end of file845\ No newline at end of file
1846
=== modified file 'main.build'
--- main.build 2010-09-30 09:36:24 +0000
+++ main.build 2010-09-30 09:36:24 +0000
@@ -16,7 +16,9 @@
16 <property name="python_path" value="C:\Python26" />16 <property name="python_path" value="C:\Python26" />
17 <!-- property that allows to pass the location to be used to update the package. -->17 <!-- property that allows to pass the location to be used to update the package. -->
18 <property name="upload_path" value="http://s3.amazonaws.com/u1wintest/" />18 <property name="upload_path" value="http://s3.amazonaws.com/u1wintest/" />
19 19 <!-- get the os in which we are building -->
20 <property name="os" value="${operating-system::to-string(environment::get-operating-system())}" />
21
20 <target name="clean" 22 <target name="clean"
21 description="Removes all the different results of the last comilation if they exist">23 description="Removes all the different results of the last comilation if they exist">
22 <!-- delete all the different results from the previous build -->24 <!-- delete all the different results from the previous build -->
@@ -282,21 +284,40 @@
282 </fileset>284 </fileset>
283 </copy>285 </copy>
284 286
285 <!-- wix compiler -->287 <if test="${string::contains(os, 'Microsoft Windows NT 6.1')}">
286 <exec basedir="tools/Wix/bin"288 <echo message="Building installer on Windows 7" />
287 managed="true"289 <!-- wix compiler -->
288 workingdir="install"290 <exec basedir="tools/Wix/bin"
289 program="candle.exe"291 managed="true"
290 commandline="-ext WixUIExtension -ext WixUtilExtension UbuntuOne.wxs"/>292 workingdir="install"
291 293 program="candle.exe"
292 <!-- wix linker -->294 commandline="-ext WixUIExtension -ext WixUtilExtension UbuntuOne7.wxs"/>
293 <exec basedir="tools/Wix/bin"295
294 managed="true"296 <!-- wix linker -->
295 workingdir="install"297 <exec basedir="tools/Wix/bin"
296 program="light.exe"298 managed="true"
297 commandline="-out UbuntuOne.msi -ext WixUIExtension -ext WixUtilExtension UbuntuOne.wixobj"/>299 workingdir="install"
298 300 program="light.exe"
299 301 commandline="-out UbuntuOne.msi -ext WixUIExtension -ext WixUtilExtension UbuntuOne7.wixobj"/>
302 </if>
303
304 <if test="${string::contains(os, 'Microsoft Windows NT 5.1')}">
305 <echo message="Building installer on Windows XP" />
306 <!-- wix compiler -->
307 <exec basedir="tools/Wix/bin"
308 managed="true"
309 workingdir="install"
310 program="candle.exe"
311 commandline="-ext WixUIExtension -ext WixUtilExtension UbuntuOneXP.wxs"/>
312
313 <!-- wix linker -->
314 <exec basedir="tools/Wix/bin"
315 managed="true"
316 workingdir="install"
317 program="light.exe"
318 commandline="-out UbuntuOne.msi -ext WixUIExtension -ext WixUtilExtension UbuntuOneXP.wixobj"/>
319 </if>
320
300 </target>321 </target>
301 322
302 <target name="bootstrapper"323 <target name="bootstrapper"
303324
=== modified file 'src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs'
--- src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs 2010-09-30 09:36:24 +0000
+++ src/Canonical.Ubuntu.SSO/DPAPIDataProtector.cs 2010-09-30 09:36:24 +0000
@@ -20,6 +20,7 @@
2020
21using System.Security.Cryptography;21using System.Security.Cryptography;
22using System.Text;22using System.Text;
23using log4net;
2324
24namespace Canonical.Ubuntu.SSO25namespace Canonical.Ubuntu.SSO
25{26{
@@ -28,6 +29,40 @@
28 /// </summary>29 /// </summary>
29 public class DPAPIDataProtector : IDataProtector30 public class DPAPIDataProtector : IDataProtector
30 {31 {
32 #region Variables
33
34 private ILog _logger;
35 private readonly object _loggerLock = new object();
36
37 #endregion
38
39 #region DI properties
40
41 /// <summary>
42 /// Gets and sets the logger that will be used to log the operation of the
43 /// class.
44 /// </summary>
45 public ILog Logger
46 {
47 get
48 {
49 if (_logger == null)
50 {
51 lock (_loggerLock)
52 {
53 _logger = LogManager.GetLogger(typeof(Keyring));
54 }
55 }
56 return _logger;
57 }
58 set
59 {
60 _logger = value;
61 }
62 }
63
64 #endregion
65
31 #region Implementation of IDataProtector66 #region Implementation of IDataProtector
3267
33 /// <summary>68 /// <summary>
@@ -39,6 +74,8 @@
39 /// <returns>A string representing the encrypted data.</returns>74 /// <returns>A string representing the encrypted data.</returns>
40 public byte[] Protect(string userData, byte[] optionalEntropy, DataProtectionScope scope)75 public byte[] Protect(string userData, byte[] optionalEntropy, DataProtectionScope scope)
41 {76 {
77 // we do not use [DebugLogged] because it will compromise the security of the secrets in the logs
78 Logger.DebugFormat("> ProtectData(\"****\", {0}, {1})", optionalEntropy, scope);
42 if(userData != null)79 if(userData != null)
43 {80 {
44 var userDataBytes = Encoding.UTF8.GetBytes(userData);81 var userDataBytes = Encoding.UTF8.GetBytes(userData);
@@ -46,6 +83,7 @@
4683
47 return encryptedBytes;84 return encryptedBytes;
48 }85 }
86 Logger.Info("User data is NULL");
49 return null;87 return null;
50 }88 }
5189
@@ -58,11 +96,14 @@
58 /// <returns>A string representing the unprotected data.</returns>96 /// <returns>A string representing the unprotected data.</returns>
59 public string Unprotect(byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)97 public string Unprotect(byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)
60 {98 {
99 // we do not use [DebugLogged] because it will compromise the security of the secrets in the logs
100 Logger.DebugFormat("> Unprotect({0}, {1}, {2})", encryptedData, optionalEntropy, scope);
61 if (encryptedData != null)101 if (encryptedData != null)
62 {102 {
63 var userDataBytes = ProtectedData.Unprotect(encryptedData, optionalEntropy, scope);103 var userDataBytes = ProtectedData.Unprotect(encryptedData, optionalEntropy, scope);
64 return Encoding.UTF8.GetString(userDataBytes);104 return Encoding.UTF8.GetString(userDataBytes);
65 }105 }
106 Logger.Info("Encrypted data is NULL");
66 return null;107 return null;
67 }108 }
68109
69110
=== modified file 'src/Canonical.Ubuntu.SSO/Keyring.cs'
--- src/Canonical.Ubuntu.SSO/Keyring.cs 2010-09-30 09:36:24 +0000
+++ src/Canonical.Ubuntu.SSO/Keyring.cs 2010-09-30 09:36:24 +0000
@@ -21,6 +21,7 @@
21using System.Linq;21using System.Linq;
22using System.Security.Cryptography;22using System.Security.Cryptography;
23using System.Text;23using System.Text;
24using Canonical.UbuntuOne.Common.Aop;
24using Canonical.UbuntuOne.Common.Validation;25using Canonical.UbuntuOne.Common.Validation;
25using log4net;26using log4net;
26using Microsoft.Win32;27using Microsoft.Win32;
@@ -39,7 +40,7 @@
39 private const int KeyringMaxNameLength = 255;40 private const int KeyringMaxNameLength = 255;
40 private ILog _logger;41 private ILog _logger;
41 private readonly object _loggerLock = new object();42 private readonly object _loggerLock = new object();
42 private bool _keyringsRootExists = false;43 private bool _keyringsRootExists;
4344
44 #endregion45 #endregion
4546
@@ -108,6 +109,12 @@
108109
109 #region Helpers110 #region Helpers
110111
112 /// <summary>
113 /// Determines if the root used to store the keyrings does exist in the current user
114 /// registry key.
115 /// </summary>
116 /// <returns>A boolean flag that states if the root of the keyrings exists.</returns>
117 [DebugLogged]
111 private bool KeyringsRootExists()118 private bool KeyringsRootExists()
112 {119 {
113 if (!_keyringsRootExists)120 if (!_keyringsRootExists)
@@ -133,6 +140,12 @@
133 return _keyringsRootExists;140 return _keyringsRootExists;
134 }141 }
135142
143 /// <summary>
144 /// States if a keyring with the given name exists in the ssytem.
145 /// </summary>
146 /// <param name="keyring">The name of the keyring we are looking for.</param>
147 /// <returns>A flag stating if the keyring does exist.</returns>
148 [DebugLogged]
136 private bool KeyringExist(string keyring)149 private bool KeyringExist(string keyring)
137 {150 {
138 // open the root keyring and then the subkeyring to ensure that the151 // open the root keyring and then the subkeyring to ensure that the
@@ -149,12 +162,22 @@
149 }162 }
150 }163 }
151164
165 /// <summary>
166 /// Creates the root path used by the keyrings.
167 /// </summary>
168 /// <returns>The registry key that represents the root path of the keyrings.</returns>
169 [DebugLogged]
152 private IRegistryKey CreateKeyringRootPath()170 private IRegistryKey CreateKeyringRootPath()
153 {171 {
154 // create a key with the root path to be used172 // create a key with the root path to be used
155 return UserRegistry.CreateSubKey(RootPath);173 return UserRegistry.CreateSubKey(RootPath);
156 }174 }
157175
176 /// <summary>
177 /// Creates a keyring with the given name.
178 /// </summary>
179 /// <param name="keyring">The registry key that is used to store the data in the keyring.</param>
180 [DebugLogged]
158 private void CreateKeyring(string keyring)181 private void CreateKeyring(string keyring)
159 {182 {
160 using(var rootKey = (KeyringsRootExists())?183 using(var rootKey = (KeyringsRootExists())?
@@ -165,6 +188,12 @@
165 }188 }
166 }189 }
167190
191 /// <summary>
192 /// Allows to open a keyring with the given name.
193 /// </summary>
194 /// <param name="keyring">The name of the keyring to open.</param>
195 /// <returns>A keyring key that is used to manage the keyring.</returns>
196 [DebugLogged]
168 private IRegistryKey OpenKeyring(string keyring)197 private IRegistryKey OpenKeyring(string keyring)
169 {198 {
170 using(var rootKey = UserRegistry.OpenSubKey(RootPath,RegistryKeyPermissionCheck.ReadWriteSubTree))199 using(var rootKey = UserRegistry.OpenSubKey(RootPath,RegistryKeyPermissionCheck.ReadWriteSubTree))
@@ -173,8 +202,17 @@
173 }202 }
174 }203 }
175204
205 /// <summary>
206 /// Allows to save a value in the keyring with the given name.
207 /// </summary>
208 /// <param name="keyringName">The name of the keyring in which the secret will be stored.</param>
209 /// <param name="applicationName">The name of the application that is storing the secret.</param>
210 /// <param name="secret">The secret to be stored.</param>
176 private void SaveValue(string keyringName, string applicationName, string secret)211 private void SaveValue(string keyringName, string applicationName, string secret)
177 {212 {
213 // we do not use the [DebugLogged] because we will be printing the secret and therefore
214 // expose private data, instead with used the normal logging
215 Logger.DebugFormat("> SaveValue({0}, {1}, \"******\")", keyringName, applicationName);
178 using(var keyring = OpenKeyring(keyringName))216 using(var keyring = OpenKeyring(keyringName))
179 {217 {
180 var encryptedSecret = DataProtector.Protect(secret, Encoding.UTF8.GetBytes(Entropy),218 var encryptedSecret = DataProtector.Protect(secret, Encoding.UTF8.GetBytes(Entropy),
@@ -183,11 +221,21 @@
183 }221 }
184 }222 }
185223
224 /// <summary>
225 /// Allows to retrieve a value from a given keyring.
226 /// </summary>
227 /// <param name="keyringName">The name of the keyring from which the value will be read.</param>
228 /// <param name="applicationName">The anme of the application whose secret we want to read.</param>
229 /// <returns>The secret that was read.</returns>
186 private string GetValue(string keyringName, string applicationName)230 private string GetValue(string keyringName, string applicationName)
187 {231 {
232 // we do not user [DbugLogged] because it will be printing the secret and therefore
233 // expose private data. insetead we use normal logging
234 Logger.DebugFormat("> GetValue({0}, {1})", keyringName, applicationName);
188 using (var keyring = OpenKeyring(keyringName))235 using (var keyring = OpenKeyring(keyringName))
189 {236 {
190 var secret = keyring.GetValue(applicationName) as byte[];237 var secret = keyring.GetValue(applicationName) as byte[];
238 Logger.Debug("< GetValue(\"******\")");
191 return DataProtector.Unprotect(secret, Encoding.UTF8.GetBytes(Entropy), DataProtectionScope.CurrentUser);239 return DataProtector.Unprotect(secret, Encoding.UTF8.GetBytes(Entropy), DataProtectionScope.CurrentUser);
192 } 240 }
193 }241 }
@@ -203,6 +251,7 @@
203 /// <param name="keyringName">The name of the keyring where the secret will be stored.</param>251 /// <param name="keyringName">The name of the keyring where the secret will be stored.</param>
204 /// <param name="applicationName">The name of the application whose secret will be stored.</param>252 /// <param name="applicationName">The name of the application whose secret will be stored.</param>
205 /// <param name="secret">The secret to store in the keyring.</param>253 /// <param name="secret">The secret to store in the keyring.</param>
254 [DebugLogged]
206 public void CreateSecret(string keyringName, string applicationName, string secret)255 public void CreateSecret(string keyringName, string applicationName, string secret)
207 {256 {
208 ValidateArgs.Begin()257 ValidateArgs.Begin()
@@ -214,6 +263,7 @@
214263
215 if (!KeyringExist(keyringName))264 if (!KeyringExist(keyringName))
216 {265 {
266 Logger.InfoFormat("Keyring '{0}' does not exist.", keyringName);
217 CreateKeyring(keyringName);267 CreateKeyring(keyringName);
218 Logger.InfoFormat("Creating keyring with name {0}", keyringName);268 Logger.InfoFormat("Creating keyring with name {0}", keyringName);
219 }269 }
@@ -226,6 +276,7 @@
226 /// <param name="keyringName">The name of the keyring where the secret was stored.</param>276 /// <param name="keyringName">The name of the keyring where the secret was stored.</param>
227 /// <param name="applicationName">the name of the application that stored the secret.</param>277 /// <param name="applicationName">the name of the application that stored the secret.</param>
228 /// <returns>An empty string if the secret does not exist, the secret otherwhise.</returns>278 /// <returns>An empty string if the secret does not exist, the secret otherwhise.</returns>
279 [DebugLogged]
229 public string GetSecretByName(string keyringName, string applicationName)280 public string GetSecretByName(string keyringName, string applicationName)
230 {281 {
231 ValidateArgs.Begin()282 ValidateArgs.Begin()
@@ -241,6 +292,7 @@
241 /// Gets a lists with all the names of the available keyrings.292 /// Gets a lists with all the names of the available keyrings.
242 /// </summary>293 /// </summary>
243 /// <returns>An enumerable with all the names of the different keyrings.</returns>294 /// <returns>An enumerable with all the names of the different keyrings.</returns>
295 [DebugLogged]
244 public IEnumerable<string> GetKeyrings()296 public IEnumerable<string> GetKeyrings()
245 {297 {
246 if(KeyringsRootExists())298 if(KeyringsRootExists())
@@ -250,6 +302,7 @@
250 return keyringRoot.GetSubKeyNames();302 return keyringRoot.GetSubKeyNames();
251 }303 }
252 }304 }
305 Logger.Info("Keyrings root does not exist.");
253 return new string[0];306 return new string[0];
254 }307 }
255308
@@ -258,6 +311,7 @@
258 /// </summary>311 /// </summary>
259 /// <param name="keyringName">The name of the keyring that is queried.</param>312 /// <param name="keyringName">The name of the keyring that is queried.</param>
260 /// <returns>An enumerable with all the applications in the keyring.</returns>313 /// <returns>An enumerable with all the applications in the keyring.</returns>
314 [DebugLogged]
261 public IEnumerable<string> GetApplications(string keyringName)315 public IEnumerable<string> GetApplications(string keyringName)
262 {316 {
263 ValidateArgs.Begin()317 ValidateArgs.Begin()
@@ -274,6 +328,7 @@
274 }328 }
275 }329 }
276 }330 }
331 Logger.InfoFormat("Keyring '{0}' does not exist.", keyringName);
277 return new string[0];332 return new string[0];
278 }333 }
279334
280335
=== modified file 'src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs'
--- src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs 2010-09-30 09:36:24 +0000
+++ src/Canonical.Ubuntu.SSO/RegistryKeyWrapper.cs 2010-09-30 09:36:24 +0000
@@ -19,6 +19,8 @@
19 */19 */
2020
21using System;21using System;
22using Canonical.UbuntuOne.Common.Aop;
23using log4net;
22using Microsoft.Win32;24using Microsoft.Win32;
2325
24namespace Canonical.Ubuntu.SSO26namespace Canonical.Ubuntu.SSO
@@ -32,6 +34,35 @@
32 #region Variables34 #region Variables
3335
34 private readonly RegistryKey _key;36 private readonly RegistryKey _key;
37 private ILog _logger;
38 private readonly object _loggerLock = new object();
39
40 #endregion
41
42 #region DI properties
43
44 /// <summary>
45 /// Gets and sets the logger that will be used to log the operation of the
46 /// class.
47 /// </summary>
48 public ILog Logger
49 {
50 get
51 {
52 if (_logger == null)
53 {
54 lock (_loggerLock)
55 {
56 _logger = LogManager.GetLogger(typeof(Keyring));
57 }
58 }
59 return _logger;
60 }
61 set
62 {
63 _logger = value;
64 }
65 }
3566
36 #endregion67 #endregion
3768
@@ -112,6 +143,7 @@
112 /// </summary>143 /// </summary>
113 /// <param name="name">The name or path of the subkey to create or open. </param>144 /// <param name="name">The name or path of the subkey to create or open. </param>
114 /// <returns>A sub key to work with.</returns>145 /// <returns>A sub key to work with.</returns>
146 [DebugLogged]
115 public IRegistryKey CreateSubKey(string name)147 public IRegistryKey CreateSubKey(string name)
116 {148 {
117 return new RegistryKeyWrapper(_key.CreateSubKey(name));149 return new RegistryKeyWrapper(_key.CreateSubKey(name));
@@ -125,6 +157,7 @@
125 /// <param name="permissionCheck">One of the RegistryKeyPermissionCheck values that 157 /// <param name="permissionCheck">One of the RegistryKeyPermissionCheck values that
126 /// specifies whether the key is opened for read or read/write access.</param>158 /// specifies whether the key is opened for read or read/write access.</param>
127 /// <returns>A subkey to work with.</returns>159 /// <returns>A subkey to work with.</returns>
160 [DebugLogged]
128 public IRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck)161 public IRegistryKey CreateSubKey(string subkey, RegistryKeyPermissionCheck permissionCheck)
129 {162 {
130 return new RegistryKeyWrapper(_key.CreateSubKey(subkey, permissionCheck));163 return new RegistryKeyWrapper(_key.CreateSubKey(subkey, permissionCheck));
@@ -134,6 +167,7 @@
134 /// Deletes the specified subkey. The string subkey is not case-sensitive.167 /// Deletes the specified subkey. The string subkey is not case-sensitive.
135 /// </summary>168 /// </summary>
136 /// <param name="subkey">The name of the subkey to delete. </param>169 /// <param name="subkey">The name of the subkey to delete. </param>
170 [DebugLogged]
137 public void DeleteSubKey(string subkey)171 public void DeleteSubKey(string subkey)
138 {172 {
139 _key.DeleteSubKey(subkey);173 _key.DeleteSubKey(subkey);
@@ -143,6 +177,7 @@
143 /// Deletes the specified value from this key.177 /// Deletes the specified value from this key.
144 /// </summary>178 /// </summary>
145 /// <param name="name">The name of the value to delete.</param>179 /// <param name="name">The name of the value to delete.</param>
180 [DebugLogged]
146 public void DeleteValue(string name)181 public void DeleteValue(string name)
147 {182 {
148 _key.DeleteValue(name);183 _key.DeleteValue(name);
@@ -152,6 +187,7 @@
152 /// Writes all the attributes of the specified open registry 187 /// Writes all the attributes of the specified open registry
153 /// key into the registry.188 /// key into the registry.
154 /// </summary>189 /// </summary>
190 [DebugLogged]
155 public void Flush()191 public void Flush()
156 {192 {
157 _key.Flush();193 _key.Flush();
@@ -162,6 +198,7 @@
162 /// </summary>198 /// </summary>
163 /// <returns>An array of strings that contains the names of the 199 /// <returns>An array of strings that contains the names of the
164 /// subkeys for the current key.</returns>200 /// subkeys for the current key.</returns>
201 [DebugLogged]
165 public string[] GetSubKeyNames()202 public string[] GetSubKeyNames()
166 {203 {
167 return _key.GetSubKeyNames();204 return _key.GetSubKeyNames();
@@ -175,6 +212,8 @@
175 /// <returns>The value associated with name, or null if name is not found.</returns>212 /// <returns>The value associated with name, or null if name is not found.</returns>
176 public object GetValue(string name)213 public object GetValue(string name)
177 {214 {
215 // use norml logging because otherwhise it will expose user data
216 Logger.DebugFormat("> GetValue({0})", name);
178 return _key.GetValue(name);217 return _key.GetValue(name);
179 }218 }
180219
@@ -188,6 +227,7 @@
188 /// environment variables left unexpanded, or defaultValue if name is not found.</returns>227 /// environment variables left unexpanded, or defaultValue if name is not found.</returns>
189 public object GetValue(string name, object defaultValue)228 public object GetValue(string name, object defaultValue)
190 {229 {
230 Logger.DebugFormat("> GetValue({0}, {1})", name, defaultValue);
191 return _key.GetValue(name, defaultValue);231 return _key.GetValue(name, defaultValue);
192 }232 }
193233
@@ -197,6 +237,7 @@
197 /// <param name="name">The name of the value whose registry data type is to be retrieved. </param>237 /// <param name="name">The name of the value whose registry data type is to be retrieved. </param>
198 /// <returns>A RegistryValueKind value representing the registry 238 /// <returns>A RegistryValueKind value representing the registry
199 /// data type of the value associated with name.</returns>239 /// data type of the value associated with name.</returns>
240 [DebugLogged]
200 public RegistryValueKind GetValueKind(string name)241 public RegistryValueKind GetValueKind(string name)
201 {242 {
202 return _key.GetValueKind(name);243 return _key.GetValueKind(name);
@@ -208,6 +249,7 @@
208 /// </summary>249 /// </summary>
209 /// <returns>An array of strings that contains 250 /// <returns>An array of strings that contains
210 /// the value names for the current key.</returns>251 /// the value names for the current key.</returns>
252 [DebugLogged]
211 public string[] GetValueNames()253 public string[] GetValueNames()
212 {254 {
213 return _key.GetValueNames();255 return _key.GetValueNames();
@@ -218,6 +260,7 @@
218 /// </summary>260 /// </summary>
219 /// <param name="name">The name or path of the subkey to open read-only. </param>261 /// <param name="name">The name or path of the subkey to open read-only. </param>
220 /// <returns>The subkey requested, or null if the operation failed.</returns>262 /// <returns>The subkey requested, or null if the operation failed.</returns>
263 [DebugLogged]
221 public IRegistryKey OpenSubKey(string name)264 public IRegistryKey OpenSubKey(string name)
222 {265 {
223 return new RegistryKeyWrapper(_key.OpenSubKey(name));266 return new RegistryKeyWrapper(_key.OpenSubKey(name));
@@ -230,6 +273,7 @@
230 /// <param name="permissionCheck">One of the RegistryKeyPermissionCheck values 273 /// <param name="permissionCheck">One of the RegistryKeyPermissionCheck values
231 /// that specifies whether the key is opened for read or read/write access.</param>274 /// that specifies whether the key is opened for read or read/write access.</param>
232 /// <returns></returns>275 /// <returns></returns>
276 [DebugLogged]
233 public IRegistryKey OpenSubKey(string name, RegistryKeyPermissionCheck permissionCheck)277 public IRegistryKey OpenSubKey(string name, RegistryKeyPermissionCheck permissionCheck)
234 {278 {
235 return new RegistryKeyWrapper(_key.OpenSubKey(name, permissionCheck));279 return new RegistryKeyWrapper(_key.OpenSubKey(name, permissionCheck));
@@ -242,6 +286,7 @@
242 /// <param name="value">The data to be stored.</param>286 /// <param name="value">The data to be stored.</param>
243 public void SetValue(string name, object value)287 public void SetValue(string name, object value)
244 {288 {
289 Logger.DebugFormat("> SetValue({0}, \"******\")", name);
245 _key.SetValue(name, value);290 _key.SetValue(name, value);
246 }291 }
247292
@@ -253,6 +298,7 @@
253 /// <param name="valueKind">The registry data type to use when storing the data</param>298 /// <param name="valueKind">The registry data type to use when storing the data</param>
254 public void SetValue(string name, object value, RegistryValueKind valueKind)299 public void SetValue(string name, object value, RegistryValueKind valueKind)
255 {300 {
301 Logger.DebugFormat("> SetValue({0}, \"******\", {1})", name, valueKind);
256 _key.SetValue(name, value, valueKind);302 _key.SetValue(name, value, valueKind);
257 }303 }
258304
259305
=== modified file 'src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs'
--- src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs 2010-09-30 09:36:24 +0000
+++ src/Canonical.Ubuntu.SSO/SSOCredentialsProvider.cs 2010-09-30 09:36:24 +0000
@@ -19,6 +19,7 @@
19 */19 */
20using System;20using System;
21using System.Collections.Generic;21using System.Collections.Generic;
22using Canonical.UbuntuOne.Common.Aop;
2223
23namespace Canonical.Ubuntu.SSO24namespace Canonical.Ubuntu.SSO
24{25{
@@ -52,6 +53,7 @@
52 /// The result of this action will be notified through the use of the event handlers53 /// The result of this action will be notified through the use of the event handlers
53 /// due to the fact that the call to the sso webservice is async.54 /// due to the fact that the call to the sso webservice is async.
54 /// </summary>55 /// </summary>
56 [DebugLogged]
55 public void LoginToGetCredentials()57 public void LoginToGetCredentials()
56 {58 {
57 // try to get the credentials from the keyring59 // try to get the credentials from the keyring
@@ -68,6 +70,7 @@
68 /// The result of this action will be notified through the use of the event handlers70 /// The result of this action will be notified through the use of the event handlers
69 /// due to the fact that the call to the sso webservice is async.71 /// due to the fact that the call to the sso webservice is async.
70 /// </summary>72 /// </summary>
73 [DebugLogged]
71 public void LoginOrRegisterToGetCredentials()74 public void LoginOrRegisterToGetCredentials()
72 {75 {
73 }76 }
7477
=== modified file 'src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs'
--- src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-09-30 09:36:24 +0000
+++ src/Canonical.UbuntuOne.Client/Notification/NotificationIconPresenter.cs 2010-09-30 09:36:24 +0000
@@ -19,8 +19,6 @@
19using System.Diagnostics;19using System.Diagnostics;
20using System.IO;20using System.IO;
21using System.Net;21using System.Net;
22using System.Text;
23using System.Text.RegularExpressions;
24using System.Web;22using System.Web;
25using System.Windows;23using System.Windows;
26using Canonical.Ubuntu.SSO;24using Canonical.Ubuntu.SSO;
2725
=== modified file 'src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml'
--- src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml 2010-07-26 15:56:11 +0000
+++ src/Canonical.UbuntuOne.ProcessDispatcher/objects.xml 2010-09-30 09:36:24 +0000
@@ -1,9 +1,9 @@
1<?xml version="1.0" encoding="utf-8" ?>1<?xml version="1.0" encoding="utf-8" ?>
2<objects xmlns="http://www.springframework.net">2<objects xmlns="http://www.springframework.net">
33
4 <!-- ###################################################################################################### -->4 <!-- ####################################################################################################### -->
5 <!-- Set up the aop code that will inject debugging logs when the solution has been deply in alpha and beta -->5 <!-- Set up the aop code that will inject debugging logs when the solution has been deploy in alpha and beta -->
6 <!-- ###################################################################################################### -->6 <!-- ####################################################################################################### -->
7 7
8 <!-- Pointcut used for debugging method calls -->8 <!-- Pointcut used for debugging method calls -->
9 9
1010
=== modified file 'src/UbuntuOneClient.Tests/ProgramFixture.cs'
--- src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-08-10 10:04:31 +0000
+++ src/UbuntuOneClient.Tests/ProgramFixture.cs 2010-09-30 09:36:24 +0000
@@ -125,6 +125,7 @@
125 [Test]125 [Test]
126 public void StartApplicationWithCheckUpdatesExceptionTest()126 public void StartApplicationWithCheckUpdatesExceptionTest()
127 {127 {
128 Assert.Ignore("RhinoMocks does not support multithreaded tests and therefore this test will not be reliable");
128 using (_mocks.Record())129 using (_mocks.Record())
129 {130 {
130 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;131 _app.ShutdownMode = ShutdownMode.OnExplicitShutdown;
131132
=== modified file 'src/UbuntuOneClient/objects.xml'
--- src/UbuntuOneClient/objects.xml 2010-08-19 16:54:57 +0000
+++ src/UbuntuOneClient/objects.xml 2010-09-30 09:36:24 +0000
@@ -1,6 +1,45 @@
1<?xml version="1.0" encoding="utf-8" ?>1<?xml version="1.0" encoding="utf-8" ?>
2<objects xmlns="http://www.springframework.net">2<objects xmlns="http://www.springframework.net">
3 <!-- Define window that will be used as the start point of the app -->3
4 <!-- ####################################################################################################### -->
5 <!-- Set up the aop code that will inject debugging logs when the solution has been deploy in alpha and beta -->
6 <!-- ####################################################################################################### -->
7
8 <!-- Pointcut used for debugging method calls -->
9
10 <!-- Provides logging before a method has been called -->
11 <object id="LogBeforeCall"
12 type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop" >
13 <property name="advice">
14 <object type="Canonical.UbuntuOne.Common.Aop.DebugLogBeforeCallInterceptor, Canonical.UbuntuOne.Common" />
15 </property>
16 <property name="attribute"
17 value="Canonical.UbuntuOne.Common.Aop.DebugLoggedAttribute, Canonical.UbuntuOne.Common" />
18 </object>
19
20 <!-- Provides logging fater a method has been called -->
21 <object id="LofAfterCall"
22 type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop" >
23 <property name="advice">
24 <object type="Canonical.UbuntuOne.Common.Aop.DebugLogAfterCallInterceptor, Canonical.UbuntuOne.Common" />
25 </property>
26 <property name="attribute"
27 value="Canonical.UbuntuOne.Common.Aop.DebugLoggedAttribute, Canonical.UbuntuOne.Common" />
28 </object>
29
30 <object id="LofAfterThrow"
31 type="Spring.Aop.Support.AttributeMatchMethodPointcutAdvisor, Spring.Aop" >
32 <property name="advice">
33 <object type="Canonical.UbuntuOne.Common.Aop.DebugLogAfterThrowInterceptor, Canonical.UbuntuOne.Common" />
34 </property>
35 <property name="attribute"
36 value="Canonical.UbuntuOne.Common.Aop.DebugLoggedAttribute, Canonical.UbuntuOne.Common" />
37 </object>
38
39 <!-- ############################################################### -->
40 <!-- Define window that will be used as the start point of the app -->
41 <!-- ############################################################### -->
42
4 <object id="Updater"43 <object id="Updater"
5 type="Canonical.UbuntuOne.Common.Update.Updater, Canonical.UbuntuOne.Common" 44 type="Canonical.UbuntuOne.Common.Update.Updater, Canonical.UbuntuOne.Common"
6 autowire="autodetect">45 autowire="autodetect">
746
=== added file 'utils/BaseDirectory.py'
--- utils/BaseDirectory.py 1970-01-01 00:00:00 +0000
+++ utils/BaseDirectory.py 2010-09-30 09:36:24 +0000
@@ -0,0 +1,173 @@
1"""
2This module is based on a rox module (LGPL):
3
4http://cvs.sourceforge.net/viewcvs.py/rox/ROX-Lib2/python/rox/basedir.py?rev=1.9&view=log
5
6The freedesktop.org Base Directory specification provides a way for
7applications to locate shared data and configuration:
8
9 http://standards.freedesktop.org/basedir-spec/
10
11(based on version 0.6)
12
13This module can be used to load and save from and to these directories.
14
15Typical usage:
16
17 from rox import basedir
18
19 for dir in basedir.load_config_paths('mydomain.org', 'MyProg', 'Options'):
20 print "Load settings from", dir
21
22 dir = basedir.save_config_path('mydomain.org', 'MyProg')
23 print >>file(os.path.join(dir, 'Options'), 'w'), "foo=2"
24
25Note: see the rox.Options module for a higher-level API for managing options.
26"""
27
28from __future__ import generators
29import os
30import sys
31
32# we must chech which os we are using to ensure that the correct
33# paths are set
34if sys.platform == "win32":
35
36 def get_special_folders():
37
38 # Routine to grab all the Windows Shell Folder locations from the registry. If successful, returns dictionary
39 # of shell folder locations indexed on Windows keyword for each; otherwise, returns an empty dictionary.
40 import _winreg
41 special_folders = {}
42
43 # First open the registry hive
44 try:
45 Hive = _winreg.ConnectRegistry(None, _winreg.HKEY_CURRENT_USER)
46 except WindowsError:
47 print "Can't connect to registry hive HKEY_CURRENT_USER."
48 return special_folders
49
50 # Then open the registry key where Windows stores the Shell Folder locations
51 try:
52 Key = _winreg.OpenKey(Hive, "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
53 except WindowsError:
54 print "Can't open registry key Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders."
55 _winreg.CloseKey(Hive)
56 return special_folders
57
58 # Nothing failed above, so enumerate through all the Shell Folder values and return in a dictionary
59 # This relies on error at end of
60 try:
61 #i = 0
62 #while 1:
63 for i in range(0, _winreg.QueryInfoKey(Key)[1]):
64 name, value, val_type = _winreg.EnumValue(Key, i)
65 special_folders[name] = value
66 i += 1
67 _winreg.CloseKey(Key) # Only use with for loop
68 _winreg.CloseKey(Hive) # Only use with for loop
69 return special_folders # Only use with for loop
70 except WindowsError:
71 # In case of failure before read completed, don't return partial results
72 _winreg.CloseKey(Key)
73 _winreg.CloseKey(Hive)
74 special_folders = {}
75
76 special_folders = get_special_folders()
77
78 home_path = special_folders['Personal']
79 app_local_data_path = special_folders['Local AppData']
80 app_global_data_path = special_folders['AppData']
81 app_roaming_data_path = special_folders['Cache']
82
83 # use the non romain app data
84 xdg_data_home = os.environ.get('XDG_DATA_HOME',
85 os.path.join(app_local_data_path, 'xdg'))
86
87 # we will use ; as the spearator because is the char used
88 # in the windows env variables
89 xdg_data_dirs = os.environ.get('XDG_DATA_DIRS',
90 '{0};{1};{2}'.format(app_local_data_path,
91 app_global_data_path, app_roaming_data_path)).split(';')
92
93 # we will return the roaming data wich is as close as we get in windows
94 # regarding caching.
95 xdg_cache_home = os.environ.get('XDG_CACHE_HOME',
96 app_roaming_data_path)
97
98 # point to the not roaming app data for the user
99 xdg_config_home = os.environ.get('XDG_CONFIG_HOME',
100 app_local_data_path)
101
102 xdg_config_dirs = [xdg_config_home] + \
103 os.environ.get('XDG_CONFIG_DIRS',
104 os.path.join(app_global_data_path, 'xdg')).split(':')
105
106else:
107 _home = os.environ.get('HOME', '/')
108 xdg_data_home = os.environ.get('XDG_DATA_HOME',
109 os.path.join(_home, '.local', 'share'))
110
111 xdg_data_dirs = [xdg_data_home] + \
112 os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
113
114 xdg_config_home = os.environ.get('XDG_CONFIG_HOME',
115 os.path.join(_home, '.config'))
116
117 xdg_config_dirs = [xdg_config_home] + \
118 os.environ.get('XDG_CONFIG_DIRS', '/etc/xdg').split(':')
119
120 xdg_cache_home = os.environ.get('XDG_CACHE_HOME',
121 os.path.join(_home, '.cache'))
122
123xdg_data_dirs = filter(lambda x: x, xdg_data_dirs)
124xdg_config_dirs = filter(lambda x: x, xdg_config_dirs)
125
126def save_config_path(*resource):
127 """Ensure $XDG_CONFIG_HOME/<resource>/ exists, and return its path.
128 'resource' should normally be the name of your application. Use this
129 when SAVING configuration settings. Use the xdg_config_dirs variable
130 for loading."""
131 resource = os.path.join(*resource)
132 assert not resource.startswith('/')
133 path = os.path.join(xdg_config_home, resource)
134 if not os.path.isdir(path):
135 os.makedirs(path, 0700)
136 return path
137
138def save_data_path(*resource):
139 """Ensure $XDG_DATA_HOME/<resource>/ exists, and return its path.
140 'resource' is the name of some shared resource. Use this when updating
141 a shared (between programs) database. Use the xdg_data_dirs variable
142 for loading."""
143 resource = os.path.join(*resource)
144 assert not resource.startswith('/')
145 path = os.path.join(xdg_data_home, resource)
146 if not os.path.isdir(path):
147 os.makedirs(path)
148 return path
149
150def load_config_paths(*resource):
151 """Returns an iterator which gives each directory named 'resource' in the
152 configuration search path. Information provided by earlier directories should
153 take precedence over later ones (ie, the user's config dir comes first)."""
154 resource = os.path.join(*resource)
155 for config_dir in xdg_config_dirs:
156 path = os.path.join(config_dir, resource)
157 if os.path.exists(path): yield path
158
159def load_first_config(*resource):
160 """Returns the first result from load_config_paths, or None if there is nothing
161 to load."""
162 for x in load_config_paths(*resource):
163 return x
164 return None
165
166def load_data_paths(*resource):
167 """Returns an iterator which gives each directory named 'resource' in the
168 shared data search path. Information provided by earlier directories should
169 take precedence over later ones."""
170 resource = os.path.join(*resource)
171 for data_dir in xdg_data_dirs:
172 path = os.path.join(data_dir, resource)
173 if os.path.exists(path): yield path
0174
=== added file 'utils/env_setup.bat'
--- utils/env_setup.bat 1970-01-01 00:00:00 +0000
+++ utils/env_setup.bat 2010-09-30 09:36:24 +0000
@@ -0,0 +1,236 @@
1@ECHO off
2:: Tell the user what the batch does.
3ECHO.
4ECHO This batch will set up your enviroment do that you can build the Windows Ubuntu One port.
5ECHO.
6ECHO The following actions will be taken:
7ECHO 1. Download and install python 2.6.
8ECHO 2. Install easy_install for windows.
9ECHO 3. Install python required libraries.
10ECHO 4. Install py2exe.
11ECHO 5. Install bazaar.
12ECHO 6. Install Ubuntu One Protocol
13ECHO.
14ECHO Quering OS architecture
15:: Get the first 3 chars of process identifier
16SET ARCH=%processor_identifier:~0,3%
17IF NOT %ARCH% == x86 GOTO :X64
18:: set the paths for the x86 packages
19ECHO Setting Install Congi for arch %ARCH%
20SET PYWIN32INSTALLER=pywin32-214.win32-py2.6.exe
21SET PYTHONDOWNLOAD=http://www.python.org/ftp/python/2.6.6/python-2.6.6.msi
22SET EASYINSTALLDOWNLOAD=http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe#md5=1509752c3c2e64b5d0f9589aafe053dc
23SET PY2EXEDOWNLOAD=http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.6.exe/download
24SET PROTOCDOWNLOAD=http://protobuf.googlecode.com/files/protoc-2.3.0-win32.zip
25SET PROTOBUFDOWNLOAD=http://protobuf.googlecode.com/files/protobuf-2.3.0.zip
26SET PYOPENSSLDOWNLOAD=http://pypi.python.org/packages/2.6/p/pyOpenSSL/pyOpenSSL-0.10.winxp32-py2.6.msi#md5=90920217fb35d76524cab66c8c135cc8
27SET TWISTEDDOWNLOAD=http://tmrc.mit.edu/mirror/twisted/Twisted/10.1/Twisted-10.1.0.winxp32-py2.6.msi
28SET BZRDOWNLOAD=http://launchpad.net/bzr/2.2/2.2.0/+download/bzr-2.2.0.win32-py2.6.exe
29GOTO :STARTINSTALLATION
30:X64
31SET PYWIN32INSTALLER=pywin32-214.win-amd64-py2.6.exe
32SET PYTHONDOWNLOAD=http://www.python.org/ftp/python/2.6.6/python-2.6.6.amd64.msi
33SET EASYINSTALLDOWNLOAD=http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe#md5=1509752c3c2e64b5d0f9589aafe053dc
34SET PY2EXEDOWNLOAD=http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win64-py2.6.amd64.exe/download
35SET PROTOCDOWNLOAD=http://protobuf.googlecode.com/files/protoc-2.3.0-win32.zip
36SET PROTOBUFDOWNLOAD=http://protobuf.googlecode.com/files/protobuf-2.3.0.zip
37SET PYOPENSSLDOWNLOAD=http://pypi.python.org/packages/2.6/p/pyOpenSSL/pyOpenSSL-0.10.winxp32-py2.6.msi#md5=90920217fb35d76524cab66c8c135cc8
38SET TWISTEDDOWNLOAD=http://tmrc.mit.edu/mirror/twisted/Twisted/10.1/Twisted-10.1.0.winxp32-py2.6.msi
39SET BZRDOWNLOAD=http://launchpad.net/bzr/2.2/2.2.0/+download/bzr-2.2.0.win32-py2.6.exe
40ECHO 64
41:STARTINSTALLATION
42ECHO Starting installation
43
44:: ============================================================================
45:: Set up temp directory
46:: ============================================================================
47ECHO.
48SET TEMPFILE=%TEMP%\ENV_SET_UP
49ECHO The file that will be used to store the downloaded data is:
50ECHO %TEMPFILE%
51:: If the dir does not exist we have not problem and continue
52:: otherwhise delete the dir and create it so that we do not
53:: have old data present
54IF NOT EXIST %TEMPFILE% GOTO :NOTEMPDIR
55:: Ask user if he wants to delete the dir, he might not want to
56CHOICE /C YN /M "The dir is already present. Do you want to delete it"
57IF ERRORLEVEL 1 GOTO :DELETEDIR
58:: User does not want to delete, we are not that smart!! bye!
59ECHO Please delete the dir manually
60ECHO Leaving installation
61EXIT
62:DELETEDIR
63RD /s /Q %TEMPFILE%
64:NOTEMPDIR
65MD %TEMPFILE%
66
67:: ============================================================================
68:: Set up python
69:: ============================================================================
70
71SET PYTHONPATH=""
72ECHO Checking if python2.6 is in the system
73:GETPYTHONPATH
74:: This is very anoying, FOR /F will work differently depending on the output
75:: of reg which is not consistent between os (xp, 7) we have to choose the tokens
76:: according to the os
77SET PYTHONPATHTOKENS=3
78VER | FIND "XP" > nul
79IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4
80FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY HKLM\Software\Python\PythonCore\2.6\InstallPath /ve') DO @SET PYTHONPATH=%%A
81IF NOT %PYTHONPATH% == "" GOTO :PYTHONPRESENT
82:: donload python and install it
83ECHO Download python 2.6
84wget.exe -v --output-document=%TEMPFILE%\python.msi %PYTHONDOWNLOAD%
85ECHO Installing python...
86START /wait msiexec.exe /i %TEMPFILE%\python.msi
87:: Set the location of python
88GOTO :GETPYTHONPATH
89:PYTHONPRESENT
90:: Let user know we did find python 2.6
91ECHO Python is present!
92ECHO Python dir is %PYTHONPATH%
93
94:: ============================================================================
95:: Setup pywin32 extensions
96:: ============================================================================
97
98:: This should be downloaded, but I have issues with wget and sourceforge
99ECHO Installing pywin32 python extensions
100START /wait %PYWIN32INSTALLER%
101
102:: ============================================================================
103:: Set up easy_install
104:: ============================================================================
105
106ECHO Checking if easy_install is in the system
107IF EXIST %PYTHONPATH%\Scripts\easy_install.exe GOTO :EASYINSTALLPRESENT
108ECHO Download easy_install for Windows
109wget.exe -v --output-document=%TEMPFILE%\easy_install.exe %EASYINSTALLDOWNLOAD%
110ECHO Installing easy_install...
111START /wait %TEMPFILE%\easy_install.exe %EASYINSTALLDOWNLOAD%
112:EASYINSTALLPRESENT
113:: set the easy_install path, this is not superb since if the user changed
114:: the path of python, we have problems
115SET EASYINSTALLPATH=%PYTHONPATH%\Scripts\easy_install.exe
116ECHO easy_install is present!
117ECHO Python dir is %EASYINSTALLPATH%
118
119:: ============================================================================
120:: Set up dependencies
121:: ============================================================================
122
123
124ECHO The following dependencies will be installed using easy_install
125ECHO 1. zope.interface
126ECHO 2. oauth
127ECHO 4. boto
128ECHO 5. lazr.authentication
129ECHO 6. lazr.restfulclient
130ECHO 7. lazr.uri
131ECHO Installing dependencies
132%EASYINSTALLPATH% -Z -U zope.interface oauth boto lazr.authentication lazr.restfulclient lazr.uri
133ECHO.
134ECHO Python dependencies have been installed
135ECHO.
136
137:: ============================================================================
138:: Set up depedencies that cannot be install with easy_install
139::=============================================================================
140
141:: Install py2exe using an msi, the easy_install pacakage fails in systems such
142:: as XP
143ECHO Downloading py2exe for Windows
144wget.exe -v --output-document=%TEMPFILE%\py2exe.exe "%PY2EXEDOWNLOAD%"
145ECHO Installing py2exe
146%TEMPFILE%\py2exe.exe
147
148:: It is of extreme importance to install protoc before, otherwhise the protobuf
149:: module for python will not be correctly generated
150ECHO Downloading protobuf compiler for python
151wget.exe -v --output-document=%TEMPFILE%\protoc_compiler.zip %PROTOCDOWNLOAD%
152ECHO Extracting protobuf compiler
153IF NOT EXIST "%ProgramFiles%\Protoc" MD "%ProgramFiles%\Protoc"
154unzip -o %TEMPFILE%\protoc_compiler.zip -d "%ProgramFiles%\Protoc"
155
156
157:: distutils does not work with the pacakage correctly and we have to unxip ourselves
158ECHO Downloading Protobuf for Windows
159wget.exe -v --output-document=%TEMPFILE%\protoc.zip %PROTOBUFDOWNLOAD%
160unzip -o %TEMPFILE%\protoc.zip -d %TEMPFILE%\Protoc
161:: distutils.spawn.find_executable is used to find protoc but it does not do a
162:: a very good job on windows, although we have installer protoc in the
163:: %ProgramFiles% we are going to copy it to the current location so that
164:: python can find it... lame!
165COPY /B "%ProgramFiles%\Protoc\protoc.exe" %TEMPFILE%\Protoc\protobuf-2.3.0\python
166ECHO Installing Protobuf for Windows
167START /B "%PYTHONPATH%\pycdthon.exe" /D%TEMPFILE%\Protoc\protobuf-2.3.0\python setup.py install
168:: The setup.py from google creates an egg, but py2exe does notlike that, lets extract it
169unzip -o %PYTHONPATH%\Lib\site-packages\protobuf-2.3.0-py2.6.egg -d %PYTHONPATH%\Lib\site-packages
170
171:: The msi does not add an entry in the reg therefore we always install :(
172ECHO Downloading pyOpenSSl for Windows
173wget.exe -v --output-document=%TEMPFILE%\pyOpenSSL.msi %PYOPENSSLDOWNLOAD%
174ECHO Installing pyOpenSSL
175START /wait msiexec.exe /i %TEMPFILE%\pyOpenSSL.msi
176
177:: Twisted cannot be installer with easy_install on windows
178ECHO Downloading twisted for Windows
179wget.exe -v --output-document=%TEMPFILE%\twisted.msi %TWISTEDDOWNLOAD%
180ECHO Installing twisted
181START /wait msiexec.exe /i %TEMPFILE%\twisted.msi
182
183:: Install xdg.BaseDirectory for Windows
184ECHO Installing xdg.BaseDirectory
185IF NOT EXIST %PYTHONPATH%\Lib\site-packages\xdg MD %PYTHONPATH%\Lib\site-packages\xdg
186COPY BaseDirectory.py %PYTHONPATH%\Lib\site-packages\xdg
187ECHO. 2>%PYTHONPATH%\Lib\site-packages\xdg\__init__.py
188
189:: ============================================================================
190:: Set up bazaar
191:: ============================================================================
192
193ECHO Checking if bzr is in the system
194:GETBZRPATH
195SET BZRPATH = ""
196:: This is tricky since the Program Files dir has a space and does provide
197:: a problem because the delimeters are not correctly set, well is batch :(
198FOR /F "tokens=3-6" %%A IN ('REG QUERY HKLM\Software\Bazaar /v InstallPath') DO @SET BZRPATH=%%A %%B
199IF NOT BZRPATH == "" GOTO :BZRPRESENT
200ECHO Downloading bazaar
201wget.exe -v --output-document=%TEMPFILE%\bazaar.exe %BZRDOWNLOAD%
202ECHO Installing bazaar
203%TEMPFILE%\bazaar.exe
204:: get the path from reg
205GOTO :GETBZRPATH
206:BZRPRESENT
207ECHO bzr is present!
208ECHO bzr path is %BZRPATH%
209
210
211:: ============================================================================
212:: Set up ubuntuone-storage-protocol
213:: ============================================================================
214
215ECHO Branching ubuntuone-storage-protocol
216"%BZRPATH%\bzr.exe" branch lp:ubuntuone-storage-protocol %TEMPFILE%\ubuntuone-storage-protocol
217:: distutils.spawn.find_executable is used to find protoc but it does not do a
218:: a very good job on windows, although we have installer protoc in the
219:: %ProgramFiles% we are going to copy it to the current location so that
220:: python can find it... lame!
221COPY /B "%ProgramFiles%\Protoc\protoc.exe" %TEMPFILE%\ubuntuone-storage-protocol
222ECHO Installing ubuntuone-storage-protocol from source
223:: Use start, otherwhise we will not be able to set the execution dir and
224:: setup.py will complain about not being able to find the correct dirs
225:: to install
226START /B "%PYTHONPATH%\python.exe" /D%TEMPFILE%\ubuntuone-storage-protocol\ setup.py install
227:: ubuntuone.logger is in not pacakage, we just copy it from the utils dir
228COPY logger.py %PYTHONPATH%\Lib\site-packages\ubuntuone
229
230:: ============================================================================
231:: Clean up the downloaded data
232:: ============================================================================
233
234ECHO Cleaning Temp files
235RD /s /Q %TEMPFILE%
236ECHO Installation completed!!
0\ No newline at end of file237\ No newline at end of file
1238
=== added file 'utils/logger.py'
--- utils/logger.py 1970-01-01 00:00:00 +0000
+++ utils/logger.py 2010-09-30 09:36:24 +0000
@@ -0,0 +1,268 @@
1# ubuntuone.syncdaemon.logger - logging utilities
2#
3# Author: Guillermo Gonzalez <guillermo.gonzalez@canonical.com>
4#
5# Copyright 2010 Canonical Ltd.
6#
7# This program is free software: you can redistribute it and/or modify it
8# under the terms of the GNU General Public License version 3, as published
9# by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranties of
13# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14# PURPOSE. See the GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program. If not, see <http://www.gnu.org/licenses/>.
18"""Ubuntuone client logging utilities and config. """
19from __future__ import with_statement
20
21import contextlib
22import logging
23import sys
24import os
25import re
26import weakref
27import functools
28import xdg.BaseDirectory
29
30from logging.handlers import TimedRotatingFileHandler
31
32# extra levels
33# be more verbose than logging.DEBUG(10)
34TRACE = 5
35# info that we almost always want to log (logging.ERROR - 1)
36NOTE = logging.ERROR - 1
37
38# map names to the extra levels
39levels = {'TRACE':TRACE, 'NOTE':NOTE}
40for k, v in levels.items():
41 logging.addLevelName(v, k)
42
43
44class Logger(logging.Logger):
45 """Logger that support out custom levels."""
46
47 def note(self, msg, *args, **kwargs):
48 """log at NOTE level"""
49 if self.isEnabledFor(NOTE):
50 self._log(NOTE, msg, args, **kwargs)
51
52 def trace(self, msg, *args, **kwargs):
53 """log at TRACE level"""
54 if self.isEnabledFor(TRACE):
55 self._log(TRACE, msg, args, **kwargs)
56
57
58class DayRotatingFileHandler(TimedRotatingFileHandler):
59 """A mix of TimedRotatingFileHandler and RotatingFileHandler configured for
60 daily rotation but that uses the suffix and extMatch of Hourly rotation, in
61 order to allow seconds based rotation on each startup.
62 The log file is also rotated when the specified size is reached.
63 """
64
65 def __init__(self, *args, **kwargs):
66 """ create the instance and override the suffix and extMatch.
67 Also accepts a maxBytes keyword arg to rotate the file when it reachs
68 maxBytes.
69 """
70 kwargs['when'] = 'D'
71 kwargs['backupCount'] = LOGBACKUP
72 # check if we are in 2.5, only for PQM
73 if sys.version_info[:2] >= (2, 6):
74 kwargs['delay'] = 1
75 if 'maxBytes' in kwargs:
76 self.maxBytes = kwargs.pop('maxBytes')
77 else:
78 self.maxBytes = 0
79 TimedRotatingFileHandler.__init__(self, *args, **kwargs)
80 # override suffix
81 self.suffix = "%Y-%m-%d_%H-%M-%S"
82 self.extMatch = re.compile(r"^\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}$")
83
84 def shouldRollover(self, record):
85 """
86 Determine if rollover should occur.
87
88 Basically, see if TimedRotatingFileHandler.shouldRollover and if it's
89 False see if the supplied record would cause the file to exceed
90 the size limit we have.
91
92 The size based rotation are from logging.handlers.RotatingFileHandler
93 """
94 if TimedRotatingFileHandler.shouldRollover(self, record):
95 return 1
96 else:
97 # check the size
98 if self.stream is None: # delay was set...
99 self.stream = self._open()
100 if self.maxBytes > 0: # are we rolling over?
101 msg = "%s\n" % self.format(record)
102 self.stream.seek(0, 2) #due to non-posix-compliant Windows feature
103 if self.stream.tell() + len(msg) >= self.maxBytes:
104 return 1
105 return 0
106
107
108class MultiFilter(logging.Filter):
109 """Our own logging.Filter.
110
111 To allow filter by multiple names in a single handler or logger.
112
113 """
114
115 def __init__(self, names=None):
116 logging.Filter.__init__(self)
117 self.names = names or []
118 self.filters = []
119 for name in self.names:
120 self.filters.append(logging.Filter(name))
121
122 def filter(self, record):
123 """Determine if the specified record is to be logged.
124
125 This work a bit different from the standard logging.Filter, the
126 record is logged if at least one filter allows it.
127 If there are no filters, the record is allowed.
128
129 """
130 if not self.filters:
131 # no filters, allow the record
132 return True
133 for f in self.filters:
134 if f.filter(record):
135 return True
136 return False
137
138
139class DebugCapture(logging.Handler):
140 """
141 A context manager to capture debug logs.
142 """
143
144 def __init__(self, logger, raise_unhandled=False, on_error=True):
145 """Creates the instance.
146
147 @param logger: the logger to wrap
148 @param raise_unhandled: raise unhandled errors (which are alse logged)
149 @param on_error: if it's True (default) the captured debug info is
150 dumped if a record with log level >= ERROR is logged.
151 """
152 logging.Handler.__init__(self, logging.DEBUG)
153 self.on_error = on_error
154 self.dirty = False
155 self.raise_unhandled = raise_unhandled
156 self.records = []
157 # insert myself as the handler for the logger
158 self.logger = weakref.proxy(logger)
159 # store the logger log level
160 self.old_level = logger.level
161 # remove us from the Handler list and dict
162 self.close()
163
164 def emit_debug(self):
165 """emit stored records to the original logger handler(s)"""
166 enable_debug = self.enable_debug
167 for record in self.records:
168 for slave in self.slaves:
169 with enable_debug(slave):
170 slave.handle(record)
171
172 @contextlib.contextmanager
173 def enable_debug(self, obj):
174 """context manager that temporarily changes the level attribute of obj
175 to logging.DEBUG.
176 """
177 old_level = obj.level
178 obj.level = logging.DEBUG
179 yield obj
180 obj.level = old_level
181
182 def clear(self):
183 """cleanup the captured records"""
184 self.records = []
185
186 def install(self):
187 """Install the debug capture in the logger"""
188 self.slaves = self.logger.handlers
189 self.logger.handlers = [self]
190 # set the logger level in DEBUG
191 self.logger.setLevel(logging.DEBUG)
192
193 def uninstall(self):
194 """restore the logger original handlers"""
195 # restore the logger
196 self.logger.handlers = self.slaves
197 self.logger.setLevel(self.old_level)
198 self.clear()
199 self.dirty = False
200 self.slaves = []
201
202 def emit(self, record):
203 """A emit() that append the record to the record list"""
204 self.records.append(record)
205
206 def handle(self, record):
207 """ handle a record """
208 # if its a DEBUG level record then intercept otherwise
209 # pass through to the original logger handler(s)
210 if self.old_level <= logging.DEBUG:
211 return sum(slave.handle(record) for slave in self.slaves)
212 if record.levelno == logging.DEBUG:
213 return logging.Handler.handle(self, record)
214 elif self.on_error and record.levelno >= logging.ERROR and \
215 record.levelno != NOTE:
216 # if it's >= ERROR keep it, but mark the dirty falg
217 self.dirty = True
218 return logging.Handler.handle(self, record)
219 else:
220 return sum(slave.handle(record) for slave in self.slaves)
221
222 def __enter__(self):
223 """ContextManager API"""
224 self.install()
225 return self
226
227 def __exit__(self, exc_type, exc_value, traceback):
228 """ContextManager API"""
229 if exc_type is not None:
230 self.emit_debug()
231 self.on_error = False
232 self.logger.error('unhandled exception', exc_info=(exc_type,
233 exc_value, traceback))
234 elif self.dirty:
235 # emit all debug messages collected after the error
236 self.emit_debug()
237 self.uninstall()
238 if self.raise_unhandled and exc_type is not None:
239 raise exc_type, exc_value, traceback
240 else:
241 return True
242
243
244### configure the thing ###
245# define the location of the log folder
246home = xdg.BaseDirectory.xdg_cache_home
247LOGFOLDER = os.path.join(home, 'ubuntuone','log')
248if not os.path.exists(LOGFOLDER):
249 os.makedirs(LOGFOLDER)
250
251LOGBACKUP = 5 # the number of log files to keep around
252
253basic_formatter = logging.Formatter(fmt="%(asctime)s - %(name)s - " \
254 "%(levelname)s - %(message)s")
255debug_formatter = logging.Formatter(fmt="%(asctime)s %(name)s %(module)s " \
256 "%(lineno)s %(funcName)s %(message)s")
257
258# a constant to change the default DEBUG level value
259_DEBUG_LOG_LEVEL = logging.DEBUG
260
261
262# partial config of the handler to rotate when the file size is 1MB
263CustomRotatingFileHandler = functools.partial(DayRotatingFileHandler,
264 maxBytes=1048576)
265
266# use our logger as the default Logger class
267logging.setLoggerClass(Logger)
268
0269
=== added file 'utils/pywin32-214.win-amd64-py2.6.exe'
1Binary files utils/pywin32-214.win-amd64-py2.6.exe 1970-01-01 00:00:00 +0000 and utils/pywin32-214.win-amd64-py2.6.exe 2010-09-30 09:36:24 +0000 differ270Binary files utils/pywin32-214.win-amd64-py2.6.exe 1970-01-01 00:00:00 +0000 and utils/pywin32-214.win-amd64-py2.6.exe 2010-09-30 09:36:24 +0000 differ
=== added file 'utils/pywin32-214.win32-py2.6.exe'
2Binary files utils/pywin32-214.win32-py2.6.exe 1970-01-01 00:00:00 +0000 and utils/pywin32-214.win32-py2.6.exe 2010-09-30 09:36:24 +0000 differ271Binary files utils/pywin32-214.win32-py2.6.exe 1970-01-01 00:00:00 +0000 and utils/pywin32-214.win32-py2.6.exe 2010-09-30 09:36:24 +0000 differ
=== added file 'utils/unzip.exe'
3Binary files utils/unzip.exe 1970-01-01 00:00:00 +0000 and utils/unzip.exe 2010-09-30 09:36:24 +0000 differ272Binary files utils/unzip.exe 1970-01-01 00:00:00 +0000 and utils/unzip.exe 2010-09-30 09:36:24 +0000 differ
=== added file 'utils/unzip32.dll'
4Binary files utils/unzip32.dll 1970-01-01 00:00:00 +0000 and utils/unzip32.dll 2010-09-30 09:36:24 +0000 differ273Binary files utils/unzip32.dll 1970-01-01 00:00:00 +0000 and utils/unzip32.dll 2010-09-30 09:36:24 +0000 differ
=== added file 'utils/wget.exe'
5Binary files utils/wget.exe 1970-01-01 00:00:00 +0000 and utils/wget.exe 2010-09-30 09:36:24 +0000 differ274Binary files utils/wget.exe 1970-01-01 00:00:00 +0000 and utils/wget.exe 2010-09-30 09:36:24 +0000 differ

Subscribers

People subscribed via source and target branches

to all changes: