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

how to use a package locally if not yet merged in pantry? #427

Closed
mfts opened this issue Mar 7, 2023 · 9 comments · Fixed by pkgxdev/pantry.core#522
Closed

how to use a package locally if not yet merged in pantry? #427

mfts opened this issue Mar 7, 2023 · 9 comments · Fixed by pkgxdev/pantry.core#522

Comments

@mfts
Copy link
Contributor

mfts commented Mar 7, 2023

I had a discussion with @ddobrinskiy about testing / using a package locally that was built locally with pkg but not yet merged in the global pantry.

For example git3.sh

$ cd ~/pantry.extra
$ pkg build git3.sh
...
# builds binary successfully to tea.out/git3.sh

# open a new terminal in `cd $HOME`
$ TEA_PREFIX=~/pantry.extra/tea.out tea +git3.sh git3 --help
resolving package graph
error: not-found: pantry (spilt-tea-007)
no pantry: run `tea --sync`

Expectation

I expect that if I change the TEA_PREFIX to something where the package + binary already exists locally, it would work.

Interesting observation on what works:

$ cd ~/pantry.extra
$ TEA_PREFIX=~/dev/tea/pantry.extra/tea.out tea +git3.sh git3 --help
Usage: git3 [options] [command]

git3 mangement tool
...
@mxcl
Copy link
Member

mxcl commented Mar 7, 2023

Interesting observation on what works

Run env | grep TEA_ and you will see why it works.

@mxcl
Copy link
Member

mxcl commented Mar 7, 2023

This isn't really a bug, there literally is no pantry in your TEA_PREFIX. You would need to set TEA_PANTRY_PATH if you expect it to work which is why stepping into the pantry directory fixes it (its dev-env sets the pantry path).

I understand the pain. Perhaps I will come up with something that eases this. For now you can do:

TEA_DIR=~/pantry.extra tea git3 --help

I will leave it as an exercise for the reader on why this works.

@mxcl mxcl changed the title use a package locally if not yet merged in pantry how to use a package locally if not yet merged in pantry Mar 7, 2023
@mxcl mxcl changed the title how to use a package locally if not yet merged in pantry how to use a package locally if not yet merged in pantry? Mar 7, 2023
@mxcl mxcl added the question label Mar 7, 2023
@mfts
Copy link
Contributor Author

mfts commented Mar 7, 2023

Run env | grep TEA_ and you will see why it works.

Ok, I understand why it works from the pantry.extra directory but not anywhere else.

So setting these env variables, I expect it to work anywhere else

$ cd ~
$ TEA_PANTRY_PATH=/Users/mfts/dev/tea/pantry.extra tea git3 --help 
resolving package graph
error: http (spilt-tea-500)
403: https://dist.tea.xyz/git3.sh/darwin/aarch64/versions.txt

$ TEA_DIR=/Users/mfts/dev/tea/pantry.extra tea git3 --help 
tea: command not found: git3

I also tried it with both TEA_PREFIX and TEA_PANTRY_PATH

$ TEA_PANTRY_PATH=/Users/mfts/dev/tea/pantry.extra TEA_PREFIX=/Users/mfts/dev/tea/pantry.extra/tea.out tea git3 --help
resolving package graph
error: not found in pantry: nodejs.org (spilt-tea-005)

did you mean `nmap.org`? otherwise… see you on GitHub?

Not in pantry: nodejs.org

https://github.com/teaxyz/pantry.extra#contributing

nodejs.org is a runtime dep so I guess because it's in pantry.core and not pantry.extra, it's not found

Solution

Setting the pantry env variable to both pantry.extra, where git3.sh locally exists and the pantry from .tea where nodejs.org should exist, the result works! 🎉

$ TEA_PANTRY_PATH=/Users/mfts/dev/tea/pantry.extra:/Users/mfts/.tea/tea.xyz/var/pantry TEA_PREFIX=/Users/mfts/dev/tea/pantry.extra/tea.out tea git3 --help 
Usage: git3 [options] [command]

git3 mangement tool

@mxcl
Copy link
Member

mxcl commented Mar 7, 2023

Setting TEA_DIR should work, otherwise it's a bug.

@mfts you'll find that your solution is setting the same vars as the dev-env does.

@mxcl
Copy link
Member

mxcl commented Mar 7, 2023

Quite possibly setting an alternative TEA_PREFIX has no benefits. Worth considering. Then supplementing TEA_PANTRY_PATH would be enough to use working checkouts of the pantry and installs go to ~/.tea

@mfts
Copy link
Contributor Author

mfts commented Mar 7, 2023

Setting TEA_DIR should work, otherwise it's a bug.

Seems like it

$ TEA_DIR=/Users/mfts/dev/tea/pantry.extra tea git3 --help 
resolving package graph
error: http (spilt-tea-500)
403: https://dist.tea.xyz/git3.sh/darwin/aarch64/versions.txt

you'll find that your solution is setting the same vars as the dev-env does.

Yes, I copied the env | grep TEA_ from pantry.extra's dev-env

@mxcl
Copy link
Member

mxcl commented Mar 7, 2023

K I know why setting TEA_DIR doesn't work, it's because it changes TEA_PREFIX which the active tea cannot handle.

$ TEA_DIR=/Users/mfts/dev/tea/pantry.extra tea tea git3 --help 
# ^^ probably works lol

@mfts
Copy link
Contributor Author

mfts commented Mar 7, 2023

Unfortunately, same error

$ TEA_DIR=/Users/mfts/dev/tea/pantry.extra tea tea git3 --help 
resolving package graph
error: http (spilt-tea-500)
403: https://dist.tea.xyz/git3.sh/darwin/aarch64/versions.txt

@ddobrinskiy ddobrinskiy mentioned this issue Mar 8, 2023
2 tasks
mxcl added a commit to pkgxdev/pantry.core that referenced this issue Mar 8, 2023
Fixes pkgxdev/pkgx#427

We build to TEA_PREFIX by default in pantry dev-envs now. You can still override this if you want.

`TEA_PANTRY_PATH=foo tea bar` will now use
@mxcl
Copy link
Member

mxcl commented Mar 9, 2023

New brewkit and pantries (not all released), installs everything to your standard TEA_PREFIX with builds in the pantry checkout.

This means TEA_PANTRY_PATH=pantry tea foo will work (or TEA_DIR=pantry tea foo) (and inside the dev-env just tea foo) (or ofc. just foo with magic)

Which is only marginally better, but it is a solution to this anyway.

Potentially we could cp the package.yml after builds. I dunno. Smells bad.

edit: or possibly this is the right solution since otherwise why are we installing to ~/.tea anyway? We could symlink it perhaps

mxcl added a commit to pkgxdev/pantry.core that referenced this issue Mar 9, 2023
Fixes pkgxdev/pkgx#427

We build to TEA_PREFIX by default in pantry dev-envs now. You can still override this if you want.

`TEA_PANTRY_PATH=foo tea bar` will now use
mxcl added a commit to pkgxdev/pantry.core that referenced this issue Mar 9, 2023
* Don’t set TEA_PREFIX

Fixes pkgxdev/pkgx#427

We build to TEA_PREFIX by default in pantry dev-envs now. You can still override this if you want.

`TEA_PANTRY_PATH=foo tea bar` will now use

* wip
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.

2 participants