basho/riak — pull request #204 by jaredmorrow (2012-08-11 06:19:36+00:00)
Title: Fix `platform_lib_dir` definition in packages to compare with devrel settings

## Issue

In devrel and source builds, `platform_lib_dir` gets set to the `lib` directory that is created by reltool. In all packages though, this directory is copied along with the `releases` and `erts-*` directories into the system lib directory. So in all packages `platform_lib_dir` gets defined as a top level directory containing `lib`, `releases`, and `erts-*`. The `riak` script attempts to set the load paths based on this `platform_lib_dir` setting so source builds act differently than package builds.

See: basho/riak#126

## Change

This change fixes that inconsistency and defines a new variable `platform_base_dir` as the new system lib directory. `platform_lib_dir` is then defined as `platform_base_dir/lib` to match up with devrel/source builds.

## Testing

This is easy to test by checking which etop is being called.

### Riak 1.2.0 test results (on Ubuntu 12.04)

```shell
(riak@127.0.0.1)2> code:which(etop_txt).
"/usr/lib/riak/lib/observer-1.1/ebin/etop_txt.beam"

(riak@127.0.0.1)3> code:get_path().
[".","/usr/lib/riak/lib/kernel-2.15.1/ebin",
"/usr/lib/riak/lib/stdlib-1.18.1/ebin",
"/usr/lib/riak/lib/sasl-2.2.1/ebin",
"/usr/lib/riak/lib/crypto-2.1/ebin",
# no basho-patches listed
"/usr/lib/riak/lib/riak_api-1.2.0/ebin",
"/usr/lib/riak/lib/cluster_info-1.2.2/ebin",
[...]|...]
```

### Package built from this branch results (also on Ubuntu 12.04)

```shell
(riak@127.0.0.1)1> code:which(etop_txt).
"/usr/lib/riak/lib/basho-patches/etop_txt.beam"

(riak@127.0.0.1)2> code:get_path().
["/usr/lib/riak/lib/basho-patches",".",
"/usr/lib/riak/lib/kernel-2.15.1/ebin",
"/usr/lib/riak/lib/stdlib-1.18.1/ebin",

"/usr/lib/riak/lib/riak_search-1.2.0/ebin",
"/usr/lib/riak/lib/riak_api-1.2.0/ebin",
[...]|...]
(riak@127.0.0.1)3>
```

In addition to make sure nothing else got borked in the process, I tested start/stop/ping, riak-admin test and uninstall package (to make sure directories are cleaned up). The only platform tested was Ubuntu 12.04, so additional platforms should be tested.