basho/riak_cs — pull request #687 by jaredmorrow (2013-10-03 21:23:02+00:00)
Title: Bugfix/jem debian missing repl cs ee

## Description

During build of debian packages, the environment is cleaned by debuild
by setting all environmental variables to "". This fact made the
passing of RIAK_CS_EE_DEPS variable work on accident until the `[]->false`
pattern was added to the rebar.config.script. Though adding that
pattern fixed the OSS build, it did break debian package builds.

This commit fixes this by removing that check, but also not
automatically exporting the RIAK_CS_EE_DEPS makefile since an export
will export an empty variable and the rebar.config.script can now
trigger on an empty setting again.

Calling `unset RIAK_CS_EE_DEPS` is the only way to build an OSS
build after previously exporting the variable for riak-cs-ee.

In addtion a flag is passed into the debian's debuild so when
it RIAK_CS_EE_DEPS is available even when the environment is cleaned.

## Testing

Testing this is really annoying, so I did it myself and recorded my steps if anyone wants to sanity check.

### Case of unset variable

```
$ unset RIAK_CS_EE_DEPS
$ env | grep RIAK_CS_EE_DEPS

# Confirm rebar works w/o make
$ ./rebar get-deps
Building riak-cs
==> rel (get-deps)
==> riak_cs (get-deps)

# Confirm same with make
$ make deps
Building riak-cs
==> rel (get-deps)
==> riak_cs (get-deps)

# Confirm package does not build EE version
$ make dist
Building riak-cs

tar -C package -czf package/riak-cs-1.4.1.7.g9299226.tar.gz riak-cs-1.4.1.7.g9299226
cp package/riak-cs-1.4.1.7.g9299226.tar.gz .
# confirm make didn't add a variable and cause submake to build EE
$ diff pkg.vars.config package/riak-cs-1.4.1.7.g9299226/pkg.vars.config
$ grep package_name pkg.vars.config
{package_name, "riak-cs"}.
$ tar -tzf package/riak-cs-1.4.1.7.g9299226.tar.gz | grep riak_repl
```

### Case of set variable

```
$ export RIAK_CS_EE_DEPS=true
$ env | grep RIAK_CS_EE_DEPS
RIAK_CS_EE_DEPS=true
$ ./rebar get-deps
Building riak-cs-ee
==> rel (get-deps)
==> riak_cs (get-deps)

$ make dist
Building riak-cs-ee
==> rel (get-deps)
==> riak_cs (get-deps)

tar -C package -czf package/riak-cs-1.4.1.7.g9299226.tar.gz riak-cs-1.4.1.7.g9299226
cp package/riak-cs-1.4.1.7.g9299226.tar.gz .
$ diff pkg.vars.config package/riak-cs-1.4.1.7.g9299226/pkg.vars.config
$ grep package_name pkg.vars.config
{package_name, "riak-cs-ee"}.
$ tar -tzf package/riak-cs-1.4.1.7.g9299226.tar.gz| grep riak_repl

riak-cs-1.4.1.7.g9299226/deps/riak_repl_pb_api/src/riak_repl_pb_api.app.src
riak-cs-1.4.1.7.g9299226/deps/riak_repl_pb_api/src/riak_repl_pb_api.erl
riak-cs-1.4.1.7.g9299226/deps/riak_repl_pb_api/priv/vsn.git

```

#### Testing package on Ubuntu

```
$ git checkout bugfix/jem-debian-missing-repl-cs-ee
Branch bugfix/jem-debian-missing-repl-cs-ee set up to track remote branch bugfix/jem-debian-missing-repl-cs-ee from origin.
Switched to a new branch 'bugfix/jem-debian-missing-repl-cs-ee'
$ uname -a
Linux build-ubuntu-1204-64 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ env | grep RIAK_CS_EE_DEPS
$ export RIAK_CS_EE_DEPS=true
$ env | grep RIAK_CS_EE_DEPS
RIAK_CS_EE_DEPS=true
$ make package
Building riak-cs-ee
==> rel (get-deps)
==> riak_cs (get-deps)

$ dpkg-deb -c package/packages/riak-cs-ee_1.4.1.10.g028bb83-1_amd64.deb | grep riak_repl

-rw-r--r-- root/root 7532 2013-10-03 16:51 ./usr/lib/riak-cs/lib/riak_repl_pb_api-0.2.3/ebin/riak_repl_pb_api.beam
-rw-r--r-- root/root 255 2013-10-03 16:51 ./usr/lib/riak-cs/lib/riak_repl_pb_api-0.2.3/ebin/riak_repl_pb_api.app
-rw-r--r-- root/root 12520 2013-10-03 16:51 ./usr/lib/riak-cs/lib/riak_repl_pb_api-0.2.3/ebin/riak_repl_pb.beam
drwxr-xr-x root/root 0 2013-10-03 16:51 ./usr/lib/riak-cs/lib/riak_repl_pb_api-0.2.3/include/
-rw-r--r-- root/root 690 2013-10-03 16:51 ./usr/lib/riak-cs/lib/riak_repl_pb_api-0.2.3/include/riak_repl_pb.hrl
```

### Case of empty variable, but set (should act same as set variable)

```
$ export RIAK_CS_EE_DEPS=
$ env | grep RIAK_CS_EE_DEPS
RIAK_CS_EE_DEPS=
$ ./rebar get-deps
Building riak-cs-ee
==> rel (get-deps)
==> riak_cs (get-deps)

$ make deps
Building riak-cs-ee
==> rel (get-deps)

```