opam icon indicating copy to clipboard operation
opam copied to clipboard

Additional export/import capabilities

Open Drup opened this issue 9 years ago • 6 comments

I would like the ability to import

  • only root packages
  • ignore versions

Basically, I want to move from one version of ocaml to another and have globally the same root packages (and pins, and repo) but let the precise dependency handling free (so that packages that are ocaml-version senstive works, like camlp4).

I know you can do awk magic, but I think it should be in opam directly. Maybe as an opam migrate tool ?

Drup avatar Jun 20 '15 03:06 Drup

Related to #1520 I'm actually on something that may help with this.

AltGr avatar Jun 23 '15 01:06 AltGr

Somewhat related, I would like to be able to move an entire switch from one compiler to another.

More precisely, I created several switches with "opam switch -A 4.02.1", and now that 4.02.2 is out, I want to migrate them all to 4.02.2. I can do it by exporting, re-creating the switch, and importing, but I would like something less manual.

cmangin avatar Jun 23 '15 12:06 cmangin

Supporting a way to opam import SWITCH to stand for opam switch SWITCH; opam switch export /tmp/bla ; opam switch OTHERSWITCH; opam switch import /tmp/bla would be nice.

dbuenzli avatar Aug 05 '15 14:08 dbuenzli

Good idea, but note that you can already shorten this to

opam switch export - --switch FROM | opam switch import - --yes

that won't work if you want interactive mode though, but in that case, bash version

opam switch import <(opam switch export - --switch FROM)

should be ok

AltGr avatar Aug 11 '15 02:08 AltGr

opam switch import <(opam switch export - --switch FROM)

Now that compilers became packages this no longer works:

  * No agreement on the version of ocaml-base-compiler:
    - (invariant) → ocaml-base-compiler >= 4.14.0
    - ocaml = 4.12.0 → ocaml-base-compiler < 4.12.1~
    You can temporarily relax the switch invariant with `--update-invariant'

No solution found, exiting

I certainly do not want to relax the switch invariant since this will result in having in 4.12 in my 4.14 switch.

What's the expected workflow nowadays ?

dbuenzli avatar Jun 21 '22 14:06 dbuenzli

The workflow didn't change (and shouldn't). It's a regression that need to be fixed. Can you open a separate issue for it?

rjbou avatar Jun 27 '22 15:06 rjbou