fix copy-packages

`copy-packages` assumes that the `$ROOT` is exactly 6 levels deep, but this isn't always the case. This pull request calculates the depth so that the package names can be found. This should address #314