[CT-775] [Enhancement] `dbt deps` does not correctly resolve local dependency of local dependency
- Dominant language
- Rust
- Stars
- 13.8k
- Forks
- 2.6k
- Avg merge
- 21h 31m
- Merged PRs (30d)
- 56
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Current Behavior
Suppose there are the following [local dependency](https://docs.getdbt.com/docs/building-a-dbt-project/package-management#local-packages) relations: `pkg1` => `pkg2` => `pkg3`.
Then, the directory of `pkg3` is specified by `packages.yml` file of `pkg2`. But, when running `dbt deps` in `pkg1`, `pkg3` is searched from `pkg1`'s directory, not from `pkg2`'s directory.
### Expected Behavior
The directory of `pkg3` should be resolved from `pkg2`'s directory, so that `pkg3` can be found regardless of the location of `pkg1`.
### Steps To Reproduce
I've prepared a minimal repro: https://github.com/skirino/dbt_local_dep_path_issue
1. `git clone https://github.com/skirino/dbt_local_dep_path_issue.git`
2. `cd dbt_local_dep_path_issue/b/c`
3. `dbt deps`
```
[2022-06-27 21:01:17] $ dbt deps [~/tmp/dbt_local_dep_path_issue/b/c] 0s
12:01:20 Running with dbt=1.1.1
12:01:21 Encountered an error:
Runtime Error
no dbt_project.yml found at expected path /Users/skirino/tmp/dbt_local_dep_path_issue/b/common2/dbt_project.yml
```
### Relevant log output
_No response_
### Environment
```markdown
- OS: macOS 12.4
- Python: 3.7.13
- dbt: 1.1.1
```
### What database are you using dbt with?
snowflake
### Additional Context
This is the same issue as described in https://github.com/dbt-labs/dbt-core/issues/4538#issuecomment-1127034448, but I think it deserves a separate issue.
Contributor guide
Assessment
This issue has not been assessed yet.