N0REP0
### <hash.sh>
set -ue
repo=$1
nv=$2
n=`echo "$nv" | cut -f1 -d.`
path=$repo/packages/$n/$nv
echo "extra-files:[" >> "$path/opam"
for file in `ls "$path/files"`; do
  echo "  [\"$file\" \"md5=`openssl md5 "$path/files/$file" | cut -f2 -d' '`\"]" >> "$path/opam"
done
echo   "]" >> "$path/opam"
### <REPO/packages/foo/foo.1/opam>
opam-version: "2.0"
build: ["test" "-f" "bar"]
### <REPO/packages/foo/foo.1/files/bar>
some content
### sh hash.sh REPO foo.1
### : Internal repository storage as archive or plain directory :
### opam switch create tarring --empty
### opam update -vv | grep '^\+' | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
+ diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo)
+ patch "--version"
+ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${BASEDIR}/OPAM/repo/default)
### ls $OPAMROOT/repo | grep -v "cache"
default
lock
repos-config
### opam install foo.1 -vv | grep '^\+' | sed-cmd test
+ test "-f" "bar" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.1)
### opam repository add plain ./REPO --this-switch
[plain] Initialised
### OPAMREPOSITORYTARRING=1
### : From plain repo to tarred repo (default)
### <REPO/packages/foo/foo.2/opam>
opam-version: "2.0"
build: ["test" "-f" "baz"]
### <REPO/packages/foo/foo.2/files/baz>
some content
### sh hash.sh REPO foo.2
### opam update default -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
+ diff "-ruaN" "default" "default.new" (CWD=${BASEDIR}/OPAM/repo)
+ patch "--version"
+ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${BASEDIR}/OPAM/repo/default)
+ tar "cfz" "${BASEDIR}/OPAM/repo/default.tar.gz.tmp" "-C" "${BASEDIR}/OPAM/repo" "default"
### ls $OPAMROOT/repo | grep -v "cache"
default.tar.gz
lock
plain
repos-config
### opam install foo.2 -vv | grep '^\+' | sed-cmd test | sed-cmd tar
+ tar "xfz" "${BASEDIR}/OPAM/repo/default.tar.gz" "-C" "${OPAMTMP}"
+ test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.2)
### opam repository remove default --all
### : Add tarred repo (tarred)
### <REPO/packages/foo/foo.3/opam>
opam-version: "2.0"
build: ["test" "-f" "baz"]
### <REPO/packages/foo/foo.3/files/baz>
some content
### sh hash.sh REPO foo.3
### opam repository add tarred ./REPO --this-switch
[tarred] Initialised
### : New tarred repositories does not change already unchanged existing ones
### ls $OPAMROOT/repo | grep -v "cache"
lock
plain
repos-config
tarred.tar.gz
### opam install foo.3 -vv | grep '^\+' | sed-cmd test | sed-cmd tar
+ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}"
+ test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.3)
### opam repository remove plain --all
### : Update tarred repo (tarred)
### <REPO/packages/foo/foo.4/opam>
opam-version: "2.0"
build: ["test" "-f" "baz"]
### <REPO/packages/foo/foo.4/files/baz>
some content
### sh hash.sh REPO foo.4
### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
+ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}"
+ diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP})
+ patch "--version"
+ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${OPAMTMP}/tarred)
+ tar "cfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz.tmp" "-C" "${OPAMTMP}" "tarred"
### opam install foo.4 -vv | grep '^\+' | sed-cmd test | sed-cmd tar
+ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}"
+ test "-f" "baz" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.4)
### mkdir tarred-ext
### tar xf OPAM/repo/tarred.tar.gz
### diff -ru ./tarred REPO
### ls $OPAMROOT/repo | grep -v "cache"
lock
repos-config
tarred.tar.gz
### : From tarred repo to plain repo (tarred)
### OPAMREPOSITORYTARRING=0
### <REPO/packages/foo/foo.5/opam>
opam-version: "2.0"
build: ["test" "-f" "quux"]
### <REPO/packages/foo/foo.5/files/quux>
some content
### sh hash.sh REPO foo.5
### opam update -vv | grep '^\+' | sed-cmd tar | sed-cmd diff | sed-cmd patch | 'patch-[^"]+' -> 'patch'
+ tar "xfz" "${BASEDIR}/OPAM/repo/tarred.tar.gz" "-C" "${OPAMTMP}"
+ diff "-ruaN" "tarred" "tarred.new" (CWD=${OPAMTMP})
+ patch "--version"
+ patch "-p1" "-i" "${BASEDIR}/OPAM/log/patch" (CWD=${OPAMTMP}/tarred)
### opam install foo.5 -vv | grep '^\+' | sed-cmd test
+ test "-f" "quux" (CWD=${BASEDIR}/OPAM/tarring/.opam-switch/build/foo.5)
### ls $OPAMROOT/repo | grep -v "cache"
lock
repos-config
tarred
### ls $OPAMROOT/repo/tarred
packages
repo
### diff -ru ./REPO $OPAMROOT/repo/tarred
### # Noop update with no changes
### <REPO/packages/foo/foo.4/opam>
opam-version: "2.0"
build: ["test" "-f" "rab"]
### <REPO/packages/foo/foo.4/files/rab>
some content
### sh hash.sh REPO foo.4
### OPAMDEBUGSECTIONS="FILE(opam) FILE(repo) FILE(repos-config)  CACHE(repository)"
### opam update --debug-level=-3 | "state-[0-9A-Z]{8}" -> "state-hash" | unordered
FILE(config)                    Read ${BASEDIR}/OPAM/config in 0.000s
FILE(repos-config)              Read ${BASEDIR}/OPAM/repo/repos-config in 0.000s
CACHE(repository)               Loaded ${BASEDIR}/OPAM/repo/state-hash.cache in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/tarring/.opam-switch/packages/foo.5/opam in 0.000s

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[tarred] synchronised from file://${BASEDIR}/REPO
FILE(repo)                      Read ${BASEDIR}/OPAM/repo/tarred/repo in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.4/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.3/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.2/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.1/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.5/opam in 0.000s
FILE(repos-config)              Wrote ${BASEDIR}/OPAM/repo/repos-config atomically in 0.000s
CACHE(repository)               Writing the repository cache to ${BASEDIR}/OPAM/repo/state-hash.cache ...
CACHE(repository)               ${BASEDIR}/OPAM/repo/state-hash.cache written in 0.000s
Now run 'opam upgrade' to apply any package updates.
### opam install foo.4
The following actions will be performed:
=== downgrade 1 package
  - downgrade foo 5 to 4

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed   foo.5
-> installed foo.4
Done.
### opam update --debug-level=-3 | "state-[0-9A-Z]{8}" -> "state-hash"
FILE(config)                    Read ${BASEDIR}/OPAM/config in 0.000s
FILE(repos-config)              Read ${BASEDIR}/OPAM/repo/repos-config in 0.000s
CACHE(repository)               Loaded ${BASEDIR}/OPAM/repo/state-hash.cache in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/tarring/.opam-switch/packages/foo.4/opam in 0.000s

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[tarred] no changes from file://${BASEDIR}/REPO
### opam list --all --all-versions
# Packages matching: any
# Package # Installed # Synopsis
foo.1     4
foo.2     4
foo.3     4
foo.4     4
foo.5     4
### opam install foo.1
The following actions will be performed:
=== downgrade 1 package
  - downgrade foo 4 to 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed   foo.4
-> installed foo.1
Done.
### : behaviour with multi repo / on cache write
### <REPO2/repo>
opam-version: "2.0"
### <REPO2/packages/bar/bar.1/opam>
opam-version: "2.0"
build: ["test" "-f" "oof"]
### <REPO2/packages/bar/bar.1/files/oof>
some content
### sh hash.sh REPO2 bar.1
### opam repository add repo2 ./REPO2 --this-switch
[repo2] Initialised
### opam update --debug-level=-3 | "state-[0-9A-Z]{8}" -> "state-hash"
FILE(config)                    Read ${BASEDIR}/OPAM/config in 0.000s
FILE(repos-config)              Read ${BASEDIR}/OPAM/repo/repos-config in 0.000s
CACHE(repository)               Loaded ${BASEDIR}/OPAM/repo/state-hash.cache in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/tarring/.opam-switch/packages/foo.1/opam in 0.000s

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo2] no changes from file://${BASEDIR}/REPO2
[tarred] no changes from file://${BASEDIR}/REPO
### opam install bar.1
The following actions will be performed:
=== install 1 package
  - install bar 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed bar.1
Done.
### <REPO2/packages/bar/bar.2/opam>
opam-version: "2.0"
build: ["test" "-f" "oof"]
### <REPO2/packages/bar/bar.2/files/oof>
some content
### sh hash.sh REPO2 bar.2
### opam update --debug-level=-3 | "state-[0-9A-Z]{8}" -> "state-hash" | unordered
FILE(config)                    Read ${BASEDIR}/OPAM/config in 0.000s
FILE(repos-config)              Read ${BASEDIR}/OPAM/repo/repos-config in 0.000s
CACHE(repository)               Loaded ${BASEDIR}/OPAM/repo/state-hash.cache in 0.000s

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo2] synchronised from file://${BASEDIR}/REPO2
FILE(repo)                      Read ${BASEDIR}/OPAM/repo/repo2/repo in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/repo2/packages/bar/bar.2/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/repo2/packages/bar/bar.1/opam in 0.000s
[tarred] no changes from file://${BASEDIR}/REPO
FILE(repos-config)              Wrote ${BASEDIR}/OPAM/repo/repos-config atomically in 0.000s
CACHE(repository)               Writing the repository cache to ${BASEDIR}/OPAM/repo/state-hash.cache ...
CACHE(repository)               ${BASEDIR}/OPAM/repo/state-hash.cache written in 0.000s
Now run 'opam upgrade' to apply any package updates.
### opam install bar.2
The following actions will be performed:
=== upgrade 1 package
  - upgrade bar 1 to 2

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed   bar.1
-> installed bar.2
Done.
### <REPO/packages/foo/foo.6/opam>
opam-version: "2.0"
build: ["test" "-f" "rab"]
### <REPO/packages/foo/foo.6/files/rab>
some content
### sh hash.sh REPO foo.6
### <REPO2/packages/bar/bar.3/opam>
opam-version: "2.0"
build: ["test" "-f" "oof"]
### <REPO2/packages/bar/bar.3/files/oof>
some content
### sh hash.sh REPO2 bar.3
### opam update --debug-level=-3 | "state-[0-9A-Z]{8}" -> "state-hash" | unordered
FILE(config)                    Read ${BASEDIR}/OPAM/config in 0.000s
FILE(repos-config)              Read ${BASEDIR}/OPAM/repo/repos-config in 0.000s
CACHE(repository)               Loaded ${BASEDIR}/OPAM/repo/state-hash.cache in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/tarring/.opam-switch/packages/bar.2/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/tarring/.opam-switch/packages/foo.1/opam in 0.000s

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo2] synchronised from file://${BASEDIR}/REPO2
FILE(repo)                      Read ${BASEDIR}/OPAM/repo/repo2/repo in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/repo2/packages/bar/bar.2/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/repo2/packages/bar/bar.3/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/repo2/packages/bar/bar.1/opam in 0.000s
[tarred] synchronised from file://${BASEDIR}/REPO
FILE(repo)                      Read ${BASEDIR}/OPAM/repo/tarred/repo in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.4/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.6/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.3/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.2/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.1/opam in 0.000s
FILE(opam)                      Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/foo.5/opam in 0.000s
FILE(repos-config)              Wrote ${BASEDIR}/OPAM/repo/repos-config atomically in 0.000s
CACHE(repository)               Writing the repository cache to ${BASEDIR}/OPAM/repo/state-hash.cache ...
CACHE(repository)               ${BASEDIR}/OPAM/repo/state-hash.cache written in 0.000s
Now run 'opam upgrade' to apply any package updates.
### opam install bar.3 foo.6 | unordered
The following actions will be performed:
=== upgrade 2 packages
  - upgrade bar 2 to 3
  - upgrade foo 1 to 6

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> removed   foo.1
-> installed foo.6
-> removed   bar.2
-> installed bar.3
Done.
### : Failing urls :
### <OPER/repo>
opam-version: "2.0"
### <OPER/packages/first/first.1/opam>
opam-version: "2.0"
### <OPER2/repo>
opam-version: "2.0"
### <OPER2/packages/second/second.2/opam>
opam-version: "2.0"
version: "2.2"
### <OPER3/repo>
opam-version: "2.0"
### <OPER3/packages/third/third.3/opam>
opam-version: "2.0"
### opam repository add oper ./OPER --all --set-default
[oper] Initialised
### opam repository remove tarred --all
### opam switch create repos --empty
### :: Reset repository at its state ::
### ::: rsync - rsync :::
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### <OPER/packages/fantom/fantom.0/opam>
opam-version: "2.0"
### opam repository set-url oper ./OPER4
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### ::: rsync - git :::
### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### ::: git - rsync :::
### git -C ./OPER init -q
### git -C ./OPER config core.autocrlf false
### git -C ./OPER add repo
### git -C ./OPER add packages/first
### git -C ./OPER commit -qm "third"
### opam repository set-url oper git+file://$BASEDIR/OPER
[oper] Initialised
### git -C ./OPER add packages/fantom
### git -C ./OPER commit -qm "fantom"
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### opam repository set-url oper ./OPER4
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### ::: git - git :::
### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to git+file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### ::: check that fantom can be well fetched :::
### opam update oper

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[oper] synchronised from git+file://${BASEDIR}/OPER
Now run 'opam upgrade' to apply any package updates.
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
fantom --
first  --
### rm -rf OPER/.git OPER/packages/fantom
### opam repository set-url oper ./OPER
[oper] Initialised
### :: Simply failing urls ::
### opam repository --this-switch add oper4 ./OPER4
[ERROR] Could not update repository "oper4": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Initial repository fetch failed
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch set-url oper ./OPER4
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch add oper2 ./OPER2 --strict
[oper2] Initialised
[ERROR] In ${BASEDIR}/OPAM/repo/oper2/packages/second/second.2/opam:
        This file is for package 'second.2' but has mismatching fields 'version:2.2.
[ERROR] Strict mode: aborting
[ERROR] Could not update repository "oper2": OpamStd.OpamSys.Exit(30)
[ERROR] Initial repository fetch failed
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch set-url oper ./OPER2 --strict
[oper] Initialised
[ERROR] In ${BASEDIR}/OPAM/repo/oper/packages/second/second.2/opam:
        This file is for package 'second.2' but has mismatching fields 'version:2.2.
[ERROR] Strict mode: aborting
[ERROR] Could not update repository "oper": OpamStd.OpamSys.Exit(30)
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER2 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch add oper3 ./OPER3 --strict
[oper3] Initialised
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper3 file://${BASEDIR}/OPER3
 2 oper  file://${BASEDIR}/OPER
### opam repository --this-switch set-url oper ./OPER3 --strict
[oper] Initialised
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper3 file://${BASEDIR}/OPER3
 2 oper  file://${BASEDIR}/OPER3
### :: Failing urls with repository tarring ::
### opam repository add default ./REPO --this-switch
[default] Initialised
### opam repository remove oper oper3 --all
### opam switch remove repos -y
Switch repos and all its packages will be wiped. Are you sure? [y/n] y
### OPAMREPOSITORYTARRING=1
### rm -rf OPER OPER2 OPER3
### <OPER/repo>
opam-version: "2.0"
### <OPER/packages/first/first.1/opam>
opam-version: "2.0"
### <OPER2/repo>
opam-version: "2.0"
### <OPER2/packages/second/second.2/opam>
opam-version: "2.0"
version: "2.2"
### <OPER3/repo>
opam-version: "2.0"
### <OPER3/packages/third/third.3/opam>
opam-version: "2.0"
### opam repository add oper ./OPER --all --set-default
[oper] Initialised
### opam repository remove default --all
### opam switch create repos --empty
### ::: Reset repository at its state :::
### :::: rsync - rsync ::::
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### <OPER/packages/fantom/fantom.0/opam>
opam-version: "2.0"
### opam repository set-url oper ./OPER4
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### :::: rsync - git ::::
### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### :::: git - rsync ::::
### git -C ./OPER init -q
### git -C ./OPER config core.autocrlf false
### git -C ./OPER add repo
### git -C ./OPER add packages/first
### git -C ./OPER commit -qm "third"
### opam repository set-url oper git+file://$BASEDIR/OPER
[oper] Initialised
### git -C ./OPER add packages/fantom
### git -C ./OPER commit -qm "fantom"
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### opam repository set-url oper ./OPER4
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### :::: git - git ::::
### opam repository set-url oper git+file://$BASEDIR/OPER4 | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://${BASEDIR}/OPER4 fails, reverting to git+file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### opam repository set-url oper git+file://./OPER3#unknownbranch | sed-cmd git
[ERROR] Could not update repository "oper": "git fetch -q" exited with code 128
[ERROR] Fetching repository oper with git+file://./OPER3#unknownbranch fails, reverting to git+file://${BASEDIR}/OPER
# Return code 40 #
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
first  --
### ::: check that fantom can be well fetched :::
### opam update oper

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[oper] synchronised from git+file://${BASEDIR}/OPER
Now run 'opam upgrade' to apply any package updates.
### opam list --available --repo=oper
# Packages matching: from-repository(oper) & available
# Name # Installed # Synopsis
fantom --
first  --
### rm -rf OPER/.git OPER/packages/fantom
### opam repository set-url oper ./OPER
[oper] Initialised
### ::: Simply failing urls :::
### opam repository --this-switch add oper4 ./OPER4
[ERROR] Could not update repository "oper4": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Initial repository fetch failed
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch set-url oper ./OPER4
[ERROR] Could not update repository "oper": rsync error: Directory ${BASEDIR}/OPER4/ does not exist
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER4 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch add oper2 ./OPER2 --strict
[oper2] Initialised
[ERROR] In ${BASEDIR}/OPAM/repo/oper2/packages/second/second.2/opam:
        This file is for package 'second.2' but has mismatching fields 'version:2.2.
[ERROR] Strict mode: aborting
[ERROR] Could not update repository "oper2": OpamStd.OpamSys.Exit(30)
[ERROR] Initial repository fetch failed
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch set-url oper ./OPER2 --strict
[oper] Initialised
[ERROR] In ${BASEDIR}/OPAM/repo/oper/packages/second/second.2/opam:
        This file is for package 'second.2' but has mismatching fields 'version:2.2.
[ERROR] Strict mode: aborting
[ERROR] Could not update repository "oper": OpamStd.OpamSys.Exit(30)
[ERROR] Fetching repository oper with file://${BASEDIR}/OPER2 fails, reverting to file://${BASEDIR}/OPER
# Return code 40 #
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper file://${BASEDIR}/OPER
### opam repository --this-switch add oper3 ./OPER3 --strict
[oper3] Initialised
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper3 file://${BASEDIR}/OPER3
 2 oper  file://${BASEDIR}/OPER
### opam repository --this-switch set-url oper ./OPER3 --strict
[oper] Initialised
### opam repository --this-switch

<><> Repository configuration for switch repos ><><><><><><><><><><><><><><><><>
 1 oper3 file://${BASEDIR}/OPER3
 2 oper  file://${BASEDIR}/OPER3
### : Ensure that git repository is retrieved not with full history
### OPAMREPOSITORYTARRING=0
### <TMCS/repo>
opam-version: "2.0"
### <TMCS/packages/first/first.1/opam>
opam-version: "2.0"
### git -C ./TMCS init -q
### git -C ./TMCS config core.autocrlf false
### git -C ./TMCS add repo
### git -C ./TMCS add packages/first
### git -C ./TMCS commit -qm "init"
### git -C ./TMCS commit --allow-empty -m "second empty commit" --quiet
### git -C ./TMCS commit --allow-empty -m "thirs empty commit" --quiet
### git -C ./TMCS rev-list --all --count
3
### opam repository add to-many-commits git+file://$BASEDIR/TMCS --this-switch
[to-many-commits] Initialised
### git -C ./OPAM/repo/to-many-commits rev-list --all --count
1
### : Test repository upgrade path (packages requiring newer version of opam) ::::
### OPAMDEBUGSECTIONS="opam-file"
### sh -c "opam --version | cut -f -2 -d '.'" >$ OPAMMAJORVERSION
### opam repository remove -a oper3 oper repo2 to-many-commits
### <VRS/repo>
opam-version: "2.0"
### <VRS/packages/good-opam-version/good-opam-version.1/opam>
opam-version: "2.0"
### opam repository --this-switch add versions ./VRS
[versions] Initialised
### opam repository --this-switch add repo ./REPO
[repo] Initialised
### opam list -A --all-versions -s
foo.1
foo.2
foo.3
foo.4
foo.5
foo.6
good-opam-version.1
### :: with opam strict
### OPAMSTRICT=1
### <VRS/packages/bad-opam-version/bad-opam-version.1/opam>
opam-version: "5.0"
some-field-that-do-not-exist: true
### opam update -a --debug-level=-1

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo] no changes from file://${BASEDIR}/REPO
[versions] synchronised from file://${BASEDIR}/VRS
opam-file                       opam-version "5.0" unsupported on ${BASEDIR}/OPAM/repo/versions/packages/bad-opam-version/bad-opam-version.1/opam. Added as dummy unavailable package.
Now run 'opam upgrade' to apply any package updates.
### opam list -A --all-versions -s
bad-opam-version.1
foo.1
foo.2
foo.3
foo.4
foo.5
foo.6
good-opam-version.1
### opam show --raw bad-opam-version.1 | "${OPAMMAJORVERSION}" -> "CURRENTMAJOR"
opam-version: "2.0"
name: "bad-opam-version"
version: "1"
synopsis: ""
description: """\
This package uses opam 5.0 file format which opam CURRENTMAJOR cannot read.

In order to install or view information on this package, please upgrade your opam installation to at least version 5.0."""
available: opam-version >= "5.0"
### :: without opam strict
### OPAMSTRICT=0
### <REPO/packages/bad-opam-version/bad-opam-version.2/opam>
opam-version: "5.0"
some-field-that-do-not-exist: true
### <REPO/packages/bad-opam-version/bad-opam-version.3/opam>
opam-version: "5.0"
GARBAGE
### <VRS/packages/a/a.1/opam>
opam-version: "2.0"
### opam update -a --debug-level=-1 | unordered

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[repo] synchronised from file://${BASEDIR}/REPO
opam-file                       opam-version "5.0" unsupported on ${BASEDIR}/OPAM/repo/repo/packages/bad-opam-version/bad-opam-version.2/opam. Added as dummy unavailable package.
opam-file                       opam-version "5.0" unsupported on ${BASEDIR}/OPAM/repo/repo/packages/bad-opam-version/bad-opam-version.3/opam. Added as dummy unavailable package.
[versions] synchronised from file://${BASEDIR}/VRS
opam-file                       opam-version "5.0" unsupported on ${BASEDIR}/OPAM/repo/versions/packages/bad-opam-version/bad-opam-version.1/opam. Added as dummy unavailable package.
Now run 'opam upgrade' to apply any package updates.
### opam list -A --all-versions -s
a.1
bad-opam-version.1
bad-opam-version.2
bad-opam-version.3
foo.1
foo.2
foo.3
foo.4
foo.5
foo.6
good-opam-version.1
### opam repository remove -a versions
### opam repository remove -a repo
### opam list -A --all-versions -s
### opam repository --this-switch add repo ./REPO
[repo] Initialised
### opam repository --this-switch add versions ./VRS
[versions] Initialised
### opam list -A --all-versions -s
a.1
bad-opam-version.1
bad-opam-version.2
bad-opam-version.3
foo.1
foo.2
foo.3
foo.4
foo.5
foo.6
good-opam-version.1
### opam show --raw bad-opam-version.1 | "${OPAMMAJORVERSION}" -> "CURRENTMAJOR"
opam-version: "2.0"
name: "bad-opam-version"
version: "1"
synopsis: ""
description: """\
This package uses opam 5.0 file format which opam CURRENTMAJOR cannot read.

In order to install or view information on this package, please upgrade your opam installation to at least version 5.0."""
available: opam-version >= "5.0"
### opam show --raw bad-opam-version.2 | "${OPAMMAJORVERSION}" -> "CURRENTMAJOR"
opam-version: "2.0"
name: "bad-opam-version"
version: "2"
synopsis: ""
description: """\
This package uses opam 5.0 file format which opam CURRENTMAJOR cannot read.

In order to install or view information on this package, please upgrade your opam installation to at least version 5.0."""
available: opam-version >= "5.0"
### opam show --raw bad-opam-version.3 | "${OPAMMAJORVERSION}" -> "CURRENTMAJOR"
opam-version: "2.0"
name: "bad-opam-version"
version: "3"
synopsis: ""
description: """\
This package uses opam 5.0 file format which opam CURRENTMAJOR cannot read.

In order to install or view information on this package, please upgrade your opam installation to at least version 5.0."""
available: opam-version >= "5.0"
### :: Parse errors
### <VRS/packages/two-zero/two-zero.1/opam>
opam-version: "2.0"
GARBAGE
### opam update versions

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[versions] synchronised from file://${BASEDIR}/VRS
[WARNING] Could not read file ${BASEDIR}/OPAM/repo/versions/packages/two-zero/two-zero.1/opam. skipping:
          At ${BASEDIR}/OPAM/repo/versions/packages/two-zero/two-zero.1/opam:3:0-3:0::
          Parse error
### opam show two-zero --raw
[ERROR] No package matching two-zero found
# Return code 5 #
### rm -r VRS/packages
### <VRS/packages/two-one/two-one.1/opam>
opam-version: "2.1"
GARBAGE
### opam update versions

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[versions] synchronised from file://${BASEDIR}/VRS
[WARNING] Could not read file ${BASEDIR}/OPAM/repo/versions/packages/two-one/two-one.1/opam. skipping:
          At ${BASEDIR}/OPAM/repo/versions/packages/two-one/two-one.1/opam:3:0-3:0::
          Parse error
Now run 'opam upgrade' to apply any package updates.
### opam show two-one --raw
[ERROR] No package matching two-one found
# Return code 5 #
### rm -r VRS/packages
### <VRS/packages/two-two/two-two.1/opam>
opam-version: "2.2"
GARBAGE
### opam update versions

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[versions] synchronised from file://${BASEDIR}/VRS
[WARNING] Could not read file ${BASEDIR}/OPAM/repo/versions/packages/two-two/two-two.1/opam. skipping:
          At ${BASEDIR}/OPAM/repo/versions/packages/two-two/two-two.1/opam:3:0-3:0::
          Parse error
### opam show two-two --raw
[ERROR] No package matching two-two found
# Return code 5 #
### rm -r VRS/packages
### <VRS/packages/two-three/two-three.1/opam>
opam-version: "2.3"
GARBAGE
### opam update versions

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[versions] synchronised from file://${BASEDIR}/VRS
[WARNING] Could not read file ${BASEDIR}/OPAM/repo/versions/packages/two-three/two-three.1/opam. skipping:
          At ${BASEDIR}/OPAM/repo/versions/packages/two-three/two-three.1/opam:3:0-3:0::
          Parse error
### opam show two-three --raw
[ERROR] No package matching two-three found
# Return code 5 #
