On 09.11.2013, at 00:19, Andre LaBranche <dre@apple.com> wrote:


On Nov 8, 2013, at 1:39 PM, Bernhard Spinnler <Bernhard.Spinnler@gmx.net> wrote:

BTW: ./run -I chokes on the same error ./run -i does. ./run -b completes successfully, but when I start caldavd twisted fails for some reason. I could provide details in case of interest. For now I will just ./run -n in place.

run -b is designed to produce a fully self-contained 'root' of Calendar Server and all its dependencies (all the way down to python!). It is currently used only for a very specific deployment, under very specific conditions, and has not been tested or qualified for general purpose use. Having said that, please feel free to experiment. I can't think of any reason why it would necessarily break outside of the current (internal) use case.

When using run -b, supply a path at which the root is to be installed; e.g. ./run -b /whatever/foo/bar/CalendarServer. I would recommend against using "/" or "/usr/local", at least until you are experienced with the behavior of this mode of operation, and are confident that you won't stomp something that shouldn't be stomped. Once again, I am reiterating that run -b is not that smart - it always builds / installs the same set of deps, and it's probably not going to keep you from shooting your legs off if you point it in the wrong direction.

To actually use the resulting root, it's expected that the invoking shell has sourced the environment.sh file which is produced by run -b and lives in the root's installation directory. I tried this just now, and it seems to work on Mavericks enough to build / install the root at the supplied directory. After sourcing the environment.sh file, I can run one of our support tools in 'bin' without throwing any Python tracebacks, which means all of our modules are being found and loaded. I stopped short of actually trying to run the service, as that would involve provisioning a postgres cluster somewhere and doctoring up a new config file.


Setting up the environment via sourcing environment.sh changed something but still doesn't seem to work correctly for me. I can run python from the bin directory, but running caldavd throws the following error on me:

Greece:bin Admin$ ./caldavd 
Traceback (most recent call last):
  File "/Users/Admin/Tmp/cs/bin/twistd", line 5, in <module>
    pkg_resources.run_script('Twisted==12.3.0', 'twistd')
  File "build/bdist.macosx-10.4-x86_64/egg/pkg_resources.py", line 489, in run_script
  File "build/bdist.macosx-10.4-x86_64/egg/pkg_resources.py", line 1207, in run_script
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/EGG-INFO/scripts/twistd", line 14, in <module>
    run()
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/scripts/twistd.py", line 27, in run
    app.run(runApp, ServerOptions)
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/application/app.py", line 647, in run
    config.parseOptions()
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/application/app.py", line 614, in parseOptions
    usage.Options.parseOptions(self, options)
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/python/usage.py", line 261, in parseOptions
    for (cmd, short, parser, doc) in self.subCommands:
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/application/app.py", line 631, in subCommands
    for plug in sorted(plugins, key=attrgetter('tapname')):
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/twisted/plugins/caldav.py", line 31, in getProperty
    return getattr(reflect.namedClass(self.serviceMakerClass), propname)
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/python/_reflectpy3.py", line 95, in namedObject
    module = namedModule('.'.join(classSplit[:-1]))
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/Twisted-12.3.0-py2.7-macosx-10.4-x86_64.egg/twisted/python/_reflectpy3.py", line 82, in namedModule
    topLevel = __import__(name)
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/calendarserver/tap/caldav.py", line 78, in <module>
    from twistedcaldav.upgrade import UpgradeFileSystemFormatStep, PostDBImportStep
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/twistedcaldav/upgrade.py", line 41, in <module>
    from twistedcaldav.directory.appleopendirectory import OpenDirectoryService
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/twistedcaldav/directory/appleopendirectory.py", line 43, in <module>
    from calendarserver.platform.darwin.od import opendirectory, dsattributes, dsquery
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/calendarserver/platform/darwin/od/opendirectory.py", line 21, in <module>
    import odframework
  File "/Users/Admin/Tmp/cs/lib/python2.7/site-packages/calendarserver/platform/darwin/od/odframework.py", line 1, in <module>
    import objc as _objc
ImportError: No module named objc

I'm not particularly keen on getting this to work (I'm fine with run -n). So don't feel obliged to help. But if it helps I could make some more tests.

Best,
Bernhard