caml-list - the Caml user's mailing list
 help / Atom feed
* [Caml-list] Local switch using opam 2
@ 2019-04-10  0:35 Kenichi Asai
  2019-04-10  9:08 ` Gabriel Scherer
  0 siblings, 1 reply; 3+ messages in thread
From: Kenichi Asai @ 2019-04-10  0:35 UTC (permalink / raw)
  To: caml-list

I want to create a local switch for a particular version of OCaml
with my own patch applied using opam 2.  For opam 1.2.2, I did the
following rather low-level thing:

- create a directory: ~/.opam/compilers/4.04.0/4.04.0+my-ocaml
- place two files in this directory:
  4.04.0+type-debugger.comp, containing where opam can find my own patch
  4.04.0+type-debugger.descr, with a description of the compiler
- add an entry to ~/.opam/repo/compiler-index:
  4.04.0+my-ocaml default 4.04.0/4.04.0+my-ocaml

and then execute opam switch 4.04.0+my-ocaml.  Can I do the similar
thing in opam 2?  Thank you in advance for any info.

-- 
Kenichi Asai

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Local switch using opam 2
  2019-04-10  0:35 [Caml-list] Local switch using opam 2 Kenichi Asai
@ 2019-04-10  9:08 ` Gabriel Scherer
  2019-04-13 11:15   ` Kenichi Asai
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Scherer @ 2019-04-10  9:08 UTC (permalink / raw)
  To: Kenichi Asai; +Cc: caml users

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

Dear Kenichi,

Our short-term plan is to merge opam file in the OCaml compiler
distribution so that "opam pin ." or "opam install ." or "opam switch
create ." works as for any other opam packages. There is an in-progress
proposal by Leo White in https://github.com/ocaml/ocaml/pull/2207 ; before
that gets finished and integrated, please feel free to download the patch
proposed and use it locally.

On Wed, Apr 10, 2019 at 2:35 AM Kenichi Asai <asai@is.ocha.ac.jp> wrote:

> I want to create a local switch for a particular version of OCaml
> with my own patch applied using opam 2.  For opam 1.2.2, I did the
> following rather low-level thing:
>
> - create a directory: ~/.opam/compilers/4.04.0/4.04.0+my-ocaml
> - place two files in this directory:
>   4.04.0+type-debugger.comp, containing where opam can find my own patch
>   4.04.0+type-debugger.descr, with a description of the compiler
> - add an entry to ~/.opam/repo/compiler-index:
>   4.04.0+my-ocaml default 4.04.0/4.04.0+my-ocaml
>
> and then execute opam switch 4.04.0+my-ocaml.  Can I do the similar
> thing in opam 2?  Thank you in advance for any info.
>
> --
> Kenichi Asai
>

[-- Attachment #2: Type: text/html, Size: 1625 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Local switch using opam 2
  2019-04-10  9:08 ` Gabriel Scherer
@ 2019-04-13 11:15   ` Kenichi Asai
  0 siblings, 0 replies; 3+ messages in thread
From: Kenichi Asai @ 2019-04-13 11:15 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: caml users

Dear Gabriel,

> Our short-term plan is to merge opam file in the OCaml compiler distribution so
> that "opam pin ." or "opam install ." or "opam switch create ." works as for
> any other opam packages. There is an in-progress proposal by Leo White in
> https://github.com/ocaml/ocaml/pull/2207 ; before that gets finished and
> integrated, please feel free to download the patch proposed and use it locally.

Thank you.  It worked.  For record, I write what I did:

- create a directory containing the OCaml distribution
- change it as I want
- at the top directory of the OCaml distribution,
  * place ocaml-variants.opam as found in the above pull request
  * opam switch create . --empty
  * opam install .

However, I found that this local switch is valid only in the above
directory and I cannot set it as my default OCaml compiler.

So, I looked around the .opam directory and found this low-level thing
that corresponds to what I did for opam 1.2:

cd ~/.opam/repo
rm state.cache  -- necessary to include the following new variant info
cd default/packages/ocaml-variants/
mkdir ocaml-variants.4.04.0+my-own-variant
cd ocaml-variants.4.04.0+my-own-variant

Then, I place the opam file in this directory that designates the
base OCaml compiler and the url of the patch I want to apply.  I could
find many examples of opam files under

~/.opam/repo/default-packages/ocaml-variants/*/

I then execute:

opam switch install 4.04.0+my-own-variant

and it worked as though it is one of the standard ocaml variants.

-- 
Kenichi Asai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-10  0:35 [Caml-list] Local switch using opam 2 Kenichi Asai
2019-04-10  9:08 ` Gabriel Scherer
2019-04-13 11:15   ` Kenichi Asai

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror https://inbox.ocaml.org/caml-list

AGPL code for this site: git clone https://public-inbox.org/ public-inbox