protofetch icon indicating copy to clipboard operation
protofetch copied to clipboard

When sources are deleted manually it is not possible to run protofetch fetch again

Open saraiva132 opened this issue 3 years ago • 1 comments

Since we are using git worktree to build sources directory tree, when sources are deletes manually (from ~./protofetch/cache), it is not possible to run protofetch fetch since the worktree already exists (the metadata). Thus, that metadata needs to also be deleted for it work again. The library does not support git worktree removal at the time this ticket was opened.

Tip: Look at fetch::fetch method

Edit: Since now we copy proto files as the actual output that is fine to delete. Only the folder inside cache with the source code errors out.

saraiva132 avatar May 28 '22 13:05 saraiva132

protofetch.toml:

name = "corp"

[envoy]
url = "github.com/envoyproxy/envoy"
revision = "72d653e2540cc5f77e2acdc1c9a57a10263d74dc"
protocol = "https"
allow_policies = ["envoy/*"]
content_roots = ["api"]

[grpc]
url = "github.com/grpc/grpc"
revision = "b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1"
protocol = "https"
allow_policies = ["grpc/health/v1/*"]
content_roots = ["src/proto"]

[udpa]
url = "github.com/cncf/udpa"
revision = "c52dc94e7fbe6449d8465faaeda22c76ca62d4ff"
protocol = "https"
allow_policies = ["udpa/*"]

Test after deleting proto_src and added that udpa dependency above:

% protofetch fetch                
INFO Resolving github.com/grpc/grpc
INFO Resolving github.com/envoyproxy/envoy
INFO Resolving github.com/cncf/udpa
INFO Wrote lockfile to /Users/kris/Code/appbiotic/corp/protofetch.lock
INFO Fetching dependencies source files...
INFO Copying proto files from corp descriptor...
INFO Found existing worktree for envoy at /Users/kris/.cache/protofetch/dependencies/envoy/72d653e2540cc5f77e2acdc1c9a57a10263d74dc.
ERROR Error while canonicalizing path /Users/kris/.cache/protofetch/dependencies/grpc/b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1: No such file or directory (os error 2)

Only is resolvable if I delete the cache and lockfile and start over:

% protofetch fetch          
INFO Resolving github.com/cncf/udpa
INFO Resolving github.com/grpc/grpc
INFO Resolving github.com/envoyproxy/envoy
INFO Wrote lockfile to /Users/kris/Code/appbiotic/corp/protofetch.lock
INFO Fetching dependencies source files...
INFO Copying proto files from corp descriptor...
INFO Creating new worktree for envoy at /Users/kris/.cache/protofetch/dependencies/envoy/72d653e2540cc5f77e2acdc1c9a57a10263d74dc.
INFO Creating new worktree for grpc at /Users/kris/.cache/protofetch/dependencies/grpc/b8a04acbbf18fd1c805e5d53d62ed9fa4721a4d1.
INFO Creating new worktree for udpa at /Users/kris/.cache/protofetch/dependencies/udpa/c52dc94e7fbe6449d8465faaeda22c76ca62d4ff.

It is not clear what is the root issue nor how the user should resolve it.

kriswuollett avatar May 29 '24 18:05 kriswuollett