-
Notifications
You must be signed in to change notification settings - Fork 496
test: Reproducer for refetching packages with symlinks #14429
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| Documenting that sources with file symlinks are re-fetched every time. The | ||
| menhir package is an example of such a package in the opam-repository. See | ||
| `./fetch-cache.t` for a normal package test. | ||
|
|
||
| The fetch rules are always considered safe to cache, but we make it explicit | ||
| here. We set a custom directory for the shared cache and enable cache tracing. | ||
|
|
||
| $ export DUNE_CACHE=enabled | ||
| $ export DUNE_CACHE_ROOT=$(pwd)/dune-cache | ||
| $ export DUNE_TRACE=+cache | ||
|
|
||
| Set up a project that depends on a package that is being downloaded. Note that | ||
| the package being downloaded has a symlink. | ||
|
|
||
| $ make_lockdir | ||
| $ echo "Contents" > tar-contents | ||
| $ CONTENT_CHECKSUM=$(md5sum tar-contents | cut -f1 -d' ') | ||
| $ ln -s tar-contents tar-symlink | ||
| $ tar cf test.tar tar-contents tar-symlink | ||
| $ echo test.tar > fake-curls | ||
| $ SRC_PORT=1 | ||
| $ SRC_CHECKSUM=$(md5sum test.tar | cut -f1 -d' ') | ||
| $ make_lockpkg test <<EOF | ||
| > (version 0.0.1) | ||
| > (source | ||
| > (fetch | ||
| > (url http://localhost:$SRC_PORT) | ||
| > (checksum md5=$SRC_CHECKSUM))) | ||
| > EOF | ||
| $ cat > dune-project <<EOF | ||
| > (lang dune 3.17) | ||
| > (package (name my) (depends test) (allow_empty)) | ||
| > EOF | ||
|
|
||
| The first build should succeed, fetching the source, populating the cache and | ||
| disabling the download of the source a second time. | ||
|
|
||
| $ build_pkg test | ||
|
|
||
| We see cache store events for our targets in the trace: | ||
|
|
||
| $ dune trace cat | jq -s '[.[] | select(.args.message == "cache store target creation errors") ] | length' | ||
| 1 | ||
|
|
||
| Cleaning the project to force rebuilding. This triggers an attempt to | ||
| re-download the source, since it contains a symlink and wasn't cached: | ||
|
|
||
| $ dune clean | ||
| $ export DUNE_CACHE=enabled | ||
| $ build_pkg test | ||
| File "dune.lock/test.pkg", line 4, characters 7-25: | ||
| 4 | (url http://localhost:1) | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| Error: Download failed with code 404 | ||
|
|
||
| [1] | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.