Merge lp:~mikemc/ubuntuone-control-panel/launchdaemon into lp:ubuntuone-control-panel
| Status: | Merged |
|---|---|
| Approved by: | Mike McCracken on 2012-09-28 |
| Approved revision: | 361 |
| Merged at revision: | 360 |
| Proposed branch: | lp:~mikemc/ubuntuone-control-panel/launchdaemon |
| Merge into: | lp:ubuntuone-control-panel |
| Diff against target: |
663 lines (+601/-0) 2 files modified
ubuntuone/controlpanel/utils/darwin.py (+375/-0) ubuntuone/controlpanel/utils/tests/test_darwin.py (+226/-0) |
| To merge this branch: | bzr merge lp:~mikemc/ubuntuone-control-panel/launchdaemon |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Manuel de la Peña (community) | 2012-09-24 | Approve on 2012-09-26 | |
| Roberto Alsina (community) | 2012-09-18 | Approve on 2012-09-19 | |
|
Review via email:
|
|||
Commit Message
- Darwin: use ServiceManagement API to securely install, check versions, and upgrade root fsevents daemon.
Description of the Change
- Darwin: use ServiceManagement API to securely install, check versions, and upgrade root fsevents daemon.
** NOTES ABOUT WHAT IS GOING ON HERE **
This calls a bunch of CoreFoundation APIs using ctypes so the first 140 lines or so of the diff are ctypes boilerplate that sets up the types for the CF functions.
start reading at check_and_
This function compares the version of the daemon that's packaged in the app's bundle (at daemon_path) to the version that's installed, if it exists.
If the installed one is the same, we're done. If it's newer, we raise an exception.
If it's older, we remove it. Then we install the new one.
The twist in this method is that we have to get authorization (show a dialog box) once to remove the old job, and then kill that authorization (calling AuthorizationFree with the kAuthorizationF
Nothing else is all that tricky, the other functions are just wrapping a CoreFoundation call and checking the error message.
-- about CFShow: I had half a day of unicode annoyance trying to get the error description copied into a printable python string, and gave up and used CFShow. It just prints the description to stdout. It's the CF equivalent of NSLog or 'print'. It's sufficient to get the error messages somewhere readable.
-- About CFRelease(): the rule is that if you call a function that has "create" or "copy" in its name, then you'll need to release its return value. If you call a function that has "get", you don't own it and shouldn't release it.
-- about get_authorizati
** notes on testing **
This includes new tests in ubuntuone/
Those tests pass for me, but trunk still has some failing tests in share_links.py, which are unrelated.
pylint doesn't work right for me on darwin, but this branch adds no new pyflakes errors.
To IRL-test, talk to mmcc on IRC, or use the bundles I've built.
Building the bundle correctly with code signing - but not using my cert - will require changing the cert CN in the code for the daemon (in a branch not in trunk there) as well as the setup-mac script.
Using my bundles, here's how to test:
(Note that you need to have the line saying 'fs_monitor.
Test that running the app installs a daemon using this:
% sudo launchctl list com.ubuntu.
remove it with
% sudo launchctl remove com.ubuntu.
then install an old version of the daemon by running an old build of the app. Not the alpha 1, it didn't have this branch. -- Again, talk to me, I have an old one laying around.
Then run the new one again, with U1_DEBUG=1 and look at the log, does it say it found 1.0 and replaced it with 1.1? Then it worked.
Also, does the file sync work? Only version 1.1 of the fsevents daemon correctly sends events to the client.
| Mike McCracken (mikemc) wrote : | # |
| Roberto Alsina (ralsina) wrote : | # |
Tested IRL and read the code. AFAICS it looks good.
| Manuel de la Peña (mandel) wrote : | # |
In the following code:
354 + try:
355 + remove_
356 + except Exception, e:
357 + logger.
358 +
359 + AuthorizationFr
shouldn't the Free be called in a finally clause?
In the InstallDaemonTe
469 + self._patch_
470 + [('get_
471 + ('remove_
472 + ('install_
473 + ('Authorization
| Mike McCracken (mikemc) wrote : | # |
We just log that exception and don't re-raise it, so no - we will always call that AuthorizationFree.
The repeated patch call is now in setup.
| Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
The attempt to merge lp:~mikemc/ubuntuone-control-panel/launchdaemon into lp:ubuntuone-control-panel failed. Below is the output from the failed tests.
*** Running DBus test suite ***
ubuntuone.
BaseTestCase
runTest ... [OK]
DBusServiceMa
test_
test_
DBusServiceTe
test_
test_
test_
test_
test_
test_
test_
test_
FileSyncTestCase
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
OperationsAut
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_
test_star...
- 361. By Mike McCracken on 2012-09-28
-
fix lint errors


If you want to review this before I wake up, here's a signed build with this branch that just uploaded itself: http:// ubuntuone. com/4KKHgfhAK46 ABkOuvrdZci