Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows package cache root switch does only work with "{root}" not this.root #1065

Closed
nebukadhezer opened this issue Apr 21, 2021 · 6 comments · Fixed by #1076
Closed

windows package cache root switch does only work with "{root}" not this.root #1065

nebukadhezer opened this issue Apr 21, 2021 · 6 comments · Fixed by #1076

Comments

@nebukadhezer
Copy link

The package cache root switch does not work with this.root in an envvar under windows.
Only if the the var is being set with "{root}/whatnot" the root switch to the local payload works.

The payload copy does work, only when resolving it wont use the local data even with REZ_READ_PACKAGE_CACHE=1
Changing the package from this.root to "{root}" will make it work.

@nerdvegas
Copy link
Contributor

Thanks, I'm gonna make it priority to fix this.

@nebukadhezer
Copy link
Author

I tried to find the root (ha, what a semantic coincidence) of this, but with no success, still getting into the code base and reading.
Maybe it is the typical backslash windows exception... this.root was always used in conjunction with os.path.join ....
Would love to be able to make a PR but I am just not up to speed with REZ.

@nebukadhezer
Copy link
Author

https://github.com/nerdvegas/rez/pull/1046/files

Is this related ?
Could be the issue itself.

@instinct-vfx
Copy link
Contributor

Here is an example package to reproduce:

name = 'foo'
version = '1.0.0'
uuid = "8a004223-992e-47c8-8b0b-f6719ada4c15"


def commands():
    env.PKG_ROOT_STRING.append('{root}')
    env.PKG_ROOT_PYTHON.append(this.root)

With payload caching enable run rez env foo once to cache the package. In this first resolve the paths both point to the repository. Run again, this triggers payload caching to be used. Looking at the env var, the ROOT_STRING var points to the local payload cache, the ROOT_PYTHON var points to the package repository still.

Tested with 2.8x and pwsh

@davidlatwe
Copy link
Contributor

Ah, thanks. Now I understand the issue and able to reproduce.

@davidlatwe
Copy link
Contributor

So it looks like this line in ResolvedContext

https://github.com/nerdvegas/rez/blob/3f66e9ca1a0db227af608757e8dced08e88bd461/src/rez/resolved_context.py#L2007

is binding a installed variant, not a cached one.

Tested with this change can correct the result.

# Line 2007 in rez/resolved_context.py
pkg_bindings_["variant"].root = pkg_roots.get(pkg.name, pkg.root)
executor.bind('this', pkg_bindings_["variant"])

But that shouldn't be the right way to fix it, thoughts ? I think we should let the variant know it's been cached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants