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

Rollback to fetch failure #4416

Merged
merged 2 commits into from Dec 15, 2020
Merged

Rollback to fetch failure #4416

merged 2 commits into from Dec 15, 2020

Conversation

rjbou
Copy link
Collaborator

@rjbou rjbou commented Nov 4, 2020

  • If all action error are fetching failure, return code 31 (Sync_error) instead of code 40 (Package_operation_error).
  • if there is mixed failures, exit with code 40
  • if there is some sucess, and some fetching failures, exit with code 31

Fix #4214

@rjbou rjbou added this to the 2.1.0~beta4 milestone Nov 4, 2020
@rjbou rjbou added this to PR in Progress in Opam 2.1.x via automation Nov 4, 2020
@rjbou rjbou requested a review from AltGr November 4, 2020 19:39
@rjbou
Copy link
Collaborator Author

rjbou commented Dec 3, 2020

ping @kit-ty-kate

@kit-ty-kate
Copy link
Member

Mh, I just tried and it still didn't give me the right exit code:

$ opam install kappa-library.4.1.0
The following actions will be performed:
  ∗ install kappa-library 4.1.0

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Failed to get sources of kappa-library.4.1.0: Bad checksum

#=== ERROR while fetching sources for kappa-library.4.1.0 ====================#
https://github.com/Kappa-Dev/KappaTools/archive/v4.1.tar.gz (Bad checksum, expected sha256=f24a38f73a88f1b3d8137aa083bad8d76c679c4b6c59ec29e1567ad95bf1df13)


<><> Error report ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ ⬇ fetch kappa-library 4.1.0
└─ 
╶─ No changes have been performed
$ echo $?
31

@rjbou
Copy link
Collaborator Author

rjbou commented Dec 3, 2020

hmm... I don't have the same locally :

$ ./opam install kappa-library.4.1.0
The following actions will be performed:
  ∗ install fmt           0.8.9 [required by kappa-library]
  ∗ install num           1.4   [required by kappa-library]
  ∗ install logs          0.7.0 [required by kappa-library]
  ∗ install kappa-library 4.1.0
===== ∗ 4 =====
Do you want to continue? [Y/n] y

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved fmt.0.8.9  (cached)
⬇ retrieved logs.0.7.0  (cached)
⬇ retrieved num.1.4  (cached)
∗ installed fmt.0.8.9
∗ installed num.1.4
∗ installed logs.0.7.0
[ERROR] Failed to get sources of kappa-library.4.1.0: Bad checksum

#=== ERROR while fetching sources for kappa-library.4.1.0 =====================#
OpamSolution.Fetch_fail("https://github.com/Kappa-Dev/KappaTools/archive/v4.1.tar.gz (Bad checksum, expected sha256=f24a38f73a88f1b3d8137aa083bad8d76c679c4b6c59ec29e1567ad95bf1df13)")


<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ ⬇ fetch kappa-library 4.1.0
└─ 
┌─ The following changes have been performed
│ ∗ install fmt  0.8.9
│ ∗ install logs 0.7.0
│ ∗ install num  1.4
└─ 

The former state can be restored with:
    opam/_build/default/src/client/opamMain.exe switch import ".opam/switch/.opam-switch/backup/state-20201203142116.export"
Or you can retry to install your package selection with:
    opam/_build/default/src/client/opamMain.exe install --restore

==> err code [40]


$ ./opam install kappa-library.4.1.0
The following actions will be performed:
  ∗ install kappa-library 4.1.0

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Failed to get sources of kappa-library.4.1.0: Bad checksum

#=== ERROR while fetching sources for kappa-library.4.1.0 =====================#
OpamSolution.Fetch_fail("https://github.com/Kappa-Dev/KappaTools/archive/v4.1.tar.gz (Bad checksum, expected sha256=f24a38f73a88f1b3d8137aa083bad8d76c679c4b6c59ec29e1567ad95bf1df13)")


<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ ⬇ fetch kappa-library 4.1.0
└─ 
╶─ No changes have been performed

==> err code [40]


$ ./opam install kappa-library.4.1.0 pat-sub #pat-sub is a fail on build local package

<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[pat-sub.0.1] synchronised (file://pat-sub)
[WARNING] Failed checks in opam file from upstream of pat-sub:
  warning 62: License doesn't adhere to the SPDX standard, see https://spdx.org/licenses/: " "
[pat-sub] Installing new package description from upstream file:///w/pkgs_opam/pat-sub

The following actions will be performed:
  ∗ install kappa-library 4.1.0
  ∗ install pat-sub       0.1*
===== ∗ 2 =====

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of pat-sub.0.1 failed at "bcat foo bar baz".
[ERROR] Failed to get sources of kappa-library.4.1.0: Bad checksum

#=== ERROR while compiling pat-sub.0.1 ========================================#
# context     2.1.0~beta4 | linux/x86_64 |  | pinned(file:///w/pkgs_opam/pat-sub)
# path        ~/.opam/switch/.opam-switch/build/pat-sub.0.1
# command     ~/.opam/opam-init/hooks/sandbox.sh build bcat foo bar baz
# exit-code   1
# env-file    ~/.opam/log/pat-sub-2545285-9b2e35.env
# output-file ~/.opam/log/pat-sub-2545285-9b2e35.out
### output ###
# bwrap: execvp bcat: No such file or directory


#=== ERROR while fetching sources for kappa-library.4.1.0 =====================#
OpamSolution.Fetch_fail("https://github.com/Kappa-Dev/KappaTools/archive/v4.1.tar.gz (Bad checksum, expected sha256=f24a38f73a88f1b3d8137aa083bad8d76c679c4b6c59ec29e1567ad95bf1df13)")


<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
┌─ The following actions failed
│ ⬇ fetch kappa-library 4.1.0
│ λ build pat-sub       0.1
└─ 
╶─ No changes have been performed

==> err code: [31]

@rjbou rjbou merged commit 71c4495 into ocaml:master Dec 15, 2020
Opam 2.1.x automation moved this from PR in Progress to Done Dec 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.1.x
  
Done
Development

Successfully merging this pull request may close these issues.

[opam.2.1.0~alpha] Errors while fetching sources return with exit code 31 instead of 40
2 participants