basho/riak — pull request #347 by jaredmorrow (2013-06-28 17:50:03+00:00)
Title: Include leveldb source code in riak source distribution

When building riak's source tarball, `git archive` is used
to ensure clean repositories are used rather than working
directories that might have uncommited changes. This works
fine except for one special case where eleveldb downloads
leveldb into its source tree. In this case 'git archive'
then removes the leveldb source because it is not truly
a committed file in eleveldb's repository.

The side effect of this issue are users who try to build
riak from source while either offline or without access
to github while building. Any build will fail because
eleveldb does not have leveldb's source tree that is needed.

This commit fixes that by using a work around to `git archive`
in the one special case of eleveldb. The `.git` directories
are still cleaned, but the leveldb source tree is left intact.

The one downside to this change is eleveldb is not treated
differently than every other repository and local changes
to eleveldb's source tree can possibly leak into the source
tarball. This however is very unlikely due to `make dist`
using a completely separate `make deps` chain than the standard
developer `make deps`. Basically someone would have to really
try hard to mess it up.

This addresses basho/riak#345

#### How to Test

Here is the already built source tarball of this branch: https://dl.dropboxusercontent.com/u/183971/riak-1.4.0rc1-ad85a134.tar.gz

Here is the link to the 1.4.0rc1 source tarball: http://s3.amazonaws.com/downloads.basho.com/riak/1.4/1.4.0rc1/riak-1.4.0rc1.tar.gz

* download each source tarball
* unpack each tarball
* disconnect your network or add "127.0.0.1 github.com" to your `/etc/hosts` file
* in each untarred directory try to `make rel`

The 1.4.0rc1 tar will fail, the new one will pass.

#### My testing

I've built this on all platforms to prove I didn't add any platform incompatibilities with my `find` call. The passing builds can be seen here:

![screen shot 2013-06-27 at 11 26 28 pm](https://f.cloud.github.com/assets/718326/723534/986592e0-e01a-11e2-961d-eaf61d332368.png)

I also compared the `tree` output of the two different source builds by running `make dist` on `riak-1.4.0rc1` and `jem-dist-include-leveldb` to make sure the `.git` directories were still cleaned and no other files were lost in the change.

I added the one 'gotcha' to the commit text that mentions eleveldb being handled differently than all other repos. It would be next to impossible to accidentally build working-copy code even with this change as toplevel is still clean cloned to `distdir/riak-clone` directory before these changed steps even happen.