checkout: move the code to cffi

As part of this, make the strategy part of **kwargs, in preparation for
supporting more options.
checkout: add support for overriding the target directory