Merge lp:~mikemc/ubuntuone-control-panel/launchdaemon into lp:ubuntuone-control-panel
Status: | Merged |
---|---|
Approved by: | Mike McCracken |
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) | Approve | ||
Roberto Alsina (community) | Approve | ||
Review via email: mp+124847@code.launchpad.net |
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.
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