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

Proposed by Manuel de la Peña
Status: Merged
Approved by: Rick McBride
Approved revision: 54
Merged at revision: 68
Proposed branch: lp:~mandel/ubuntuone-windows-installer/add_create_update_build
Merge into: lp:ubuntuone-windows-installer/beta
Diff against target: 929 lines (+467/-60)
20 files modified
README.txt (+12/-0)
main.build (+33/-1)
src/Canonical.UbuntuOne.Client.Views/Update/DownloadingView.xaml.cs (+28/-0)
src/Canonical.UbuntuOne.Client.Views/Update/UpdatingView.xaml.cs (+32/-1)
src/Canonical.UbuntuOne.Common.Tests/Canonical.UbuntuOne.Common.Tests.csproj (+4/-0)
src/Canonical.UbuntuOne.Common.Tests/TestDispatcher.cs (+69/-0)
src/Canonical.UbuntuOne.Common.Tests/Update/DownloadingPresenterFixture.cs (+13/-1)
src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj (+2/-0)
src/Canonical.UbuntuOne.Common/Threading/IDispatcher.cs (+48/-0)
src/Canonical.UbuntuOne.Common/Threading/WpfDispatcher.cs (+89/-0)
src/Canonical.UbuntuOne.Common/Update/DotUpdaterWrapper.cs (+47/-4)
src/Canonical.UbuntuOne.Common/Update/DownloadingPresenter.cs (+27/-11)
src/Canonical.UbuntuOne.Common/Update/IDownloadingView.cs (+9/-1)
src/Canonical.UbuntuOne.Common/Update/IUpdatingPresenter.cs (+1/-1)
src/Canonical.UbuntuOne.Common/Update/IUpdatingView.cs (+27/-17)
src/Canonical.UbuntuOne.Common/Update/Updater.cs (+2/-2)
src/Canonical.UbuntuOne.Common/objects.xml (+1/-1)
src/UbuntuOneClient/objects.xml (+1/-1)
utils/rss_templates.py (+6/-6)
utils/upload_new_update.py (+16/-13)
To merge this branch: bzr merge lp:~mandel/ubuntuone-windows-installer/add_create_update_build
Reviewer Review Type Date Requested Status
John Lenton (community) Approve
Vincenzo Di Somma (community) Approve
Review via email: mp+33534@code.launchpad.net

Description of the change

Changes required to make the selfupda as expected, specially ensuring that the async calls can modify objects that have been created in a diff branch.

To post a comment you must log in.
Revision history for this message
Vincenzo Di Somma (vds) wrote :

Looks good, build and tests are passing.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.txt'
2--- README.txt 2010-07-19 10:19:22 +0000
3+++ README.txt 2010-08-24 15:18:39 +0000
4@@ -39,6 +39,18 @@
5 2.6 bootstrapper
6
7 Crates a boot strapper that will allow to install a bundle with UbuntuOne that includes Tomboy and Gtk sharp if needed.
8+
9+ 2.7 create_update
10+
11+ Creates the msi that will be used to update the application, updates the rss used to notify updates an uploads the data to the server.
12+
13+ Bare in mind that to be able to execute create_update you have to have the rights to update the data in canonicals S3. In order to do that
14+ you have to set the following enviroment valirables in your windows machine:
15+
16+ AWS_ACCESS_KEY_ID: The account Id
17+ AWS_SECRET_ACCESS_KEY: The secret required to use the account.
18+
19+ In order to run the script you will need to have boto () to be able to use S3.
20
21 In order to execute the build script execute at the root of the project
22
23
24=== added file 'lib/DotUpdater/DotUpdater.pdb'
25Binary files lib/DotUpdater/DotUpdater.pdb 1970-01-01 00:00:00 +0000 and lib/DotUpdater/DotUpdater.pdb 2010-08-24 15:18:39 +0000 differ
26=== modified file 'main.build'
27--- main.build 2010-08-18 09:39:49 +0000
28+++ main.build 2010-08-24 15:18:39 +0000
29@@ -4,11 +4,19 @@
30 <property name="enviroment" value="debug" />
31 <!-- property that allows to pass where to place the build results -->
32 <property name="build_results" value="install/build_results" />
33+ <!-- property thas allows to pass the location used to build the api docs. -->
34 <property name="docs_api" value="docs/api" />
35+ <!-- property that allows to point to the location in which sandcastle was installed -->
36 <property name="sandcastle_path" value="C:\Program Files\Sandcastle" />
37+ <!-- property that allows to point to the location in which the html workshop was installer -->
38 <property name="html_help_compiler_path" value="C:\Program Files\HTML Help Workshop" />
39 <!-- property that allows to pass the number for the current build. -->
40 <property name="build" value="0" />
41+ <!-- property that allows to point to the location in which python was installer -->
42+ <property name="python_path" value="C:\Python26" />
43+ <!-- property that allows to pass the location to be used to update the package. -->
44+ <property name="upload_path" value="http://s3.amazonaws.com/u1wintest/UbuntuOne.msi" />
45+
46 <target name="clean"
47 description="Removes all the different results of the last comilation if they exist">
48 <!-- delete all the different results from the previous build -->
49@@ -206,7 +214,7 @@
50
51 <target name="installer"
52 description="Compiles the solution and create a merge installer that allows to install the solution and other related apps."
53- depends="build">
54+ depends="tests">
55
56 <mkdir dir="${build_results}" />
57
58@@ -279,6 +287,30 @@
59 commandline="/Output:setup.exe /Template:dotNetInstaller.exe /Configuration:InstallerProject.xml /Embed+" />
60 </target>
61
62+ <target name="create_update"
63+ description="Creates the msi that will be used to update the application, updates the rss used to notify updates an uploads the data to the server."
64+ depends="installer">
65+
66+ <echo message="Creating update for version ${buildnumber.major}.${buildnumber.minor}.${buildnumber.build}.${buildnumber.revision}"/>
67+
68+ <!-- call the utils script that was created using python to allows the update and rss generation -->
69+
70+ <echo message='Executing: python upload_new_update.py ../install/UbuntuOne.msi ${buildnumber.major}.${buildnumber.minor}.${buildnumber.build}.${buildnumber.revision} "${upload_path}"'/>
71+
72+ <!-- copy the installer, otherwhise the script has issues when uploading, windows is funny -->
73+ <copy file="install/UbuntuOne.msi"
74+ tofile="utils/UbuntuOne.msi" />
75+
76+ <exec basedir="${python_path}"
77+ managed="false"
78+ workingdir="utils"
79+ program="python.exe"
80+ commandline='upload_new_update.py UbuntuOne.msi ${buildnumber.major}.${buildnumber.minor}.${buildnumber.build}.${buildnumber.revision} "${upload_path}"' />
81+
82+ <!-- delete the copied file -->
83+ <delete file="utils/UbuntuOne.msi" />
84+
85+ </target>
86 <target name="documentation"
87 description="Generates the documentation using the xml documents."
88 depends="build">
89
90=== modified file 'src/Canonical.UbuntuOne.Client.Views/Update/DownloadingView.xaml.cs'
91--- src/Canonical.UbuntuOne.Client.Views/Update/DownloadingView.xaml.cs 2010-08-05 08:15:00 +0000
92+++ src/Canonical.UbuntuOne.Client.Views/Update/DownloadingView.xaml.cs 2010-08-24 15:18:39 +0000
93@@ -16,6 +16,7 @@
94 //
95 // Authors: Manuel de la Peña <manuel.delapena@canonical.com>
96 using System;
97+using Canonical.UbuntuOne.Common.Threading;
98 using Canonical.UbuntuOne.Common.Update;
99 using StaticResources = Canonical.UbuntuOne.Client.Views.Resources.Resources;
100 namespace Canonical.UbuntuOne.Client.Views.Update
101@@ -25,6 +26,13 @@
102 /// </summary>
103 public partial class DownloadingView : IDownloadingView
104 {
105+ #region Variables
106+
107+ private IDispatcher _dispatcher;
108+ private readonly object _dispatcherLock = new object();
109+
110+ #endregion
111+
112 /// <summary>
113 /// Initializes a new instance of the DownloadingView class.
114 /// </summary>
115@@ -35,6 +43,26 @@
116 }
117
118 /// <summary>
119+ /// Gets the dispatcher that can be used to call actions on the object from a
120+ /// different thread.
121+ /// </summary>
122+ public IDispatcher ViewDispatcher
123+ {
124+ get
125+ {
126+ if(_dispatcher == null)
127+ {
128+ lock (_dispatcherLock)
129+ {
130+ _dispatcher = new WpfDispatcher(Dispatcher);
131+ }
132+ }
133+ return _dispatcher;
134+ }
135+ set { _dispatcher = value; }
136+ }
137+
138+ /// <summary>
139 /// Gets and sets if the close button is enabled.
140 /// </summary>
141 public bool CloseButtonIsEnabled
142
143=== modified file 'src/Canonical.UbuntuOne.Client.Views/Update/UpdatingView.xaml.cs'
144--- src/Canonical.UbuntuOne.Client.Views/Update/UpdatingView.xaml.cs 2010-08-05 08:15:00 +0000
145+++ src/Canonical.UbuntuOne.Client.Views/Update/UpdatingView.xaml.cs 2010-08-24 15:18:39 +0000
146@@ -16,6 +16,7 @@
147 //
148 // Authors: Manuel de la Peña <manuel.delapena@canonical.com>
149 using System;
150+using Canonical.UbuntuOne.Common.Threading;
151 using Canonical.UbuntuOne.Common.Update;
152
153 namespace Canonical.UbuntuOne.Client.Views.Update
154@@ -25,6 +26,36 @@
155 /// </summary>
156 public partial class UpdatingView : IUpdatingView
157 {
158+ #region Variables
159+
160+ private IDispatcher _dispatcher;
161+ private readonly object _dispatcherLock = new object();
162+
163+ #endregion
164+
165+ #region DI Properties
166+
167+ /// <summary>
168+ /// Gets and sets a dispatcher that can be used by the view in a multithreaded env.
169+ /// </summary>
170+ public IDispatcher ViewDispatcher
171+ {
172+ get
173+ {
174+ if(_dispatcher == null)
175+ {
176+ lock (_dispatcherLock)
177+ {
178+ _dispatcher = new WpfDispatcher(Dispatcher);
179+ }
180+ }
181+ return _dispatcher;
182+ }
183+ set { _dispatcher = value; }
184+ }
185+
186+ #endregion
187+
188 /// <summary>
189 /// Initializes a new instance of the UpdatingView class.
190 /// </summary>
191@@ -51,7 +82,7 @@
192 /// </summary>
193 public string UpdatingText
194 {
195- get { return (String) MessageLabel.Content; }
196+ get { return (String)MessageLabel.Content; }
197 set { MessageLabel.Content = value; }
198 }
199 }
200
201=== modified file 'src/Canonical.UbuntuOne.Common.Tests/Canonical.UbuntuOne.Common.Tests.csproj'
202--- src/Canonical.UbuntuOne.Common.Tests/Canonical.UbuntuOne.Common.Tests.csproj 2010-08-05 08:15:00 +0000
203+++ src/Canonical.UbuntuOne.Common.Tests/Canonical.UbuntuOne.Common.Tests.csproj 2010-08-24 15:18:39 +0000
204@@ -44,6 +44,7 @@
205 <Compile Include="ProcessManagementExceptionFixture.cs" />
206 <Compile Include="Properties\AssemblyInfo.cs" />
207 <Compile Include="SyncDaemonExceptionFixture.cs" />
208+ <Compile Include="TestDispatcher.cs" />
209 <Compile Include="Update\DownloadingPresenterFixture.cs" />
210 <Compile Include="Update\SelfUpdateExceptionFixture.cs" />
211 <Compile Include="Update\UpdaterFixture.cs" />
212@@ -82,6 +83,9 @@
213 <HintPath>..\..\lib\Spring.Net\Spring.Core.dll</HintPath>
214 </Reference>
215 <Reference Include="System" />
216+ <Reference Include="System.Core">
217+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
218+ </Reference>
219 <Reference Include="System.Data" />
220 <Reference Include="System.Xml" />
221 </ItemGroup>
222
223=== added file 'src/Canonical.UbuntuOne.Common.Tests/TestDispatcher.cs'
224--- src/Canonical.UbuntuOne.Common.Tests/TestDispatcher.cs 1970-01-01 00:00:00 +0000
225+++ src/Canonical.UbuntuOne.Common.Tests/TestDispatcher.cs 2010-08-24 15:18:39 +0000
226@@ -0,0 +1,69 @@
227+/*
228+ * Copyright 2010 Canonical Ltd.
229+ *
230+ * This file is part of UbuntuOne on Windows.
231+ *
232+ * UbuntuOne on Windows is free software: you can redistribute it and/or modify
233+ * it under the terms of the GNU Lesser General Public License version
234+ * as published by the Free Software Foundation.
235+ *
236+ * Ubuntu One on Windows is distributed in the hope that it will be useful,
237+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
238+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
239+ * GNU Lesser General Public License for more details.
240+ *
241+ * You should have received a copy of the GNU Lesser General Public License
242+ * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
243+ *
244+ * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
245+ */
246+using System;
247+using Canonical.UbuntuOne.Common.Threading;
248+
249+namespace Canonical.UbuntuOne.Common.Tests
250+{
251+ /// <summary>
252+ /// Dummy implementation of the IDispatcher that is used for test puposes.
253+ /// </summary>
254+ internal class TestDispatcher : IDispatcher
255+ {
256+ #region Implementation of IDispatcher
257+
258+ /// <summary>
259+ /// Dispatches the specified action to the thread.
260+ /// </summary>
261+ /// <param name="actionToInvoke">The action to invoke.</param>
262+ public void Dispatch(Action actionToInvoke)
263+ {
264+ actionToInvoke();
265+ }
266+
267+ #endregion
268+
269+ #region Implementation of IDispatcher
270+
271+ /// <summary>
272+ /// Dispatches the specified action to the thread.
273+ /// </summary>
274+ /// <param name="actionToInvoke">The action to invoke.</param>
275+ public TResult Dispatch<TResult>(Func<TResult> actionToInvoke)
276+ {
277+ return actionToInvoke();
278+ }
279+
280+ #endregion
281+
282+ #region Implementation of IDispatcher
283+
284+ /// <summary>
285+ /// Checks whether the thread invoking the method .
286+ /// </summary>
287+ /// <returns></returns>
288+ public bool DispatchRequired()
289+ {
290+ return false;
291+ }
292+
293+ #endregion
294+ }
295+}
296
297=== modified file 'src/Canonical.UbuntuOne.Common.Tests/Update/DownloadingPresenterFixture.cs'
298--- src/Canonical.UbuntuOne.Common.Tests/Update/DownloadingPresenterFixture.cs 2010-07-29 16:38:26 +0000
299+++ src/Canonical.UbuntuOne.Common.Tests/Update/DownloadingPresenterFixture.cs 2010-08-24 15:18:39 +0000
300@@ -1,4 +1,4 @@
301-/**
302+/*
303 * Copyright 2010 Canonical Ltd.
304 *
305 * This file is part of UbuntuOne on Windows.
306@@ -18,6 +18,7 @@
307 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
308 */
309 using System;
310+using Canonical.UbuntuOne.Common.Threading;
311 using Canonical.UbuntuOne.Common.Update;
312 using Microsoft.ApplicationBlocks.Updater;
313 using NUnit.Framework;
314@@ -31,6 +32,7 @@
315
316 private MockRepository _mocks;
317 private IDownloadingView _view;
318+ private IDispatcher _dispatcher;
319 private DownloadingPresenter _presenter;
320
321 #endregion
322@@ -42,6 +44,7 @@
323 {
324 _mocks = new MockRepository();
325 _view = _mocks.DynamicMock<IDownloadingView>();
326+ _dispatcher = new TestDispatcher();
327 _presenter = new DownloadingPresenter
328 {
329 View = _view
330@@ -78,6 +81,9 @@
331 {
332 SetupResult.For(_view.IsShown)
333 .Return(true);
334+ SetupResult.For(_view.ViewDispatcher)
335+ .Return(_dispatcher);
336+
337 _view.DownloadingMessage = UpdateResources.DownloadInProgress;
338 _view.Progress = (progress * DownloadingPresenter.MaximumValue) / total;
339 }
340@@ -98,6 +104,8 @@
341 .Return(false);
342 Expect.Call(() => _view.Show())
343 .Repeat.Once();
344+ SetupResult.For(_view.ViewDispatcher)
345+ .Return(_dispatcher);
346 _view.DownloadingMessage = UpdateResources.DownloadInProgress;
347 _view.Progress = (progress * DownloadingPresenter.MaximumValue) / total;
348 }
349@@ -112,6 +120,8 @@
350 {
351 using (_mocks.Record())
352 {
353+ SetupResult.For(_view.ViewDispatcher)
354+ .Return(_dispatcher);
355 _view.DownloadingMessage = UpdateResources.DownloadError;
356 _view.CloseButtonIsEnabled = true;
357 _view.Progress = DownloadingPresenter.MinimumValue;
358@@ -127,6 +137,8 @@
359 {
360 using (_mocks.Record())
361 {
362+ SetupResult.For(_view.ViewDispatcher)
363+ .Return(_dispatcher);
364 _view.DownloadingMessage = UpdateResources.DownloadCompleted;
365 _view.Progress = DownloadingPresenter.MaximumValue;
366 _view.Close();
367
368=== modified file 'src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj'
369--- src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj 2010-08-16 12:46:11 +0000
370+++ src/Canonical.UbuntuOne.Common/Canonical.UbuntuOne.Common.csproj 2010-08-24 15:18:39 +0000
371@@ -59,6 +59,8 @@
372 <Compile Include="Container\UnsatisfiedDependencyException.cs" />
373 <Compile Include="IAuthentication.cs" />
374 <Compile Include="OperationContracts\IEventNotifier.cs" />
375+ <Compile Include="Threading\IDispatcher.cs" />
376+ <Compile Include="Threading\WpfDispatcher.cs" />
377 <Compile Include="Utils\ApplicationWrapper.cs" />
378 <Compile Include="Utils\Explorer.cs" />
379 <Compile Include="Utils\ExplorerException.cs" />
380
381=== added directory 'src/Canonical.UbuntuOne.Common/Threading'
382=== added file 'src/Canonical.UbuntuOne.Common/Threading/IDispatcher.cs'
383--- src/Canonical.UbuntuOne.Common/Threading/IDispatcher.cs 1970-01-01 00:00:00 +0000
384+++ src/Canonical.UbuntuOne.Common/Threading/IDispatcher.cs 2010-08-24 15:18:39 +0000
385@@ -0,0 +1,48 @@
386+/*
387+ * Copyright 2010 Canonical Ltd.
388+ *
389+ * This file is part of UbuntuOne on Windows.
390+ *
391+ * UbuntuOne on Windows is free software: you can redistribute it and/or modify
392+ * it under the terms of the GNU Lesser General Public License version
393+ * as published by the Free Software Foundation.
394+ *
395+ * Ubuntu One on Windows is distributed in the hope that it will be useful,
396+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
397+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
398+ * GNU Lesser General Public License for more details.
399+ *
400+ * You should have received a copy of the GNU Lesser General Public License
401+ * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
402+ *
403+ * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
404+ */
405+using System;
406+
407+namespace Canonical.UbuntuOne.Common.Threading
408+{
409+ /// <summary>
410+ /// Provides a wrapper around the process of dispatching actions onto
411+ /// different threads, primarily for unit testing.
412+ /// </summary>
413+ public interface IDispatcher
414+ {
415+ /// <summary>
416+ /// Dispatches the specified action to the thread.
417+ /// </summary>
418+ /// <param name="actionToInvoke">The action to invoke.</param>
419+ void Dispatch(Action actionToInvoke);
420+
421+ /// <summary>
422+ /// Dispatches the specified action to the thread.
423+ /// </summary>
424+ /// <param name="actionToInvoke">The action to invoke.</param>
425+ TResult Dispatch<TResult>(Func<TResult> actionToInvoke);
426+
427+ /// <summary>
428+ /// Checks whether the thread invoking the method .
429+ /// </summary>
430+ /// <returns></returns>
431+ bool DispatchRequired();
432+ }
433+}
434
435=== added file 'src/Canonical.UbuntuOne.Common/Threading/WpfDispatcher.cs'
436--- src/Canonical.UbuntuOne.Common/Threading/WpfDispatcher.cs 1970-01-01 00:00:00 +0000
437+++ src/Canonical.UbuntuOne.Common/Threading/WpfDispatcher.cs 2010-08-24 15:18:39 +0000
438@@ -0,0 +1,89 @@
439+/*
440+ * Copyright 2010 Canonical Ltd.
441+ *
442+ * This file is part of UbuntuOne on Windows.
443+ *
444+ * UbuntuOne on Windows is free software: you can redistribute it and/or modify
445+ * it under the terms of the GNU Lesser General Public License version
446+ * as published by the Free Software Foundation.
447+ *
448+ * Ubuntu One on Windows is distributed in the hope that it will be useful,
449+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
450+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
451+ * GNU Lesser General Public License for more details.
452+ *
453+ * You should have received a copy of the GNU Lesser General Public License
454+ * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
455+ *
456+ * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
457+ */
458+
459+using System;
460+using System.Windows.Threading;
461+
462+namespace Canonical.UbuntuOne.Common.Threading
463+{
464+ /// <summary>
465+ /// This dispatcher is used at runtime by both Windows Forms and WPF. The WPF Dispatcher
466+ /// class works within Windows Forms, so this appears to be safe.
467+ /// </summary>
468+ public class WpfDispatcher : IDispatcher
469+ {
470+ private readonly Dispatcher _dispatcher;
471+
472+ /// <summary>
473+ /// Initializes a new instance of the <see cref="WpfDispatcher"/> class.
474+ /// </summary>
475+ public WpfDispatcher()
476+ : this(Dispatcher.CurrentDispatcher) { }
477+
478+ /// <summary>
479+ /// Initializes a new instance of the <see cref="WpfDispatcher"/> class.
480+ /// </summary>
481+ /// <param name="dispatcher">The dispatcher.</param>
482+ public WpfDispatcher(Dispatcher dispatcher)
483+ {
484+ _dispatcher = dispatcher;
485+ }
486+
487+ /// <summary>
488+ /// Dispatches the specified action to the thread.
489+ /// </summary>
490+ /// <param name="actionToInvoke">The action to invoke.</param>
491+ public void Dispatch(Action actionToInvoke)
492+ {
493+ if (!DispatchRequired())
494+ {
495+ actionToInvoke();
496+ }
497+ else
498+ {
499+ _dispatcher.Invoke(DispatcherPriority.Normal, actionToInvoke);
500+ }
501+ }
502+
503+ /// <summary>
504+ /// Dispatches the specified action to the thread.
505+ /// </summary>
506+ /// <typeparam name="TResult"></typeparam>
507+ /// <param name="actionToInvoke">The action to invoke.</param>
508+ /// <returns></returns>
509+ public TResult Dispatch<TResult>(Func<TResult> actionToInvoke)
510+ {
511+ if (_dispatcher.CheckAccess())
512+ {
513+ return actionToInvoke();
514+ }
515+ return (TResult)_dispatcher.Invoke(DispatcherPriority.Normal, actionToInvoke);
516+ }
517+
518+ /// <summary>
519+ /// Checks whether the thread invoking the method.
520+ /// </summary>
521+ /// <returns></returns>
522+ public bool DispatchRequired()
523+ {
524+ return !_dispatcher.CheckAccess();
525+ }
526+ }
527+}
528
529=== modified file 'src/Canonical.UbuntuOne.Common/Update/DotUpdaterWrapper.cs'
530--- src/Canonical.UbuntuOne.Common/Update/DotUpdaterWrapper.cs 2010-07-21 10:07:22 +0000
531+++ src/Canonical.UbuntuOne.Common/Update/DotUpdaterWrapper.cs 2010-08-24 15:18:39 +0000
532@@ -1,4 +1,4 @@
533-/**
534+/*
535 * Copyright 2010 Canonical Ltd.
536 *
537 * This file is part of UbuntuOne on Windows.
538@@ -39,12 +39,55 @@
539
540 #endregion
541
542+ #region Helpers
543+
544+ /// <summary>
545+ /// Helper used to propagate the event from the wrapped object.
546+ /// </summary>
547+ /// <param name="sender">The sender of the event.</param>
548+ /// <param name="args">The aruments about the completed task.</param>
549+ private void DownloadCompletedHandler(object sender, TaskEventArgs args)
550+ {
551+ if(OnDownloadCompleted != null)
552+ {
553+ OnDownloadCompleted(sender, args);
554+ }
555+ }
556+
557+ /// <summary>
558+ /// Helper used to propagate the event from the wrapped object.
559+ /// </summary>
560+ /// <param name="sender">The sender of the event.</param>
561+ /// <param name="args">The arguments with the completed information.</param>
562+ private void DownloadProgressHandler(object sender, DownloadTaskProgressEventArgs args)
563+ {
564+ if(OnDownloadProgress != null)
565+ {
566+ OnDownloadProgress(sender, args);
567+ }
568+ }
569+
570+ /// <summary>
571+ /// Helper used to propagate the event from the wrapped object.
572+ /// </summary>
573+ /// <param name="sender">The sender of the event.</param>
574+ /// <param name="args">The arguments with the error information.</param>
575+ private void DownloadErrorHandler(object sender, DownloadTaskErrorEventArgs args)
576+ {
577+ if(OnDownloadError != null)
578+ {
579+ OnDownloadError(sender, args);
580+ }
581+ }
582+
583+ #endregion
584+
585 public DotUpdaterWrapper(Logger logger, string rss)
586 {
587 _updater = new DotUpdater.Updater(logger, rss);
588- OnDownloadCompleted = _updater.OnDownloadCompleted;
589- OnDownloadProgress = _updater.OnDownloadProgress;
590- OnDownloadError = _updater.OnDownloadError;
591+ _updater.OnDownloadCompleted += DownloadCompletedHandler;
592+ _updater.OnDownloadProgress += DownloadProgressHandler;
593+ _updater.OnDownloadError += DownloadErrorHandler;
594 }
595
596 public UpdaterTask CheckForUpdates()
597
598=== modified file 'src/Canonical.UbuntuOne.Common/Update/DownloadingPresenter.cs'
599--- src/Canonical.UbuntuOne.Common/Update/DownloadingPresenter.cs 2010-08-05 08:01:59 +0000
600+++ src/Canonical.UbuntuOne.Common/Update/DownloadingPresenter.cs 2010-08-24 15:18:39 +0000
601@@ -1,4 +1,4 @@
602-/**
603+/*
604 * Copyright 2010 Canonical Ltd.
605 *
606 * This file is part of UbuntuOne on Windows.
607@@ -75,10 +75,18 @@
608 /// <param name="args">The arguments that provide information regarding the changes in the download.</param>
609 public void DownloadProgressHandler(object sender, DownloadTaskProgressEventArgs args)
610 {
611- if(!View.IsShown)
612- View.Show();
613- View.DownloadingMessage = UpdateResources.DownloadInProgress;
614- View.Progress = (args.BytesTransferred * MaximumValue) / args.BytesTotal;
615+ if (!View.IsShown)
616+ {
617+ // dispatch to the correct thread to show the view
618+ View.ViewDispatcher.Dispatch(() => View.Show());
619+ }
620+ // dispatch to the correct thread to set the data
621+ View.ViewDispatcher.Dispatch(
622+ () =>
623+ {
624+ View.DownloadingMessage = UpdateResources.DownloadInProgress;
625+ View.Progress = (args.BytesTransferred * MaximumValue) / args.BytesTotal;
626+ });
627 }
628
629 /// <summary>
630@@ -88,9 +96,13 @@
631 /// <param name="args">The arguments that provide information regarding the error.</param>
632 public void DownloadErrorHandler(object sender, DownloadTaskErrorEventArgs args)
633 {
634- View.DownloadingMessage = UpdateResources.DownloadError;
635- View.Progress = MinimumValue;
636- View.CloseButtonIsEnabled = true;
637+ View.ViewDispatcher.Dispatch(
638+ () =>
639+ {
640+ View.DownloadingMessage = UpdateResources.DownloadError;
641+ View.Progress = MinimumValue;
642+ View.CloseButtonIsEnabled = true;
643+ });
644 }
645
646 /// <summary>
647@@ -100,11 +112,15 @@
648 /// <param name="e">The arguments that provide more information about the comleted task.</param>
649 public void DownloadUpdateCompleted(object sender, TaskEventArgs e)
650 {
651- View.DownloadingMessage = UpdateResources.DownloadCompleted;
652- View.Progress = MaximumValue;
653+ View.ViewDispatcher.Dispatch(
654+ () =>
655+ {
656+ View.DownloadingMessage = UpdateResources.DownloadCompleted;
657+ View.Progress = MaximumValue;
658+ });
659 // let the user know
660 Thread.Sleep(100);
661- View.Close();
662+ View.ViewDispatcher.Dispatch(() => View.Close());
663 }
664 }
665 }
666
667=== modified file 'src/Canonical.UbuntuOne.Common/Update/IDownloadingView.cs'
668--- src/Canonical.UbuntuOne.Common/Update/IDownloadingView.cs 2010-07-29 16:33:39 +0000
669+++ src/Canonical.UbuntuOne.Common/Update/IDownloadingView.cs 2010-08-24 15:18:39 +0000
670@@ -1,4 +1,4 @@
671-/**
672+/*
673 * Copyright 2010 Canonical Ltd.
674 *
675 * This file is part of UbuntuOne on Windows.
676@@ -17,6 +17,8 @@
677 *
678 * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
679 */
680+using Canonical.UbuntuOne.Common.Threading;
681+
682 namespace Canonical.UbuntuOne.Common.Update
683 {
684 /// <summary>
685@@ -25,6 +27,12 @@
686 public interface IDownloadingView
687 {
688 /// <summary>
689+ /// Gets the dispatcher that can be used to call actions on the object from a
690+ /// different thread.
691+ /// </summary>
692+ IDispatcher ViewDispatcher { get; }
693+
694+ /// <summary>
695 /// Gets and sets if the close button is enabled.
696 /// </summary>
697 bool CloseButtonIsEnabled { get; set; }
698
699=== modified file 'src/Canonical.UbuntuOne.Common/Update/IUpdatingPresenter.cs'
700--- src/Canonical.UbuntuOne.Common/Update/IUpdatingPresenter.cs 2010-08-05 07:13:28 +0000
701+++ src/Canonical.UbuntuOne.Common/Update/IUpdatingPresenter.cs 2010-08-24 15:18:39 +0000
702@@ -1,4 +1,4 @@
703-/**
704+/*
705 * Copyright 2010 Canonical Ltd.
706 *
707 * This file is part of UbuntuOne on Windows.
708
709=== modified file 'src/Canonical.UbuntuOne.Common/Update/IUpdatingView.cs'
710--- src/Canonical.UbuntuOne.Common/Update/IUpdatingView.cs 2010-08-05 08:15:00 +0000
711+++ src/Canonical.UbuntuOne.Common/Update/IUpdatingView.cs 2010-08-24 15:18:39 +0000
712@@ -1,20 +1,24 @@
713-// Copyright 2010 Canonical Ltd.
714-//
715-// This file is part of UbuntuOne on Windows.
716-//
717-// UbuntuOne on Windows is free software: you can redistribute it and/or modify
718-// it under the terms of the GNU Lesser General Public License version
719-// as published by the Free Software Foundation.
720-//
721-// Ubuntu One on Windows is distributed in the hope that it will be useful,
722-// but WITHOUT ANY WARRANTY; without even the implied warranty of
723-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
724-// GNU Lesser General Public License for more details.
725-//
726-// You should have received a copy of the GNU Lesser General Public License
727-// along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
728-//
729-// Authors: Manuel de la Peña <manuel.delapena@canonical.com>
730+/*
731+ * Copyright 2010 Canonical Ltd.
732+ *
733+ * This file is part of UbuntuOne on Windows.
734+ *
735+ * UbuntuOne on Windows is free software: you can redistribute it and/or modify
736+ * it under the terms of the GNU Lesser General Public License version
737+ * as published by the Free Software Foundation.
738+ *
739+ * Ubuntu One on Windows is distributed in the hope that it will be useful,
740+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
741+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
742+ * GNU Lesser General Public License for more details.
743+ *
744+ * You should have received a copy of the GNU Lesser General Public License
745+ * along with UbuntuOne for Windows. If not, see <http://www.gnu.org/licenses/>.
746+ *
747+ * Authors: Manuel de la Peña <manuel.delapena@canonical.com>
748+ */
749+
750+using Canonical.UbuntuOne.Common.Threading;
751
752 namespace Canonical.UbuntuOne.Common.Update
753 {
754@@ -25,6 +29,12 @@
755 public interface IUpdatingView
756 {
757 /// <summary>
758+ /// Gets the dispatcher that can be used to call actions on the object from a
759+ /// different thread.
760+ /// </summary>
761+ IDispatcher ViewDispatcher { get; }
762+
763+ /// <summary>
764 /// Gets and sets if the view is visible
765 /// </summary>
766 bool IsShown { get; }
767
768=== modified file 'src/Canonical.UbuntuOne.Common/Update/Updater.cs'
769--- src/Canonical.UbuntuOne.Common/Update/Updater.cs 2010-08-05 07:13:28 +0000
770+++ src/Canonical.UbuntuOne.Common/Update/Updater.cs 2010-08-24 15:18:39 +0000
771@@ -154,7 +154,7 @@
772 private void DownloadErrorHandler(object sender, DownloadTaskErrorEventArgs args)
773 {
774 Logger.Error(args.Exception.Message);
775- throw new SelfUpdateException(UpdateResources.DownloadError, args.Exception);
776+ //throw new SelfUpdateException(UpdateResources.DownloadError, args.Exception);
777 }
778
779 /// <summary>
780@@ -240,7 +240,6 @@
781 try
782 {
783 _downloadingUpdate = true;
784- DotUpdater.BeginDownload(_task);
785 // provide the handler for the progress of the download as well as the
786 // error and finish
787 DotUpdater.OnDownloadProgress += DownloadingPresenter.DownloadProgressHandler;
788@@ -252,6 +251,7 @@
789 // one for the updater that will handle the error.
790 DotUpdater.OnDownloadError += DownloadingPresenter.DownloadErrorHandler;
791 DotUpdater.OnDownloadError += DownloadErrorHandler;
792+ DotUpdater.BeginDownload(_task);
793 }
794 catch (UpdaterException e)
795 {
796
797=== modified file 'src/Canonical.UbuntuOne.Common/objects.xml'
798--- src/Canonical.UbuntuOne.Common/objects.xml 2010-08-02 14:31:39 +0000
799+++ src/Canonical.UbuntuOne.Common/objects.xml 2010-08-24 15:18:39 +0000
800@@ -29,7 +29,7 @@
801 type="Canonical.UbuntuOne.Common.Update.Updater, Canonical.UbuntuOne.Common"
802 autowire="autodetect">
803 <property name="RSSFeed"
804- value="http://path/to/rss.feed"/> <!-- Provide a way to set this through config ????-->
805+ value="http://s3.amazonaws.com/u1wintest/rss"/> <!-- Provide a way to set this through config ????-->
806 </object>
807
808 <!-- ######################################################################################## -->
809
810=== modified file 'src/UbuntuOneClient/objects.xml'
811--- src/UbuntuOneClient/objects.xml 2010-07-30 16:32:54 +0000
812+++ src/UbuntuOneClient/objects.xml 2010-08-24 15:18:39 +0000
813@@ -5,7 +5,7 @@
814 type="Canonical.UbuntuOne.Common.Update.Updater, Canonical.UbuntuOne.Common"
815 autowire="autodetect">
816 <property name="RSSFeed"
817- value="http://path/to/rss.feed"/>
818+ value="http://s3.amazonaws.com/u1wintest/rss"/>
819 </object>
820
821 <object id="Application"
822
823=== modified file 'utils/rss_templates.py'
824--- utils/rss_templates.py 2010-07-29 12:20:01 +0000
825+++ utils/rss_templates.py 2010-08-24 15:18:39 +0000
826@@ -7,8 +7,8 @@
827 - version
828 - enclosure url
829 - enclosure lenght
830- - sha
831-
832+ - md5
833+ - uuid
834 """
835
836 from string import Template
837@@ -21,16 +21,16 @@
838 <generator>WiX Toolset's ClickThrough for Isolated Applications</generator>
839 <lastBuildDate>$lastBuildDate</lastBuildDate>
840 <ttl>1440</ttl>
841- <as:application type="application/vnd.ms-msi">7bb74cea-a4a3-4904-9706-8f4dc764b368</as:application>
842+ <as:application type="application/vnd.ms-msi">bd2e11b5-5e83-45e4-88cd-4f7c414d71c7</as:application>
843 <item>
844- <guid isPermaLink="false">urn:msi:7bb74cea-a4a3-4904-9706-8f4dc764b368/$version</guid>
845+ <guid isPermaLink="false">urn:msi:bd2e11b5-5e83-45e4-88cd-4f7c414d71c7/$version</guid>
846 <pubDate>$pubDate</pubDate>
847 <title>Ubuntu One Windows Client</title>
848 <description>Ubuntu One Windows Client</description>
849- <as:application type="application/vnd.ms-msi">58cdea62-96b2-482b-b046-d884583c8ccd</as:application>
850+ <as:application type="application/vnd.ms-msi">$uuid</as:application>
851 <as:version>$version</as:version>
852 <enclosure url="$url" length="$lenght" type="application/octet-stream" />
853- <as:digest algorithm="sha256">$sha</as:digest>
854+ <as:digest algorithm="md5">$md5</as:digest>
855 </item>
856 </channel>
857 </rss>
858
859=== modified file 'utils/upload_new_update.py'
860--- utils/upload_new_update.py 2010-07-29 12:20:01 +0000
861+++ utils/upload_new_update.py 2010-08-24 15:18:39 +0000
862@@ -3,10 +3,12 @@
863
864 """This utilities release an Ubuntu One windows update."""
865
866+import base64
867+import hashlib
868 import os
869+import sys
870 import time
871-import hashlib
872-import sys
873+from uuid import uuid1
874
875 import boto
876 from boto.s3.key import Key
877@@ -20,18 +22,16 @@
878 RSS_FILE_NAME = 'rss'
879
880
881-def upload_package(bucket, filename):
882+def upload_package(bucket, filename, rss_params):
883 """Upload the package"""
884- try:
885- print 'Removing %s...' % filename
886- bucket.delete_key(filename)
887- except S3ResponseError:
888- print 'No previous upload.'
889- print 'Uploading %s...' % filename
890 k = Key(bucket)
891- k.key = filename
892+ path = filename.split('\\')
893+ name = path[len(path) -1]
894+ keyname = rss_params['version'] + '/' + name
895+ k.key = keyname
896+ print 'Uploading %s...' % name
897 k.set_contents_from_filename(filename)
898- bucket.set_acl('public-read', filename)
899+ bucket.set_acl('public-read', keyname)
900 print "Uploaded!"
901
902
903@@ -40,8 +40,10 @@
904 now = time.strftime('%d %b %Y %H:%M:%S %Z')
905 rss_params['lastBuildDate'] = rss_params['pubDate'] = now
906 fd = open(filename,'r')
907- rss_params['sha'] = hashlib.sha1(fd.read()).hexdigest()
908+ md5_hash = hashlib.md5(fd.read()).digest()
909+ rss_params['md5'] = base64.urlsafe_b64encode(md5_hash)
910 rss_params['lenght'] = os.path.getsize(filename)
911+ rss_params['url'] = rss_params['url']
912 try:
913 print 'Removing rss...'
914 bucket.delete_key(RSS_FILE_NAME)
915@@ -64,7 +66,7 @@
916 conn = boto.connect_s3()
917 print 'Connected!'
918 bucket = conn.get_bucket(BUCKET)
919- upload_package(bucket, filename)
920+ upload_package(bucket, filename, rss_params)
921 upload_rss(bucket, filename, rss_params)
922
923
924@@ -80,4 +82,5 @@
925 rss_params = {}
926 rss_params['version'] = argv[2]
927 rss_params['url'] = argv[3]
928+ rss_params['uuid'] = str(uuid1())
929 sys.exit(main(filename=argv[1], rss_params=rss_params))

Subscribers

People subscribed via source and target branches

to all changes: