Skip to content

Commit

Permalink
fixup! cache: when fetching from cache, add missing symlink for every…
Browse files Browse the repository at this point in the history
… checksum found in opam file
  • Loading branch information
rjbou committed Jul 16, 2024
1 parent 77d6516 commit 828846e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
18 changes: 11 additions & 7 deletions tests/reftests/archive.test
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ The following actions will be performed:
Done.
### sh check-cache.sh
MD5: archive, with matching checksum
SHA256: not found
SHA256: link, to md5 archive
### opam remove good-md5-good-sha256
The following actions will be performed:
=== remove 1 package
Expand Down Expand Up @@ -405,7 +405,7 @@ The following actions will be performed:
Done.
### sh check-cache.sh
MD5: archive, with matching checksum
SHA256: not found
SHA256: link, to md5 archive
### opam remove good-sha256-good-md5
The following actions will be performed:
=== remove 1 package
Expand Down Expand Up @@ -962,7 +962,7 @@ The following actions will be performed:
-> installed good-sha256-good-md5.1
Done.
### sh check-cache.sh
MD5: not found
MD5: link, to sha256 archive
SHA256: archive, with matching checksum
### opam clean --download-cache
Clearing cache of downloaded files
Expand Down Expand Up @@ -1028,15 +1028,19 @@ The following actions will be performed:
- install good-sha256-good-md5 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved good-sha256-good-md5.1 (cached)
[ERROR] Conflicting file hashes, or broken or compromised cache!
- sha256=99a0bdda5cc48eef1f53c6831c06c4b1d51bc746e68a84efc71785f00d7e927e (MISMATCH)
- md5=2c729f293240d43f46058280c2ac00e3 (MISMATCH)

-> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/archive.tgz)
-> installed good-sha256-good-md5.1
Done.
### sh check-cache.sh
MD5: archive, with mismatching checksum
MD5: link, to sha256 archive
SHA256: archive, with matching checksum
### :II:4: corrupt sha256 archive in cache
### sh check-cache.sh
MD5: archive, with mismatching checksum
MD5: link, to sha256 archive
SHA256: archive, with matching checksum
### opam remove good-sha256-good-md5
The following actions will be performed:
Expand All @@ -1050,7 +1054,7 @@ Done.
### rm "$ARCHIVE_SHA256_PATH"
### tar czf "$ARCHIVE_SHA256_PATH" check-cache.sh
### sh check-cache.sh
MD5: archive, with matching checksum
MD5: link, to sha256 archive
SHA256: archive, with mismatching checksum
### # what happens here is that sha256 is checked first, there is a mismatch on sha256 archive (checking its sha256 & md5), so it is remove, returns file not available, and then it downloads the archive from url
### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash'
Expand Down
12 changes: 6 additions & 6 deletions tests/reftests/extrasource.test
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ The following actions will be performed:
Done.
### sh check-cache.sh
MD5: patch, with matching checksum
SHA256: not found
SHA256: link, to md5 patch
### opam remove good-md5-good-sha256
The following actions will be performed:
=== remove 1 package
Expand Down Expand Up @@ -480,7 +480,7 @@ The following actions will be performed:
Done.
### sh check-cache.sh
MD5: patch, with matching checksum
SHA256: not found
SHA256: link, to md5 patch
### opam remove good-sha256-good-md5
The following actions will be performed:
=== remove 1 package
Expand Down Expand Up @@ -1090,7 +1090,7 @@ The following actions will be performed:
-> installed good-sha256-good-md5.1
Done.
### sh check-cache.sh
MD5: not found
MD5: link, to sha256 patch
SHA256: patch, with matching checksum
### opam clean --download-cache
Clearing cache of downloaded files
Expand Down Expand Up @@ -1120,11 +1120,11 @@ The following actions will be performed:
Done.
### sh check-cache.sh
MD5: patch, with matching checksum
SHA256: not found
SHA256: link, to md5 patch
### :III:c: corrupt md5 patch in cache
### sh check-cache.sh
MD5: patch, with matching checksum
SHA256: not found
SHA256: link, to md5 patch
### opam remove good-sha256-good-md5
The following actions will be performed:
=== remove 1 package
Expand All @@ -1136,7 +1136,7 @@ Done.
### cp check-cache.sh "$PATCH_MD5_PATH"
### sh check-cache.sh
MD5: patch, with mismatching checksum
SHA256: not found
SHA256: link, to md5 patch
### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash'
The following actions will be performed:
=== install 1 package
Expand Down

0 comments on commit 828846e

Please sign in to comment.