N0REP0
### OPAMYES=1
### : Test that pinned packages are reinstalled if they are updated in the imported file :
### <pin:nip/nip.opam>
opam-version: "2.0"
install: [ "cp" "fst.out" "%{lib}%" ]
### git -C nip init -q --initial-branch=fst-head
### git -C nip config core.autocrlf false
### git -C nip add -A
### git -C nip commit -qm "init"
### git -C nip branch snd-head
### <nip/fst.out>
fst branch
### git -C nip add -A
### git -C nip commit -qm "fst file"
### git -C nip checkout snd-head
Switched to branch 'snd-head'
### <pin:nip/nip.opam>
opam-version: "2.0"
install: [ "cp" "snd.out" "%{lib}%" ]
### <nip/snd.out>
snd branch
### git -C nip add -A
### git -C nip commit -qm "snd file"
### opam switch create twice --empty
### git -C nip checkout fst-head
Switched to branch 'fst-head'
### opam pin git+file://${BASEDIR}/nip#fst-head
Package nip does not exist, create as a NEW package? [y/n] y
nip is now pinned to git+file://${BASEDIR}/nip#fst-head (version dev)

The following actions will be performed:
=== install 1 package
  - install nip dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved nip.dev  (no changes)
-> installed nip.dev
Done.
### opam list nip --installed --columns=name,installed-files --normalise | grep -v '^#'
nip    ${BASEDIR}/OPAM/twice/lib/fst.out
### opam switch export twice.xp
### opam-cat twice.xp
installed: ["nip.dev"]
opam-version: "2.0"
pinned: "nip.dev"
roots: ["nip.dev"]
package "nip" {
opam-version: "2.0"
version: "dev"
synopsis: "A word"
description: "Two words."
maintainer: "maint@tain.er"
authors: "the testing team"
license: "MIT"
homepage: "egapemoh"
bug-reports: "https://nobug"
install: ["cp" "fst.out" "%{lib}%"]
dev-repo: "hg+https://pkg@op.am"
url {
src: "git+file://${BASEDIR}/nip#fst-head"
}
}
### <twice.snd.xp>
installed: ["nip.dev"]
opam-version: "2.0"
pinned: "nip.dev"
roots: ["nip.dev"]
package "nip" {
opam-version: "2.0"
version: "dev"
synopsis: "A word"
description: "Two words."
maintainer: "maint@tain.er"
authors: "the testing team"
license: "MIT"
homepage: "egapemoh"
bug-reports: "https://nobug"
install: ["cp" "snd.out" "%{lib}%"]
dev-repo: "hg+https://pkg@op.am"
url {
### <add-hash.sh>
basedir=`echo $BASEDIR | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g"`
echo "src: \"git+file://${basedir}/nip#snd-head\"}}" >> twice.snd.xp
### sh add-hash.sh
### opam switch import twice.snd.xp
The following actions will be performed:
=== recompile 1 package
  - recompile nip dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved nip.dev  (git+file://${BASEDIR}/nip#snd-head)
-> removed   nip.dev
-> installed nip.dev
Done.
### opam pin
nip.dev    git  git+file://${BASEDIR}/nip#snd-head
### opam list nip --installed --columns=name,installed-files --normalise | grep -v '^#'
nip    ${BASEDIR}/OPAM/twice/lib/snd.out
### opam switch import twice.snd.xp --switch tierce
The following actions will be performed:
=== install 1 package
  - install nip dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved nip.dev  (git+file://${BASEDIR}/nip#snd-head)
-> installed nip.dev
Done.
### opam pin
nip.dev    git  git+file://${BASEDIR}/nip#snd-head
### opam list nip --installed --columns=name,installed-files --normalise --switch tierce | grep -v '^#'
nip    ${BASEDIR}/OPAM/tierce/lib/snd.out
### opam switch create test-switch-export-freeze --empty
### opam switch export --freeze switch-freeze.export
### opam-cat switch-freeze.export
opam-version: "2.0"
### <pkg:test.1>
opam-version: "2.0"
url {
  src: "https://example.com/some/fake/url.tar.gz"
  checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
extra-source "file" {
  src: "https://example.com/some/fake/extra/source"
  checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
### opam install --fake test.1
The following actions will be faked:
=== install 1 package
  - install test 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Faking installation of test.1
Done.
### opam switch export --freeze switch-freeze.export
### opam-cat switch-freeze.export
installed: ["test.1"]
opam-version: "2.0"
roots: ["test.1"]
package "test" {
opam-version: "2.0"
version: "1"
url {
src: "https://example.com/some/fake/url.tar.gz"
checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
extra-source "file" {
src: "https://example.com/some/fake/extra/source"
checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
}
### <pkg:test.1>
opam-version: "2.0"
url {
  src: "https://example.com/some/fake/url.tar.gz"
}
extra-source "file" {
  src: "https://example.com/some/fake/extra/source"
  checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
### opam install --fake test.1
The following actions will be faked:
=== recompile 1 package
  - recompile test 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Faking installation of test.1
Done.
### opam switch export --freeze switch-freeze.export
[ERROR] test url doesn't have an associated checksum, it can't be exported with --freeze.
# Return code 5 #
### <pkg:test.1>
opam-version: "2.0"
url {
  src: "https://example.com/some/fake/url.tar.gz"
  checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
extra-source "file" {
  src: "https://example.com/some/fake/extra/source"
}
### opam install --fake test.1
The following actions will be faked:
=== recompile 1 package
  - recompile test 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Faking installation of test.1
Done.
### opam switch export --freeze switch-freeze.export
[ERROR] test url doesn't have an associated checksum, it can't be exported with --freeze.
# Return code 5 #
### opam-cat switch-freeze.export
installed: ["test.1"]
opam-version: "2.0"
roots: ["test.1"]
package "test" {
opam-version: "2.0"
version: "1"
url {
src: "https://example.com/some/fake/url.tar.gz"
checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
extra-source "file" {
src: "https://example.com/some/fake/extra/source"
checksum: "md5=6aef5a674977ebc5ec853dc4f85cf2bb"
}
}
### # Test that invariant is not changed when importing a switch
### <pkg:a.1>
opam-version: "2.0"
flags: compiler
### <pkg:a.2>
opam-version: "2.0"
flags: compiler
### <pkg:b.1>
opam-version: "2.0"
depends: [ "a" { = "1" } ]
### <pkg:b.2>
opam-version: "2.0"
depends: [ "a" { = "2" } ]
### <pkg:c.1>
opam-version: "2.0"
### opam switch create orig b.1

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["b" {= "1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed a.1
-> installed b.1
Done.
### opam install c
The following actions will be performed:
=== install 1 package
  - install c 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed c.1
Done.
### opam-cat OPAM/orig/.opam-switch/switch-state
compiler: ["a.1" "b.1"]
installed: ["a.1" "b.1" "c.1"]
opam-version: "2.0"
roots: ["b.1" "c.1"]
### opam switch export orig.xp
### opam-cat orig.xp
compiler: ["a.1" "b.1"]
installed: ["a.1" "b.1" "c.1"]
opam-version: "2.0"
roots: ["b.1" "c.1"]
### opam switch create toupd b.2

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["b" {= "2"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed a.2
-> installed b.2
Done.
### opam-cat OPAM/toupd/.opam-switch/switch-state
compiler: ["a.2" "b.2"]
installed: ["a.2" "b.2"]
opam-version: "2.0"
roots: ["b.2"]
### opam switch import orig.xp
The following actions will be performed:
=== install 1 package
  - install c 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed c.1
Done.
### # Test that 2.1 unpadded export files are well imported
### opam switch create padded-base64-extra-files --empty
### <padded-base64-extra-files.xp>
extra-files: ["md5=d8e8fca2dc0f896fd7cb4cb0031ba249" "dGVzdAo="]
opam-version: "2.0"
roots: ["test.dev"]
installed: ["test.dev"]
pinned: "test.dev"
package "test" {
  opam-version: "2.0"
  version: "dev"
  extra-files: ["test" "md5=d8e8fca2dc0f896fd7cb4cb0031ba249"]
  install: ["cp" "test" "%{prefix}%/test"]
}
### opam switch import padded-base64-extra-files.xp
The following actions will be performed:
=== install 1 package
  - install test dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed test.dev
Done.
### cat OPAM/padded-base64-extra-files/test
test
### opam switch create unpadded-base64-extra-files --empty
### <unpadded-base64-extra-files.xp>
extra-files: ["md5=d8e8fca2dc0f896fd7cb4cb0031ba249" "dGVzdAo"]
opam-version: "2.0"
roots: ["test.dev"]
installed: ["test.dev"]
pinned: "test.dev"
package "test" {
  opam-version: "2.0"
  version: "dev"
  extra-files: ["test" "md5=d8e8fca2dc0f896fd7cb4cb0031ba249"]
  install: ["cp" "test" "%{prefix}%/test"]
}
### opam switch import unpadded-base64-extra-files.xp
The following actions will be performed:
=== install 1 package
  - install test dev (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed test.dev
Done.
### cat OPAM/unpadded-base64-extra-files/test
test
### <export-extra-files/test.opam>
opam-version: "2.0"
extra-files: ["test" "md5=d8e8fca2dc0f896fd7cb4cb0031ba249"]
### <export-extra-files/files/test>
test
### opam switch create export-extra-files --empty
### opam pin ./export-extra-files
test is now pinned to file://${BASEDIR}/export-extra-files (version 1)

The following actions will be performed:
=== install 1 package
  - install test 1 (pinned)

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> retrieved test.1  (file://${BASEDIR}/export-extra-files)
-> installed test.1
Done.
### opam switch export extra-files.xp
### opam-cat ./extra-files.xp
extra-files: ["md5=d8e8fca2dc0f896fd7cb4cb0031ba249" "dGVzdAo"]
installed: ["test.1"]
opam-version: "2.0"
pinned: "test.1"
roots: ["test.1"]
package "test" {
opam-version: "2.0"
version: "1"
extra-files: ["test" "md5=d8e8fca2dc0f896fd7cb4cb0031ba249"]
url {
src: "file://${BASEDIR}/export-extra-files"
}
}
### : import with deps-only :
### <pkg:foo.1>
opam-version: "2.0"
flags: compiler
### <pkg:foo.2>
opam-version: "2.0"
flags: compiler
### <pkg:bar.1>
opam-version: "2.0"
depends: "baz"
### <pkg:baz.1>
opam-version: "2.0"
### opam switch create for-deps foo.1

<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["foo" {= "1"}]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed foo.1
Done.
### opam install bar
The following actions will be performed:
=== install 2 packages
  - install bar 1
  - install baz 1 [required by bar]

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed baz.1
-> installed bar.1
Done.
### opam switch export deps.xp
### opam-cat deps.xp
compiler: ["foo.1"]
installed: ["bar.1" "baz.1" "foo.1"]
opam-version: "2.0"
roots: ["bar.1" "foo.1"]
### opam switch import deps.xp --switch deps --deps-only
The following actions will be performed:
=== install 2 packages
  - install baz 1
  - install foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed baz.1
-> installed foo.1
Done.
