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

opam init with MSYS2 #5683

Closed
jonahbeckford opened this issue Sep 20, 2023 · 3 comments · Fixed by #5843
Closed

opam init with MSYS2 #5683

jonahbeckford opened this issue Sep 20, 2023 · 3 comments · Fixed by #5843
Milestone

Comments

@jonahbeckford
Copy link
Contributor

          I am quite fine with `OPAMFETCH=wget` ... it is only for the initial `opam init`.

And it gets past the curl issue, so technically this issue can be closed.

However, opam init fails at a later point, and I do now think that --msys2-location=DIR is unavoidable. I'll open a new issue for that.

Originally posted by @jonahbeckford in #5681 (comment)

@jonahbeckford
Copy link
Contributor Author

jonahbeckford commented Sep 20, 2023

Problem

Using opam init --no-cygwin-setup:

$env:OPAMFETCH="wget"; with-dkml opam init --yes --no-setup --bare --disable-sandboxing --no-cygwin-setup --verbose --debug-level 4 default https://opam.ocaml.org

gives:

<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><>  🐫
00:00.092  PARALLEL               Iterate over 1 task(s) with 3 process(es)
00:00.092  PARALLEL               Starting job 0 (worker 1/3): 0
00:00.093  REPOSITORY             update default from https://opam.ocaml.org
00:00.093  CURL                   pull-repo-update
00:00.094  SYSTEM                 mkdir Z:\Temp\opamroot1\repo\default.new
00:00.095  SYSTEM                 mkdir C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62
00:00.097  SYSTEM                 mkdir C:\Users\beckf\AppData\Local\Temp\opam-beckf-29332
00:00.100  PARALLEL               Next task in job 0: C:\Users\beckf\AppData\Local\Programs\DKMLNA~1\tools\MSYS2\usr\bin\wget.exe --content-disposition -t 3 -O C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62\index.tar.gz.part -U opam/2.2.0~alpha3~dev -- https://opam.ocaml.org/index.tar.gz
Processing  1/1: [default: http]
00:02.795  PARALLEL               Collected task for job 0 (ret:0)
00:02.795  SYSTEM                 mv C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62\index.tar.gz.part -> C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62\index.tar.gz
00:02.804  PARALLEL               Next task in job 0: C:\Users\beckf\AppData\Local\Programs\DKMLNA~1\tools\MSYS2\usr\bin\tar.exe xfz C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62\index.tar.gz -C Z:\Temp\opamroot1\repo\default.new
00:05.680  PARALLEL               Collected task for job 0 (ret:2)
00:05.684  SYSTEM                 rmdir C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62
00:05.685  SYSTEM                 rm C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62\index.tar.gz
00:05.687  SYSTEM                 rmdir Z:\Temp\opamroot1\repo\default.new
[ERROR] Could not update repository "default": Failed to extract archive C:\Users\beckf\AppData\Local\Temp\opam-29332-a1ba62\index.tar.gz:
        "C:\\Users\\beckf\\AppData\\Local\\Programs\\DKMLNA~1\\tools\\MSYS2\\usr\\bin\\tar.exe xfz C:\\Users\\beckf\\AppData\\Local\\Temp\\opam-29332-a1ba62\\index.tar.gz -C
        Z:\\Temp\\opamroot1\\repo\\default.new" exited with code 2
00:05.688  PARALLEL               Job 0 finished
00:05.689  SYSTEM                 rmdir Z:\Temp\opamroot1
00:05.691  SYSTEM                 rm Z:\Temp\opamroot1\repo\state-265DFA6D.cache
00:05.692  SYSTEM                 rm Z:\Temp\opamroot1\repo\repos-config
00:05.693  SYSTEM                 rm Z:\Temp\opamroot1\repo\lock
00:05.694  SYSTEM                 rm Z:\Temp\opamroot1\lock
00:05.696  SYSTEM                 rm Z:\Temp\opamroot1\config.lock
00:05.697  SYSTEM                 rm Z:\Temp\opamroot1\config

The problem is more general ... any opam spawned process will have all of the cygpath logic (etc.) disappear when --no-cygwin-setup is used.

@jonahbeckford
Copy link
Contributor Author

jonahbeckford commented Sep 20, 2023

Proposed Solutions

  1. Get back to the old behavior for MSYS2 (using cygpath when executing opam subprocesses, etc.). That can't happen unless opam knows about MSYS2:

    opam init --msys2-location=DIR
  2. Wrap all opam launched processes with a user-specified command (ex. with-dkml), rather than just the wrap-build-commands/wrap-install-commands/wrap-remove-commands subset. I don't think this is a good idea right now ... it will take a lot of soak testing to get right, and will unnecessarily delay opam 2.2


Also, I don't need --msys2-internal-install or --msys2-local-install because I still need with-dkml for DkML users

@kit-ty-kate
Copy link
Member

Does it work if you use opam init --cygwin-location=C:\msys64 ?

@rjbou rjbou added this to the 2.2.0~beta2 milestone Apr 10, 2024
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.

3 participants