aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-02-22 00:58:53 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-03-15 19:15:55 +0300
commita791b1ce0fa2bc9859474fb6f7a9c0ff8cbd1d4a (patch)
tree3c9823a54e6e28a8c8f9fb281d82ad2a67c117ba /tests
parent755a99a7ebf24e00675e2f2e0f5184825ad74c4a (diff)
Port test.sh to testscript
Diffstat (limited to 'tests')
-rw-r--r--tests/auth.test23
-rwxr-xr-xtests/auth/cert36
-rw-r--r--tests/auth/default-cert-fp1
-rw-r--r--tests/auth/default-cert.pem (renamed from tests/pkg/1/build2.org/auth/create-expired/repositories)29
-rw-r--r--tests/auth/default-openssl.cnf (renamed from tests/default-openssl.cnf)0
-rw-r--r--tests/auth/expired-cert.pem30
-rw-r--r--tests/auth/key.pem (renamed from tests/key.pem)0
-rw-r--r--tests/auth/mismatch-cert.pem31
-rw-r--r--tests/auth/mismatch-openssl.cnf (renamed from tests/mismatch-openssl.cnf)2
-rw-r--r--tests/auth/noemail-cert.pem (renamed from tests/pkg/1/build2.org/auth/create-noemail/repositories)31
-rw-r--r--tests/auth/noemail-openssl.cnf (renamed from tests/noemail-openssl.cnf)0
-rw-r--r--tests/build/.gitignore1
-rw-r--r--tests/build/bootstrap.build9
-rw-r--r--tests/build/root.build17
-rw-r--r--tests/buildfile12
-rwxr-xr-xtests/cert.sh46
-rw-r--r--tests/cfg-create.test75
-rw-r--r--tests/common.test41
-rw-r--r--tests/common/bar/stable/libbar-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/common/bar/stable/libbar-1.0.0.tar.gz)bin957 -> 957 bytes
-rw-r--r--tests/common/bar/stable/repositories (renamed from tests/pkg/1/build2.org/common/bar/stable/repositories)0
-rw-r--r--tests/common/bar/testing/libbar-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/common/bar/testing/libbar-1.1.0.tar.gz)bin959 -> 959 bytes
-rw-r--r--tests/common/bar/testing/repositories (renamed from tests/pkg/1/build2.org/common/bar/testing/repositories)0
-rw-r--r--tests/common/bar/unstable/libbar-1.1.1.tar.gz (renamed from tests/pkg/1/build2.org/common/bar/unstable/libbar-1.1.1.tar.gz)bin1189 -> 1189 bytes
-rw-r--r--tests/common/bar/unstable/repositories (renamed from tests/pkg/1/build2.org/common/bar/unstable/repositories)0
-rw-r--r--tests/common/foo-1.tar.gzbin0 -> 261 bytes
-rw-r--r--tests/common/foo/stable/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/common/foo/stable/libfoo-1.0.0.tar.gz)bin881 -> 881 bytes
-rw-r--r--tests/common/foo/stable/repositories (renamed from tests/pkg/1/build2.org/common/foo/stable/repositories)0
-rw-r--r--tests/common/foo/testing/libfoo-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/common/foo/testing/libfoo-1.1.0.tar.gz)bin874 -> 874 bytes
-rw-r--r--tests/common/foo/testing/repositories (renamed from tests/pkg/1/build2.org/common/foo/testing/repositories)0
-rw-r--r--tests/common/hello/libhello-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/common/hello/libhello-1.0.0.tar.gz)bin2483 -> 2483 bytes
-rw-r--r--tests/common/hello/repositories4
-rw-r--r--tests/common/libfoo-1.1.0/build/bootstrap.build (renamed from tests/pkg/1/build2.org/fetch/libfoo-1.1.0/build/bootstrap.build)0
-rw-r--r--tests/common/libfoo-1.1.0/buildfile (renamed from tests/pkg/1/build2.org/fetch/libfoo-1.1.0/buildfile)0
-rw-r--r--tests/common/libfoo-1.1.0/manifest (renamed from tests/pkg/1/build2.org/fetch/libfoo-1.1.0/manifest)0
-rw-r--r--tests/common/libhello-1.0.0/INSTALL (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/INSTALL)0
-rw-r--r--tests/common/libhello-1.0.0/build/bootstrap.build (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/build/bootstrap.build)0
-rw-r--r--tests/common/libhello-1.0.0/build/export.build (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/build/export.build)0
-rw-r--r--tests/common/libhello-1.0.0/build/root.build (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/build/root.build)0
-rw-r--r--tests/common/libhello-1.0.0/buildfile (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/buildfile)0
-rw-r--r--tests/common/libhello-1.0.0/hello/buildfile (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/hello/buildfile)0
-rw-r--r--tests/common/libhello-1.0.0/hello/export (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/hello/export)0
-rw-r--r--tests/common/libhello-1.0.0/hello/hello (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/hello/hello)0
-rw-r--r--tests/common/libhello-1.0.0/hello/hello.cxx (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/hello/hello.cxx)0
-rw-r--r--tests/common/libhello-1.0.0/manifest (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/manifest)0
-rw-r--r--tests/common/libhello-1.0.0/tests/build/bootstrap.build (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/tests/build/bootstrap.build)0
-rw-r--r--tests/common/libhello-1.0.0/tests/build/root.build (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/tests/build/root.build)0
-rw-r--r--tests/common/libhello-1.0.0/tests/buildfile (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/tests/buildfile)0
-rw-r--r--tests/common/libhello-1.0.0/tests/test/buildfile (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/buildfile)0
-rw-r--r--tests/common/libhello-1.0.0/tests/test/driver.cxx (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/driver.cxx)0
-rw-r--r--tests/common/libhello-1.0.0/tests/test/test.out (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/test.out)0
-rw-r--r--tests/common/libhello-1.0.0/version (renamed from tests/pkg/1/build2.org/common/libhello-1.0.0/version)0
-rw-r--r--tests/common/satisfy/libbar-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libbar-1.0.0.tar.gz)bin356 -> 356 bytes
-rw-r--r--tests/common/satisfy/libbar-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libbar-1.1.0.tar.gz)bin360 -> 360 bytes
-rw-r--r--tests/common/satisfy/libbar-1.2.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libbar-1.2.0.tar.gz)bin348 -> 348 bytes
-rw-r--r--tests/common/satisfy/libbaz-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libbaz-1.0.0.tar.gz)bin359 -> 359 bytes
-rw-r--r--tests/common/satisfy/libbaz-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libbaz-1.1.0.tar.gz)bin363 -> 363 bytes
-rw-r--r--tests/common/satisfy/libbiz-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libbiz-1.0.0.tar.gz)bin366 -> 366 bytes
-rw-r--r--tests/common/satisfy/libfoo-0.0.1.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libfoo-0.0.1.tar.gz)bin352 -> 352 bytes
-rw-r--r--tests/common/satisfy/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/auth/libfoo-1.0.0.tar.gz)bin348 -> 348 bytes
-rw-r--r--tests/common/satisfy/libfoo-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libfoo-1.1.0.tar.gz)bin349 -> 349 bytes
-rw-r--r--tests/common/satisfy/libfoo-1.1.0/build/bootstrap.build (renamed from tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/build/bootstrap.build)0
-rw-r--r--tests/common/satisfy/libfoo-1.1.0/buildfile (renamed from tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/buildfile)0
-rw-r--r--tests/common/satisfy/libfoo-1.1.0/manifest (renamed from tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/manifest)0
-rw-r--r--tests/common/satisfy/libfoo-1.2.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libfoo-1.2.0.tar.gz)bin350 -> 350 bytes
-rw-r--r--tests/common/satisfy/libfox-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libfox-1.0.0.tar.gz)bin349 -> 349 bytes
-rw-r--r--tests/common/satisfy/repositories (renamed from tests/pkg/1/build2.org/auth/unsigned1/repositories)0
l---------tests/common/satisfy/t1/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/auth/create-expired/libfoo-1.0.0.tar.gz)0
l---------tests/common/satisfy/t1/repositories (renamed from tests/pkg/1/build2.org/fetch/t1/repositories)0
l---------tests/common/satisfy/t2/libbar-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t2/libbar-1.0.0.tar.gz)0
l---------tests/common/satisfy/t2/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/auth/create-noemail/libfoo-1.0.0.tar.gz)0
l---------tests/common/satisfy/t2/repositories (renamed from tests/pkg/1/build2.org/satisfy/t1/repositories)0
l---------tests/common/satisfy/t3/libbaz-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t3/libbaz-1.0.0.tar.gz)0
l---------tests/common/satisfy/t3/libfox-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t3/libfox-1.0.0.tar.gz)0
-rw-r--r--tests/common/satisfy/t3/repositories (renamed from tests/pkg/1/build2.org/satisfy/t3/repositories)0
l---------tests/common/satisfy/t4a/libfoo-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/fetch/t1/libfoo-1.1.0.tar.gz)0
l---------tests/common/satisfy/t4a/repositories (renamed from tests/pkg/1/build2.org/satisfy/t2/repositories)0
l---------tests/common/satisfy/t4b/libbar-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t4b/libbar-1.1.0.tar.gz)0
-rw-r--r--tests/common/satisfy/t4b/repositories (renamed from tests/pkg/1/build2.org/satisfy/t4b/repositories)0
l---------tests/common/satisfy/t4c/libbaz-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t4c/libbaz-1.1.0.tar.gz)0
l---------tests/common/satisfy/t4c/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/auth/expired/libfoo-1.0.0.tar.gz)0
-rw-r--r--tests/common/satisfy/t4c/repositories (renamed from tests/pkg/1/build2.org/satisfy/t4c/repositories)0
l---------tests/common/satisfy/t4d/libbiz-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t4d/libbiz-1.0.0.tar.gz)0
l---------tests/common/satisfy/t4d/libfox-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t4d/libfox-1.0.0.tar.gz)0
-rw-r--r--tests/common/satisfy/t4d/repositories (renamed from tests/pkg/1/build2.org/satisfy/t4d/repositories)0
l---------tests/common/satisfy/t5/libbar-1.2.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/t5/libbar-1.2.0.tar.gz)0
l---------tests/common/satisfy/t5/repositories (renamed from tests/pkg/1/build2.org/satisfy/t4a/repositories)0
-rw-r--r--tests/common/t1/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libfoo-1.0.0.tar.gz)bin348 -> 348 bytes
-rw-r--r--tests/common/t1/libfoo-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/fetch/libfoo-1.1.0.tar.gz)bin349 -> 349 bytes
-rw-r--r--tests/common/t1/repositories (renamed from tests/pkg/1/build2.org/auth/unsigned2/repositories)0
-rw-r--r--tests/config.test27
-rw-r--r--tests/pkg-build.test1239
l---------tests/pkg-build/libbar-1.0.0.tar.gz1
l---------tests/pkg-build/libbaz-1.1.0.tar.gz1
l---------tests/pkg-build/libfoo-0.0.1.tar.gz1
l---------tests/pkg-build/libfoo-1.0.0.tar.gz1
l---------tests/pkg-build/libfoo-1.1.01
l---------tests/pkg-build/libfoo-1.1.0.tar.gz1
l---------tests/pkg-build/libfoo-1.2.0.tar.gz1
l---------tests/pkg-build/t11
l---------tests/pkg-build/t21
l---------tests/pkg-build/t31
l---------tests/pkg-build/t4a1
l---------tests/pkg-build/t4b1
l---------tests/pkg-build/t4c1
l---------tests/pkg-build/t4d1
l---------tests/pkg-build/t51
-rw-r--r--tests/pkg-clean.test133
l---------tests/pkg-clean/hello1
l---------tests/pkg-clean/libhello-1.0.01
-rw-r--r--tests/pkg-configure.test389
l---------tests/pkg-configure/hello1
l---------tests/pkg-configure/libhello-1.0.01
-rw-r--r--tests/pkg-configure/stable/libbar-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libbar-1.0.0.tar.gz)bin354 -> 354 bytes
-rw-r--r--tests/pkg-configure/stable/libbar-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libbar-1.1.0.tar.gz)bin359 -> 359 bytes
-rw-r--r--tests/pkg-configure/stable/libbar-1.2.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libbar-1.2.0.tar.gz)bin372 -> 372 bytes
-rw-r--r--tests/pkg-configure/stable/libbar-1.3.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libbar-1.3.0.tar.gz)bin378 -> 378 bytes
-rw-r--r--tests/pkg-configure/stable/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz)bin348 -> 348 bytes
-rw-r--r--tests/pkg-configure/stable/libfoo-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/satisfy/libfoo-1.1.0.tar.gz)bin349 -> 349 bytes
-rw-r--r--tests/pkg-configure/stable/libfoo-1.2.0.tar.gz (renamed from tests/pkg/1/build2.org/depend/stable/libfoo-1.2.0.tar.gz)bin348 -> 348 bytes
-rw-r--r--tests/pkg-configure/stable/repositories (renamed from tests/pkg/1/build2.org/depend/stable/repositories)0
-rw-r--r--tests/pkg-drop.test448
l---------tests/pkg-drop/t4a1
l---------tests/pkg-drop/t4b1
l---------tests/pkg-drop/t4c1
l---------tests/pkg-drop/t4d1
-rw-r--r--tests/pkg-fetch.test200
l---------tests/pkg-fetch/hello1
l---------tests/pkg-fetch/t11
-rw-r--r--tests/pkg-purge.test182
l---------tests/pkg-purge/libfoo-1.0.0.tar.gz1
l---------tests/pkg-purge/libfoo-1.1.01
-rw-r--r--tests/pkg-status.test160
-rw-r--r--tests/pkg-status/extra/libbar-1.1.0+1.tar.gz (renamed from tests/pkg/1/build2.org/status/extra/libbar-1.1.0+1.tar.gz)bin243 -> 243 bytes
-rw-r--r--tests/pkg-status/extra/repositories (renamed from tests/pkg/1/build2.org/status/extra/repositories)0
-rw-r--r--tests/pkg-status/stable/libbar-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/status/stable/libbar-1.0.0.tar.gz)bin241 -> 241 bytes
-rw-r--r--tests/pkg-status/stable/libfoo-1.0.0.tar.gz (renamed from tests/pkg/1/build2.org/status/stable/libfoo-1.0.0.tar.gz)bin240 -> 240 bytes
-rw-r--r--tests/pkg-status/stable/repositories (renamed from tests/pkg/1/build2.org/fetch/repositories)0
-rw-r--r--tests/pkg-status/testing/libbar-1.0.0+1.tar.gz (renamed from tests/pkg/1/build2.org/status/testing/libbar-1.0.0+1.tar.gz)bin243 -> 243 bytes
-rw-r--r--tests/pkg-status/testing/libbar-1.1.0.tar.gz (renamed from tests/pkg/1/build2.org/status/testing/libbar-1.1.0.tar.gz)bin242 -> 242 bytes
-rw-r--r--tests/pkg-status/testing/repositories (renamed from tests/pkg/1/build2.org/status/testing/repositories)0
-rw-r--r--tests/pkg-status/unstable/libbar-2.0.0.tar.gz (renamed from tests/pkg/1/build2.org/status/unstable/libbar-2.0.0.tar.gz)bin245 -> 245 bytes
-rw-r--r--tests/pkg-status/unstable/repositories (renamed from tests/pkg/1/build2.org/status/unstable/repositories)0
-rw-r--r--tests/pkg-system.test873
-rw-r--r--tests/pkg-system/foo-2.tar.gz (renamed from tests/pkg/1/build2.org/system/foo-2.tar.gz)bin356 -> 356 bytes
-rw-r--r--tests/pkg-system/libbar-0+1.tar.gz (renamed from tests/pkg/1/build2.org/system/libbar-0+1.tar.gz)bin239 -> 239 bytes
-rw-r--r--tests/pkg-system/libbar-1.tar.gz (renamed from tests/pkg/1/build2.org/system/libbar-1.tar.gz)bin352 -> 352 bytes
-rw-r--r--tests/pkg-system/libbar-2.tar.gz (renamed from tests/pkg/1/build2.org/system/libbar-2.tar.gz)bin353 -> 353 bytes
-rw-r--r--tests/pkg-system/libbaz-2.tar.gz (renamed from tests/pkg/1/build2.org/system/libbaz-2.tar.gz)bin338 -> 338 bytes
l---------tests/pkg-system/t1/foo-2.tar.gz (renamed from tests/pkg/1/build2.org/system/t1/foo-2.tar.gz)0
l---------tests/pkg-system/t1/libbar-1.tar.gz (renamed from tests/pkg/1/build2.org/system/t1/libbar-1.tar.gz)0
l---------tests/pkg-system/t1/libbar-2.tar.gz (renamed from tests/pkg/1/build2.org/system/t1/libbar-2.tar.gz)0
l---------tests/pkg-system/t1/libbaz-2.tar.gz (renamed from tests/pkg/1/build2.org/system/t1/libbaz-2.tar.gz)0
-rw-r--r--tests/pkg-system/t1/repositories (renamed from tests/pkg/1/build2.org/satisfy/repositories)0
l---------tests/pkg-system/t2/foo-2.tar.gz (renamed from tests/pkg/1/build2.org/system/t2/foo-2.tar.gz)0
l---------tests/pkg-system/t2/libbar-0+1.tar.gz (renamed from tests/pkg/1/build2.org/system/t2/libbar-0+1.tar.gz)0
-rw-r--r--tests/pkg-system/t2/repositories (renamed from tests/pkg/1/build2.org/status/stable/repositories)0
l---------tests/pkg-system/t3/foo-2.tar.gz (renamed from tests/pkg/1/build2.org/system/t3/foo-2.tar.gz)0
-rw-r--r--tests/pkg-system/t3/repositories (renamed from tests/pkg/1/build2.org/system/t3/repositories)0
-rw-r--r--tests/pkg-unpack.test199
l---------tests/pkg-unpack/hello1
l---------tests/pkg-unpack/libfoo-1.1.01
l---------tests/pkg-unpack/t11
-rw-r--r--tests/pkg-update.test148
l---------tests/pkg-update/hello1
l---------tests/pkg-update/libhello-1.0.01
-rw-r--r--tests/pkg-verify.test59
l---------tests/pkg-verify/foo-1.tar.gz1
-rw-r--r--tests/pkg-verify/foo-2.tar.gzbin0 -> 277 bytes
-rw-r--r--tests/pkg-verify/not-a-package.tar.gzbin0 -> 174 bytes
-rw-r--r--tests/pkg/.gitignore2
-rw-r--r--tests/pkg/1/build2.org/auth/expired/packages11
-rw-r--r--tests/pkg/1/build2.org/auth/expired/signature13
l---------tests/pkg/1/build2.org/auth/name-mismatch/libfoo-1.0.0.tar.gz1
-rw-r--r--tests/pkg/1/build2.org/auth/name-mismatch/repositories34
l---------tests/pkg/1/build2.org/auth/sha256sum-mismatch/libfoo-1.0.0.tar.gz1
-rw-r--r--tests/pkg/1/build2.org/auth/sha256sum-mismatch/repositories33
l---------tests/pkg/1/build2.org/auth/signature-mismatch/libfoo-1.0.0.tar.gz1
-rw-r--r--tests/pkg/1/build2.org/auth/signature-mismatch/repositories33
l---------tests/pkg/1/build2.org/auth/signed/libfoo-1.0.0.tar.gz1
-rw-r--r--tests/pkg/1/build2.org/auth/signed/repositories33
l---------tests/pkg/1/build2.org/auth/unsigned1/libfoo-1.0.0.tar.gz1
l---------tests/pkg/1/build2.org/auth/unsigned2/libfoo-1.0.0.tar.gz1
-rw-r--r--tests/pkg/1/build2.org/common/hello/repositories36
-rw-r--r--tests/pkg/1/build2.org/common/not-a-package.tar.gzbin259 -> 0 bytes
l---------tests/pkg/1/build2.org/fetch/t1/libfoo-1.0.0.tar.gz1
-rw-r--r--tests/pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gzbin348 -> 0 bytes
l---------tests/pkg/1/build2.org/satisfy/t1/libfoo-1.0.0.tar.gz1
l---------tests/pkg/1/build2.org/satisfy/t2/libfoo-1.0.0.tar.gz1
l---------tests/pkg/1/build2.org/satisfy/t4a/libfoo-1.1.0.tar.gz1
l---------tests/pkg/1/build2.org/satisfy/t4c/libfoo-1.0.0.tar.gz1
l---------tests/pkg/1/build2.org/satisfy/t5/repositories1
-rwxr-xr-xtests/publish (renamed from tests/pkg/publish)2
-rw-r--r--tests/remote.test37
-rw-r--r--tests/rep-add.test70
-rw-r--r--tests/rep-auth.test469
l---------tests/rep-auth/expired/foo-1.tar.gz1
-rw-r--r--tests/rep-auth/expired/packages11
-rw-r--r--tests/rep-auth/expired/repositories (renamed from tests/pkg/1/build2.org/auth/expired/repositories)26
-rw-r--r--tests/rep-auth/expired/signature13
l---------tests/rep-auth/unsigned/foo-1.tar.gz1
-rw-r--r--tests/rep-auth/unsigned/repositories (renamed from tests/pkg/1/build2.org/system/t1/repositories)0
-rw-r--r--tests/rep-create.test184
l---------tests/rep-create/stable/foo-1.tar.gz1
-rw-r--r--tests/rep-create/stable/repositories (renamed from tests/pkg/1/build2.org/system/t2/repositories)0
-rw-r--r--tests/rep-create/testing/foo-2.tar.gzbin0 -> 277 bytes
-rw-r--r--tests/rep-create/testing/repositories4
-rw-r--r--tests/rep-fetch.test134
l---------tests/rep-fetch/bar1
l---------tests/rep-fetch/foo1
l---------tests/rep-fetch/hello1
-rw-r--r--tests/rep-info.test128
l---------tests/rep-info/testing/foo-1.tar.gz1
-rw-r--r--tests/rep-info/testing/repositories6
-rwxr-xr-xtests/test.sh2003
214 files changed, 5475 insertions, 2304 deletions
diff --git a/tests/auth.test b/tests/auth.test
new file mode 100644
index 0000000..3669894
--- /dev/null
+++ b/tests/auth.test
@@ -0,0 +1,23 @@
+# file : tests/auth.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# OpenSSL passwordless private key.
+#
+key = $src_base/auth/key.pem
+
+# Repository certificate generated with the above private key.
+#
+cert = $src_base/auth/default-cert.pem
+
+# Repository certificate fingerprint.
+#
++set cert_fp <<<$src_base/auth/default-cert-fp
+
+# Manifest certificate name/value. Can be appended to the repositories file to
+# sign the repository.
+#
+cert_manifest = $~/cert-manifest
++echo 'certificate: \' >=$cert_manifest
++cat <<<$cert >+$cert_manifest
++echo '\' >+$cert_manifest
diff --git a/tests/auth/cert b/tests/auth/cert
new file mode 100755
index 0000000..41b3b9c
--- /dev/null
+++ b/tests/auth/cert
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+# Normally, you don't need to regenerate the private key.
+#
+# openssl genrsa 4096 > key.pem
+
+openssl req -x509 -new -key key.pem -days 1825 -config default-openssl.cnf > \
+ default-cert.pem
+
+cat default-cert.pem | openssl x509 -sha256 -noout -fingerprint | \
+ sed -n 's/^SHA256 Fingerprint=\(.*\)$/\1/p' >default-cert-fp
+
+openssl req -x509 -new -key key.pem -days 1825 -config mismatch-openssl.cnf > \
+ mismatch-cert.pem
+
+openssl req -x509 -new -key key.pem -days 1825 -config noemail-openssl.cnf > \
+ noemail-cert.pem
+
+# Normally, you have no reason to regenerate expired-cert.pem, as need to keep
+# it expired for the testing purposes. But if you do, copy expired-cert.pem
+# content to the certificate value of the following manifest files:
+# ../rep-auth/expired/repositories
+#
+# To regenerate the packages and signature manifest files run bpkg rep-create
+# command, for example:
+#
+# ../../bpkg/bpkg rep-create ../rep-auth/expired --key key.pem
+#
+# We cannot do it in the testscript since the certificate has expired. This is
+# also the reason why we store these auto-generated manifests in git.
+#
+# Will have to wait 1 day until the certificate expires. Until then testscript
+# will be failing.
+#
+# openssl req -x509 -new -key key.pem -days 1 -config default-openssl.cnf > \
+# expired-cert.pem
diff --git a/tests/auth/default-cert-fp b/tests/auth/default-cert-fp
new file mode 100644
index 0000000..11ebf3a
--- /dev/null
+++ b/tests/auth/default-cert-fp
@@ -0,0 +1 @@
+AB:0D:3F:C1:B0:13:E4:0E:AD:4A:08:06:AE:F3:85:DB:E2:27:5F:83:11:47:A2:78:64:3C:73:60:F8:66:3A:A4
diff --git a/tests/pkg/1/build2.org/auth/create-expired/repositories b/tests/auth/default-cert.pem
index 8370fa4..34a39f9 100644
--- a/tests/pkg/1/build2.org/auth/create-expired/repositories
+++ b/tests/auth/default-cert.pem
@@ -1,9 +1,7 @@
-: 1
-certificate: \
-----BEGIN CERTIFICATE-----
-MIIFLzCCAxegAwIBAgIJAPIoh0763iYdMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
+MIIFLzCCAxegAwIBAgIJAKroQKG400AsMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
BAoMDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDDA9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNTAxMTA1MDMyWhcNMTYwNTAyMTA1MDMyWjAzMRcwFQYDVQQKDA5Db2RlIFN5
+MTcwMzA3MDk1NjExWhcNMjIwMzA2MDk1NjExWjAzMRcwFQYDVQQKDA5Db2RlIFN5
bnRoZXNpczEYMBYGA1UEAwwPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
@@ -18,16 +16,15 @@ u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
-AgEAAb+Yxvqi4sOZ+Ti8wcxkxqFrIs32M3XgJIeZYJn9JZbtjuBx0JFZWnL/tz4M
-VTiM2nrUc4qIIpTqEt2If1NcdH0Cjvf6vysLvIOoB4q09B+aW4F+19moixYodoDp
-qq1Ki1MZrBMx+KUICagqRSklPyxaZ2rEFv2TY0pg8/QRFRWGCFgdWJleX6VsqIXC
-KDK6MyHfR1gsDnZZfgr7HJCq1SH3loqlchLBvAF6K/c1LdQyJFYoP4xAt6yaQWzv
-wEqqhhZ7tLpjrjK0K2pqsPoupNcNhE31k+6ZdM5Z5oHT844qKIVNJIdlvFwnQ3ed
-grP6gBCLVY7h7GJ0x2ZG/2hYt4My8RqLxFYHaHAzQsmXFATIzT1Yqz1nw+8V3l5P
-m+rXQNVAw7rgpl3T7klbHVfkg5rPa0kF66PkKq5ax46NS6KVj9sNOqkcXL7huQSG
-BnSLTkaLwwrSZWl+DPXeY8TgUGkkEMY6RvYdqoOGZiZSqtMfK9QKsFi79a4Munc8
-ypUPxE++jhtXcarDy0ta3BXrspIg63a2Ab6C5yv2fC31Ec5v75rUxt9BVxMMQdlX
-h9eMe5FmkgkSBcklOShE2kZvTOPUCSq8DK7JuKsKEH3istPto+PpoyT8RxuZ9K2Q
-rr78CskHtj+TVdFv7TAqn2YDx9ki4HJIxWKVanJ+zOBSrJw=
+AgEANT2ZQXyrjo/Tqm9KWfQfbYwYMGZH8Ftm1miqpXc5/+Hs3gtKhzIgQvCByO+l
+glvpqOB4sPnul1FTE/9cJFMGH6GGD/oe9pFnaR7mnz+WGwtUCa+i33QJ9sc9H8Uf
+Nk8DDO1g8c6Okn2SAEvg5owygFlhdL822PTCnxB34ns1Q+mgfZlCqczh7MDtXN4h
+d2ezPND6cfWTyEZ/ZYfZVJ54+xUEcuHnY6huyHQJ8vm/E0B77y1B1u9ESHCZKD0A
+/Vb1CYPCIB4Re4oradVO6CkgX6+7k47vhIlFV1Ulo7KtMb1f5a7dlpiMQbVovdK2
+njsMKdaWxgQ9PWXXuDOQZ3U5BcxfUNF8wlOA9ad1Kze+i6Bp64s3FfZ4s+x3QD11
+hDofBZ0YJeEYxyY/zIz7wCmqIoM++FpSYR9lrLuVDnxWN+fdxue79C3oG86c+ny6
+/RR8P+YzO4Jy9nevMom7Hx6F+q/3vU25+NuSvupMqJB3/MuBJl9RNcQ3mcwber8l
+cZNTUVoM/YQ1DwPqLmXobRNxUuqnRtaIEDoWKXNCzhFsMMFA9SJBrEaKDRAuzrxE
+B7GWDvwwpnoKvTooz0g1/CJbPd7qrnAqhHzBZBe7Ux8dTJc62FKNhNn0TSZxIXhS
+nqyCIjDkxJHGaTIoe32tsNxmM1JdRqJUcXHuq6vlFOfHFeI=
-----END CERTIFICATE-----
-\
diff --git a/tests/default-openssl.cnf b/tests/auth/default-openssl.cnf
index c14ec06..c14ec06 100644
--- a/tests/default-openssl.cnf
+++ b/tests/auth/default-openssl.cnf
diff --git a/tests/auth/expired-cert.pem b/tests/auth/expired-cert.pem
new file mode 100644
index 0000000..3dbbe91
--- /dev/null
+++ b/tests/auth/expired-cert.pem
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIFLzCCAxegAwIBAgIJAOx1KvcHxv3GMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
+BAoMDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDDA9uYW1lOmJ1aWxkMi5vcmcwHhcN
+MTcwMzAxMTcwMTI0WhcNMTcwMzAyMTcwMTI0WjAzMRcwFQYDVQQKDA5Db2RlIFN5
+bnRoZXNpczEYMBYGA1UEAwwPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
+AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
+IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
+PR58SFNwwd2E6C8pmyN7QhXuy+gpVdwbsN9RWXnXBY9A9JtSt+xBuxeDs/PkdoPH
+4O3aL2HB0TUzTPhHZ23BCSzMXIIqJfxEX2g9eKtPPkRMsLd/X0lRqkutjmXlnKXN
+CJ8uE8yUcuWtPSfsqSiEfvBpfcrJ4trQzYgiXfNp4Cy434SsVV5wB2Uki9fTRy2H
+Y478bHLT2wgqVqCLartkOKTawy8bx0C/uA1mxen4U6P9dcKI4j1/oPmiykl0r0Hl
+QIAGOYZzxbk52/pkt7LlSLvqW4jtyIhM4p8CgSRvIyI0eJHEt0ztoB6LN1zAdThu
+bomWaImTxTLJXzl/fea8JJ+6jsP4NBiIrrnT/HBF1MUEiqLfwjAwTraBPtqH8A6a
+I+yGPsWPAhTtlYeyTKv2qkTFA4QolegtkmjWt/oxFzwCwnLPrN19CFPUFPOGiA1+
+u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
+DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
+4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
+BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
+AgEATQmuoB+NC/IF2qoNQnurJWrV63lC4Ozi/VLIqCSR6A4S9TCcoLNDAtcdiyf4
+GrM+/USyV3whpISesXn0ij10OEMe2/9NUoqkO0Q/woN9WtUQActeBxThOcz0NYMi
+1vg6krlx1fKpQ5g65yC3qka8VUaV9gtaCHFa6mOxZ9q5DaV2NdBAr+FOutRY6d4v
+UySkOyqxfZYLs5W2e+9ofEve17eVNFQwuJY29sw406X+18gYc+KiqldPlwKIhJs1
+CBsWhO0m1GP5dR0gRBmF9WQ4fzNyoYF293ix+WC7eMf2OtRTpo/GEAXDqLlRvpiF
+jALhFtcZjiIqrvnkQFq36jyVNcUnxbMKUgW4XJVpYv4uVII47eJk4a8XRGj0d+7b
+nuFfT4d6gACN3gfOmtd12uT7dNsn5q0fkGhzR4ppDIyTJpGA8UhHETTRPL+HFcb1
+6kXnRPFS7eoF9DoSGtBhdpRUefj8EPJWhfE7xQvMDTYIE/ccBWp173F+xShr2mgF
+xDkHH+vXGFzUZXSEAF2NW9U3bf4bRQpdOkYJsvHJmLYjcGNKdkHjJVWdXmoRpbsR
+IC8M7ZPp+/oV5JEinCXRsT1NN+7l8rkec9hNk5sbokVCcyYv+GxL8kRFt2jyLqny
+RlM2vM3uhgJNYVSlYsgjjg4QfikV6s+QawjSVi6y4ZnHEho=
+-----END CERTIFICATE-----
diff --git a/tests/key.pem b/tests/auth/key.pem
index 6615a2d..6615a2d 100644
--- a/tests/key.pem
+++ b/tests/auth/key.pem
diff --git a/tests/auth/mismatch-cert.pem b/tests/auth/mismatch-cert.pem
new file mode 100644
index 0000000..785e094
--- /dev/null
+++ b/tests/auth/mismatch-cert.pem
@@ -0,0 +1,31 @@
+-----BEGIN CERTIFICATE-----
+MIIFTzCCAzegAwIBAgIJAO7DtVrDDUcXMA0GCSqGSIb3DQEBCwUAMEMxFzAVBgNV
+BAoMDkNvZGUgU3ludGhlc2lzMSgwJgYDVQQDDB9uYW1lOmJ1aWxkMi5vcmcvbWlz
+bWF0Y2hlZC9uYW1lMB4XDTE3MDMwNzA5NTYxMVoXDTIyMDMwNjA5NTYxMVowQzEX
+MBUGA1UECgwOQ29kZSBTeW50aGVzaXMxKDAmBgNVBAMMH25hbWU6YnVpbGQyLm9y
+Zy9taXNtYXRjaGVkL25hbWUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
+AQDau/El7sxcwjKBVNUZ8xHgH8xNFFGBsp0txdpRu74h93KMYy7fgaxQbnVbOFw0
+6Y10tfYUcSKIRIA+9VtY4Q75lAvcgjFtdzwiCI0Sk089HnxIU3DB3YToLymbI3tC
+Fe7L6ClV3Buw31FZedcFj0D0m1K37EG7F4Oz8+R2g8fg7dovYcHRNTNM+EdnbcEJ
+LMxcgiol/ERfaD14q08+REywt39fSVGqS62OZeWcpc0Iny4TzJRy5a09J+ypKIR+
+8Gl9ysni2tDNiCJd82ngLLjfhKxVXnAHZSSL19NHLYdjjvxsctPbCCpWoItqu2Q4
+pNrDLxvHQL+4DWbF6fhTo/11wojiPX+g+aLKSXSvQeVAgAY5hnPFuTnb+mS3suVI
+u+pbiO3IiEzinwKBJG8jIjR4kcS3TO2gHos3XMB1OG5uiZZoiZPFMslfOX995rwk
+n7qOw/g0GIiuudP8cEXUxQSKot/CMDBOtoE+2ofwDpoj7IY+xY8CFO2Vh7JMq/aq
+RMUDhCiV6C2SaNa3+jEXPALCcs+s3X0IU9QU84aIDX67uMY1TOn0q40VBd+JrLln
+M/xyqPVt+dAMNsuRefZM4j/puxurgWK6phJb/9d1WpoNmWdW9/CjM+UrN0pH3AxK
+zs8/w/tIUZTmgiHlrbNRts1nELwZ5/sxgPrEyLtMQBTgkQIDAQABo0YwRDAOBgNV
+HQ8BAf8EBAMCB4AwFgYDVR0lAQH/BAwwCgYIKwYBBQUHAwMwGgYDVR0RBBMwEYEP
+aW5mb0BidWlsZDIub3JnMA0GCSqGSIb3DQEBCwUAA4ICAQDCecjF6hzS8IcSsOgx
+ReZIu4UPpBXGcfvx5NSiYqahxeepWTnd6Du14Z5gtQZYeXsNLnhHaZMNgLKPnQ0g
+cmpTpeqQF9XKiWbW7YQVstwWdPWoWmmqfZY1nz5jPD/aYBzq+JV1UjztWTQgCQYu
+bovxs/kor6BcPy+KH5oKGq6l+kDdaXCKNqHP7Eg0xiB7tjP8OFt4XPV34tLcLQcb
+gZdhuDCNgds0n8EglUoUBieRtDVIWxP2uVfiTiVTEVpFeFjC2KWEZ5OtFXa4WTkY
+CLDnxVAngZ2xmfNt189YGUrtDS1kD/Kza+wOggQ95iHy2zyNlU4cHZVJxakOm3yf
+X7EcLoQLY2rwtQUr+h+qvk/zrN5eBB50zjTrbFaIC+zTR4FOv+/UWieX8k/aqcnD
+DeLvcEjuh+amLSapYlYrhMGal615PIbsi3eAJJz5ZDS8oUuev9NcuU57rBNqUNbz
+UV8hMHGsD7ej8Tu+XeEgIBmBY6Bke1M6VU00Bt3xW0bH9yaEa0RWSflyfQfX4WGA
+Ukl/CzI3IVxqO8TXDJ5ww0NOdzl9PkQV5HwzDiukutkrvGumUDzu5zkvSyDPGauO
+/xmojCNSGuGYAI1bQnJjLtnKOxJgrHxTsiNCznOCXePr9+/UcoIQ6nyrHwi37/ze
+8hMr+XqSi4IaPRAjSsj8b6IVVg==
+-----END CERTIFICATE-----
diff --git a/tests/mismatch-openssl.cnf b/tests/auth/mismatch-openssl.cnf
index f4fe4d7..0c328d0 100644
--- a/tests/mismatch-openssl.cnf
+++ b/tests/auth/mismatch-openssl.cnf
@@ -1,4 +1,4 @@
-repository = build2.org/auth/mismatched/name/x
+repository = build2.org/mismatched/name
company = Code Synthesis
email = info@build2.org
diff --git a/tests/pkg/1/build2.org/auth/create-noemail/repositories b/tests/auth/noemail-cert.pem
index 3645b23..420c195 100644
--- a/tests/pkg/1/build2.org/auth/create-noemail/repositories
+++ b/tests/auth/noemail-cert.pem
@@ -1,9 +1,7 @@
-: 1
-certificate: \
-----BEGIN CERTIFICATE-----
-MIIFEzCCAvugAwIBAgIJANxwhIzYRCmBMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
+MIIFEzCCAvugAwIBAgIJALnZEjzzFueMMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
BAoMDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDDA9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNTAxMTYwODQyWhcNMTcwNTAxMTYwODQyWjAzMRcwFQYDVQQKDA5Db2RlIFN5
+MTcwMzA3MDk1NjExWhcNMjIwMzA2MDk1NjExWjAzMRcwFQYDVQQKDA5Db2RlIFN5
bnRoZXNpczEYMBYGA1UEAwwPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
@@ -17,17 +15,16 @@ I+yGPsWPAhTtlYeyTKv2qkTFA4QolegtkmjWt/oxFzwCwnLPrN19CFPUFPOGiA1+
u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
4JECAwEAAaMqMCgwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
-BwMDMA0GCSqGSIb3DQEBCwUAA4ICAQC4bolUadknEL7ryAGisjFxK0WkH4zNDGrV
-c3c27jHfr7D/GXqMvAkpE9aXwbBDTkgmsvQMkLx4on1WewLFVuDfyvqAS2IGU9i4
-7bbCaACkrhEb1PYvZ8mbVJiXSfnwHSmbEeBbVlej9OqFga2+drv2cI1cqpPZJKhF
-UiUstPYl6vFONE5hLGxKI+6Xg6HYkkc/qawCmY3fuNxC5Hv4n0dwQGdcUqMt5oMK
-1NhfPnunBXY2d/N3SaeBh8PW9Wk5zDq/S2LcO6fgdSho3R3oGbkHj52wPLWK93Vr
-IBU1NhswvR69IOT92UG5KAqHK3VFp8EatuvbODQpvd0uuwIf7BO4Cj7ZPy5R7u8c
-6fwyP1C/jTwSER143NA0LlmjR+qowsicz7zhBI4Fv6dj4rO725lnZ0+Sqok/45SR
-jYdSPZnyWhiWh2ImfMC5INIlWvTtpL6dbfbkR1ZVABVkn3j0Xe4kpsFrmhY693mJ
-LY8PTKJpIZeoj/XrnTDm/NgwcDHpS8j3F++DwZ2UxzJSOgmL9NJlC1lf1ehhxQt8
-33+/zTw6VXwK0PUputdS7xf7z+10Yf4el1kEoAzWZwaz5bwVFOyCQHPCYxuSUKz+
-O0X8FWd2wgPCmU6CB518Cv9cOyUfoZZuV3Va/IyoOUvwNd5Lxen0mo2LPNlXRMVM
-e44+PKmbFA==
+BwMDMA0GCSqGSIb3DQEBCwUAA4ICAQC1grbRMNAvDJ2+yYnHsGsafgx7mYM7QN7N
+kHyYdzr87wvumRiJ5xgnn49VBO51RQkcT7Z/P4MJq9xjYkKS+wCJV2+WTev3ltzQ
+LyFfRJkTJKTvHRDM+hbRFqyvtuRe4U91/aJU7G79gaCjmEr2LSwOywusnPU95VNw
+UPMUMUYhdD1qdQfJ+PbNmrl1UC8MaflwVOb7K/OSjl7tO9JOk3QK3cMm9bqpeCYD
+3HJglvl/yLzW3smh6DxdBVujWcrOAbTALc1tC2bTNQm+f83MipD4YXj09qWAnBy0
+WdRuEtdwZKW3zQ/Y1QesZcEv/3QBYSaKkwr+9sNqAHpD/UVj7qwRfHYLs1GM6o+d
+/bpYz+evSdEu/3lMDxg4CLQtRqElgOnOhvIuziu7qcpgmJpRvYSHJ7RrGQET/fna
++a5KZiYvWVbFQhA79nPBGWvW/Om2dk+/pzn40zcnwnRF8wwNt8ncAI/ZhjLap5qG
+5VFoMA/AP+MCsk0at3E4t4VwofdS7WB0KJv2cuGEnLRk7GOP058zOv/QQt2fXgK/
+iO68nn7vfNzVFNfbb6vYzfKigd9JiYn+icfi/cZfB7zbVHzvjS3GEQk+2NVBnnyf
+LUTr5k9fTekFR1l1AE8NWi56fJ6W5d/TApkl8uun7CItHL6y2WuLyKhMxAp66LLB
+hMfgR3OW4w==
-----END CERTIFICATE-----
-\
diff --git a/tests/noemail-openssl.cnf b/tests/auth/noemail-openssl.cnf
index 4fc8618..4fc8618 100644
--- a/tests/noemail-openssl.cnf
+++ b/tests/auth/noemail-openssl.cnf
diff --git a/tests/build/.gitignore b/tests/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/tests/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build
new file mode 100644
index 0000000..355a05a
--- /dev/null
+++ b/tests/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : tests/build/bootstrap.build
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/tests/build/root.build b/tests/build/root.build
new file mode 100644
index 0000000..c188bc6
--- /dev/null
+++ b/tests/build/root.build
@@ -0,0 +1,17 @@
+# file : tests/build/root.build
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# We need to configure C++ module to pass the compiler path to some of bpkg
+# test commands.
+#
+using cxx
+
+# Setup the bpkg that we are testing.
+#
+import bpkg = bpkg%exe{bpkg}
+dir{*}: test = $bpkg
+
+# Specify the test target for cross-testing.
+#
+test.target = $cxx.target
diff --git a/tests/buildfile b/tests/buildfile
new file mode 100644
index 0000000..d59d40e
--- /dev/null
+++ b/tests/buildfile
@@ -0,0 +1,12 @@
+# file : tests/buildfile
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+define common: file
+common{*}: extension = test
+
+# The common/ directory contains repositories that are reused, being symlinked
+# in source repositories specific for testscripts.
+#
+./: test{* -common -config -auth -remote} common{common config auth remote} \
+ {*/ -build/ -test/}{**} $bpkg
diff --git a/tests/cert.sh b/tests/cert.sh
deleted file mode 100755
index 7382636..0000000
--- a/tests/cert.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-#! /bin/sh
-
-# Normally, you don't need to regenerate the private key.
-#
-# openssl genrsa 4096 > key.pem
-
-# Copy default-cert.pem content to the certificate value of the following
-# manifest files:
-# pkg/1/build2.org/auth/signature-mismatch/repositories
-# pkg/1/build2.org/auth/sha256sum-mismatch/repositories
-# pkg/1/build2.org/auth/signed/repositories
-# pkg/1/build2.org/common/hello/repositories
-#
-openssl req -x509 -new -key key.pem -days 365 -config default-openssl.cnf > \
- default-cert.pem
-
-# Copy mismatch-cert.pem content to the certificate value of
-# pkg/1/build2.org/auth/name-mismatch/repositories manifest file.
-#
-openssl req -x509 -new -key key.pem -days 365 -config mismatch-openssl.cnf > \
- mismatch-cert.pem
-
-# Copy noemail-cert.pem content to the certificate value of
-# pkg/1/build2.org/auth/create-noemail/repositories manifest file.
-#
-openssl req -x509 -new -key key.pem -days 365 -config noemail-openssl.cnf > \
- noemail-cert.pem
-
-# Normally, you have no reason to regenerate expired-cert.pem, as need to keep
-# it expired for the testing purposes. But if you do, copy expired-cert.pem
-# content to the certificate value of the following manifest files:
-# pkg/1/build2.org/auth/expired/repositories
-# pkg/1/build2.org/auth/create-expired/repositories
-#
-# To regenerate the packages and signature manifest files run:
-#
-# ../bpkg/bpkg rep-create pkg/1/build2.org/auth/expired --key key.pem
-#
-# We cannot do it in test.sh since the certificate has expired. This is also
-# the reason why we store these auto-generated manifests in git.
-#
-# Will have to wait 1 day until the certificate expires. Until then test.sh
-# will be failing.
-#
-# openssl req -x509 -new -key key.pem -days 1 -config default-openssl.cnf > \
-# expired-cert.pem
diff --git a/tests/cfg-create.test b/tests/cfg-create.test
new file mode 100644
index 0000000..65fe2f9
--- /dev/null
+++ b/tests/cfg-create.test
@@ -0,0 +1,75 @@
+# file : tests/cfg-create.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test
+
+pkg_status += -d cfg
+
+: non-empty
+:
+$* 2>>/~%EOE% != 0
+error: directory ./ is not empty
+ info: use --wipe to clean it up but be careful
+EOE
+
+: dir
+:
+{
+ test.arguments += -d cfg
+ test.cleanups += &cfg/***
+
+ : no-vars-mods
+ :
+ {
+ $* 2>>/~%EOE%;
+ %created new configuration in .+/cfg/%
+ EOE
+
+ $pkg_status libfoo >'unknown'
+ }
+
+ : conf-var
+ :
+ {
+ $* "config.install.root=$~/opt" 2>>/~%EOE%;
+ %created new configuration in .+/cfg/%
+ EOE
+
+ $pkg_status libfoo >'unknown';
+
+ cat cfg/build/config.build >>/~"%EOO%"
+ %.+
+ %config.install.root = '?.+/opt/'?%
+ %.+
+ EOO
+ }
+
+ : module
+ :
+ {
+ $* cxx "config.cxx=$config.cxx" 2>>/~%EOE%;
+ %created new configuration in .+/cfg/%
+ EOE
+
+ $pkg_status libfoo >'unknown';
+
+ cat cfg/build/config.build >>/~"%EOO%"
+ %.+
+ %config.cxx = .+%
+ %.+
+ EOO
+ }
+
+ : wipe
+ :
+ {
+ mkdir -p cfg/foo/bar &!cfg/ &!cfg/foo/ &!cfg/foo/bar/;
+
+ $* --wipe 2>>/~%EOE%;
+ %created new configuration in .+/cfg/%
+ EOE
+
+ $pkg_status libfoo >'unknown'
+ }
+}
diff --git a/tests/common.test b/tests/common.test
new file mode 100644
index 0000000..8fec47e
--- /dev/null
+++ b/tests/common.test
@@ -0,0 +1,41 @@
+# file : tests/common.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Commonly-used variables setup and driver command line.
+#
+
+# All testscripts are named after bpkg commands, for example pkg-verify.test.
+# So the testscript scope id is a name of the command being tested.
+#
+cmd = [string] $@
+test.arguments = $cmd
+
+# Each testscript has an associated repository source directory. Its
+# subdirectories are copied by tests to manipulate locally and throw away upon
+# completion.
+#
+src = [dir_path] "$src_base/$@"
+
+# Helper commands that can be used by tests to prepare the testing environment
+# or validate an outcome of the command being tested. They are likely to get
+# additional options and redirects appended prior to use. A common approach
+# will be to redirect output to the null device for commands that are used for
+# test setup, and to match it for commands being tested or performing teardown
+# (for example, to make sure that configuration post-test state is valid and is
+# as expected).
+#
+cfg_create = $0 cfg-create
+pkg_build = $0 pkg-build
+pkg_configure = $0 pkg-configure
+pkg_disfigure = $0 pkg-disfigure
+pkg_drop = $0 pkg-drop
+pkg_fetch = $0 pkg-fetch
+pkg_purge = $0 pkg-purge
+pkg_status = $0 pkg-status
+pkg_unpack = $0 pkg-unpack
+pkg_update = $0 pkg-update
+rep_add = $0 rep-add
+rep_create = $0 rep-create
+rep_fetch = $0 rep-fetch
+rep_info = $0 rep-info
diff --git a/tests/pkg/1/build2.org/common/bar/stable/libbar-1.0.0.tar.gz b/tests/common/bar/stable/libbar-1.0.0.tar.gz
index d77c1ba..d77c1ba 100644
--- a/tests/pkg/1/build2.org/common/bar/stable/libbar-1.0.0.tar.gz
+++ b/tests/common/bar/stable/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/common/bar/stable/repositories b/tests/common/bar/stable/repositories
index b8ecc1f..b8ecc1f 100644
--- a/tests/pkg/1/build2.org/common/bar/stable/repositories
+++ b/tests/common/bar/stable/repositories
diff --git a/tests/pkg/1/build2.org/common/bar/testing/libbar-1.1.0.tar.gz b/tests/common/bar/testing/libbar-1.1.0.tar.gz
index f081804..f081804 100644
--- a/tests/pkg/1/build2.org/common/bar/testing/libbar-1.1.0.tar.gz
+++ b/tests/common/bar/testing/libbar-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/common/bar/testing/repositories b/tests/common/bar/testing/repositories
index 5ab8cba..5ab8cba 100644
--- a/tests/pkg/1/build2.org/common/bar/testing/repositories
+++ b/tests/common/bar/testing/repositories
diff --git a/tests/pkg/1/build2.org/common/bar/unstable/libbar-1.1.1.tar.gz b/tests/common/bar/unstable/libbar-1.1.1.tar.gz
index a0fbdc3..a0fbdc3 100644
--- a/tests/pkg/1/build2.org/common/bar/unstable/libbar-1.1.1.tar.gz
+++ b/tests/common/bar/unstable/libbar-1.1.1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/common/bar/unstable/repositories b/tests/common/bar/unstable/repositories
index d4ddcf5..d4ddcf5 100644
--- a/tests/pkg/1/build2.org/common/bar/unstable/repositories
+++ b/tests/common/bar/unstable/repositories
diff --git a/tests/common/foo-1.tar.gz b/tests/common/foo-1.tar.gz
new file mode 100644
index 0000000..0195f04
--- /dev/null
+++ b/tests/common/foo-1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/common/foo/stable/libfoo-1.0.0.tar.gz b/tests/common/foo/stable/libfoo-1.0.0.tar.gz
index c29dd9d..c29dd9d 100644
--- a/tests/pkg/1/build2.org/common/foo/stable/libfoo-1.0.0.tar.gz
+++ b/tests/common/foo/stable/libfoo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/common/foo/stable/repositories b/tests/common/foo/stable/repositories
index 13673fb..13673fb 100644
--- a/tests/pkg/1/build2.org/common/foo/stable/repositories
+++ b/tests/common/foo/stable/repositories
diff --git a/tests/pkg/1/build2.org/common/foo/testing/libfoo-1.1.0.tar.gz b/tests/common/foo/testing/libfoo-1.1.0.tar.gz
index a6c0202..a6c0202 100644
--- a/tests/pkg/1/build2.org/common/foo/testing/libfoo-1.1.0.tar.gz
+++ b/tests/common/foo/testing/libfoo-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/common/foo/testing/repositories b/tests/common/foo/testing/repositories
index cd33f88..cd33f88 100644
--- a/tests/pkg/1/build2.org/common/foo/testing/repositories
+++ b/tests/common/foo/testing/repositories
diff --git a/tests/pkg/1/build2.org/common/hello/libhello-1.0.0.tar.gz b/tests/common/hello/libhello-1.0.0.tar.gz
index e9d9ff1..e9d9ff1 100644
--- a/tests/pkg/1/build2.org/common/hello/libhello-1.0.0.tar.gz
+++ b/tests/common/hello/libhello-1.0.0.tar.gz
Binary files differ
diff --git a/tests/common/hello/repositories b/tests/common/hello/repositories
new file mode 100644
index 0000000..eb30fe1
--- /dev/null
+++ b/tests/common/hello/repositories
@@ -0,0 +1,4 @@
+# Hello World repository. Currently does not have any prerequisite
+# repositories.
+#
+: 1
diff --git a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0/build/bootstrap.build b/tests/common/libfoo-1.1.0/build/bootstrap.build
index 54f267e..54f267e 100644
--- a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0/build/bootstrap.build
+++ b/tests/common/libfoo-1.1.0/build/bootstrap.build
diff --git a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0/buildfile b/tests/common/libfoo-1.1.0/buildfile
index 9f80de9..9f80de9 100644
--- a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0/buildfile
+++ b/tests/common/libfoo-1.1.0/buildfile
diff --git a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0/manifest b/tests/common/libfoo-1.1.0/manifest
index 3453757..3453757 100644
--- a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0/manifest
+++ b/tests/common/libfoo-1.1.0/manifest
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/INSTALL b/tests/common/libhello-1.0.0/INSTALL
index 485b10f..485b10f 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/INSTALL
+++ b/tests/common/libhello-1.0.0/INSTALL
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/build/bootstrap.build b/tests/common/libhello-1.0.0/build/bootstrap.build
index 8d8db2b..8d8db2b 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/build/bootstrap.build
+++ b/tests/common/libhello-1.0.0/build/bootstrap.build
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/build/export.build b/tests/common/libhello-1.0.0/build/export.build
index 1eb73b7..1eb73b7 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/build/export.build
+++ b/tests/common/libhello-1.0.0/build/export.build
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/build/root.build b/tests/common/libhello-1.0.0/build/root.build
index 4f70114..4f70114 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/build/root.build
+++ b/tests/common/libhello-1.0.0/build/root.build
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/buildfile b/tests/common/libhello-1.0.0/buildfile
index a416648..a416648 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/buildfile
+++ b/tests/common/libhello-1.0.0/buildfile
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/buildfile b/tests/common/libhello-1.0.0/hello/buildfile
index bff7fce..bff7fce 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/buildfile
+++ b/tests/common/libhello-1.0.0/hello/buildfile
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/export b/tests/common/libhello-1.0.0/hello/export
index 18f4968..18f4968 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/export
+++ b/tests/common/libhello-1.0.0/hello/export
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/hello b/tests/common/libhello-1.0.0/hello/hello
index 5fb7d9e..5fb7d9e 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/hello
+++ b/tests/common/libhello-1.0.0/hello/hello
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/hello.cxx b/tests/common/libhello-1.0.0/hello/hello.cxx
index 65d0aa7..65d0aa7 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/hello/hello.cxx
+++ b/tests/common/libhello-1.0.0/hello/hello.cxx
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/manifest b/tests/common/libhello-1.0.0/manifest
index 75dc91b..75dc91b 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/manifest
+++ b/tests/common/libhello-1.0.0/manifest
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/build/bootstrap.build b/tests/common/libhello-1.0.0/tests/build/bootstrap.build
index 2c2de24..2c2de24 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/build/bootstrap.build
+++ b/tests/common/libhello-1.0.0/tests/build/bootstrap.build
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/build/root.build b/tests/common/libhello-1.0.0/tests/build/root.build
index de723b8..de723b8 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/build/root.build
+++ b/tests/common/libhello-1.0.0/tests/build/root.build
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/buildfile b/tests/common/libhello-1.0.0/tests/buildfile
index 4dcbe2a..4dcbe2a 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/buildfile
+++ b/tests/common/libhello-1.0.0/tests/buildfile
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/buildfile b/tests/common/libhello-1.0.0/tests/test/buildfile
index a46969d..a46969d 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/buildfile
+++ b/tests/common/libhello-1.0.0/tests/test/buildfile
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/driver.cxx b/tests/common/libhello-1.0.0/tests/test/driver.cxx
index 59bfb2d..59bfb2d 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/driver.cxx
+++ b/tests/common/libhello-1.0.0/tests/test/driver.cxx
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/test.out b/tests/common/libhello-1.0.0/tests/test/test.out
index 8ab686e..8ab686e 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/tests/test/test.out
+++ b/tests/common/libhello-1.0.0/tests/test/test.out
diff --git a/tests/pkg/1/build2.org/common/libhello-1.0.0/version b/tests/common/libhello-1.0.0/version
index 3eefcb9..3eefcb9 100644
--- a/tests/pkg/1/build2.org/common/libhello-1.0.0/version
+++ b/tests/common/libhello-1.0.0/version
diff --git a/tests/pkg/1/build2.org/satisfy/libbar-1.0.0.tar.gz b/tests/common/satisfy/libbar-1.0.0.tar.gz
index 5dc3a9b..5dc3a9b 100644
--- a/tests/pkg/1/build2.org/satisfy/libbar-1.0.0.tar.gz
+++ b/tests/common/satisfy/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libbar-1.1.0.tar.gz b/tests/common/satisfy/libbar-1.1.0.tar.gz
index 881292e..881292e 100644
--- a/tests/pkg/1/build2.org/satisfy/libbar-1.1.0.tar.gz
+++ b/tests/common/satisfy/libbar-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libbar-1.2.0.tar.gz b/tests/common/satisfy/libbar-1.2.0.tar.gz
index 4572395..4572395 100644
--- a/tests/pkg/1/build2.org/satisfy/libbar-1.2.0.tar.gz
+++ b/tests/common/satisfy/libbar-1.2.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libbaz-1.0.0.tar.gz b/tests/common/satisfy/libbaz-1.0.0.tar.gz
index 1de32b2..1de32b2 100644
--- a/tests/pkg/1/build2.org/satisfy/libbaz-1.0.0.tar.gz
+++ b/tests/common/satisfy/libbaz-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libbaz-1.1.0.tar.gz b/tests/common/satisfy/libbaz-1.1.0.tar.gz
index 1aa72a8..1aa72a8 100644
--- a/tests/pkg/1/build2.org/satisfy/libbaz-1.1.0.tar.gz
+++ b/tests/common/satisfy/libbaz-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libbiz-1.0.0.tar.gz b/tests/common/satisfy/libbiz-1.0.0.tar.gz
index 42e3db4..42e3db4 100644
--- a/tests/pkg/1/build2.org/satisfy/libbiz-1.0.0.tar.gz
+++ b/tests/common/satisfy/libbiz-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-0.0.1.tar.gz b/tests/common/satisfy/libfoo-0.0.1.tar.gz
index 2ab5094..2ab5094 100644
--- a/tests/pkg/1/build2.org/satisfy/libfoo-0.0.1.tar.gz
+++ b/tests/common/satisfy/libfoo-0.0.1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/auth/libfoo-1.0.0.tar.gz b/tests/common/satisfy/libfoo-1.0.0.tar.gz
index 28a6a90..28a6a90 100644
--- a/tests/pkg/1/build2.org/auth/libfoo-1.0.0.tar.gz
+++ b/tests/common/satisfy/libfoo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/depend/stable/libfoo-1.1.0.tar.gz b/tests/common/satisfy/libfoo-1.1.0.tar.gz
index e03481f..e03481f 100644
--- a/tests/pkg/1/build2.org/depend/stable/libfoo-1.1.0.tar.gz
+++ b/tests/common/satisfy/libfoo-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/build/bootstrap.build b/tests/common/satisfy/libfoo-1.1.0/build/bootstrap.build
index b24ee6a..b24ee6a 100644
--- a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/build/bootstrap.build
+++ b/tests/common/satisfy/libfoo-1.1.0/build/bootstrap.build
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/buildfile b/tests/common/satisfy/libfoo-1.1.0/buildfile
index 9f80de9..9f80de9 100644
--- a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/buildfile
+++ b/tests/common/satisfy/libfoo-1.1.0/buildfile
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/manifest b/tests/common/satisfy/libfoo-1.1.0/manifest
index 3453757..3453757 100644
--- a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0/manifest
+++ b/tests/common/satisfy/libfoo-1.1.0/manifest
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-1.2.0.tar.gz b/tests/common/satisfy/libfoo-1.2.0.tar.gz
index 80ce03b..80ce03b 100644
--- a/tests/pkg/1/build2.org/satisfy/libfoo-1.2.0.tar.gz
+++ b/tests/common/satisfy/libfoo-1.2.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libfox-1.0.0.tar.gz b/tests/common/satisfy/libfox-1.0.0.tar.gz
index 9ba7a31..9ba7a31 100644
--- a/tests/pkg/1/build2.org/satisfy/libfox-1.0.0.tar.gz
+++ b/tests/common/satisfy/libfox-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/auth/unsigned1/repositories b/tests/common/satisfy/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/auth/unsigned1/repositories
+++ b/tests/common/satisfy/repositories
diff --git a/tests/pkg/1/build2.org/auth/create-expired/libfoo-1.0.0.tar.gz b/tests/common/satisfy/t1/libfoo-1.0.0.tar.gz
index 32e5a3c..32e5a3c 120000
--- a/tests/pkg/1/build2.org/auth/create-expired/libfoo-1.0.0.tar.gz
+++ b/tests/common/satisfy/t1/libfoo-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/fetch/t1/repositories b/tests/common/satisfy/t1/repositories
index d965b15..d965b15 120000
--- a/tests/pkg/1/build2.org/fetch/t1/repositories
+++ b/tests/common/satisfy/t1/repositories
diff --git a/tests/pkg/1/build2.org/satisfy/t2/libbar-1.0.0.tar.gz b/tests/common/satisfy/t2/libbar-1.0.0.tar.gz
index 93e8c71..93e8c71 120000
--- a/tests/pkg/1/build2.org/satisfy/t2/libbar-1.0.0.tar.gz
+++ b/tests/common/satisfy/t2/libbar-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/auth/create-noemail/libfoo-1.0.0.tar.gz b/tests/common/satisfy/t2/libfoo-1.0.0.tar.gz
index 32e5a3c..32e5a3c 120000
--- a/tests/pkg/1/build2.org/auth/create-noemail/libfoo-1.0.0.tar.gz
+++ b/tests/common/satisfy/t2/libfoo-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t1/repositories b/tests/common/satisfy/t2/repositories
index d965b15..d965b15 120000
--- a/tests/pkg/1/build2.org/satisfy/t1/repositories
+++ b/tests/common/satisfy/t2/repositories
diff --git a/tests/pkg/1/build2.org/satisfy/t3/libbaz-1.0.0.tar.gz b/tests/common/satisfy/t3/libbaz-1.0.0.tar.gz
index 189242a..189242a 120000
--- a/tests/pkg/1/build2.org/satisfy/t3/libbaz-1.0.0.tar.gz
+++ b/tests/common/satisfy/t3/libbaz-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t3/libfox-1.0.0.tar.gz b/tests/common/satisfy/t3/libfox-1.0.0.tar.gz
index dcfd7aa..dcfd7aa 120000
--- a/tests/pkg/1/build2.org/satisfy/t3/libfox-1.0.0.tar.gz
+++ b/tests/common/satisfy/t3/libfox-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t3/repositories b/tests/common/satisfy/t3/repositories
index d65b272..d65b272 100644
--- a/tests/pkg/1/build2.org/satisfy/t3/repositories
+++ b/tests/common/satisfy/t3/repositories
diff --git a/tests/pkg/1/build2.org/fetch/t1/libfoo-1.1.0.tar.gz b/tests/common/satisfy/t4a/libfoo-1.1.0.tar.gz
index c004b2a..c004b2a 120000
--- a/tests/pkg/1/build2.org/fetch/t1/libfoo-1.1.0.tar.gz
+++ b/tests/common/satisfy/t4a/libfoo-1.1.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t2/repositories b/tests/common/satisfy/t4a/repositories
index d965b15..d965b15 120000
--- a/tests/pkg/1/build2.org/satisfy/t2/repositories
+++ b/tests/common/satisfy/t4a/repositories
diff --git a/tests/pkg/1/build2.org/satisfy/t4b/libbar-1.1.0.tar.gz b/tests/common/satisfy/t4b/libbar-1.1.0.tar.gz
index b9a2de5..b9a2de5 120000
--- a/tests/pkg/1/build2.org/satisfy/t4b/libbar-1.1.0.tar.gz
+++ b/tests/common/satisfy/t4b/libbar-1.1.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t4b/repositories b/tests/common/satisfy/t4b/repositories
index 7b85e71..7b85e71 100644
--- a/tests/pkg/1/build2.org/satisfy/t4b/repositories
+++ b/tests/common/satisfy/t4b/repositories
diff --git a/tests/pkg/1/build2.org/satisfy/t4c/libbaz-1.1.0.tar.gz b/tests/common/satisfy/t4c/libbaz-1.1.0.tar.gz
index 0edbce7..0edbce7 120000
--- a/tests/pkg/1/build2.org/satisfy/t4c/libbaz-1.1.0.tar.gz
+++ b/tests/common/satisfy/t4c/libbaz-1.1.0.tar.gz
diff --git a/tests/pkg/1/build2.org/auth/expired/libfoo-1.0.0.tar.gz b/tests/common/satisfy/t4c/libfoo-1.0.0.tar.gz
index 32e5a3c..32e5a3c 120000
--- a/tests/pkg/1/build2.org/auth/expired/libfoo-1.0.0.tar.gz
+++ b/tests/common/satisfy/t4c/libfoo-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t4c/repositories b/tests/common/satisfy/t4c/repositories
index 26c0e93..26c0e93 100644
--- a/tests/pkg/1/build2.org/satisfy/t4c/repositories
+++ b/tests/common/satisfy/t4c/repositories
diff --git a/tests/pkg/1/build2.org/satisfy/t4d/libbiz-1.0.0.tar.gz b/tests/common/satisfy/t4d/libbiz-1.0.0.tar.gz
index 70c2fda..70c2fda 120000
--- a/tests/pkg/1/build2.org/satisfy/t4d/libbiz-1.0.0.tar.gz
+++ b/tests/common/satisfy/t4d/libbiz-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t4d/libfox-1.0.0.tar.gz b/tests/common/satisfy/t4d/libfox-1.0.0.tar.gz
index dcfd7aa..dcfd7aa 120000
--- a/tests/pkg/1/build2.org/satisfy/t4d/libfox-1.0.0.tar.gz
+++ b/tests/common/satisfy/t4d/libfox-1.0.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t4d/repositories b/tests/common/satisfy/t4d/repositories
index f0e1983..f0e1983 100644
--- a/tests/pkg/1/build2.org/satisfy/t4d/repositories
+++ b/tests/common/satisfy/t4d/repositories
diff --git a/tests/pkg/1/build2.org/satisfy/t5/libbar-1.2.0.tar.gz b/tests/common/satisfy/t5/libbar-1.2.0.tar.gz
index b4a7773..b4a7773 120000
--- a/tests/pkg/1/build2.org/satisfy/t5/libbar-1.2.0.tar.gz
+++ b/tests/common/satisfy/t5/libbar-1.2.0.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/t4a/repositories b/tests/common/satisfy/t5/repositories
index d965b15..d965b15 120000
--- a/tests/pkg/1/build2.org/satisfy/t4a/repositories
+++ b/tests/common/satisfy/t5/repositories
diff --git a/tests/pkg/1/build2.org/depend/stable/libfoo-1.0.0.tar.gz b/tests/common/t1/libfoo-1.0.0.tar.gz
index 28a6a90..28a6a90 100644
--- a/tests/pkg/1/build2.org/depend/stable/libfoo-1.0.0.tar.gz
+++ b/tests/common/t1/libfoo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0.tar.gz b/tests/common/t1/libfoo-1.1.0.tar.gz
index e03481f..e03481f 100644
--- a/tests/pkg/1/build2.org/fetch/libfoo-1.1.0.tar.gz
+++ b/tests/common/t1/libfoo-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/auth/unsigned2/repositories b/tests/common/t1/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/auth/unsigned2/repositories
+++ b/tests/common/t1/repositories
diff --git a/tests/config.test b/tests/config.test
new file mode 100644
index 0000000..c40d24b
--- /dev/null
+++ b/tests/config.test
@@ -0,0 +1,27 @@
+# file : tests/config.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Create an empty configuration that will be copied by subsequent tests and
+# scopes setup commands. The common approach will be that group scopes copy and
+# modify the parent scope configuration as required by the nested tests and
+# scopes. Tests will also clone the parent scope configuration to optionally
+# modify it, use and cleanup at the end. Note that configuration can not be
+# shared between multiple bpkg processes. Also we need to make sure that
+# configurations are not cloned while being used by bpkg.
+#
++$cfg_create -d cfg 2>- &cfg/***
+
+# The most commonly used configuration cloning command that copies it from the
+# parent scope working directory.
+#
+clone_cfg = cp -r ../cfg ./
+
+# Clones the original (presumably empty) configuration from the root scope
+# working directory.
+#
+clone_root_cfg = cp -r $~/cfg ./
+
+# Setup a test command to use a cloned configuration directory by default.
+#
+test.arguments += -d cfg
diff --git a/tests/pkg-build.test b/tests/pkg-build.test
new file mode 100644
index 0000000..763574b
--- /dev/null
+++ b/tests/pkg-build.test
@@ -0,0 +1,1239 @@
+# file : tests/pkg-build.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test config.test remote.test
+
+# Source repository:
+#
+# pkg-build
+# |-- libbar-1.0.0.tar.gz
+# |-- libbaz-1.1.0.tar.gz
+# |-- libfoo-0.0.1.tar.gz
+# |-- libfoo-1.0.0.tar.gz
+# |-- libfoo-1.1.0
+# | |-- build
+# | | `-- bootstrap.build
+# | |-- buildfile
+# | `-- manifest
+# |-- libfoo-1.1.0.tar.gz
+# |-- libfoo-1.2.0.tar.gz
+# |-- t1
+# | |-- libfoo-1.0.0.tar.gz
+# | `-- repositories
+# |-- t2
+# | |-- libbar-1.0.0.tar.gz -> libfoo
+# | |-- libfoo-1.0.0.tar.gz
+# | `-- repositories
+# |-- t3 -> t2 (prerequisite)
+# | |-- libbaz-1.0.0.tar.gz -> libbar
+# | |-- libfox-1.0.0.tar.gz
+# | `-- repositories
+# |-- t4a
+# | |-- libfoo-1.1.0.tar.gz
+# | `-- repositories
+# |-- t4b -> t4a (prerequisite)
+# | |-- libbar-1.1.0.tar.gz -> libfoo == 1.1.0
+# | `-- repositories
+# |-- t4c -> t4b (prerequisite)
+# | |-- libbaz-1.1.0.tar.gz -> libfoo, libbar
+# | |-- libfoo-1.0.0.tar.gz
+# | `-- repositories
+# |-- t4d -> t4c (prerequisite)
+# | |-- libbiz-1.0.0.tar.gz -> libfox, libfoo, libbaz
+# | |-- libfox-1.0.0.tar.gz
+# | `-- repositories
+# `-- t5
+# |-- libbar-1.2.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ cp -r $src/t1 $out/t1 && $rep_create $out/t1 &$out/t1/packages
+ cp -r $src/t2 $out/t2 && $rep_create $out/t2 &$out/t2/packages
+ cp -r $src/t3 $out/t3 && $rep_create $out/t3 &$out/t3/packages
+ cp -r $src/t4a $out/t4a && $rep_create $out/t4a &$out/t4a/packages
+ cp -r $src/t4b $out/t4b && $rep_create $out/t4b &$out/t4b/packages
+ cp -r $src/t4c $out/t4c && $rep_create $out/t4c &$out/t4c/packages
+ cp -r $src/t4d $out/t4d && $rep_create $out/t4d &$out/t4d/packages
+ cp -r $src/t5 $out/t5 && $rep_create $out/t5 &$out/t5/packages
+end
+
+pkg_configure += -d cfg "config.cxx=$config.cxx" 2>-
+pkg_disfigure += -d cfg
+pkg_fetch += -d cfg 2>-
+pkg_purge += -d cfg
+pkg_status += -d cfg
+pkg_unpack += -d cfg 2>-
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all --trust-yes 2>-
+
+: libfoo
+:
+: Test building different versions of libfoo.
+:
+{
+ test.arguments += --print-only
+
+ : no-name
+ :
+ $clone_root_cfg;
+ $* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-build' for more information
+ EOE
+
+ : unknown-package
+ :
+ $clone_root_cfg;
+ $* libfoo 2>>/EOE != 0
+ error: unknown package libfoo
+ info: configuration cfg/ has no repositories
+ info: use 'bpkg rep-add' to add a repository
+ EOE
+
+ : unknown-package-ver
+ :
+ $clone_root_cfg;
+ $* libfoo/1.0.0 2>>/EOE != 0
+ error: unknown package libfoo
+ info: configuration cfg/ has no repositories
+ info: use 'bpkg rep-add' to add a repository
+ EOE
+
+ : archive
+ :
+ $clone_root_cfg;
+ $* $src/libfoo-1.1.0.tar.gz >'build libfoo/1.1.0'
+
+ : dir
+ :
+ $clone_root_cfg;
+ $* $src/libfoo-1.1.0/ >'build libfoo/1.1.0'
+
+ : unpacked-dir
+ :
+ {
+ $clone_root_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
+
+ $* libfoo >'build libfoo/1.1.0';
+ $* libfoo/1.1.0 >'build libfoo/1.1.0';
+ $* libfoo libfoo >'build libfoo/1.1.0';
+
+ $* libfoo libfoo/1.1.0 2>>EOE != 0;
+ error: duplicate package libfoo
+ info: first mentioned as libfoo
+ info: second mentioned as libfoo/1.1.0
+ EOE
+
+ $* libfoo/1.1.0 libfoo 2>>EOE != 0;
+ error: duplicate package libfoo
+ info: first mentioned as libfoo/1.1.0
+ info: second mentioned as libfoo
+ EOE
+
+ $* libfoo/1.1.0 libfoo/1.1.0 >'build libfoo/1.1.0';
+
+ $* libfoo/1.0.0 2>>/EOE != 0;
+ error: unknown package libfoo
+ info: configuration cfg/ has no repositories
+ info: use 'bpkg rep-add' to add a repository
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : t1
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t1 && $rep_fetch
+
+ : downgrade
+ :
+ {
+ $clone_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
+
+ $* libfoo >'build libfoo/1.1.0';
+ $* libfoo/1.0.0 >'downgrade libfoo/1.0.0';
+
+ $* libfoo/0.0.1 2>>EOE != 0;
+ error: libfoo/0.0.1 is not available in source
+ info: specify sys:libfoo/0.0.1 if it is available from the system
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : upgrade
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch -e $src/libfoo-0.0.1.tar.gz && $pkg_unpack libfoo;
+
+ $* libfoo >'upgrade libfoo/1.0.0';
+ $* libfoo/0.0.1 >'build libfoo/0.0.1';
+
+ $* libfoo/1.1.0 2>>EOE != 0;
+ error: libfoo/1.1.0 is not available in source
+ info: specify sys:libfoo/1.1.0 if it is available from the system
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/0.0.1'
+ }
+
+ : upgrade-failure
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo >'build libfoo/1.0.0';
+ $* libfoo/1.0.0 >'build libfoo/1.0.0';
+
+ $* libfoo/1.1.0 2>>EOE != 0
+ error: libfoo/1.1.0 is not available in source
+ info: specify sys:libfoo/1.1.0 if it is available from the system
+ EOE
+ }
+ }
+}
+
+: libbar-libfoo
+:
+: Test building libbar that depends on libfoo.
+:
+{
+ test.arguments += --print-only
+
+ : unknown-prerequisite
+ :
+ $clone_root_cfg;
+ $* $src/libbar-1.0.0.tar.gz 2>>EOE != 0
+ error: unknown prerequisite libfoo of package libbar
+ info: while satisfying libbar/1.0.0
+ EOE
+
+ : t2
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t2 && $rep_fetch
+
+ : build-prerequisite
+ :
+ {
+ $clone_cfg;
+
+ $* libbar >>EOO;
+ build libfoo/1.0.0 (required by libbar)
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo >>EOO;
+ build libfoo/1.0.0
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo/1.0.0 >>EOO;
+ build libfoo/1.0.0
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo libbar/1.0.0 2>>EOE != 0;
+ error: duplicate package libbar
+ info: first mentioned as libbar
+ info: second mentioned as libbar/1.0.0
+ EOE
+
+ $* libbar libfoo/1.1.0 2>>EOE != 0
+ error: libfoo/1.1.0 is not available in source
+ info: specify sys:libfoo/1.1.0 if it is available from the system
+ EOE
+ }
+
+ : upgrade-prerequisite
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch -e $src/libfoo-0.0.1.tar.gz && $pkg_unpack libfoo;
+
+ $* libbar >>EOO;
+ build libfoo/0.0.1 (required by libbar)
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo >>EOO;
+ upgrade libfoo/1.0.0
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo/0.0.1 >>EOO;
+ build libfoo/0.0.1
+ build libbar/1.0.0
+ EOO
+
+ $pkg_purge libfoo 2>'purged libfoo/0.0.1'
+ }
+
+ : downgrade-prerequisite
+ :
+ {
+ $clone_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
+
+ $* libbar >>EOO;
+ build libfoo/1.1.0 (required by libbar)
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo >>EOO;
+ build libfoo/1.1.0
+ build libbar/1.0.0
+ EOO
+
+ $* libbar libfoo/1.0.0 >>EOO;
+ downgrade libfoo/1.0.0
+ build libbar/1.0.0
+ EOO
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+ }
+}
+
+: libbaz-libbar
+:
+: Test building libbaz that depends on libbar; libbar is in prerequisite
+: repository.
+:
+{
+ test.arguments += --print-only
+
+ : t3
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t3 && $rep_fetch
+
+ : prerequisites-build-failure
+ :
+ : Fail to build packages that are only in prerequisite repository.
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo 2>>EOE != 0;
+ error: unknown package libfoo
+ EOE
+
+ $* libbar 2>>EOE != 0;
+ error: unknown package libbar
+ EOE
+
+ $* libbaz libbar 2>>EOE != 0
+ error: unknown package libbar
+ EOE
+ }
+
+ : prerequisites-build
+ :
+ $clone_cfg;
+ $* libbaz >>EOO
+ build libfoo/1.0.0 (required by libbar)
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : different-build-order
+ :
+ {
+ +$clone_cfg && $rep_add $rep/t2 && $rep_fetch
+
+ : fox-foo
+ :
+ $clone_cfg;
+ $* libfox libfoo >>EOO
+ build libfox/1.0.0
+ build libfoo/1.0.0
+ EOO
+
+ : foo-fox
+ :
+ $clone_cfg;
+ $* libfoo libfox >>EOO
+ build libfoo/1.0.0
+ build libfox/1.0.0
+ EOO
+
+ : baz-foo
+ :
+ $clone_cfg;
+ $* libbaz libfoo >>EOO
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : foo-baz
+ :
+ $clone_cfg;
+ $* libfoo libbaz >>EOO
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : baz-fox
+ :
+ $clone_cfg;
+ $* libbaz libfox >>EOO
+ build libfoo/1.0.0 (required by libbar)
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ build libfox/1.0.0
+ EOO
+
+ : fox-baz
+ :
+ $clone_cfg;
+ $* libfox libbaz >>EOO
+ build libfox/1.0.0
+ build libfoo/1.0.0 (required by libbar)
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : fox-foo-baz
+ :
+ $clone_cfg;
+ $* libfox libfoo libbaz >>EOO
+ build libfox/1.0.0
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : fox-baz-foo
+ :
+ $clone_cfg;
+ $* libfox libbaz libfoo >>EOO
+ build libfox/1.0.0
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : foo-fox-baz
+ :
+ $clone_cfg;
+ $* libfoo libfox libbaz >>EOO
+ build libfoo/1.0.0
+ build libfox/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : foo-baz-fox
+ :
+ $clone_cfg;
+ $* libfoo libbaz libfox >>EOO
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ build libfox/1.0.0
+ EOO
+
+ : baz-fox-foo
+ :
+ : This one is contradictory: baz before fox but fox before foo.
+ :
+ $clone_cfg;
+ $* libbaz libfox libfoo >>EOO
+ build libfox/1.0.0
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ EOO
+
+ : baz-foo-fox
+ :
+ $clone_cfg;
+ $* libbaz libfoo libfox >>EOO
+ build libfoo/1.0.0
+ build libbar/1.0.0 (required by libbaz)
+ build libbaz/1.0.0
+ build libfox/1.0.0
+ EOO
+
+ : baz-foo-bar
+ :
+ $clone_cfg;
+ $* libbaz libfoo libbar >>EOO
+ build libfoo/1.0.0
+ build libbar/1.0.0
+ build libbaz/1.0.0
+ EOO
+
+ : baz-bar-foo
+ :
+ $clone_cfg;
+ $* libbaz libbar libfoo >>EOO
+ build libfoo/1.0.0
+ build libbar/1.0.0
+ build libbaz/1.0.0
+ EOO
+ }
+ }
+}
+
+: libbaz-libfoo-libbar
+:
+: Test building libbaz that depends on libfoo and libbar; libbar depends on
+: libfoo >= 1.1.0.
+:
+{
+ test.arguments += --print-only
+
+ : t4c
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t4c && $rep_fetch
+
+ : baz
+ :
+ $clone_cfg;
+ $* libbaz >>EOO
+ build libfoo/1.1.0 (required by libbar libbaz)
+ build libbar/1.1.0 (required by libbaz)
+ build libbaz/1.1.0
+ EOO
+
+ : foo-baz
+ :
+ $clone_cfg;
+ $* libfoo libbaz >>EOO
+ build libfoo/1.1.0
+ build libbar/1.1.0 (required by libbaz)
+ build libbaz/1.1.0
+ EOO
+
+ : unable-satisfy
+ :
+ $clone_cfg;
+ $* libfoo/1.0.0 libbaz 2>>EOE != 0
+ error: unable to satisfy constraints on package libfoo
+ info: libbar depends on (libfoo == 1.1.0)
+ info: command line depends on (libfoo == 1.0.0)
+ info: available libfoo/1.1.0
+ info: available libfoo/1.0.0
+ info: explicitly specify libfoo version to manually satisfy both constraints
+ info: while satisfying libbar/1.1.0
+ info: while satisfying libbaz/1.1.0
+ EOE
+
+ : not-available
+ :
+ $clone_cfg;
+ $* libfoo/1.1.0 libbaz 2>>EOE != 0
+ error: libfoo/1.1.0 is not available in source
+ info: specify sys:libfoo/1.1.0 if it is available from the system
+ EOE
+
+ : upgrade-warning
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch -e $src/libfoo-0.0.1.tar.gz && $pkg_unpack libfoo;
+
+ $* libbaz >>EOO 2>>EOE;
+ upgrade libfoo/1.1.0 (required by libbar libbaz)
+ build libbar/1.1.0 (required by libbaz)
+ build libbaz/1.1.0
+ EOO
+ warning: package libbar dependency on (libfoo == 1.1.0) is forcing upgrade of libfoo/0.0.1 to 1.1.0
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/0.0.1'
+ }
+
+ : downgrade-error
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch -e $src/libfoo-1.2.0.tar.gz && $pkg_unpack libfoo;
+
+ $* libbaz 2>>EOE != 0;
+ error: package libbar dependency on (libfoo == 1.1.0) is forcing downgrade of libfoo/1.2.0 to 1.1.0
+ info: explicitly request version downgrade to continue
+ info: while satisfying libbar/1.1.0
+ info: while satisfying libbaz/1.1.0
+ EOE
+
+ $rep_add $rep/t4a && $rep_fetch;
+
+ $* libfoo/1.1.0 libbaz >>EOO;
+ downgrade libfoo/1.1.0
+ build libbar/1.1.0 (required by libbaz)
+ build libbaz/1.1.0
+ EOO
+
+ $pkg_purge libfoo 2>'purged libfoo/1.2.0'
+ }
+
+ : unable-downgrade
+ :
+ : Test that dependent prevents up/downgrade that would break dependency
+ : constraints.
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libfoo/1.1.0 && $pkg_unpack libfoo && $pkg_configure libfoo;
+ $pkg_fetch libbar/1.1.0 && $pkg_unpack libbar && $pkg_configure libbar;
+
+ $* libfoo-1.2.0.tar.gz 2>>EOE != 0;
+ error: unknown package libfoo-1.2.0.tar.gz
+ EOE
+
+ $* libfoo/1.0.0 2>>EOE != 0;
+ error: unable to downgrade package libfoo/1.1.0 to 1.0.0
+ info: because package libbar depends on (libfoo == 1.1.0)
+ info: explicitly request up/downgrade of package libbar
+ info: or explicitly specify package libfoo version to manually satisfy these constraints
+ EOE
+
+ $* libfoo/1.1.0 >'build libfoo/1.1.0';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.1.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+ }
+
+ : dependent-reconfiguration
+ :
+ {
+ +$clone_root_cfg
+
+ +$pkg_fetch -e $src/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo
+ +$pkg_configure libfoo
+
+ +$pkg_fetch -e $src/libbar-1.0.0.tar.gz && $pkg_unpack libbar
+ +$pkg_configure libbar
+
+ +$pkg_fetch -e $src/libbaz-1.1.0.tar.gz && $pkg_unpack libbaz
+ +$pkg_configure libbaz
+
+ +$rep_add $rep/t4a && $rep_add $rep/t4b && $rep_fetch
+
+ : bar
+ :
+ $clone_cfg;
+ $* libbar >>EOO 2>>EOE
+ upgrade libfoo/1.1.0 (required by libbar libbaz)
+ upgrade libbar/1.1.0
+ reconfigure libbaz (dependent of libbar)
+ EOO
+ warning: package libbar dependency on (libfoo == 1.1.0) is forcing upgrade of libfoo/1.0.0 to 1.1.0
+ EOE
+
+ : foo
+ :
+ $clone_cfg;
+ $* libfoo >>EOO
+ upgrade libfoo/1.1.0
+ reconfigure libbar (dependent of libfoo)
+ reconfigure libbaz (dependent of libbar)
+ EOO
+
+ : foo-bar
+ :
+ $clone_cfg;
+ $* libfoo libbar/1.0.0 >>EOO
+ upgrade libfoo/1.1.0
+ reconfigure/build libbar/1.0.0
+ reconfigure libbaz (dependent of libbar)
+ EOO
+
+ : bar-foo
+ :
+ $clone_cfg;
+ $* libbar/1.0.0 libfoo >>EOO
+ upgrade libfoo/1.1.0
+ reconfigure/build libbar/1.0.0
+ reconfigure libbaz (dependent of libbar)
+ EOO
+
+ : baz-foo
+ :
+ $clone_cfg;
+ $* libbaz libfoo >>EOO
+ upgrade libfoo/1.1.0
+ reconfigure libbar (dependent of libbaz libfoo)
+ reconfigure/build libbaz/1.1.0
+ EOO
+
+ : baz-foo-1.0.0
+ :
+ $clone_cfg;
+ $* libbaz libfoo/1.0.0 >>EOO
+ build libfoo/1.0.0
+ build libbaz/1.1.0
+ EOO
+
+ -$pkg_disfigure libbaz 2>'disfigured libbaz/1.1.0'
+ -$pkg_purge libbaz 2>'purged libbaz/1.1.0'
+
+ -$pkg_disfigure libbar 2>'disfigured libbar/1.0.0'
+ -$pkg_purge libbar 2>'purged libbar/1.0.0'
+
+ -$pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0'
+ -$pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+}
+
+# Note that when we fetch a package from remote repository the bpkg stderr
+# contains fetch program progress output, that comes prior the informational
+# message.
+#
+
+: actual-build
+:
+{
+ test.arguments += --yes
+
+ : wth-prerequisites
+ :
+ {
+ $clone_root_cfg && $rep_add $rep/t4c && $rep_fetch;
+
+ $* libbaz 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.1.0%
+ unpacked libfoo/1.1.0
+ %.*
+ %.*fetched libbar/1.1.0%
+ unpacked libbar/1.1.0
+ %.*
+ %.*fetched libbaz/1.1.0%
+ unpacked libbaz/1.1.0
+ configured libfoo/1.1.0
+ configured libbar/1.1.0
+ configured libbaz/1.1.0
+ %info: dir.+libbaz-1.1.0.+ is up to date%
+ updated libbaz/1.1.0
+ EOE
+
+ $pkg_status libfoo/1.1.0 >'configured; available';
+ $pkg_status libbar/1.1.0 >'configured';
+ $pkg_status libbaz/1.1.0 >'configured hold_package; available';
+
+ $pkg_disfigure libbaz 2>'disfigured libbaz/1.1.0';
+ $pkg_purge libbaz 2>'purged libbaz/1.1.0';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.1.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : hold-fs-fetched
+ :
+ {
+ : direct
+ :
+ {
+ $clone_root_cfg;
+
+ $* $src/libfoo-1.0.0.tar.gz 2>>~%EOE%;
+ fetched libfoo/1.0.0
+ unpacked libfoo/1.0.0
+ configured libfoo/1.0.0
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package hold_version';
+
+ $* $src/libfoo-1.1.0/ 2>>~%EOE%;
+ disfigured libfoo/1.0.0
+ unpacked libfoo/1.1.0
+ configured libfoo/1.1.0
+ %info: dir.+libfoo-1.1.0.+ is up to date%
+ updated libfoo/1.1.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.1.0 hold_package hold_version';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : pre-fetch
+ :
+ {
+ $clone_root_cfg;
+ $pkg_fetch -e $src/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
+ $pkg_configure libfoo;
+
+ $pkg_status libfoo >'configured 1.0.0';
+
+ $* libfoo 2>>~%EOE%;
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+ }
+
+ : hold-repo-fetched
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/t4c && $rep_fetch
+
+ : package-version
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ configured libfoo/1.0.0
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package; available sys:?';
+
+ $* libfoo/1.0.0 2>>~%EOE%;
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package hold_version; available sys:?';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+
+ : version
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo/1.0.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ configured libfoo/1.0.0
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package hold_version; available sys:?';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+
+ : not-held
+ :
+ {
+ $clone_cfg;
+
+ $* libbaz 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.1.0%
+ unpacked libfoo/1.1.0
+ %.*
+ %.*fetched libbar/1.1.0%
+ unpacked libbar/1.1.0
+ %.*
+ %.*fetched libbaz/1.1.0%
+ unpacked libbaz/1.1.0
+ configured libfoo/1.1.0
+ configured libbar/1.1.0
+ configured libbaz/1.1.0
+ %info: dir.+libbaz-1.1.0.+ is up to date%
+ updated libbaz/1.1.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.1.0; available sys:?';
+
+ $pkg_disfigure libbaz 2>'disfigured libbaz/1.1.0';
+ $pkg_purge libbaz 2>'purged libbaz/1.1.0';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.1.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : forcing-upgrade-unheld
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ configured libfoo/1.0.0
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package; available sys:?';
+
+ $* libbaz 2>>~%EOE%;
+ warning: package libbar dependency on (libfoo == 1.1.0) is forcing upgrade of libfoo/1.0.0 to 1.1.0
+ disfigured libfoo/1.0.0
+ %.*
+ %.*fetched libfoo/1.1.0%
+ unpacked libfoo/1.1.0
+ %.*
+ %.*fetched libbar/1.1.0%
+ unpacked libbar/1.1.0
+ %.*
+ %.*fetched libbaz/1.1.0%
+ unpacked libbaz/1.1.0
+ configured libfoo/1.1.0
+ configured libbar/1.1.0
+ configured libbaz/1.1.0
+ %info: dir.+libbaz-1.1.0.+ is up to date%
+ updated libbaz/1.1.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.1.0 hold_package; available sys:?';
+
+ $pkg_disfigure libbaz 2>'disfigured libbaz/1.1.0';
+ $pkg_purge libbaz 2>'purged libbaz/1.1.0';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.1.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : forcing-upgrade-held
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo/1.0.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ configured libfoo/1.0.0
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package hold_version; available sys:?';
+
+ $* libbaz 2>>EOE != 0;
+ error: package libbar dependency on (libfoo == 1.1.0) is forcing upgrade of libfoo/1.0.0 to 1.1.0
+ info: package version libfoo/1.0.0 is held
+ info: explicitly request version upgrade to continue
+ info: while satisfying libbar/1.1.0
+ info: while satisfying libbaz/1.1.0
+ EOE
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+ }
+
+ : drop-prerequisites
+ :
+ {
+ $clone_root_cfg && $rep_add $rep/t2 && $rep_fetch;
+
+ $* libbar 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ %info: dir.+libbar-1.0.0.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0; available sys:?';
+ $pkg_status libbar >'configured 1.0.0 hold_package; available sys:?';
+
+ $rep_add $rep/t5 && $rep_fetch;
+
+ $* libbar 2>>~%EOE%;
+ disfigured libbar/1.0.0
+ %.*
+ %.*fetched libbar/1.2.0%
+ unpacked libbar/1.2.0
+ configured libbar/1.2.0
+ disfigured libfoo
+ purged libfoo
+ %info: dir.+libbar-1.2.0.+ is up to date%
+ updated libbar/1.2.0
+ EOE
+
+ $pkg_status libfoo >'available 1.0.0 sys:?';
+ $pkg_status libbar >'configured 1.2.0 hold_package; available sys:?';
+
+ $* libbar/1.0.0 libfoo 2>>~%EOE%;
+ disfigured libbar/1.2.0
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ %info: dir.+libfoo-1.0.0.+ is up to date%
+ %info: dir.+libbar-1.0.0.+ is up to date%
+ updated libfoo/1.0.0
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package; available sys:?';
+ $pkg_status libbar >'configured 1.0.0 hold_package hold_version; available 1.2.0 sys:?';
+
+ $* libbar 2>>~%EOE%;
+ disfigured libbar/1.0.0
+ %.*
+ %.*fetched libbar/1.2.0%
+ unpacked libbar/1.2.0
+ configured libbar/1.2.0
+ %info: dir.+libbar-1.2.0.+ is up to date%
+ updated libbar/1.2.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0 hold_package; available sys:?';
+ $pkg_status libbar >'configured 1.2.0 hold_package; available sys:?';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.2.0';
+ $pkg_purge libbar 2>'purged libbar/1.2.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+}
+
+: prerequisite
+:
+{
+ +$clone_cfg
+ +$rep_add $rep/t2 && $rep_add $rep/t5 && $rep_fetch
+
+ : drop
+ :
+ : Test --drop-prerequisite option.
+ :
+ {
+ $clone_cfg;
+
+ $* --yes libbar/1.0.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ %info: dir.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $* --drop-prerequisite libbar/1.2.0 <'y' 2>>~%EOE%;
+ upgrade libbar/1.2.0
+ continue? [Y/n] disfigured libbar/1.0.0
+ %.*
+ %.*fetched libbar/1.2.0%
+ unpacked libbar/1.2.0
+ configured libbar/1.2.0
+ disfigured libfoo
+ purged libfoo
+ %info: .+ is up to date%
+ updated libbar/1.2.0
+ EOE
+
+ $pkg_status libfoo >'available 1.0.0 sys:?';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.2.0';
+ $pkg_purge libbar 2>'purged libbar/1.2.0'
+ }
+
+ : keep
+ :
+ : Test --keep-prerequisite option.
+ :
+ {
+ $clone_cfg;
+
+ $* --yes libbar/1.0.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ %info: dir.+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $* --keep-prerequisite libbar/1.2.0 <'y' 2>>~%EOE%;
+ upgrade libbar/1.2.0
+ continue? [Y/n] disfigured libbar/1.0.0
+ %.*
+ %.*fetched libbar/1.2.0%
+ unpacked libbar/1.2.0
+ configured libbar/1.2.0
+ %info: .+ is up to date%
+ updated libbar/1.2.0
+ EOE
+
+ $pkg_status libfoo >'configured 1.0.0; available sys:?';
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.2.0';
+ $pkg_purge libbar 2>'purged libbar/1.2.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+}
+
+: dependent
+:
+{
+ +$clone_cfg
+ +$rep_add $rep/t2 && $rep_fetch
+
+ : update
+ :
+ : Test --update-dependent option.
+ :
+ {
+ $clone_cfg;
+
+ $* --yes libbar 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ %info: .+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $rep_add $rep/t4a && $rep_fetch;
+
+ $* --update-dependent libfoo/1.1.0 <'y' 2>>~%EOE%;
+ upgrade libfoo/1.1.0
+ reconfigure libbar (dependent of libfoo)
+ continue? [Y/n] disfigured libbar/1.0.0
+ disfigured libfoo/1.0.0
+ %.*
+ %.*fetched libfoo/1.1.0%
+ unpacked libfoo/1.1.0
+ configured libfoo/1.1.0
+ configured libbar/1.0.0
+ %info: .+ is up to date%
+ %info: .+ is up to date%
+ updated libfoo/1.1.0
+ updated libbar/1.0.0
+ EOE
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.0.0';
+ $pkg_purge libbar 2>'purged libbar/1.0.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : leave
+ :
+ : Test --leave-dependent option.
+ :
+ {
+ $clone_cfg;
+
+ $* --yes libbar 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ %info: .+ is up to date%
+ updated libbar/1.0.0
+ EOE
+
+ $rep_add $rep/t4a && $rep_fetch;
+
+ $* --leave-dependent libfoo/1.1.0 <'y' 2>>~%EOE%;
+ upgrade libfoo/1.1.0
+ reconfigure libbar (dependent of libfoo)
+ continue? [Y/n] disfigured libbar/1.0.0
+ disfigured libfoo/1.0.0
+ %.*
+ %.*fetched libfoo/1.1.0%
+ unpacked libfoo/1.1.0
+ configured libfoo/1.1.0
+ configured libbar/1.0.0
+ %info: .+ is up to date%
+ updated libfoo/1.1.0
+ EOE
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.0.0';
+ $pkg_purge libbar 2>'purged libbar/1.0.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+}
+
+: configure-only
+:
+: Test --configure-only option.
+:
+{
+ $clone_cfg;
+ $rep_add $rep/t2 && $rep_fetch;
+
+ $* --configure-only --yes libbar 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ unpacked libfoo/1.0.0
+ %.*
+ %.*fetched libbar/1.0.0%
+ unpacked libbar/1.0.0
+ configured libfoo/1.0.0
+ configured libbar/1.0.0
+ EOE
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.0.0';
+ $pkg_purge libbar 2>'purged libbar/1.0.0';
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+}
diff --git a/tests/pkg-build/libbar-1.0.0.tar.gz b/tests/pkg-build/libbar-1.0.0.tar.gz
new file mode 120000
index 0000000..643487e
--- /dev/null
+++ b/tests/pkg-build/libbar-1.0.0.tar.gz
@@ -0,0 +1 @@
+../common/satisfy/libbar-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg-build/libbaz-1.1.0.tar.gz b/tests/pkg-build/libbaz-1.1.0.tar.gz
new file mode 120000
index 0000000..c3a33c8
--- /dev/null
+++ b/tests/pkg-build/libbaz-1.1.0.tar.gz
@@ -0,0 +1 @@
+../common/satisfy/libbaz-1.1.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg-build/libfoo-0.0.1.tar.gz b/tests/pkg-build/libfoo-0.0.1.tar.gz
new file mode 120000
index 0000000..0f1802e
--- /dev/null
+++ b/tests/pkg-build/libfoo-0.0.1.tar.gz
@@ -0,0 +1 @@
+../common/satisfy/libfoo-0.0.1.tar.gz \ No newline at end of file
diff --git a/tests/pkg-build/libfoo-1.0.0.tar.gz b/tests/pkg-build/libfoo-1.0.0.tar.gz
new file mode 120000
index 0000000..4f215aa
--- /dev/null
+++ b/tests/pkg-build/libfoo-1.0.0.tar.gz
@@ -0,0 +1 @@
+../common/satisfy/libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg-build/libfoo-1.1.0 b/tests/pkg-build/libfoo-1.1.0
new file mode 120000
index 0000000..c991a82
--- /dev/null
+++ b/tests/pkg-build/libfoo-1.1.0
@@ -0,0 +1 @@
+../common/satisfy/libfoo-1.1.0 \ No newline at end of file
diff --git a/tests/pkg-build/libfoo-1.1.0.tar.gz b/tests/pkg-build/libfoo-1.1.0.tar.gz
new file mode 120000
index 0000000..4c8bb75
--- /dev/null
+++ b/tests/pkg-build/libfoo-1.1.0.tar.gz
@@ -0,0 +1 @@
+../common/satisfy/libfoo-1.1.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg-build/libfoo-1.2.0.tar.gz b/tests/pkg-build/libfoo-1.2.0.tar.gz
new file mode 120000
index 0000000..a6cc8b7
--- /dev/null
+++ b/tests/pkg-build/libfoo-1.2.0.tar.gz
@@ -0,0 +1 @@
+../common/satisfy/libfoo-1.2.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg-build/t1 b/tests/pkg-build/t1
new file mode 120000
index 0000000..c7c69d2
--- /dev/null
+++ b/tests/pkg-build/t1
@@ -0,0 +1 @@
+../common/satisfy/t1 \ No newline at end of file
diff --git a/tests/pkg-build/t2 b/tests/pkg-build/t2
new file mode 120000
index 0000000..0f8869b
--- /dev/null
+++ b/tests/pkg-build/t2
@@ -0,0 +1 @@
+../common/satisfy/t2 \ No newline at end of file
diff --git a/tests/pkg-build/t3 b/tests/pkg-build/t3
new file mode 120000
index 0000000..df69aba
--- /dev/null
+++ b/tests/pkg-build/t3
@@ -0,0 +1 @@
+../common/satisfy/t3 \ No newline at end of file
diff --git a/tests/pkg-build/t4a b/tests/pkg-build/t4a
new file mode 120000
index 0000000..47997b2
--- /dev/null
+++ b/tests/pkg-build/t4a
@@ -0,0 +1 @@
+../common/satisfy/t4a \ No newline at end of file
diff --git a/tests/pkg-build/t4b b/tests/pkg-build/t4b
new file mode 120000
index 0000000..917299c
--- /dev/null
+++ b/tests/pkg-build/t4b
@@ -0,0 +1 @@
+../common/satisfy/t4b \ No newline at end of file
diff --git a/tests/pkg-build/t4c b/tests/pkg-build/t4c
new file mode 120000
index 0000000..06b7611
--- /dev/null
+++ b/tests/pkg-build/t4c
@@ -0,0 +1 @@
+../common/satisfy/t4c \ No newline at end of file
diff --git a/tests/pkg-build/t4d b/tests/pkg-build/t4d
new file mode 120000
index 0000000..56dc0f7
--- /dev/null
+++ b/tests/pkg-build/t4d
@@ -0,0 +1 @@
+../common/satisfy/t4d \ No newline at end of file
diff --git a/tests/pkg-build/t5 b/tests/pkg-build/t5
new file mode 120000
index 0000000..58fcea2
--- /dev/null
+++ b/tests/pkg-build/t5
@@ -0,0 +1 @@
+../common/satisfy/t5 \ No newline at end of file
diff --git a/tests/pkg-clean.test b/tests/pkg-clean.test
new file mode 100644
index 0000000..c090036
--- /dev/null
+++ b/tests/pkg-clean.test
@@ -0,0 +1,133 @@
+# file : tests/pkg-clean.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# Source repository:
+#
+# pkg-clean
+# |-- hello
+# | |-- libhello-1.0.0.tar.gz
+# | `-- repositories
+# `-- libhello-1.0.0
+# |-- build
+# | |-- bootstrap.build
+# | |-- export.build
+# | `-- root.build
+# |-- buildfile
+# |-- hello
+# | |-- buildfile
+# | |-- export
+# | |-- hello
+# | `-- hello.cxx
+# |-- INSTALL
+# |-- manifest
+# |-- tests
+# | |-- build
+# | | |-- bootstrap.build
+# | | `-- root.build
+# | |-- buildfile
+# | `-- test
+# | |-- buildfile
+# | |-- driver.cxx
+# | `-- test.out
+# `-- version
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories
+ $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature
+end
+
+pkg_configure += -d cfg "config.cxx=$config.cxx" 2>-
+pkg_disfigure += -d cfg
+pkg_fetch += -d cfg 2>-
+pkg_purge += -d cfg
+pkg_unpack += -d cfg 2>-
+pkg_update += -d cfg 2>-
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all 2>-
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-clean' for more information
+ EOE
+
+: fetched
+:
+{
+ +$clone_cfg
+ +$rep_add $rep/hello && $rep_fetch --trust $cert_fp &cfg/.bpkg/certs/***
+
+ : no-such-package
+ :
+ $clone_cfg;
+ $* libhello 2>>/EOE != 0
+ error: package libhello does not exist in configuration cfg/
+ EOE
+
+ : wrong-state
+ :
+ {
+ $clone_cfg && $pkg_fetch libhello/1.0.0;
+
+ $* libhello 2>>EOE != 0;
+ error: package libhello is fetched
+ info: expected it to be configured
+ EOE
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+
+ : src-eq-out
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libhello/1.0.0 && $pkg_unpack libhello;
+ $pkg_configure libhello && $pkg_update libhello;
+
+ $* libhello 2>>~%EOE%;
+ %.{6}
+ cleaned libhello/1.0.0
+ EOE
+
+ $* libhello 2>>~%EOE%;
+ %info: .+ is clean%
+ cleaned libhello/1.0.0
+ EOE
+
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+}
+
+: src-ne-out
+:
+{
+ $clone_cfg;
+ $pkg_unpack -e $src/libhello-1.0.0;
+ $pkg_configure libhello && $pkg_update libhello;
+
+ $* libhello 2>>~%EOE%;
+ %.{8}
+ cleaned libhello/1.0.0
+ EOE
+
+ $* libhello 2>>~%EOE%;
+ %info: .+ is clean%
+ cleaned libhello/1.0.0
+ EOE
+
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+}
diff --git a/tests/pkg-clean/hello b/tests/pkg-clean/hello
new file mode 120000
index 0000000..e10a7f8
--- /dev/null
+++ b/tests/pkg-clean/hello
@@ -0,0 +1 @@
+../common/hello \ No newline at end of file
diff --git a/tests/pkg-clean/libhello-1.0.0 b/tests/pkg-clean/libhello-1.0.0
new file mode 120000
index 0000000..a6f638b
--- /dev/null
+++ b/tests/pkg-clean/libhello-1.0.0
@@ -0,0 +1 @@
+../common/libhello-1.0.0 \ No newline at end of file
diff --git a/tests/pkg-configure.test b/tests/pkg-configure.test
new file mode 100644
index 0000000..098b1a9
--- /dev/null
+++ b/tests/pkg-configure.test
@@ -0,0 +1,389 @@
+# file : tests/pkg-configure.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Here we test both pkg-configure and pkg-disfigure commands.
+#
+
+.include common.test auth.test config.test remote.test
+
+# Source repository:
+#
+# pkg-configure
+# |-- hello
+# | |-- libhello-1.0.0.tar.gz
+# | `-- repositories
+# |-- libhello-1.0.0
+# | |-- build
+# | | |-- bootstrap.build
+# | | |-- export.build
+# | | `-- root.build
+# | |-- buildfile
+# | |-- hello
+# | | |-- buildfile
+# | | |-- export
+# | | |-- hello
+# | | `-- hello.cxx
+# | |-- INSTALL
+# | |-- manifest
+# | |-- tests
+# | | |-- build
+# | | | |-- bootstrap.build
+# | | | `-- root.build
+# | | |-- buildfile
+# | | `-- test
+# | | |-- buildfile
+# | | |-- driver.cxx
+# | | `-- test.out
+# | `-- version
+# `-- stable
+# |-- libbar-1.0.0.tar.gz -> libfoo
+# |-- libbar-1.1.0.tar.gz -> libfoo >= 1.1.0
+# |-- libbar-1.2.0.tar.gz -> libfoo >= 1.1.0, libfox | libfoo >= 1.2.0
+# |-- libbar-1.3.0.tar.gz -> libfox | libfoo <= 1.1.0,
+# | libfix | libfoo >= 1.1.0
+# |-- libfoo-1.0.0.tar.gz
+# |-- libfoo-1.1.0.tar.gz
+# |-- libfoo-1.2.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories
+ $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature
+
+ # Create the 'stable' repository.
+ #
+ cp -r $src/stable $out/stable
+ $rep_create $out/stable &$out/stable/packages
+end
+
+test.arguments += "config.cxx=$config.cxx"
+
+pkg_disfigure += -d cfg
+pkg_fetch += -d cfg 2>-
+pkg_purge += -d cfg
+pkg_status += -d cfg
+pkg_unpack += -d cfg 2>-
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all 2>-
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-configure' for more information
+ EOE
+
+: var-no-name
+:
+$clone_cfg;
+$* "config.dist.root=$~/opt" 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-configure' for more information
+ EOE
+
+: unexpected-arg
+:
+$clone_cfg;
+$* libhello libhello 2>>EOE != 0
+ error: unexpected argument 'libhello'
+ EOE
+
+: fetched
+:
+{
+ +$clone_cfg
+ +$rep_add $rep/hello && $rep_fetch --trust $cert_fp &cfg/.bpkg/certs/***
+
+ : no-such-package
+ :
+ $clone_cfg;
+ $* libhello1 2>>/EOE != 0
+ error: package libhello1 does not exist in configuration cfg/
+ EOE
+
+ : disfigure
+ {
+ : no-name
+ :
+ $clone_root_cfg;
+ $pkg_disfigure 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-disfigure' for more information
+ EOE
+
+ : no-such-package
+ :
+ $clone_root_cfg;
+ $pkg_disfigure libhello1 2>>/EOE != 0
+ error: package libhello1 does not exist in configuration cfg/
+ EOE
+ }
+
+ : wrong-state
+ :
+ {
+ $clone_cfg && $pkg_fetch libhello/1.0.0;
+
+ $* libhello 2>>EOE != 0;
+ error: package libhello is fetched
+ info: expected it to be unpacked
+ EOE
+
+ $pkg_disfigure libhello 2>>EOE != 0;
+ error: package libhello is fetched
+ info: expected it to be configured
+ EOE
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+
+ : src-eq-out
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libhello/1.0.0 && $pkg_unpack libhello;
+
+ $* libhello 2>'configured libhello/1.0.0';
+ $pkg_status libhello 1>'configured 1.0.0; available sys:?';
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_status libhello 1>'unpacked 1.0.0; available sys:?';
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0';
+ $pkg_status libhello/1.0.0 1>'available'
+ }
+}
+
+: src-ne-out
+:
+{
+ $clone_cfg && $pkg_unpack -e $src/libhello-1.0.0;
+
+ $* libhello 2>'configured libhello/1.0.0';
+ $pkg_status libhello 1>'configured 1.0.0';
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_status libhello 1>'unpacked 1.0.0';
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0';
+ $pkg_status libhello 1>'unknown';
+ test -d cfg/libhello-1.0.0 == 1
+}
+
+: out-exists-disfigure
+:
+{
+ $clone_cfg && $pkg_unpack -e $src/libhello-1.0.0;
+
+ $* libhello 2>'configured libhello/1.0.0';
+ touch cfg/libhello-1.0.0/stray &!cfg/libhello-1.0.0/stray;
+
+ $pkg_disfigure libhello 2>>/EOE != 0;
+ warning: directory cfg/libhello-1.0.0/ is not empty, not removing
+ error: package output directory cfg/libhello-1.0.0/ still exists
+ info: package libhello is now broken; use 'pkg-purge' to remove
+ EOE
+
+ $pkg_status libhello/1.0.0 >'broken';
+ rm -r cfg/libhello-1.0.0;
+
+ $pkg_purge -f libhello 2>'purged libhello/1.0.0';
+ $pkg_status libhello/1.0.0 1>'unknown'
+}
+
+: broken
+:
+if ($cxx.target.class != 'windows')
+{
+ : disfigure-failed
+ :
+ {
+ $clone_root_cfg && $pkg_unpack -e $src/libhello-1.0.0;
+
+ $* libhello 2>'configured libhello/1.0.0';
+ chmod 555 cfg/libhello-1.0.0;
+
+ $pkg_disfigure libhello 2>>/~%EOE% != 0;
+ %error: unable to remove directory cfg/libhello-1.0.0/.+%
+ info: package libhello is now broken; use 'pkg-purge' to remove
+ EOE
+
+ $pkg_status libhello >'broken 1.0.0';
+
+ chmod 755 cfg/libhello-1.0.0;
+ rm -r cfg/libhello-1.0.0;
+ $pkg_purge -f libhello 2>'purged libhello/1.0.0';
+ $pkg_status libhello >'unknown'
+ }
+
+ : configure-failed
+ :
+ : Note that pkg-configure in case of build2 process failure implicitly
+ : performs pkg-disfigure, that succeeds.
+ :
+ {
+ $clone_root_cfg && $pkg_unpack -e $src/libhello-1.0.0;
+ c = &!cfg/libhello-1.0.0/ &!cfg/libhello-1.0.0/build/;
+ mkdir -p cfg/libhello-1.0.0/build $c;
+ chmod 555 cfg/libhello-1.0.0/build;
+
+ $* libhello 2>>/~%EOE% != 0;
+ %error: unable to create directory cfg/libhello-1.0.0/build/.+%
+ EOE
+
+ $pkg_status libhello >'unpacked 1.0.0'
+ }
+
+ : configure-disfigure-failed
+ :
+ : Note that pkg-configure in case of build2 process failure implicitly
+ : performs pkg-disfigure, that also fails.
+ :
+ {
+ $clone_root_cfg && $pkg_unpack -e $src/libhello-1.0.0;
+ c = &!cfg/libhello-1.0.0/ &!cfg/libhello-1.0.0/build/;
+ mkdir -p cfg/libhello-1.0.0/build $c;
+ chmod 555 cfg/libhello-1.0.0 cfg/libhello-1.0.0/build;
+
+ $* libhello 2>>/~%EOE% != 0;
+ %error: unable to create directory cfg/libhello-1.0.0/build/.+%
+ %error: unable to remove directory cfg/libhello-1.0.0/build/.+%
+ info: package libhello is now broken; use 'pkg-purge' to remove
+ EOE
+
+ $pkg_status libhello >'broken 1.0.0';
+
+ chmod 755 cfg/libhello-1.0.0 cfg/libhello-1.0.0/build;
+ rm -r cfg/libhello-1.0.0;
+ $pkg_purge -f libhello 2>'purged libhello/1.0.0';
+ $pkg_status libhello >'unknown'
+ }
+}
+
+: dependency-management
+:
+{
+ +$clone_cfg && $rep_add $rep/stable && $rep_fetch --trust-yes
+
+ : still-has-deps
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libbar/1.0.0 && $pkg_unpack libbar;
+
+ $* libbar 2>>EOE != 0;
+ error: no configured package satisfies dependency on libfoo
+ EOE
+
+ $pkg_status libbar/1.0.0 1>'unpacked; available';
+ $pkg_fetch libfoo/1.0.0;
+ $pkg_unpack libfoo;
+
+ $* libbar 2>>EOE != 0;
+ error: no configured package satisfies dependency on libfoo
+ EOE
+
+ $* libfoo 2>'configured libfoo/1.0.0';
+ $* libbar 2>'configured libbar/1.0.0';
+
+ $pkg_disfigure libfoo 2>>EOE != 0;
+ error: package libfoo still has dependencies:
+ info: package libbar
+ EOE
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.0.0';
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+
+ $pkg_purge libbar 2>'purged libbar/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+
+ : no-package-satisfy
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libfoo/1.0.0 && $pkg_unpack libfoo;
+
+ $* libfoo 2>'configured libfoo/1.0.0';
+ $pkg_fetch libbar/1.1.0;
+ $pkg_unpack libbar;
+
+ $* libbar 2>>EOE != 0;
+ error: no configured package satisfies dependency on libfoo >= 1.1.0
+ EOE
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0';
+ $pkg_fetch libfoo/1.1.0;
+ $pkg_unpack libfoo;
+ $* libfoo 2>'configured libfoo/1.1.0';
+ $* libbar 2>'configured libbar/1.1.0';
+ $pkg_disfigure libbar 2>'disfigured libbar/1.1.0';
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.1.0'
+ }
+
+ : no-package-satisfy-alt
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libfoo/1.1.0 && $pkg_unpack libfoo;
+
+ $* libfoo 2>'configured libfoo/1.1.0';
+ $pkg_fetch libbar/1.2.0;
+ $pkg_unpack libbar;
+
+ $* libbar 2>>EOE != 0;
+ error: no configured package satisfies dependency on libfox | libfoo >= 1.2.0
+ EOE
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0';
+ $pkg_fetch libfoo/1.2.0;
+ $pkg_unpack libfoo;
+ $* libfoo 2>'configured libfoo/1.2.0';
+ $* libbar 2>'configured libbar/1.2.0';
+
+ $pkg_disfigure libfoo 2>>EOE != 0;
+ error: package libfoo still has dependencies:
+ info: package libbar on libfoo >= 1.2.0
+ EOE
+
+ $pkg_disfigure libbar 2>'disfigured libbar/1.2.0';
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.2.0';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.2.0';
+ $pkg_purge libbar 2>'purged libbar/1.2.0'
+ }
+
+ : incompatible-constraints
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libfoo/1.1.0 && $pkg_unpack libfoo;
+
+ $* libfoo 2>'configured libfoo/1.1.0';
+ $pkg_fetch libbar/1.3.0;
+ $pkg_unpack libbar;
+
+ $* libbar 2>>EOE != 0;
+ error: multiple dependencies on package libfoo
+ info: libfoo <= 1.1.0
+ info: libfoo >= 1.1.0
+ EOE
+
+ $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0';
+ $pkg_purge libbar 2>'purged libbar/1.3.0'
+ }
+}
diff --git a/tests/pkg-configure/hello b/tests/pkg-configure/hello
new file mode 120000
index 0000000..9312ba9
--- /dev/null
+++ b/tests/pkg-configure/hello
@@ -0,0 +1 @@
+../common/hello/ \ No newline at end of file
diff --git a/tests/pkg-configure/libhello-1.0.0 b/tests/pkg-configure/libhello-1.0.0
new file mode 120000
index 0000000..a6f638b
--- /dev/null
+++ b/tests/pkg-configure/libhello-1.0.0
@@ -0,0 +1 @@
+../common/libhello-1.0.0 \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/depend/stable/libbar-1.0.0.tar.gz b/tests/pkg-configure/stable/libbar-1.0.0.tar.gz
index 0ae6e26..0ae6e26 100644
--- a/tests/pkg/1/build2.org/depend/stable/libbar-1.0.0.tar.gz
+++ b/tests/pkg-configure/stable/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/depend/stable/libbar-1.1.0.tar.gz b/tests/pkg-configure/stable/libbar-1.1.0.tar.gz
index 39dbdf4..39dbdf4 100644
--- a/tests/pkg/1/build2.org/depend/stable/libbar-1.1.0.tar.gz
+++ b/tests/pkg-configure/stable/libbar-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/depend/stable/libbar-1.2.0.tar.gz b/tests/pkg-configure/stable/libbar-1.2.0.tar.gz
index 3a034ff..3a034ff 100644
--- a/tests/pkg/1/build2.org/depend/stable/libbar-1.2.0.tar.gz
+++ b/tests/pkg-configure/stable/libbar-1.2.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/depend/stable/libbar-1.3.0.tar.gz b/tests/pkg-configure/stable/libbar-1.3.0.tar.gz
index 19d5a6f..19d5a6f 100644
--- a/tests/pkg/1/build2.org/depend/stable/libbar-1.3.0.tar.gz
+++ b/tests/pkg-configure/stable/libbar-1.3.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz b/tests/pkg-configure/stable/libfoo-1.0.0.tar.gz
index 28a6a90..28a6a90 100644
--- a/tests/pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
+++ b/tests/pkg-configure/stable/libfoo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0.tar.gz b/tests/pkg-configure/stable/libfoo-1.1.0.tar.gz
index e03481f..e03481f 100644
--- a/tests/pkg/1/build2.org/satisfy/libfoo-1.1.0.tar.gz
+++ b/tests/pkg-configure/stable/libfoo-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/depend/stable/libfoo-1.2.0.tar.gz b/tests/pkg-configure/stable/libfoo-1.2.0.tar.gz
index aad6906..aad6906 100644
--- a/tests/pkg/1/build2.org/depend/stable/libfoo-1.2.0.tar.gz
+++ b/tests/pkg-configure/stable/libfoo-1.2.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/depend/stable/repositories b/tests/pkg-configure/stable/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/depend/stable/repositories
+++ b/tests/pkg-configure/stable/repositories
diff --git a/tests/pkg-drop.test b/tests/pkg-drop.test
new file mode 100644
index 0000000..500d611
--- /dev/null
+++ b/tests/pkg-drop.test
@@ -0,0 +1,448 @@
+# file : tests/pkg-drop.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test config.test remote.test
+
+# Source repository:
+#
+# pkg-drop
+# |-- t4a
+# | |-- libfoo-1.1.0.tar.gz
+# | `-- repositories
+# |-- t4b -> t4a (prerequisite)
+# | |-- libbar-1.1.0.tar.gz -> libfoo == 1.1.0
+# | `-- repositories
+# |-- t4c -> t4b (prerequisite)
+# | |-- libbaz-1.1.0.tar.gz -> libfoo, libbar
+# | |-- libfoo-1.0.0.tar.gz
+# | `-- repositories
+# `-- t4d -> t4c (prerequisite)
+# |-- libbiz-1.0.0.tar.gz -> libfox, libfoo, libbaz
+# |-- libfox-1.0.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ cp -r $src/t4a $out/t4a && $rep_create $out/t4a &$out/t4a/packages
+ cp -r $src/t4b $out/t4b && $rep_create $out/t4b &$out/t4b/packages
+ cp -r $src/t4c $out/t4c && $rep_create $out/t4c &$out/t4c/packages
+ cp -r $src/t4d $out/t4d && $rep_create $out/t4d &$out/t4d/packages
+end
+
+pkg_build += -d cfg --yes 2>-
+pkg_status += -d cfg
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all --trust-yes 2>-
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-drop' for more information
+ EOE
+
+: unknown-package
+:
+$clone_cfg;
+$* libfoo 2>>/EOE != 0
+ error: package libfoo does not exist in configuration cfg/
+ EOE
+
+: unknown-package-ver
+:
+$clone_cfg;
+$* libfoo/1.0.0 2>>~%EOE% != 0
+ %error: package libfoo/1.0.0 does not exist in configuration cfg[/\\]%
+ EOE
+
+: prerequisites-or-dependents
+:
+{
+ +$clone_cfg && $rep_add $rep/t4c && $rep_fetch
+ +$pkg_build libbaz
+
+ test.arguments += --print-only
+
+ : foo-baz-bar
+ :
+ $clone_cfg;
+ $* -y libfoo libbaz libbar >>EOO
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+
+ : dependents
+ :
+ {
+ # Prepare the nested tests to use configuration from the enclosing
+ # 'prerequisites-or-dependents' group scope.
+ #
+ clone_cfg = cp -r $~/../cfg ./
+
+ : unconfirmed
+ :
+ {
+ test.arguments += --yes
+
+ : libfoo
+ :
+ $clone_cfg;
+ $* libfoo 2>>EOE != 0
+ following dependent packages will have to be dropped as well:
+ libbar (requires libfoo)
+ libbaz (requires libbar)
+ error: refusing to drop dependent packages with just --yes
+ info: specify --drop-dependent to confirm
+ EOE
+
+ : libfoo-libbar
+ :
+ $clone_cfg;
+ $* libfoo libbar 2>>EOE != 0
+ following dependent packages will have to be dropped as well:
+ libbaz (requires libbar)
+ error: refusing to drop dependent packages with just --yes
+ info: specify --drop-dependent to confirm
+ EOE
+
+ : libfoo-libbaz
+ :
+ $clone_cfg;
+ $* libfoo libbaz 2>>EOE != 0
+ following dependent packages will have to be dropped as well:
+ libbar (requires libfoo)
+ error: refusing to drop dependent packages with just --yes
+ info: specify --drop-dependent to confirm
+ EOE
+ }
+
+ : confirmed
+ :
+ {
+ test.arguments += --drop-dependent
+
+ : libfoo
+ :
+ $clone_cfg;
+ $* libfoo >>EOO
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+
+ : libfoo-libbaz
+ :
+ $clone_cfg;
+ $* libfoo libbaz >>EOO
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+
+ : libbaz-libfoo
+ :
+ $clone_cfg;
+ $* libbaz libfoo >>EOO
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+ }
+ }
+
+ : prerequisites
+ :
+ {
+ # Prepare the nested tests to use configuration from the enclosing
+ # 'prerequisites-or-dependents' group scope.
+ #
+ clone_cfg = cp -r $~/../cfg ./
+
+ : libbaz
+ :
+ $clone_cfg;
+ $* -y libbaz >>EOO
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+
+ : libbaz-only
+ :
+ $clone_cfg;
+ $* -n libbaz >>EOO
+ drop libbaz
+ EOO
+
+ : libbar-libbaz
+ :
+ $clone_cfg;
+ $* -n libbar libbaz >>EOO
+ drop libbaz
+ drop libbar
+ EOO
+
+ : libbaz-libbar
+ :
+ $clone_cfg;
+ $* -n libbaz libbar >>EOO
+ drop libbaz
+ drop libbar
+ EOO
+
+ : dependencies
+ :
+ : Note that we don't move this test to the prerequisites-and-dependents
+ : group as the configuration repository set would be different.
+ :
+ $clone_cfg;
+ $* -y --drop-dependent libbar >>EOO
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+ }
+
+ # Here we combine the test group teardown and the "actual drop" test.
+ #
+ -$pkg_drop -d cfg --yes libbaz 2>>EOE
+ disfigured libbaz
+ disfigured libbar
+ disfigured libfoo
+ purged libbaz
+ purged libbar
+ purged libfoo
+ EOE
+
+ -$pkg_status libbar/1.1.0 >'unknown'
+ -$pkg_status libbaz/1.1.0 >'available'
+ -$pkg_status libfoo/1.1.0 >'available'
+}
+
+: prerequisites-and-dependents
+:
+{
+ +$clone_cfg && $rep_add $rep/t4d && $rep_fetch
+ +$pkg_build libbiz
+
+ clone_cfg = cp -r ../../cfg ./
+ test.arguments += --print-only
+
+ : drop-prerequisites-no-dependents
+ :
+ {
+ test.arguments += --yes
+
+ : libbiz
+ :
+ $clone_cfg;
+ $* libbiz >>EOO
+ drop libbiz
+ drop libbaz
+ drop libbar
+ drop libfoo
+ drop libfox
+ EOO
+
+ : libfox-libbiz
+ :
+ $clone_cfg;
+ $* libfox libbiz >>EOO
+ drop libbiz
+ drop libfox
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+ }
+
+ : drop-prerequisites
+ :
+ {
+ test.arguments += --yes --drop-dependent
+
+ : libfox
+ :
+ $clone_cfg;
+ $* libfox >>EOO
+ drop libbiz
+ drop libfox
+ drop libbaz
+ drop libbar
+ drop libfoo
+ EOO
+
+ : libbaz
+ :
+ $clone_cfg;
+ $* libbaz >>EOO
+ drop libbiz
+ drop libbaz
+ drop libbar
+ drop libfoo
+ drop libfox
+ EOO
+
+ : libbar
+ :
+ $clone_cfg;
+ $* libbar >>EOO
+ drop libbiz
+ drop libbaz
+ drop libbar
+ drop libfoo
+ drop libfox
+ EOO
+
+ : libfoo
+ :
+ $clone_cfg;
+ $* libfoo >>EOO
+ drop libbiz
+ drop libbaz
+ drop libbar
+ drop libfoo
+ drop libfox
+ EOO
+ }
+
+ : keep-prerequisites
+ {
+ test.arguments += --no --drop-dependent
+
+ : fox-baz
+ :
+ $clone_cfg;
+ $* libfox libbaz >>EOO
+ drop libbiz
+ drop libfox
+ drop libbaz
+ EOO
+
+ : libbaz-libfox
+ :
+ $clone_cfg;
+ $* libbaz libfox >>EOO
+ drop libbiz
+ drop libbaz
+ drop libfox
+ EOO
+
+ : libfox-libbar
+ :
+ $clone_cfg;
+ $* libfox libbar >>EOO
+ drop libbiz
+ drop libfox
+ drop libbaz
+ drop libbar
+ EOO
+
+ : libbar-libfox
+ :
+ $clone_cfg;
+ $* libbar libfox >>EOO
+ drop libbiz
+ drop libbaz
+ drop libbar
+ drop libfox
+ EOO
+ }
+
+ -$pkg_drop -d cfg --yes --drop-dependent libbar 2>>EOE
+ disfigured libbiz
+ disfigured libbaz
+ disfigured libbar
+ disfigured libfoo
+ disfigured libfox
+ purged libbiz
+ purged libbaz
+ purged libbar
+ purged libfoo
+ purged libfox
+ EOE
+
+ -$pkg_status libfox/1.0.0 >'available'
+ -$pkg_status libfoo/1.1.0 >'unknown'
+ -$pkg_status libbar/1.1.0 >'unknown'
+ -$pkg_status libbaz/1.1.0 >'unknown'
+ -$pkg_status libbiz/1.0.0 >'available'
+}
+
+: keep-drop-options
+:
+: Test --drop-dependent, --keep-dependent, --drop-prerequisite,
+: --keep-prerequisite option.
+:
+{
+ +$clone_cfg && $rep_add $rep/t4b && $rep_fetch
+
+ : keep-drop-dependent
+ :
+ {
+ $clone_cfg && $pkg_build libbar;
+
+ $* --keep-dependent libfoo 2>>EOE != 0;
+ error: following dependent packages will have to be dropped as well:
+ libbar (requires libfoo)
+ EOE
+
+ $* --drop-dependent libfoo 2>>EOE
+ disfigured libbar
+ disfigured libfoo
+ purged libbar
+ purged libfoo
+ EOE
+ }
+
+ : drop-prerequisite
+ :
+ {
+ $clone_cfg && $pkg_build libbar;
+
+ $* --drop-prerequisite libbar 2>>EOE
+ disfigured libbar
+ disfigured libfoo
+ purged libbar
+ purged libfoo
+ EOE
+ }
+
+ : keep-prerequisite
+ :
+ {
+ $clone_cfg && $pkg_build libbar;
+
+ $* --keep-prerequisite libbar 2>>EOE;
+ disfigured libbar
+ purged libbar
+ EOE
+
+ $pkg_status libfoo >'configured 1.1.0';
+
+ $* libfoo 2>>EOE
+ disfigured libfoo
+ purged libfoo
+ EOE
+ }
+}
+
+: disfigure-only
+:
+: Test --disfigure-only option.
+:
+{
+ $clone_cfg && $rep_add $rep/t4a && $rep_fetch;
+ $pkg_build libfoo;
+
+ $* --disfigure-only libfoo 2>'disfigured libfoo';
+ $pkg_status libfoo >'unpacked 1.1.0 hold_package; available sys:?';
+
+ $* libfoo 2>'purged libfoo'
+}
diff --git a/tests/pkg-drop/t4a b/tests/pkg-drop/t4a
new file mode 120000
index 0000000..47997b2
--- /dev/null
+++ b/tests/pkg-drop/t4a
@@ -0,0 +1 @@
+../common/satisfy/t4a \ No newline at end of file
diff --git a/tests/pkg-drop/t4b b/tests/pkg-drop/t4b
new file mode 120000
index 0000000..917299c
--- /dev/null
+++ b/tests/pkg-drop/t4b
@@ -0,0 +1 @@
+../common/satisfy/t4b \ No newline at end of file
diff --git a/tests/pkg-drop/t4c b/tests/pkg-drop/t4c
new file mode 120000
index 0000000..06b7611
--- /dev/null
+++ b/tests/pkg-drop/t4c
@@ -0,0 +1 @@
+../common/satisfy/t4c \ No newline at end of file
diff --git a/tests/pkg-drop/t4d b/tests/pkg-drop/t4d
new file mode 120000
index 0000000..56dc0f7
--- /dev/null
+++ b/tests/pkg-drop/t4d
@@ -0,0 +1 @@
+../common/satisfy/t4d \ No newline at end of file
diff --git a/tests/pkg-fetch.test b/tests/pkg-fetch.test
new file mode 100644
index 0000000..6689d3d
--- /dev/null
+++ b/tests/pkg-fetch.test
@@ -0,0 +1,200 @@
+# file : tests/pkg-fetch.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# Source repository:
+#
+# pkg-fetch
+# |-- hello
+# | |-- libhello-1.0.0.tar.gz
+# | `-- repositories
+# `-- t1
+# |-- libfoo-1.0.0.tar.gz
+# |-- libfoo-1.1.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories
+ $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature
+
+ # Create the 't1' repository.
+ #
+ cp -r $src/t1 $out/t1 && $rep_create $out/t1 &$out/t1/packages
+end
+
+pkg_purge += -d cfg
+pkg_status += -d cfg
+pkg_unpack += -d cfg
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all 2>-
+
+: no-archive
+:
+$clone_cfg;
+$* -e 2>>EOE != 0
+ error: archive path argument expected
+ info: run 'bpkg help pkg-fetch' for more information
+ EOE
+
+: archive-not-exist
+:
+$clone_cfg;
+$* -e ./no-such-file 2>>/EOE != 0
+ error: archive file './no-such-file' does not exist
+ EOE
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name/version argument expected
+ info: run 'bpkg help pkg-fetch' for more information
+ EOE
+
+: no-version
+:
+$clone_cfg;
+$* libfoo 2>>EOE != 0
+ error: package version expected
+ info: run 'bpkg help pkg-fetch' for more information
+ EOE
+
+: invalid-version
+:
+$clone_cfg;
+$* libfoo/1/2/3 2>>EOE != 0
+ error: invalid package version '1/2/3': alpha-numeric characters expected in a component
+ EOE
+
+: no-repositories
+:
+$clone_cfg;
+$* libfoo/1.0.0 2>>/EOE != 0
+ error: configuration cfg/ has no repositories
+ info: use 'bpkg rep-add' to add a repository
+ EOE
+
+: no-packages
+:
+{
+ $clone_cfg && $rep_add $rep/t1;
+
+ $* libfoo/1.0.0 2>>/EOE != 0
+ error: configuration cfg/ has no available packages
+ info: use 'bpkg rep-fetch' to fetch available packages list
+ EOE
+}
+
+# Note that when we fetch a package from remote repository the bpkg stderr
+# contains fetch program progress output, that comes prior the informational
+# message.
+#
+
+: fetched-rep
+:
+{
+ +$clone_cfg && $rep_add $rep/t1 && $rep_fetch --trust-yes
+
+ : package-not-available
+ :
+ $clone_cfg;
+ $* libfoo/2.0.0+1 2>>/EOE != 0
+ error: package libfoo 2.0.0+1 is not available
+ EOE
+
+ : package-available
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo/1.0.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.0.0%
+ EOE
+
+ $pkg_status libfoo/1.0.0 1>'fetched; available';
+
+ $* libfoo/1.0.0 2>>/EOE != 0;
+ error: package libfoo already exists in configuration cfg/
+ info: version: 1.0.0, state: fetched, substate: none
+ info: use 'pkg-fetch --replace|-r' to replace
+ EOE
+
+ $* -e $src/t1/libfoo-1.0.0.tar.gz 2>>/EOE != 0;
+ error: package libfoo already exists in configuration cfg/
+ info: version: 1.0.0, state: fetched, substate: none
+ info: use 'pkg-fetch --replace|-r' to replace
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+
+ : package-replace
+ :
+ {
+ $clone_cfg;
+
+ $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'fetched libfoo/1.0.0';
+ $pkg_status libfoo/1.0.0 1>'fetched; available';
+ $pkg_unpack libfoo 2>'unpacked libfoo/1.0.0';
+
+ test.arguments += --replace; # Replace existing package.
+
+ $* libfoo/1.1.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.1.0%
+ EOE
+
+ $pkg_status libfoo/1.1.0 1>'fetched; available';
+ $pkg_unpack libfoo 2>'unpacked libfoo/1.1.0';
+ $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'fetched libfoo/1.0.0';
+ $pkg_status libfoo/1.0.0 1>'fetched; available';
+
+ $* libfoo/1.1.0 2>>~%EOE%;
+ %.*
+ %.*fetched libfoo/1.1.0%
+ EOE
+
+ $pkg_status libfoo/1.1.0 1>'fetched; available';
+ $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'fetched libfoo/1.0.0';
+ $pkg_status libfoo/1.0.0 1>'fetched; available';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+
+ : purge-existing
+ :
+ {
+ $clone_cfg;
+ cp $src/t1/libfoo-1.0.0.tar.gz ./ &!libfoo-1.0.0.tar.gz;
+
+ $* -p -e libfoo-1.0.0.tar.gz 2>'fetched libfoo/1.0.0';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+}
+
+: hello
+:
+{
+ $clone_cfg;
+ $rep_add $rep/hello && $rep_fetch --trust $cert_fp &cfg/.bpkg/certs/***;
+
+ $* libhello/1.0.0 2>>~%EOE%;
+ %.*
+ %.*fetched libhello/1.0.0%
+ EOE
+
+ $pkg_status libhello/1.0.0 1>'fetched; available';
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+}
diff --git a/tests/pkg-fetch/hello b/tests/pkg-fetch/hello
new file mode 120000
index 0000000..e10a7f8
--- /dev/null
+++ b/tests/pkg-fetch/hello
@@ -0,0 +1 @@
+../common/hello \ No newline at end of file
diff --git a/tests/pkg-fetch/t1 b/tests/pkg-fetch/t1
new file mode 120000
index 0000000..a27d298
--- /dev/null
+++ b/tests/pkg-fetch/t1
@@ -0,0 +1 @@
+../common/t1 \ No newline at end of file
diff --git a/tests/pkg-purge.test b/tests/pkg-purge.test
new file mode 100644
index 0000000..0f7b256
--- /dev/null
+++ b/tests/pkg-purge.test
@@ -0,0 +1,182 @@
+# file : tests/pkg-purge.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test config.test
+
+# Source repository:
+#
+# pkg-purge
+# |-- libfoo-1.0.0.tar.gz
+# `-- libfoo-1.1.0 ->
+# |-- build
+# | `-- bootstrap.build
+# |-- buildfile
+# `-- manifest
+
+pkg_fetch += -d cfg 2>-
+pkg_unpack += -d cfg 2>-
+pkg_status += -d cfg
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-purge' for more information
+ EOE
+
+: no-package
+:
+$clone_cfg;
+$* libfoo 2>>/EOE != 0
+ error: package libfoo does not exist in configuration cfg/
+ EOE
+
+: fetched
+:
+{
+ $clone_cfg && $pkg_fetch -e $src/libfoo-1.0.0.tar.gz;
+
+ $* libfoo 2>'purged libfoo/1.0.0';
+ $pkg_status libfoo 1>'unknown'
+}
+
+: keep
+:
+{
+ $clone_cfg && $pkg_fetch -e $src/libfoo-1.0.0.tar.gz;
+
+ $* -k libfoo 2>'keeping archive libfoo/1.0.0';
+ $pkg_status libfoo 1>'fetched 1.0.0';
+ $* libfoo 2>'purged libfoo/1.0.0'
+}
+
+: purge-archive
+:
+{
+ $clone_cfg;
+ cp $src/libfoo-1.0.0.tar.gz cfg/ &!cfg/libfoo-1.0.0.tar.gz;
+ $pkg_fetch -e -p cfg/libfoo-1.0.0.tar.gz;
+
+ $* libfoo 2>'purged libfoo/1.0.0';
+ $pkg_status libfoo 1>'unknown';
+ test -f cfg/libfoo-1.0.0.tar.gz == 1
+}
+
+: no-archive-keep
+:
+{
+ $clone_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
+
+ $* --keep libfoo 2>>EOE != 0;
+ error: package libfoo has no archive to keep
+ EOE
+
+ $pkg_status libfoo 1>'unpacked 1.1.0';
+ $* libfoo 2>'purged libfoo/1.1.0'
+}
+
+: unpacked-dir
+:
+{
+ $clone_cfg && $pkg_unpack -e $src/libfoo-1.1.0;
+
+ $* libfoo 2>'purged libfoo/1.1.0';
+ $pkg_status libfoo 1>'unknown'
+}
+
+: unpacked-archive
+:
+{
+ $clone_cfg;
+ $pkg_fetch -e $src/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
+
+ $* libfoo 2>'purged libfoo/1.0.0';
+ $pkg_status libfoo 1>'unknown';
+ test -d cfg/libfoo-1.0.0 == 1
+}
+
+: keep-unpacked-archive
+:
+{
+ $clone_cfg;
+ $pkg_fetch -e $src/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
+
+ $* --keep libfoo 2>'keeping archive libfoo/1.0.0';
+ $pkg_status libfoo 1>'fetched 1.0.0';
+ test -d cfg/libfoo-1.0.0 == 1;
+ $* libfoo 2>'purged libfoo/1.0.0';
+ $pkg_status libfoo 1>'unknown'
+}
+
+: purge-dir
+:
+{
+ $clone_cfg;
+
+ # @@ Use --no-cleanup for cp builtin when implemented.
+ #
+ d = &!cfg/libfoo-1.1.0/;
+ c = $d/ $d/build/ $d/build/bootstrap.build $d/buildfile $d/manifest;
+ cp -r $src/libfoo-1.1.0 cfg/ $c;
+
+ $pkg_unpack -e -p cfg/libfoo-1.1.0;
+
+ $* libfoo 2>'purged libfoo/1.1.0';
+ $pkg_status libfoo 1>'unknown';
+ test -d cfg/libfoo-1.1.0 == 1
+}
+
+: purge-unpacked-archive
+:
+{
+ $clone_cfg;
+ cp $src/libfoo-1.0.0.tar.gz cfg/ &!cfg/libfoo-1.0.0.tar.gz;
+ $pkg_fetch -e -p cfg/libfoo-1.0.0.tar.gz && $pkg_unpack libfoo;
+
+ $* libfoo 2>'purged libfoo/1.0.0';
+ $pkg_status libfoo 1>'unknown';
+ test -d cfg/libfoo-1.0.0 == 1;
+ test -f cfg/libfoo-1.0.0.tar.gz == 1
+}
+
+: broken
+:
+if ($cxx.target.class != 'windows')
+{
+ $clone_cfg;
+ cp $src/libfoo-1.0.0.tar.gz cfg/ &!cfg/libfoo-1.0.0.tar.gz;
+ $pkg_fetch -e -p cfg/libfoo-1.0.0.tar.gz;
+ $pkg_unpack libfoo;
+ chmod 000 cfg/libfoo-1.0.0;
+
+ $* libfoo 2>>/~%EOE% != 0;
+ %error: unable to remove directory cfg/libfoo-1.0.0/.+%
+ info: package libfoo is now broken; use 'pkg-purge --force' to remove
+ EOE
+
+ $pkg_status libfoo/1.0.0 >'broken';
+
+ $* -f -k libfoo 2>'error: cannot keep broken package libfoo' != 0;
+ $pkg_status libfoo/1.0.0 >'broken';
+
+ $* -f libfoo 2>>/EOE != 0;
+ error: source directory of broken package libfoo still exists
+ info: remove cfg/libfoo-1.0.0/ manually then re-run pkg-purge
+ EOE
+
+ $pkg_status libfoo/1.0.0 >'broken';
+
+ chmod 755 cfg/libfoo-1.0.0;
+ rm -r cfg/libfoo-1.0.0;
+
+ $* -f libfoo 2>>/EOE != 0;
+ error: archive file of broken package libfoo still exists
+ info: remove cfg/libfoo-1.0.0.tar.gz manually then re-run pkg-purge
+ EOE
+
+ rm cfg/libfoo-1.0.0.tar.gz;
+ $* -f libfoo 2>'purged libfoo/1.0.0';
+ $pkg_status libfoo >'unknown'
+}
diff --git a/tests/pkg-purge/libfoo-1.0.0.tar.gz b/tests/pkg-purge/libfoo-1.0.0.tar.gz
new file mode 120000
index 0000000..85fcfba
--- /dev/null
+++ b/tests/pkg-purge/libfoo-1.0.0.tar.gz
@@ -0,0 +1 @@
+../common/t1/libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg-purge/libfoo-1.1.0 b/tests/pkg-purge/libfoo-1.1.0
new file mode 120000
index 0000000..15fcf5c
--- /dev/null
+++ b/tests/pkg-purge/libfoo-1.1.0
@@ -0,0 +1 @@
+../common/libfoo-1.1.0 \ No newline at end of file
diff --git a/tests/pkg-status.test b/tests/pkg-status.test
new file mode 100644
index 0000000..ff7cab7
--- /dev/null
+++ b/tests/pkg-status.test
@@ -0,0 +1,160 @@
+# file : tests/pkg-status.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test config.test remote.test
+
+# Source repository:
+#
+# pkg-status
+# |-- extra -> stable (prerequisite)
+# | |-- libbar-1.1.0+1.tar.gz
+# | `-- repositories
+# |-- stable
+# | |-- libbar-1.0.0.tar.gz
+# | |-- libfoo-1.0.0.tar.gz
+# | `-- repositories
+# |-- testing -> stable (complement), extra (prerequisite)
+# | |-- libbar-1.0.0+1.tar.gz
+# | |-- libbar-1.1.0.tar.gz
+# | `-- repositories
+# `-- unstable -> testing (complement)
+# |-- libbar-2.0.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ c = $rep_create 2>-
+
+ cp -r $src/extra $out/extra && $c $out/extra &$out/extra/packages
+ cp -r $src/stable $out/stable && $c $out/stable &$out/stable/packages
+ cp -r $src/testing $out/testing && $c $out/testing &$out/testing/packages
+ cp -r $src/unstable $out/unstable && $c $out/unstable &$out/unstable/packages
+end
+
+pkg_fetch += 2>-
+pkg_purge += -d cfg 2>-
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all --trust-yes 2>-
+
+: basics
+:
+{
+ +$clone_cfg
+
+ : not-fetched
+ :
+ {
+ +$clone_cfg
+
+ : libfoo-1.0.0
+ :
+ $clone_cfg;
+ $* libfoo/1.0.0 >'unknown'
+
+ : libfoo
+ :
+ $clone_cfg;
+ $* libfoo >'unknown'
+ }
+
+ : rep-fetched
+ :
+ {
+ +$clone_cfg && $rep_add $rep/stable && $rep_fetch
+
+ +cp -r cfg ./fetched
+ +$pkg_fetch libfoo/1.0.0 -d fetched &fetched/libfoo-1.0.0.tar.gz
+
+ : libfoo-1.0.0
+ :
+ $clone_cfg;
+ $* libfoo/1.0.0 >'available'
+
+ : libfoo
+ :
+ $clone_cfg;
+ $* libfoo >'available 1.0.0 sys:?'
+
+ : pkg-fetched
+ :
+ {
+ clone_cfg = cp -r ../../fetched cfg
+
+ : libfoo-1.0.0
+ :
+ $clone_cfg;
+ $* libfoo/1.0.0 >'fetched; available'
+
+ : libfoo
+ :
+ $clone_cfg;
+ $* libfoo >'fetched 1.0.0; available sys:?'
+ }
+ }
+}
+
+: multiple-versions
+{
+ # Prepare the nested tests to copy the root configuration. Note that they
+ # must provide the destination directory name as an argument.
+ #
+ clone_cfg = cp -r $~/../cfg
+
+ : extra
+ :
+ {
+ # Here we, first, prepare 2 configurations that derive from each other, and
+ # then spawn 2 tests on them.
+ #
+ +$clone_cfg extra && $rep_add -d extra $rep/extra && $rep_fetch -d extra
+
+ +cp -r extra extra-stable
+ +$rep_add -d extra-stable $rep/stable && $rep_fetch -d extra-stable
+
+ : libbar
+ :
+ $* -d ../extra libbar >'available 1.1.0+1 sys:?'
+
+ : libbar-stable
+ :
+ $* -d ../extra-stable libbar >'available 1.1.0+1 1.0.0 sys:?'
+ }
+
+ : testing
+ :
+ {
+ $clone_cfg ./ && $rep_add $rep/testing && $rep_fetch;
+
+ $* libbar >'available 1.1.0 1.0.0+1 1.0.0 sys:?'
+ }
+
+ : unstable
+ :
+ {
+ # Here we, first, prepare 3 configurations that derive from each other, and
+ # then spawn 3 tests on them.
+ #
+ +$clone_cfg ./ && $rep_add $rep/unstable && $rep_fetch
+
+ +cp -r cfg fetched1
+ +$pkg_fetch libbar/1.0.0+1 -d fetched1 &fetched1/libbar-1.0.0+1.tar.gz
+
+ +cp -r fetched1 fetched2
+ +$pkg_purge -d fetched2 libbar &!fetched2/libbar-1.0.0+1.tar.gz
+ +$pkg_fetch libbar/2.0.0 -d fetched2 &fetched2/libbar-2.0.0.tar.gz
+
+ : not-fetched
+ :
+ $* -d ../cfg libbar >'available 2.0.0 1.1.0 1.0.0+1 1.0.0 sys:?'
+
+ : fetched-1
+ :
+ $* -d ../fetched1 libbar >'fetched 1.0.0+1; available 2.0.0 1.1.0 sys:?'
+
+ : fetched-2
+ :
+ $* -d ../fetched2 libbar >'fetched 2.0.0; available sys:?'
+ }
+}
diff --git a/tests/pkg/1/build2.org/status/extra/libbar-1.1.0+1.tar.gz b/tests/pkg-status/extra/libbar-1.1.0+1.tar.gz
index 890e9e2..890e9e2 100644
--- a/tests/pkg/1/build2.org/status/extra/libbar-1.1.0+1.tar.gz
+++ b/tests/pkg-status/extra/libbar-1.1.0+1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/status/extra/repositories b/tests/pkg-status/extra/repositories
index ecaa454..ecaa454 100644
--- a/tests/pkg/1/build2.org/status/extra/repositories
+++ b/tests/pkg-status/extra/repositories
diff --git a/tests/pkg/1/build2.org/status/stable/libbar-1.0.0.tar.gz b/tests/pkg-status/stable/libbar-1.0.0.tar.gz
index 97e6e32..97e6e32 100644
--- a/tests/pkg/1/build2.org/status/stable/libbar-1.0.0.tar.gz
+++ b/tests/pkg-status/stable/libbar-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/status/stable/libfoo-1.0.0.tar.gz b/tests/pkg-status/stable/libfoo-1.0.0.tar.gz
index 5e7fa17..5e7fa17 100644
--- a/tests/pkg/1/build2.org/status/stable/libfoo-1.0.0.tar.gz
+++ b/tests/pkg-status/stable/libfoo-1.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/fetch/repositories b/tests/pkg-status/stable/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/fetch/repositories
+++ b/tests/pkg-status/stable/repositories
diff --git a/tests/pkg/1/build2.org/status/testing/libbar-1.0.0+1.tar.gz b/tests/pkg-status/testing/libbar-1.0.0+1.tar.gz
index 5794085..5794085 100644
--- a/tests/pkg/1/build2.org/status/testing/libbar-1.0.0+1.tar.gz
+++ b/tests/pkg-status/testing/libbar-1.0.0+1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/status/testing/libbar-1.1.0.tar.gz b/tests/pkg-status/testing/libbar-1.1.0.tar.gz
index b01ac44..b01ac44 100644
--- a/tests/pkg/1/build2.org/status/testing/libbar-1.1.0.tar.gz
+++ b/tests/pkg-status/testing/libbar-1.1.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/status/testing/repositories b/tests/pkg-status/testing/repositories
index 7bd7269..7bd7269 100644
--- a/tests/pkg/1/build2.org/status/testing/repositories
+++ b/tests/pkg-status/testing/repositories
diff --git a/tests/pkg/1/build2.org/status/unstable/libbar-2.0.0.tar.gz b/tests/pkg-status/unstable/libbar-2.0.0.tar.gz
index 6cc5890..6cc5890 100644
--- a/tests/pkg/1/build2.org/status/unstable/libbar-2.0.0.tar.gz
+++ b/tests/pkg-status/unstable/libbar-2.0.0.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/status/unstable/repositories b/tests/pkg-status/unstable/repositories
index 8f4a5f6..8f4a5f6 100644
--- a/tests/pkg/1/build2.org/status/unstable/repositories
+++ b/tests/pkg-status/unstable/repositories
diff --git a/tests/pkg-system.test b/tests/pkg-system.test
new file mode 100644
index 0000000..e8210f6
--- /dev/null
+++ b/tests/pkg-system.test
@@ -0,0 +1,873 @@
+# file : tests/pkg-system.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# There is no pkg-system command, and this testscript contains tests for
+# various building scenarios that involves system packages. Note that by that
+# reason usage of $* is meaningless.
+#
+
+# Source repository:
+#
+# pkg-system
+# |-- foo-2.tar.gz -> libbar >= 2
+# |-- libbar-0+1.tar.gz
+# |-- libbar-1.tar.gz -> libbaz == 2
+# |-- libbar-2.tar.gz -> libbaz == 2
+# |-- libbaz-2.tar.gz
+# |-- t1
+# | |-- foo-2.tar.gz -> libbar >= 2
+# | |-- libbar-1.tar.gz -> libbaz == 2
+# | |-- libbar-2.tar.gz -> libbaz == 2
+# | |-- libbaz-2.tar.gz
+# | `-- repositories
+# |-- t2
+# | |-- foo-2.tar.gz -> libbar >= 2
+# | |-- libbar-0+1.tar.gz
+# | `-- repositories
+# `-- t3 -> t2 (prerequisite)
+# |-- foo-2.tar.gz -> libbar >= 2
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ cp -r $src/t1 $out/t1 && $rep_create $out/t1 &$out/t1/packages
+ cp -r $src/t2 $out/t2 && $rep_create $out/t2 &$out/t2/packages
+ cp -r $src/t3 $out/t3 && $rep_create $out/t3 &$out/t3/packages
+end
+
+pkg_build += -d cfg --yes
+pkg_drop += -d cfg --yes 2>-
+pkg_status += -d cfg
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all --trust-yes 2>-
+
+# Note that when we fetch a package from remote repository the bpkg stderr
+# contains fetch program progress output, that comes prior the informational
+# message.
+#
+
+: t1
+:
+{
+ +$clone_cfg && $rep_add $rep/t1 && $rep_fetch
+
+ : dup
+ :
+ : Test that passing package duplicates on the command line expectedly fails.
+ : Note that we unite all such tests into a single one for the sake of code
+ : (and not to think of too many ids for almost identical tests :-)).
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build 'sys:libbar' '?sys:libbar' 2>>EOE != 0;
+ error: duplicate package libbar
+ info: first mentioned as ?sys:libbar
+ info: second mentioned as sys:libbar
+ EOE
+
+ $pkg_build '?sys:libbar' 'sys:libbar' 2>>EOE != 0;
+ error: duplicate package libbar
+ info: first mentioned as ?sys:libbar
+ info: second mentioned as sys:libbar
+ EOE
+
+ $pkg_build '?sys:libbar' libbar 2>>EOE != 0;
+ error: duplicate package libbar
+ info: first mentioned as ?sys:libbar
+ info: second mentioned as libbar
+ EOE
+
+ $pkg_build libbar '?sys:libbar' 2>>EOE != 0;
+ error: duplicate package libbar
+ info: first mentioned as ?sys:libbar
+ info: second mentioned as libbar
+ EOE
+
+ $pkg_build 'sys:libbar' libbar 2>>EOE != 0;
+ error: duplicate package libbar
+ info: first mentioned as sys:libbar
+ info: second mentioned as libbar
+ EOE
+
+ $pkg_build libbar 'sys:libbar' 2>>EOE != 0
+ error: duplicate package libbar
+ info: first mentioned as libbar
+ info: second mentioned as sys:libbar
+ EOE
+ }
+
+ : syslibbar-foo-syslibbar2-libbar2
+ :
+ : The overall plan is to build sys:libbar/*, foo, then reconfigure
+ : sys:libbar/* to sys:libbar/2 and afterwards to libbar/2.
+ :
+ {
+ $clone_cfg;
+
+ # Build sys:libbar/*.
+ #
+ $pkg_build 'sys:libbar' 2>'configured sys:libbar/*';
+ $pkg_status libbar 1>'configured,system * hold_package hold_version; available 2 1 sys:?';
+ $pkg_status libbaz 1>'available 2 sys:?';
+
+ # Build foo with preconfigured sys:libbar/*.
+ #
+ $pkg_build foo 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system * hold_package hold_version; available 2 1 sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ # Reconfigure sys:libbar/* to 2.
+ #
+ $pkg_build 'sys:libbar/2' 2>>~%EOE%;
+ disfigured foo/2
+ purged libbar/*
+ configured sys:libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ # Reconfigure sys:libbar/2 to libbar/2.
+ #
+ $pkg_build libbar/2 2>>~%EOE%;
+ disfigured foo/2
+ purged libbar/2
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/2%
+ unpacked libbar/2
+ configured libbaz/2
+ configured libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ %info: .+ is up to date%
+ updated libbar/2
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : foo-syslibbar2
+ :
+ : Build foo and sys:libbar/2.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build foo 'sys:libbar/2' 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : syslibbar2-foo
+ :
+ : Build sys:libbar/2 and foo.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build 'sys:libbar/2' foo 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : libbar2-foo-syslibbar2
+ :
+ : The overall plan is to build libbar/2, then foo and sys:libbar/2.
+ :
+ {
+ $clone_cfg;
+
+ # Build libbar/2.
+ #
+ $pkg_build libbar/2 2>>~%EOE%;
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/2%
+ unpacked libbar/2
+ configured libbaz/2
+ configured libbar/2
+ %info: .+ is up to date%
+ updated libbar/2
+ EOE
+
+ $pkg_status libbar >'configured 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ # Build foo and sys:libbar/2.
+ #
+ $pkg_build foo 'sys:libbar/2' 2>>~%EOE%;
+ disfigured libbar/2
+ purged libbar/2
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ disfigured libbaz
+ purged libbaz
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : libbar2-foo-syslibbar
+ :
+ : The overall plan is to build libbar/2, then foo and sys:libbar.
+ :
+ {
+ $clone_cfg;
+
+ # Build libbar/2.
+ #
+ $pkg_build libbar/2 2>>~%EOE%;
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/2%
+ unpacked libbar/2
+ configured libbaz/2
+ configured libbar/2
+ %info: .+ is up to date%
+ updated libbar/2
+ EOE
+
+ $pkg_status libbar >'configured 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ # Build foo and sys:libbar.
+ #
+ $pkg_build foo 'sys:libbar' 2>>~%EOE%;
+ disfigured libbar/2
+ purged libbar/2
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/*
+ configured foo/2
+ disfigured libbaz
+ purged libbaz
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system * hold_package hold_version; available 2 1 sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : syslibbar2-foo-libbar2-syslibbar2-libbar2
+ :
+ : The overall plan is to build sys:libbar/2, then foo and libbar/2, then
+ : reconfigure to sys:libbar/2 and afterwards to libbar/2.
+ :
+ {
+ $clone_cfg;
+
+ # Build sys:libbar/2.
+ #
+ $pkg_build 'sys:libbar/2' 2>'configured sys:libbar/2';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+
+ # Build foo and libbar/2.
+ #
+ $pkg_build foo libbar/2 2>>~%EOE%;
+ purged libbar/2
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/2%
+ unpacked libbar/2
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured libbaz/2
+ configured libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ %info: .+ is up to date%
+ updated libbar/2
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ # Build sys:libbar/2.
+ #
+ $pkg_build 'sys:libbar/2' 2>>~%EOE%;
+ disfigured foo/2
+ disfigured libbar/2
+ purged libbar/2
+ configured sys:libbar/2
+ configured foo/2
+ disfigured libbaz
+ purged libbaz
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ # Build libbar/2.
+ #
+ $pkg_build libbar/2 2>>~%EOE%;
+ disfigured foo/2
+ purged libbar/2
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/2%
+ unpacked libbar/2
+ configured libbaz/2
+ configured libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ %info: .+ is up to date%
+ updated libbar/2
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : syslibbar1-foo-libbar
+ :
+ : The overall plan is to configure sys:libbar/1, then fail to build foo but
+ : succeed to build foo libbar.
+ :
+ {
+ $clone_cfg;
+
+ # Build sys:libbar/1.
+ #
+ $pkg_build 'sys:libbar/1' 2>'configured sys:libbar/1';
+ $pkg_status libbar 1>'configured,system 1 hold_package hold_version; available 2 sys:?';
+ $pkg_status libbaz 1>'available 2 sys:?';
+
+ # Fail to build foo.
+ #
+ $pkg_build foo 2>>EOE != 0;
+ error: package foo dependency on (libbar >= 2) is forcing upgrade of sys:libbar/1 to libbar/2
+ info: package version sys:libbar/1 is held
+ info: explicitly request version upgrade to continue
+ info: while satisfying foo/2
+ EOE
+
+ # Build foo and libbar.
+ #
+ $pkg_build foo libbar 2>>~%EOE%;
+ purged libbar/1
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/2%
+ unpacked libbar/2
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured libbaz/2
+ configured libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ %info: .+ is up to date%
+ updated libbar/2
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured 2 hold_package; available sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : foo-syslibbar
+ :
+ : Build foo and ?sys:libbar.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build foo '?sys:libbar' 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/*
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system *; available 2 1 sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : libbar1-foo-syslibbar2
+ :
+ : The overall plan is to configure libbar/1, then fail to build foo but
+ : succeed to build foo ?sys:libbar/2, and then foo sys:libbar/2.
+ :
+ {
+ $clone_cfg;
+
+ # Build libbar/1.
+ #
+ $pkg_build libbar/1 2>>~%EOE%;
+ %.*
+ %.*fetched libbaz/2%
+ unpacked libbaz/2
+ %.*
+ %.*fetched libbar/1%
+ unpacked libbar/1
+ configured libbaz/2
+ configured libbar/1
+ %info: .+ is up to date%
+ updated libbar/1
+ EOE
+
+ $pkg_status libbar >'configured 1 hold_package hold_version; available 2 sys:?';
+ $pkg_status libbaz >'configured 2; available sys:?';
+
+ # Fail to build foo.
+ #
+ $pkg_build foo 2>>EOE != 0;
+ error: package foo dependency on (libbar >= 2) is forcing upgrade of libbar/1 to 2
+ info: package version libbar/1 is held
+ info: explicitly request version upgrade to continue
+ info: while satisfying foo/2
+ EOE
+
+ # Build foo and ?sys:libbar/2.
+ #
+ $pkg_build foo '?sys:libbar/2' 2>>~%EOE%;
+ disfigured libbar/1
+ purged libbar/1
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ disfigured libbaz
+ purged libbaz
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ # Build foo and sys:libbar/2.
+ #
+ $pkg_build foo 'sys:libbar/2' 2>>~%EOE%;
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+ $pkg_status libbaz >'available 2 sys:?';
+
+ $pkg_drop foo libbar
+ }
+}
+
+: t2
+:
+{
+ +$clone_cfg && $rep_add $rep/t2 && $rep_fetch
+
+ : no-libbar
+ :
+ : Test that the following builds expectedly fails having no libbar available
+ : in source.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build foo 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: specify ?sys:libbar if it is available from the system
+ info: while satisfying foo/2
+ EOE
+
+ $pkg_build foo libbar 2>>EOE != 0;
+ error: libbar is not available in source
+ info: specify sys:libbar if it is available from the system
+ EOE
+
+ $pkg_status foo >'available 2 sys:?';
+ $pkg_status libbar >'available sys:?'
+ }
+
+ : foo-syslibbar
+ :
+ : Build foo configuring sys:libbar.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build foo 'sys:libbar' 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/*
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system * hold_package hold_version; available sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : libbar1-foo-syslibbar2
+ :
+ : The overall plan is to configure sys:libbar/1, then fail to build foo, but
+ : succeed to build foo sys:libbar/2.
+ :
+ {
+ $clone_cfg;
+
+ # Build sys:libbar/1.
+ #
+ $pkg_build 'sys:libbar/1' 2>'configured sys:libbar/1';
+ $pkg_status libbar 1>'configured,system 1 hold_package hold_version; available sys:?';
+
+ # Fail to build foo.
+ #
+ $pkg_build foo 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: sys:libbar/1 does not satisfy the constrains
+ info: while satisfying foo/2
+ EOE
+
+ # Build foo and sys:libbar/2.
+ #
+ $pkg_build foo 'sys:libbar/2' 2>>~%EOE%;
+ purged libbar/1
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+
+ $pkg_drop foo libbar
+ }
+
+ : syslibbar2
+ :
+ : The overall plan is to fail to build foo sys:libbar/1, then configure
+ : sys:libbar/2 but still fail to build foo sys:libbar/1.
+ :
+ {
+ $clone_cfg;
+
+ # Fail to build foo and sys:libbar/1.
+ #
+ $pkg_build foo 'sys:libbar/1' 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: sys:libbar/1 does not satisfy the constrains
+ info: while satisfying foo/2
+ EOE
+
+ # Build sys:libbar/2.
+ #
+ $pkg_build 'sys:libbar/2' 2>'configured sys:libbar/2';
+ $pkg_status libbar 1>'configured,system 2 hold_package hold_version; available sys:?';
+
+ # Still fail to build foo and sys:libbar/1.
+ #
+ $pkg_build foo 'sys:libbar/1' 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: sys:libbar/1 does not satisfy the constrains
+ info: while satisfying foo/2
+ EOE
+
+ $pkg_drop libbar
+ }
+
+ : syslibbar1
+ :
+ : The overall plan is to configure sys:libbar/1, then fail to build
+ : sys:libbar/1.1 foo.
+ :
+ {
+ $clone_cfg;
+
+ # Build sys:libbar/2.
+ #
+ $pkg_build 'sys:libbar/1' 2>'configured sys:libbar/1';
+ $pkg_status libbar 1>'configured,system 1 hold_package hold_version; available sys:?';
+
+ # Fail to build sys:libbar/1.1 and foo.
+ #
+ $pkg_build 'sys:libbar/1.1' foo 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: sys:libbar/1.1 does not satisfy the constrains
+ info: while satisfying foo/2
+ EOE
+
+ $pkg_drop libbar
+ }
+
+ : foo-syslibbar-drop-foo
+ :
+ : The overall plan is to build foo ?sys:libbar, then drop foo and make sure
+ : libbar is purged as well.
+ :
+ {
+ $clone_cfg;
+
+ # Build foo and ?sys:libbar.
+ #
+ $pkg_build foo '?sys:libbar' 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/*
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system *; available sys:?';
+
+ # Drop foo.
+ #
+ $pkg_drop foo 2>>EOE;
+ disfigured foo
+ purged libbar
+ purged foo
+ EOE
+
+ $pkg_status foo >'available 2 sys:?';
+ $pkg_status libbar >'available sys:?'
+ }
+
+ : syslibbar1-foo-syslibbar-drop-foo
+ :
+ : The overall plan is to build sys:libbar/1, then fail to build foo but
+ : succeed to build foo ?sys:libbar, then drop foo and make sure libbar stays.
+ :
+ {
+ $clone_cfg;
+
+ # Build sys:libbar/1.
+ #
+ $pkg_build 'sys:libbar/1' 2>'configured sys:libbar/1';
+ $pkg_status libbar 1>'configured,system 1 hold_package hold_version; available sys:?';
+
+ # Fail to build foo.
+ #
+ $pkg_build foo 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: sys:libbar/1 does not satisfy the constrains
+ info: while satisfying foo/2
+ EOE
+
+ # Build foo and '?sys:libbar/2'.
+ #
+ $pkg_build foo '?sys:libbar/2' 2>>~%EOE%;
+ purged libbar/1
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?';
+
+ # Drop foo.
+ #
+ $pkg_drop foo 2>>EOE;
+ disfigured foo
+ purged foo
+ EOE
+
+ $pkg_status foo >'available 2 sys:?';
+ $pkg_status libbar >'configured,system 2 hold_package hold_version; available sys:?'
+ }
+}
+
+: t3
+:
+{
+ +$clone_cfg && $rep_add $rep/t3 && $rep_fetch
+
+ : no-libbar
+ :
+ : Test that the following builds expectedly fails having no libbar available
+ : in source.
+ :
+ {
+ $clone_cfg;
+
+ $pkg_build foo 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: specify ?sys:libbar if it is available from the system
+ info: while satisfying foo/2
+ EOE
+
+ $pkg_build 'sys:libbar/1' 2>>EOE != 0;
+ error: unknown package libbar
+ EOE
+
+ $pkg_build foo 'sys:libbar/1' 2>>EOE != 0;
+ error: unknown package libbar
+ EOE
+
+ $pkg_build foo '?sys:libbar/1' 2>>EOE != 0;
+ error: prerequisite libbar >= 2 of package foo is not available in source
+ info: sys:libbar/1 does not satisfy the constrains
+ info: while satisfying foo/2
+ EOE
+
+ $pkg_status foo >'available 2 sys:?';
+ $pkg_status libbar >'unknown'
+ }
+
+ : syslibbar1-foo-syslibbar-drop-foo
+ :
+ : The overall plan is to build foo ?sys:libbar/2, fail to build sys:libbar
+ : and foo 'sys:libbar', but succeed to build foo ?sys:libbar/3 and foo
+ : ?sys:libbar.
+ :
+ {
+ $clone_cfg;
+
+ # Build foo '?sys:libbar/2'.
+ #
+ $pkg_build foo '?sys:libbar/2' 2>>~%EOE%;
+ %.*
+ %.*fetched foo/2%
+ unpacked foo/2
+ configured sys:libbar/2
+ configured foo/2
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2';
+
+ # Fail as libbar while being selected is still unknown (not present in t3
+ # repo).
+ #
+ $pkg_build 'sys:libbar' 2>'error: unknown package libbar' != 0;
+ $pkg_build foo 'sys:libbar' 2>'error: unknown package libbar' != 0;
+ $pkg_status foo 1>'configured 2 hold_package; available sys:?';
+ $pkg_status libbar 1>'configured,system 2';
+
+ # Build foo and ?sys:libbar/3. Note that libbar stays as system version 2.
+ #
+ $pkg_build foo '?sys:libbar/3' 2>>~%EOE%;
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2';
+
+ # Build foo and ?sys:libbar.
+ #
+ $pkg_build foo '?sys:libbar' 2>>~%EOE%;
+ %info: .+ is up to date%
+ updated foo/2
+ EOE
+
+ $pkg_status foo >'configured 2 hold_package; available sys:?';
+ $pkg_status libbar >'configured,system 2';
+
+ $pkg_drop foo
+ }
+}
diff --git a/tests/pkg/1/build2.org/system/foo-2.tar.gz b/tests/pkg-system/foo-2.tar.gz
index 7fef159..7fef159 100644
--- a/tests/pkg/1/build2.org/system/foo-2.tar.gz
+++ b/tests/pkg-system/foo-2.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/system/libbar-0+1.tar.gz b/tests/pkg-system/libbar-0+1.tar.gz
index 9f90936..9f90936 100644
--- a/tests/pkg/1/build2.org/system/libbar-0+1.tar.gz
+++ b/tests/pkg-system/libbar-0+1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/system/libbar-1.tar.gz b/tests/pkg-system/libbar-1.tar.gz
index 4b52278..4b52278 100644
--- a/tests/pkg/1/build2.org/system/libbar-1.tar.gz
+++ b/tests/pkg-system/libbar-1.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/system/libbar-2.tar.gz b/tests/pkg-system/libbar-2.tar.gz
index 28ad509..28ad509 100644
--- a/tests/pkg/1/build2.org/system/libbar-2.tar.gz
+++ b/tests/pkg-system/libbar-2.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/system/libbaz-2.tar.gz b/tests/pkg-system/libbaz-2.tar.gz
index 3e9c3e6..3e9c3e6 100644
--- a/tests/pkg/1/build2.org/system/libbaz-2.tar.gz
+++ b/tests/pkg-system/libbaz-2.tar.gz
Binary files differ
diff --git a/tests/pkg/1/build2.org/system/t1/foo-2.tar.gz b/tests/pkg-system/t1/foo-2.tar.gz
index 39d2e10..39d2e10 120000
--- a/tests/pkg/1/build2.org/system/t1/foo-2.tar.gz
+++ b/tests/pkg-system/t1/foo-2.tar.gz
diff --git a/tests/pkg/1/build2.org/system/t1/libbar-1.tar.gz b/tests/pkg-system/t1/libbar-1.tar.gz
index 971bed1..971bed1 120000
--- a/tests/pkg/1/build2.org/system/t1/libbar-1.tar.gz
+++ b/tests/pkg-system/t1/libbar-1.tar.gz
diff --git a/tests/pkg/1/build2.org/system/t1/libbar-2.tar.gz b/tests/pkg-system/t1/libbar-2.tar.gz
index 2c8027b..2c8027b 120000
--- a/tests/pkg/1/build2.org/system/t1/libbar-2.tar.gz
+++ b/tests/pkg-system/t1/libbar-2.tar.gz
diff --git a/tests/pkg/1/build2.org/system/t1/libbaz-2.tar.gz b/tests/pkg-system/t1/libbaz-2.tar.gz
index 111a2e7..111a2e7 120000
--- a/tests/pkg/1/build2.org/system/t1/libbaz-2.tar.gz
+++ b/tests/pkg-system/t1/libbaz-2.tar.gz
diff --git a/tests/pkg/1/build2.org/satisfy/repositories b/tests/pkg-system/t1/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/satisfy/repositories
+++ b/tests/pkg-system/t1/repositories
diff --git a/tests/pkg/1/build2.org/system/t2/foo-2.tar.gz b/tests/pkg-system/t2/foo-2.tar.gz
index 39d2e10..39d2e10 120000
--- a/tests/pkg/1/build2.org/system/t2/foo-2.tar.gz
+++ b/tests/pkg-system/t2/foo-2.tar.gz
diff --git a/tests/pkg/1/build2.org/system/t2/libbar-0+1.tar.gz b/tests/pkg-system/t2/libbar-0+1.tar.gz
index 82bdcba..82bdcba 120000
--- a/tests/pkg/1/build2.org/system/t2/libbar-0+1.tar.gz
+++ b/tests/pkg-system/t2/libbar-0+1.tar.gz
diff --git a/tests/pkg/1/build2.org/status/stable/repositories b/tests/pkg-system/t2/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/status/stable/repositories
+++ b/tests/pkg-system/t2/repositories
diff --git a/tests/pkg/1/build2.org/system/t3/foo-2.tar.gz b/tests/pkg-system/t3/foo-2.tar.gz
index 39d2e10..39d2e10 120000
--- a/tests/pkg/1/build2.org/system/t3/foo-2.tar.gz
+++ b/tests/pkg-system/t3/foo-2.tar.gz
diff --git a/tests/pkg/1/build2.org/system/t3/repositories b/tests/pkg-system/t3/repositories
index 2715634..2715634 100644
--- a/tests/pkg/1/build2.org/system/t3/repositories
+++ b/tests/pkg-system/t3/repositories
diff --git a/tests/pkg-unpack.test b/tests/pkg-unpack.test
new file mode 100644
index 0000000..49faffa
--- /dev/null
+++ b/tests/pkg-unpack.test
@@ -0,0 +1,199 @@
+# file : tests/pkg-unpack.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# Source repository:
+#
+# pkg-unpack
+# |-- hello
+# | |-- libhello-1.0.0.tar.gz
+# | `-- repositories
+# |-- libfoo-1.1.0
+# | |-- build
+# | | `-- bootstrap.build
+# | |-- buildfile
+# | `-- manifest
+# `-- t1
+# |-- libfoo-1.0.0.tar.gz
+# |-- libfoo-1.1.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories
+ $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature
+
+ # Create the 't1' repository.
+ #
+ cp -r $src/t1 $out/t1 && $rep_create $out/t1 &$out/t1/packages
+end
+
+pkg_fetch += -d cfg 2>-
+pkg_purge += -d cfg
+pkg_status += -d cfg
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all 2>-
+
+: replace-with-existing
+:
+$clone_cfg;
+$* -r 2>>EOE != 0
+ error: --replace|-r can only be specified with --existing|-e
+ EOE
+
+: no-dir
+:
+$clone_cfg;
+$* -e 2>>EOE != 0
+ error: package directory argument expected
+ info: run 'bpkg help pkg-unpack' for more information
+ EOE
+
+: not-package-dir
+:
+$clone_cfg;
+$* -e ./ 2>>/EOE != 0
+ error: no manifest file in package directory ./
+ EOE
+
+: dir-not-exist
+:
+$clone_cfg;
+$* -e ./no-such-dir 2>>/EOE != 0
+ error: package directory ./no-such-dir/ does not exist
+ EOE
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-unpack' for more information
+ EOE
+
+: fetched-rep
+:
+{
+ +$clone_cfg && $rep_add $rep/t1 && $rep_fetch --trust-yes
+
+ : package-exists
+ :
+ {
+ $clone_cfg && $pkg_fetch libfoo/1.0.0;
+
+ $* -e $src/libfoo-1.1.0 2>>/EOE != 0;
+ error: package libfoo already exists in configuration cfg/
+ info: version: 1.0.0, state: fetched, substate: none
+ info: use 'pkg-unpack --replace|-r' to replace
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0';
+ $* -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0';
+ $pkg_status libfoo/1.1.0 1>'unpacked; available';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : replace-fetched
+ :
+ {
+ $clone_cfg && $pkg_fetch libfoo/1.0.0;
+
+ $* -e $src/libfoo-1.1.0 2>>/EOE != 0;
+ error: package libfoo already exists in configuration cfg/
+ info: version: 1.0.0, state: fetched, substate: none
+ info: use 'pkg-unpack --replace|-r' to replace
+ EOE
+
+ $* -r -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0';
+ $pkg_status libfoo/1.1.0 1>'unpacked; available';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : replace-unpacked
+ :
+ {
+ $clone_cfg && $pkg_fetch libfoo/1.0.0;
+
+ $* libfoo 2>'unpacked libfoo/1.0.0';
+
+ $* -e $src/libfoo-1.1.0 2>>/EOE != 0;
+ error: package libfoo already exists in configuration cfg/
+ info: version: 1.0.0, state: unpacked, substate: none
+ info: use 'pkg-unpack --replace|-r' to replace
+ EOE
+
+ $* -r -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0';
+ $pkg_status libfoo/1.1.0 1>'unpacked; available';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : wrong-state
+ :
+ {
+ $clone_cfg;
+
+ $* libfoo 2>>/EOE != 0;
+ error: package libfoo does not exist in configuration cfg/
+ EOE
+
+ $* -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0';
+
+ $* libfoo 2>>EOE != 0;
+ error: package libfoo is unpacked
+ info: expected it to be fetched
+ EOE
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+
+ : right-state
+ :
+ {
+ $clone_cfg && $pkg_fetch libfoo/1.0.0;
+
+ $pkg_status libfoo/1.0.0 1>'fetched; available';
+ $* libfoo 2>'unpacked libfoo/1.0.0';
+ $pkg_status libfoo/1.0.0 1>'unpacked; available';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.0.0'
+ }
+
+ : purge-existing
+ :
+ {
+ $clone_cfg;
+
+ # @@ Use --no-cleanup for cp builtin when implemented.
+ #
+ d = &!libfoo-1.1.0/;
+ c = $d/ $d/build/ $d/build/bootstrap.build $d/buildfile $d/manifest;
+ cp -r $src/libfoo-1.1.0 ./ $c;
+
+ $* -p -e libfoo-1.1.0 2>'unpacked libfoo/1.1.0';
+
+ $pkg_purge libfoo 2>'purged libfoo/1.1.0'
+ }
+}
+
+: hello
+:
+{
+ $clone_cfg;
+ $rep_add $rep/hello && $rep_fetch --trust $cert_fp &cfg/.bpkg/certs/***;
+ $pkg_fetch libhello/1.0.0;
+
+ $* libhello 2>'unpacked libhello/1.0.0';
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+}
diff --git a/tests/pkg-unpack/hello b/tests/pkg-unpack/hello
new file mode 120000
index 0000000..e10a7f8
--- /dev/null
+++ b/tests/pkg-unpack/hello
@@ -0,0 +1 @@
+../common/hello \ No newline at end of file
diff --git a/tests/pkg-unpack/libfoo-1.1.0 b/tests/pkg-unpack/libfoo-1.1.0
new file mode 120000
index 0000000..15fcf5c
--- /dev/null
+++ b/tests/pkg-unpack/libfoo-1.1.0
@@ -0,0 +1 @@
+../common/libfoo-1.1.0 \ No newline at end of file
diff --git a/tests/pkg-unpack/t1 b/tests/pkg-unpack/t1
new file mode 120000
index 0000000..a27d298
--- /dev/null
+++ b/tests/pkg-unpack/t1
@@ -0,0 +1 @@
+../common/t1 \ No newline at end of file
diff --git a/tests/pkg-update.test b/tests/pkg-update.test
new file mode 100644
index 0000000..c64b309
--- /dev/null
+++ b/tests/pkg-update.test
@@ -0,0 +1,148 @@
+# file : tests/pkg-update.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# Source repository:
+#
+# pkg-update
+# |-- hello
+# | |-- libhello-1.0.0.tar.gz
+# | `-- repositories
+# `-- libhello-1.0.0
+# |-- build
+# | |-- bootstrap.build
+# | |-- export.build
+# | `-- root.build
+# |-- buildfile
+# |-- hello
+# | |-- buildfile
+# | |-- export
+# | |-- hello
+# | `-- hello.cxx
+# |-- INSTALL
+# |-- manifest
+# |-- tests
+# | |-- build
+# | | |-- bootstrap.build
+# | | `-- root.build
+# | |-- buildfile
+# | `-- test
+# | |-- buildfile
+# | |-- driver.cxx
+# | `-- test.out
+# `-- version
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories
+ $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature
+end
+
+pkg_configure += -d cfg "config.cxx=$config.cxx" 2>-
+pkg_disfigure += -d cfg
+pkg_fetch += -d cfg 2>-
+pkg_purge += -d cfg
+pkg_unpack += -d cfg 2>-
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg --auth all 2>-
+
+# Sometimes we need to run underlying build update operation with -j 1 options
+# to have an output that we can match reliably.
+#
+j1 = --build-option -j --build-option 1
+
+: no-name
+:
+$clone_cfg;
+$* 2>>EOE != 0
+ error: package name argument expected
+ info: run 'bpkg help pkg-update' for more information
+ EOE
+
+: fetched
+:
+{
+ +$clone_cfg
+ +$rep_add $rep/hello && $rep_fetch --trust $cert_fp &cfg/.bpkg/certs/***
+
+ : no-such-package
+ :
+ $clone_cfg;
+ $* libhello 2>>/EOE != 0
+ error: package libhello does not exist in configuration cfg/
+ EOE
+
+ : wrong-state
+ :
+ {
+ $clone_cfg && $pkg_fetch libhello/1.0.0;
+
+ $* libhello 2>>EOE != 0;
+ error: package libhello is fetched
+ info: expected it to be configured
+ EOE
+
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+
+ : src-eq-out
+ :
+ {
+ $clone_cfg;
+ $pkg_fetch libhello/1.0.0 && $pkg_unpack libhello;
+ $pkg_configure libhello;
+
+ $* $j1 libhello 2>>~%EOE%;
+ %c\+\+ .+%
+ %ld .+%
+ %c\+\+ .+%
+ %ld .+%
+ %c\+\+ .+%
+ %ld .+%
+ updated libhello/1.0.0
+ EOE
+
+ $* libhello 2>>~%EOE%;
+ %info: .+ is up to date%
+ updated libhello/1.0.0
+ EOE
+
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+ }
+}
+
+: src-ne-out
+:
+{
+ $clone_cfg;
+ $pkg_unpack -e $src/libhello-1.0.0 && $pkg_configure libhello;
+
+ $* $j1 libhello 2>>~%EOE%;
+ %mkdir .+%
+ %mkdir .+%
+ %c\+\+ .+%
+ %ld .+%
+ %c\+\+ .+%
+ %ld .+%
+ %c\+\+ .+%
+ %ld .+%
+ updated libhello/1.0.0
+ EOE
+
+ $* libhello 2>>~%EOE%;
+ %info: .+ is up to date%
+ updated libhello/1.0.0
+ EOE
+
+ $pkg_disfigure libhello 2>'disfigured libhello/1.0.0';
+ $pkg_purge libhello 2>'purged libhello/1.0.0'
+}
diff --git a/tests/pkg-update/hello b/tests/pkg-update/hello
new file mode 120000
index 0000000..e10a7f8
--- /dev/null
+++ b/tests/pkg-update/hello
@@ -0,0 +1 @@
+../common/hello \ No newline at end of file
diff --git a/tests/pkg-update/libhello-1.0.0 b/tests/pkg-update/libhello-1.0.0
new file mode 120000
index 0000000..a6f638b
--- /dev/null
+++ b/tests/pkg-update/libhello-1.0.0
@@ -0,0 +1 @@
+../common/libhello-1.0.0 \ No newline at end of file
diff --git a/tests/pkg-verify.test b/tests/pkg-verify.test
new file mode 100644
index 0000000..9d9c714
--- /dev/null
+++ b/tests/pkg-verify.test
@@ -0,0 +1,59 @@
+# file : tests/pkg-verify.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test
+
+# Source repository:
+#
+# pkg-verify
+# |-- foo-1.tar.gz
+# |-- foo-2.tar.gz (manifest with unknown name)
+# `-- not-a-package.tar.gz
+
+: valid-package
+:
+$* $src/foo-1.tar.gz 2>'valid package foo 1'
+
+: no-package
+:
+$* 2>>EOE != 0
+error: archive path argument expected
+ info: run 'bpkg help pkg-verify' for more information
+EOE
+
+: not-a-package
+:
+{
+ : verbose
+ :
+ $* $src/not-a-package.tar.gz 2>>/~%EOE% != 0
+ %.+
+ %error: .+/not-a-package.tar.gz does not appear to be a bpkg package%
+ EOE
+
+ : silent
+ :
+ $* --silent $src/not-a-package.tar.gz != 0
+}
+
+: unknown-name
+:
+: Test that package manifest that contains an unknown name is properly handled.
+:
+{
+ : verbose
+ :
+ $* $src/foo-2.tar.gz 2>>/~%EOE% != 0
+ foo-2/manifest:8:1: error: unknown name 'color' in package manifest
+ % info: package archive .+/foo-2.tar.gz%
+ EOE
+
+ : silent
+ :
+ $* --silent $src/foo-2.tar.gz != 0
+
+ : ignore
+ :
+ $* --ignore-unknown $src/foo-2.tar.gz 2>'valid package foo 2'
+}
diff --git a/tests/pkg-verify/foo-1.tar.gz b/tests/pkg-verify/foo-1.tar.gz
new file mode 120000
index 0000000..7a0bc92
--- /dev/null
+++ b/tests/pkg-verify/foo-1.tar.gz
@@ -0,0 +1 @@
+../common/foo-1.tar.gz \ No newline at end of file
diff --git a/tests/pkg-verify/foo-2.tar.gz b/tests/pkg-verify/foo-2.tar.gz
new file mode 100644
index 0000000..cb39194
--- /dev/null
+++ b/tests/pkg-verify/foo-2.tar.gz
Binary files differ
diff --git a/tests/pkg-verify/not-a-package.tar.gz b/tests/pkg-verify/not-a-package.tar.gz
new file mode 100644
index 0000000..be3823a
--- /dev/null
+++ b/tests/pkg-verify/not-a-package.tar.gz
Binary files differ
diff --git a/tests/pkg/.gitignore b/tests/pkg/.gitignore
deleted file mode 100644
index cd1ec36..0000000
--- a/tests/pkg/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-packages
-signature
diff --git a/tests/pkg/1/build2.org/auth/expired/packages b/tests/pkg/1/build2.org/auth/expired/packages
deleted file mode 100644
index 9aaf177..0000000
--- a/tests/pkg/1/build2.org/auth/expired/packages
+++ /dev/null
@@ -1,11 +0,0 @@
-: 1
-sha256sum: ba75221f5f610f5f9ebee19a7449dfcff5c9fb2c7d87d2482b8324c4ea419950
-:
-name: libfoo
-version: 1.0.0
-summary: libfoo
-license: MIT
-url: http://example.org
-email: pkg@example.org
-location: libfoo-1.0.0.tar.gz
-sha256sum: 642aa60cda80f6579247dfc64192c67ec3f2ed932ae2f56e592000ad9fea435d
diff --git a/tests/pkg/1/build2.org/auth/expired/signature b/tests/pkg/1/build2.org/auth/expired/signature
deleted file mode 100644
index dc2aeee..0000000
--- a/tests/pkg/1/build2.org/auth/expired/signature
+++ /dev/null
@@ -1,13 +0,0 @@
-: 1
-sha256sum: cd05e2ebe9dac484950a54e95a76efba0cac27ec5148dc34fa23a5cd7da72e3d
-signature: \
-geWdw7Gm+Rt+CLDMBby5Y796E8rxwImb0bmcZwGWar9D3vkFm9Kjh00Buuo1PuU7tP1dV6yvRbH8
-NzC0IryEoUJHx9909AJ449ET9Zb+C3ykEeBlKH2wonj7cAVK9ZEDpPEGAtp56XWZQEawl50mwq6t
-XkZAABxtOswXiicdh3HK7kaPHp38/9CBMc0rva6wDnkbTigUYA2ULqLtP5a5mLovVc48zI9A/hmb
-Qx1/Nr7nzTZNDGK7CwTAb1fPam9rZklTfCTPSPUUjvWjM9XdY8cbRE1FrE14TXdyQPxCLzHO2dUO
-YWH5/qMikEoCYhYXQ6KhekoT/MUiVC3PMcYQbYOrOtSxq6RcgnymexBe1XIyld5Rfo1eXu8TK11r
-QPULIqAGy6RwEUhGznuEiGHQwb1UymNyJ/qgr4vBPjJtlvptqG5XNmtiJ22f07nmeVRi2Vg2UyOw
-HoVpy5t/w0tEnUXPA39Vt0v1bUm7Knhc8qL4JFEqK/j/CzEHzEtAjn0aoGuKubCO0WUa+v6ZlkLU
-YrNUIdgT1wgj4yEhLO3g+NsnxFH05D2sfR16rrkI2E6st5crAHR8FOl2FDsWxgKqNbzXZw7rl+Fa
-TobGycX7MDf2mbBmR/KmEkMBJ4mziWLAycSAGyE5VRYDwHPJlQE0143wBzT8eNw4VLm/r+88VYw=
-\
diff --git a/tests/pkg/1/build2.org/auth/name-mismatch/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/auth/name-mismatch/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/auth/name-mismatch/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/auth/name-mismatch/repositories b/tests/pkg/1/build2.org/auth/name-mismatch/repositories
deleted file mode 100644
index 15fa092..0000000
--- a/tests/pkg/1/build2.org/auth/name-mismatch/repositories
+++ /dev/null
@@ -1,34 +0,0 @@
-: 1
-certificate: \
------BEGIN CERTIFICATE-----
-MIIFXTCCA0WgAwIBAgIJANXKeBuJax30MA0GCSqGSIb3DQEBCwUAMEoxFzAVBgNV
-BAoMDkNvZGUgU3ludGhlc2lzMS8wLQYDVQQDDCZuYW1lOmJ1aWxkMi5vcmcvYXV0
-aC9taXNtYXRjaGVkL25hbWUveDAeFw0xNjA1MDMyMzUyNDJaFw0xNzA1MDMyMzUy
-NDJaMEoxFzAVBgNVBAoMDkNvZGUgU3ludGhlc2lzMS8wLQYDVQQDDCZuYW1lOmJ1
-aWxkMi5vcmcvYXV0aC9taXNtYXRjaGVkL25hbWUveDCCAiIwDQYJKoZIhvcNAQEB
-BQADggIPADCCAgoCggIBANq78SXuzFzCMoFU1RnzEeAfzE0UUYGynS3F2lG7viH3
-coxjLt+BrFBudVs4XDTpjXS19hRxIohEgD71W1jhDvmUC9yCMW13PCIIjRKTTz0e
-fEhTcMHdhOgvKZsje0IV7svoKVXcG7DfUVl51wWPQPSbUrfsQbsXg7Pz5HaDx+Dt
-2i9hwdE1M0z4R2dtwQkszFyCKiX8RF9oPXirTz5ETLC3f19JUapLrY5l5ZylzQif
-LhPMlHLlrT0n7KkohH7waX3KyeLa0M2IIl3zaeAsuN+ErFVecAdlJIvX00cth2OO
-/Gxy09sIKlagi2q7ZDik2sMvG8dAv7gNZsXp+FOj/XXCiOI9f6D5ospJdK9B5UCA
-BjmGc8W5Odv6ZLey5Ui76luI7ciITOKfAoEkbyMiNHiRxLdM7aAeizdcwHU4bm6J
-lmiJk8UyyV85f33mvCSfuo7D+DQYiK650/xwRdTFBIqi38IwME62gT7ah/AOmiPs
-hj7FjwIU7ZWHskyr9qpExQOEKJXoLZJo1rf6MRc8AsJyz6zdfQhT1BTzhogNfru4
-xjVM6fSrjRUF34msuWcz/HKo9W350Aw2y5F59kziP+m7G6uBYrqmElv/13Vamg2Z
-Z1b38KMz5Ss3SkfcDErOzz/D+0hRlOaCIeWts1G2zWcQvBnn+zGA+sTIu0xAFOCR
-AgMBAAGjRjBEMA4GA1UdDwEB/wQEAwIHgDAWBgNVHSUBAf8EDDAKBggrBgEFBQcD
-AzAaBgNVHREEEzARgQ9pbmZvQGJ1aWxkMi5vcmcwDQYJKoZIhvcNAQELBQADggIB
-AKvUnaZP20bf4ahpa50QUvRb4Kel7yhvvmae7/aIBk5ANxnJC3yuOpmtGve5+lLE
-+6w/XwFASz/7PAdUlEp+LBYknGnx5StoqBzP7nwapm+tBcrZ3Q5MxareXXOSx1Ac
-4Dh9vDMRevDHZ5LQATHG+Q7zaKmBb0ZeSjJlP4+0680AKN4YDmY1a81uoa1jRXbV
-c4iutSoBaVNdWB5+GGelEjvhzN0gZ22IpS3mjbyCbJNywHQMHBLwtxuFgkdOfPkC
-MGBbvG5TD7SKgQNlfsoQu3UJpokzz7hP1TmjCpSDjGSqJlYvovrHCFQGWjtk0UVQ
-tXAQiVPlMsj2kbxJf2ICYYZuvQbmhvNF049ldrpk26jlDzSZ+5t2jueC+q8knTsn
-p3LPx7sqGfkIq41pxHAQseBSYUEo6r6LwfDQPmwb7fOUpLJm6GdsEkqqUhmB3W6Y
-H4t6PKCjFI91JqTka6oF3Lblf3QLXlMpevBwvgaZAC1d4eiNPq+mSAL6T2Cb8Hvq
-Imzyh6EcMbWD9RSnbDCujBjnj0WXO7VjUqShZ60D78PCdXbaK7RAOX9cLUYO/OHd
-z5vUbBrPvDImu5gJFRLOGKKw/7Yn9um/pyuSHuuucBkjBJ4J/tPi/MBZiWM7g2qc
-obzYoLev74dMkZMZDsGDAcuYX40ZVkF7ATqZC405/fSH
------END CERTIFICATE-----
-\
diff --git a/tests/pkg/1/build2.org/auth/sha256sum-mismatch/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/auth/sha256sum-mismatch/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/auth/sha256sum-mismatch/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/auth/sha256sum-mismatch/repositories b/tests/pkg/1/build2.org/auth/sha256sum-mismatch/repositories
deleted file mode 100644
index 9bcb20a..0000000
--- a/tests/pkg/1/build2.org/auth/sha256sum-mismatch/repositories
+++ /dev/null
@@ -1,33 +0,0 @@
-: 1
-certificate: \
------BEGIN CERTIFICATE-----
-MIIFLzCCAxegAwIBAgIJAK41T2Si9cMEMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
-BAoTDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDEw9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNDMwMTQyNDQ3WhcNMTcwNDMwMTQyNDQ3WjAzMRcwFQYDVQQKEw5Db2RlIFN5
-bnRoZXNpczEYMBYGA1UEAxMPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
-IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
-PR58SFNwwd2E6C8pmyN7QhXuy+gpVdwbsN9RWXnXBY9A9JtSt+xBuxeDs/PkdoPH
-4O3aL2HB0TUzTPhHZ23BCSzMXIIqJfxEX2g9eKtPPkRMsLd/X0lRqkutjmXlnKXN
-CJ8uE8yUcuWtPSfsqSiEfvBpfcrJ4trQzYgiXfNp4Cy434SsVV5wB2Uki9fTRy2H
-Y478bHLT2wgqVqCLartkOKTawy8bx0C/uA1mxen4U6P9dcKI4j1/oPmiykl0r0Hl
-QIAGOYZzxbk52/pkt7LlSLvqW4jtyIhM4p8CgSRvIyI0eJHEt0ztoB6LN1zAdThu
-bomWaImTxTLJXzl/fea8JJ+6jsP4NBiIrrnT/HBF1MUEiqLfwjAwTraBPtqH8A6a
-I+yGPsWPAhTtlYeyTKv2qkTFA4QolegtkmjWt/oxFzwCwnLPrN19CFPUFPOGiA1+
-u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
-DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
-4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
-BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
-AgEAeBHkz12OPjjFPftCZ8u/9Kq+W0ZnqQqXmSLj5SQFiG5PEUSV19XFcGawwjbU
-6guceUSHhHQr/KhpV02pyoPPtskdognHQCPr6HCR6eeEtfBUSum5dKpJAWqGhszg
-bPCb11/ksBBzpBbc/C+gnU8ZvsglJ/wxrizZ0AYeSdvyWq8pgoh2vGpgdhK5MWhd
-rVGQm+TUVmXyQwNrYDjqhoGZF02UilIekedegWUEvkXnk5rzyzTaX+GwlnsplVY2
-Xijn8cWkO4cCDkthyjfNPgUm8ZgKuBgs+OYRbW4XtuXgeBucBVCryrM8+3OSmzbs
-IBQWL0EDT7bnt2ukE+cUx8Foc/+180KZAdDbUY9MOsYCac3bXnIJd/q1pzkr+OvL
-EXnuIGuzUqVkcD4+ABaWefNUm3KeZwBAupYc9eo2/YzpCUsgAe0PAdgJhcg9D4kX
-2RwwjVpOPWUxevrPq32Lo3R8obfl2aCLzcuiuheb1EcJLlAH67KqdXLDpvZqJ9qi
-iaBCixRl2t3our5VSBWQQefGnH6DWn1JM34zyBbeZdgjyqebSN42p+hADYe2qzdf
-AviHJsBwvt3HYpr3bfU6EDx1cU5D6gNAxzZMkZhnEQ7u6kXDcLyWJhgXcZhGT0xv
-D/x+fIGI1t2XkoOmvuno1MqoDQX3sCYd0bfB/9wwzcNexic=
------END CERTIFICATE-----
-\
diff --git a/tests/pkg/1/build2.org/auth/signature-mismatch/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/auth/signature-mismatch/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/auth/signature-mismatch/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/auth/signature-mismatch/repositories b/tests/pkg/1/build2.org/auth/signature-mismatch/repositories
deleted file mode 100644
index 9bcb20a..0000000
--- a/tests/pkg/1/build2.org/auth/signature-mismatch/repositories
+++ /dev/null
@@ -1,33 +0,0 @@
-: 1
-certificate: \
------BEGIN CERTIFICATE-----
-MIIFLzCCAxegAwIBAgIJAK41T2Si9cMEMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
-BAoTDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDEw9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNDMwMTQyNDQ3WhcNMTcwNDMwMTQyNDQ3WjAzMRcwFQYDVQQKEw5Db2RlIFN5
-bnRoZXNpczEYMBYGA1UEAxMPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
-IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
-PR58SFNwwd2E6C8pmyN7QhXuy+gpVdwbsN9RWXnXBY9A9JtSt+xBuxeDs/PkdoPH
-4O3aL2HB0TUzTPhHZ23BCSzMXIIqJfxEX2g9eKtPPkRMsLd/X0lRqkutjmXlnKXN
-CJ8uE8yUcuWtPSfsqSiEfvBpfcrJ4trQzYgiXfNp4Cy434SsVV5wB2Uki9fTRy2H
-Y478bHLT2wgqVqCLartkOKTawy8bx0C/uA1mxen4U6P9dcKI4j1/oPmiykl0r0Hl
-QIAGOYZzxbk52/pkt7LlSLvqW4jtyIhM4p8CgSRvIyI0eJHEt0ztoB6LN1zAdThu
-bomWaImTxTLJXzl/fea8JJ+6jsP4NBiIrrnT/HBF1MUEiqLfwjAwTraBPtqH8A6a
-I+yGPsWPAhTtlYeyTKv2qkTFA4QolegtkmjWt/oxFzwCwnLPrN19CFPUFPOGiA1+
-u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
-DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
-4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
-BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
-AgEAeBHkz12OPjjFPftCZ8u/9Kq+W0ZnqQqXmSLj5SQFiG5PEUSV19XFcGawwjbU
-6guceUSHhHQr/KhpV02pyoPPtskdognHQCPr6HCR6eeEtfBUSum5dKpJAWqGhszg
-bPCb11/ksBBzpBbc/C+gnU8ZvsglJ/wxrizZ0AYeSdvyWq8pgoh2vGpgdhK5MWhd
-rVGQm+TUVmXyQwNrYDjqhoGZF02UilIekedegWUEvkXnk5rzyzTaX+GwlnsplVY2
-Xijn8cWkO4cCDkthyjfNPgUm8ZgKuBgs+OYRbW4XtuXgeBucBVCryrM8+3OSmzbs
-IBQWL0EDT7bnt2ukE+cUx8Foc/+180KZAdDbUY9MOsYCac3bXnIJd/q1pzkr+OvL
-EXnuIGuzUqVkcD4+ABaWefNUm3KeZwBAupYc9eo2/YzpCUsgAe0PAdgJhcg9D4kX
-2RwwjVpOPWUxevrPq32Lo3R8obfl2aCLzcuiuheb1EcJLlAH67KqdXLDpvZqJ9qi
-iaBCixRl2t3our5VSBWQQefGnH6DWn1JM34zyBbeZdgjyqebSN42p+hADYe2qzdf
-AviHJsBwvt3HYpr3bfU6EDx1cU5D6gNAxzZMkZhnEQ7u6kXDcLyWJhgXcZhGT0xv
-D/x+fIGI1t2XkoOmvuno1MqoDQX3sCYd0bfB/9wwzcNexic=
------END CERTIFICATE-----
-\
diff --git a/tests/pkg/1/build2.org/auth/signed/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/auth/signed/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/auth/signed/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/auth/signed/repositories b/tests/pkg/1/build2.org/auth/signed/repositories
deleted file mode 100644
index 9bcb20a..0000000
--- a/tests/pkg/1/build2.org/auth/signed/repositories
+++ /dev/null
@@ -1,33 +0,0 @@
-: 1
-certificate: \
------BEGIN CERTIFICATE-----
-MIIFLzCCAxegAwIBAgIJAK41T2Si9cMEMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
-BAoTDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDEw9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNDMwMTQyNDQ3WhcNMTcwNDMwMTQyNDQ3WjAzMRcwFQYDVQQKEw5Db2RlIFN5
-bnRoZXNpczEYMBYGA1UEAxMPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
-IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
-PR58SFNwwd2E6C8pmyN7QhXuy+gpVdwbsN9RWXnXBY9A9JtSt+xBuxeDs/PkdoPH
-4O3aL2HB0TUzTPhHZ23BCSzMXIIqJfxEX2g9eKtPPkRMsLd/X0lRqkutjmXlnKXN
-CJ8uE8yUcuWtPSfsqSiEfvBpfcrJ4trQzYgiXfNp4Cy434SsVV5wB2Uki9fTRy2H
-Y478bHLT2wgqVqCLartkOKTawy8bx0C/uA1mxen4U6P9dcKI4j1/oPmiykl0r0Hl
-QIAGOYZzxbk52/pkt7LlSLvqW4jtyIhM4p8CgSRvIyI0eJHEt0ztoB6LN1zAdThu
-bomWaImTxTLJXzl/fea8JJ+6jsP4NBiIrrnT/HBF1MUEiqLfwjAwTraBPtqH8A6a
-I+yGPsWPAhTtlYeyTKv2qkTFA4QolegtkmjWt/oxFzwCwnLPrN19CFPUFPOGiA1+
-u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
-DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
-4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
-BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
-AgEAeBHkz12OPjjFPftCZ8u/9Kq+W0ZnqQqXmSLj5SQFiG5PEUSV19XFcGawwjbU
-6guceUSHhHQr/KhpV02pyoPPtskdognHQCPr6HCR6eeEtfBUSum5dKpJAWqGhszg
-bPCb11/ksBBzpBbc/C+gnU8ZvsglJ/wxrizZ0AYeSdvyWq8pgoh2vGpgdhK5MWhd
-rVGQm+TUVmXyQwNrYDjqhoGZF02UilIekedegWUEvkXnk5rzyzTaX+GwlnsplVY2
-Xijn8cWkO4cCDkthyjfNPgUm8ZgKuBgs+OYRbW4XtuXgeBucBVCryrM8+3OSmzbs
-IBQWL0EDT7bnt2ukE+cUx8Foc/+180KZAdDbUY9MOsYCac3bXnIJd/q1pzkr+OvL
-EXnuIGuzUqVkcD4+ABaWefNUm3KeZwBAupYc9eo2/YzpCUsgAe0PAdgJhcg9D4kX
-2RwwjVpOPWUxevrPq32Lo3R8obfl2aCLzcuiuheb1EcJLlAH67KqdXLDpvZqJ9qi
-iaBCixRl2t3our5VSBWQQefGnH6DWn1JM34zyBbeZdgjyqebSN42p+hADYe2qzdf
-AviHJsBwvt3HYpr3bfU6EDx1cU5D6gNAxzZMkZhnEQ7u6kXDcLyWJhgXcZhGT0xv
-D/x+fIGI1t2XkoOmvuno1MqoDQX3sCYd0bfB/9wwzcNexic=
------END CERTIFICATE-----
-\
diff --git a/tests/pkg/1/build2.org/auth/unsigned1/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/auth/unsigned1/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/auth/unsigned1/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/auth/unsigned2/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/auth/unsigned2/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/auth/unsigned2/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/common/hello/repositories b/tests/pkg/1/build2.org/common/hello/repositories
deleted file mode 100644
index bbe8a66..0000000
--- a/tests/pkg/1/build2.org/common/hello/repositories
+++ /dev/null
@@ -1,36 +0,0 @@
-# Hello World repository. Currently does not have any prerequisite
-# repositories.
-#
-: 1
-certificate: \
------BEGIN CERTIFICATE-----
-MIIFLzCCAxegAwIBAgIJAK41T2Si9cMEMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
-BAoTDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDEw9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNDMwMTQyNDQ3WhcNMTcwNDMwMTQyNDQ3WjAzMRcwFQYDVQQKEw5Db2RlIFN5
-bnRoZXNpczEYMBYGA1UEAxMPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
-AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
-IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
-PR58SFNwwd2E6C8pmyN7QhXuy+gpVdwbsN9RWXnXBY9A9JtSt+xBuxeDs/PkdoPH
-4O3aL2HB0TUzTPhHZ23BCSzMXIIqJfxEX2g9eKtPPkRMsLd/X0lRqkutjmXlnKXN
-CJ8uE8yUcuWtPSfsqSiEfvBpfcrJ4trQzYgiXfNp4Cy434SsVV5wB2Uki9fTRy2H
-Y478bHLT2wgqVqCLartkOKTawy8bx0C/uA1mxen4U6P9dcKI4j1/oPmiykl0r0Hl
-QIAGOYZzxbk52/pkt7LlSLvqW4jtyIhM4p8CgSRvIyI0eJHEt0ztoB6LN1zAdThu
-bomWaImTxTLJXzl/fea8JJ+6jsP4NBiIrrnT/HBF1MUEiqLfwjAwTraBPtqH8A6a
-I+yGPsWPAhTtlYeyTKv2qkTFA4QolegtkmjWt/oxFzwCwnLPrN19CFPUFPOGiA1+
-u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
-DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
-4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
-BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
-AgEAeBHkz12OPjjFPftCZ8u/9Kq+W0ZnqQqXmSLj5SQFiG5PEUSV19XFcGawwjbU
-6guceUSHhHQr/KhpV02pyoPPtskdognHQCPr6HCR6eeEtfBUSum5dKpJAWqGhszg
-bPCb11/ksBBzpBbc/C+gnU8ZvsglJ/wxrizZ0AYeSdvyWq8pgoh2vGpgdhK5MWhd
-rVGQm+TUVmXyQwNrYDjqhoGZF02UilIekedegWUEvkXnk5rzyzTaX+GwlnsplVY2
-Xijn8cWkO4cCDkthyjfNPgUm8ZgKuBgs+OYRbW4XtuXgeBucBVCryrM8+3OSmzbs
-IBQWL0EDT7bnt2ukE+cUx8Foc/+180KZAdDbUY9MOsYCac3bXnIJd/q1pzkr+OvL
-EXnuIGuzUqVkcD4+ABaWefNUm3KeZwBAupYc9eo2/YzpCUsgAe0PAdgJhcg9D4kX
-2RwwjVpOPWUxevrPq32Lo3R8obfl2aCLzcuiuheb1EcJLlAH67KqdXLDpvZqJ9qi
-iaBCixRl2t3our5VSBWQQefGnH6DWn1JM34zyBbeZdgjyqebSN42p+hADYe2qzdf
-AviHJsBwvt3HYpr3bfU6EDx1cU5D6gNAxzZMkZhnEQ7u6kXDcLyWJhgXcZhGT0xv
-D/x+fIGI1t2XkoOmvuno1MqoDQX3sCYd0bfB/9wwzcNexic=
------END CERTIFICATE-----
-\
diff --git a/tests/pkg/1/build2.org/common/not-a-package.tar.gz b/tests/pkg/1/build2.org/common/not-a-package.tar.gz
deleted file mode 100644
index aa10905..0000000
--- a/tests/pkg/1/build2.org/common/not-a-package.tar.gz
+++ /dev/null
Binary files differ
diff --git a/tests/pkg/1/build2.org/fetch/t1/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/fetch/t1/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/fetch/t1/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gz
deleted file mode 100644
index 28a6a90..0000000
--- a/tests/pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gz
+++ /dev/null
Binary files differ
diff --git a/tests/pkg/1/build2.org/satisfy/t1/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/satisfy/t1/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/satisfy/t1/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/satisfy/t2/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/satisfy/t2/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/satisfy/t2/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/satisfy/t4a/libfoo-1.1.0.tar.gz b/tests/pkg/1/build2.org/satisfy/t4a/libfoo-1.1.0.tar.gz
deleted file mode 120000
index c004b2a..0000000
--- a/tests/pkg/1/build2.org/satisfy/t4a/libfoo-1.1.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.1.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/satisfy/t4c/libfoo-1.0.0.tar.gz b/tests/pkg/1/build2.org/satisfy/t4c/libfoo-1.0.0.tar.gz
deleted file mode 120000
index 32e5a3c..0000000
--- a/tests/pkg/1/build2.org/satisfy/t4c/libfoo-1.0.0.tar.gz
+++ /dev/null
@@ -1 +0,0 @@
-../libfoo-1.0.0.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/satisfy/t5/repositories b/tests/pkg/1/build2.org/satisfy/t5/repositories
deleted file mode 120000
index d965b15..0000000
--- a/tests/pkg/1/build2.org/satisfy/t5/repositories
+++ /dev/null
@@ -1 +0,0 @@
-../repositories \ No newline at end of file
diff --git a/tests/pkg/publish b/tests/publish
index 00453cc..3a6b0d8 100755
--- a/tests/pkg/publish
+++ b/tests/publish
@@ -14,4 +14,4 @@ rsync -v -rlpt --copy-unsafe-links \
--include 'repositories' \
--include 'signature' \
--exclude '*' \
-1/build2.org/ build2.org:/var/pkg/1/
+test/*/pkg/1/build2.org/ build2.org:/var/pkg/1/
diff --git a/tests/remote.test b/tests/remote.test
new file mode 100644
index 0000000..fdd3fbb
--- /dev/null
+++ b/tests/remote.test
@@ -0,0 +1,37 @@
+# file : tests/remote.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+# Tests for commands that accept repository location must be able to run
+# regardless whether the repository is local or remote. They also must be able
+# to create the repository used for testing at the specified path, so being
+# published to build2.org it can be used for the remote testing. Note that
+# prior to publishing repositories tests must be performed with the
+# config.test.output=keep variable override, so their working directories (that
+# contain repositories produced) are not cleaned up.
+#
+
+# Output directory path that testscripts must use to prepare repositories
+# required by tests they contains.
+#
+# Note that the local path is carefully crafted so that we end up with the
+# same repository names in both (local and remote) cases. This is necessary
+# for the authentication to work properly in both cases.
+#
+out = $canonicalize([dir_path] $~/pkg/1/build2.org/)
+
+# If $remote is true then remote repositories locations must be used for
+# tests. Variables rep_root and rep refer to the root and the command-
+# specific repositories respectively. Note that the variables type is dir_path
+# for local repositories (rather than string for the remote ones), that allows
+# to portably obtain sub-repositories locations representations.
+#
+remote = $config.bpkg.test.remote
+rep_root = ($remote == true ? [string] "https://build2.org/bpkg/1" : $out)
+
+out += [dir_path] $cmd
+rep = ($remote == true ? [string] "$rep_root/$cmd" : $out)
+
++if ($remote != true)
+ mkdir -p $out
+end
diff --git a/tests/rep-add.test b/tests/rep-add.test
new file mode 100644
index 0000000..a1b9104
--- /dev/null
+++ b/tests/rep-add.test
@@ -0,0 +1,70 @@
+# file : tests/rep-add.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test config.test
+
+: location
+:
+{
+ : none
+ :
+ $* 2>>EOE != 0
+ error: repository location argument expected
+ info: run 'bpkg help rep-add' for more information
+ EOE
+
+ : no-version
+ :
+ $* 'stable' 2>>EOE != 0
+ error: invalid repository location 'stable': missing repository version
+ EOE
+
+ : invalid-host
+ :
+ $* 'http://' 2>>EOE != 0
+ error: invalid repository location 'http://': invalid host
+ EOE
+}
+
+: relative-path
+:
+{
+ $clone_cfg;
+
+ $* ./1/bar/stable 2>>/~%EOE%;
+ %added repository .+/relative-path/bar/stable%
+ EOE
+
+ $* ./1/../1/bar/stable 2>>/~%EOE% != 0
+ %error: .+/relative-path/bar/stable is already a repository of this configuration%
+ EOE
+}
+
+: absolute-path
+:
+{
+ $clone_cfg;
+
+ $* $~/1/foo/stable 2>>/~%EOE%;
+ %added repository .+/absolute-path/foo/stable%
+ EOE
+
+ $* $~/1/../1/foo/stable 2>>/~%EOE% != 0
+ %error: .+/absolute-path/foo/stable is already a repository of this configuration%
+ EOE
+}
+
+: remote-url
+:
+{
+ $clone_cfg;
+
+ $* 'http://pkg.example.org/1/testing' 2>>~%EOE%;
+ %added repository example.org/testing%
+ EOE
+
+ $* 'https://www.example.org/1/testing' 2>>~%EOE% != 0
+ %error: example.org/testing is already a repository of this configuration%
+ EOE
+}
diff --git a/tests/rep-auth.test b/tests/rep-auth.test
new file mode 100644
index 0000000..80e98de
--- /dev/null
+++ b/tests/rep-auth.test
@@ -0,0 +1,469 @@
+# file : tests/rep-auth.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# There is no rep-auth command, and this testscript contains tests for various
+# authentication scenarios throughout different stages of repositories
+# preparation and consumption. Note that by that reason usage of $* is
+# meaningless.
+#
+
+# Source repository:
+#
+# rep-auth
+# |-- expired
+# | |-- foo-1.tar.gz
+# | |-- packages
+# | |-- repositories
+# | `-- signature
+# `-- unsigned
+# |-- foo-1.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rc = $rep_create 2>-
+
+ # Create the 'unsigned1' repository.
+ #
+ cp -r $src/unsigned $out/unsigned1
+ $rc $out/unsigned1 &$out/unsigned1/packages
+
+ # Create the 'unsigned2' repository. This is a copy of the just created
+ # 'unsigned1' repository.
+ #
+ cp -r $out/unsigned1 $out/unsigned2
+
+ # Create the 'signed' repository.
+ #
+ cp -r $src/unsigned $out/signed
+ cat <<<$cert_manifest >+$out/signed/repositories
+ $rc --key $key $out/signed &$out/signed/packages &$out/signed/signature
+
+ # Create the 'name-mismatch' repository. Note that its certificate name
+ # mismatches the repository location.
+ #
+ cp -r $src/unsigned $out/name-mismatch
+
+ echo 'certificate: \' >+$out/name-mismatch/repositories
+ cat <<<$src_base/auth/mismatch-cert.pem >+$out/name-mismatch/repositories
+ echo '\' >+$out/name-mismatch/repositories
+
+ $rc --key $key $out/name-mismatch &$out/name-mismatch/packages \
+ &$out/name-mismatch/signature
+
+ # Create the 'expired' repository. This repository is "pre-created" and its
+ # certificate is expired by now. So we just copy it from the source
+ # directory.
+ #
+ cp -r $src/expired $out/expired
+
+ # Create the 'sha256sum-mismatch' repository. This is a copy of the just
+ # created 'signed' repository that has the sha256sum manifest value tampered.
+ #
+ cp -r $out/signed $out/sha256sum-mismatch
+
+ v = 'd374c59b36fdbdbd0d4468665061d94fda9c6c687863dfe72b0bcc34ff9d5fb4'
+ sed -i -e "s/^\(sha256sum: \).*\$/\\1$v/" $out/sha256sum-mismatch/signature
+
+ # Create the 'signature-mismatch' repository. This is a copy of the just
+ # created 'signed' repository that has the signature manifest value tampered.
+ #
+ cp -r $out/signed $out/signature-mismatch
+
+ # Here we tamper the last signature line (the one of 76 chars length, without
+ # spaces and terminated with '=').
+ #
+ v = 'mnBAsS529NUdNIQy8EB4si/UK26ICaMywbLeHDVvWOB+AsqZ5rj8VjGDamLbmUrDr3ru7BU1gJU='
+ sed -i -e "s%^[^ ]{75}=\$%$v%" $out/signature-mismatch/signature
+end
+
+pkg_status += -d cfg
+rep_add += -d cfg 2>-
+rep_fetch += -d cfg
+
+# Check if rep-fetch command was successfull or not.
+#
+fetched = $pkg_status foo >'available 1 sys:?'
+not_fetched = $pkg_status foo >'unknown'
+
+sc = " " # Space character to append to here-document line when required.
+
+: no-auth
+:
+: Test that local repositories do not require authentication by default.
+:
+{
+ r = 1/signed
+ +mkdir 1/
+ +cp -r $src/unsigned $r
+ +cat <<<$cert_manifest >+$r/repositories
+ +$rep_create --key $key $r &$r/packages &$r/signature 2>-
+
+ : rep-fetch
+ :
+ {
+ $clone_root_cfg && $rep_add ../$r;
+
+ $rep_fetch 2>>/~%EOE%
+ %fetching .+/no-auth/signed%
+ 1 package(s) in 1 repository(s)
+ EOE
+ }
+
+ : rep-info
+ :
+ $clone_root_cfg;
+ $rep_info --cert-name ../$r >'name:build2.org'
+}
+
+: signed
+:
+{
+ : rep-fetch
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/signed
+ rep_fetch += --auth all &?cfg/.bpkg/certs/***
+
+ : no-auth
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch 2>>"EOE" != 0;
+ fetching build2.org/rep-auth/signed
+ warning: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ certificate is for build2.org, "Code Synthesis" <info@build2.org>
+ certificate SHA256 fingerprint:
+ $cert_fp
+ trust this certificate? [y/n]$sc
+ error: unable to read y/n answer from STDOUT
+ EOE
+
+ $not_fetched
+ }
+
+ : trust-fp
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust $cert_fp 2>>EOE;
+ fetching build2.org/rep-auth/signed
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched
+ }
+
+ : trust-fp-no
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-no --trust $cert_fp 2>>EOE;
+ fetching build2.org/rep-auth/signed
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched
+ }
+
+ : trust-yes
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-yes 2>>EOE;
+ fetching build2.org/rep-auth/signed
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched
+ }
+
+ : trust-no
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-no 2>>EOE != 0;
+ fetching build2.org/rep-auth/signed
+ error: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ EOE
+
+ $not_fetched
+ }
+
+ : trust-yes-no
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-yes --trust-no 2>>EOE != 0;
+ fetching build2.org/rep-auth/signed
+ error: --trust-yes and --trust-no are mutually exclusive
+ EOE
+
+ $not_fetched
+ }
+
+ : already-trusted
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-yes 2>>EOE;
+ fetching build2.org/rep-auth/signed
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $rep_fetch 2>>EOE;
+ fetching build2.org/rep-auth/signed
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched;
+
+ $rep_fetch --trust-no 2>>EOE;
+ fetching build2.org/rep-auth/signed
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched
+ }
+ }
+
+ : rep-info
+ :
+ {
+ rep_info += --cert-name --auth all $rep/signed
+
+ : no-auth
+ :
+ $rep_info 2>>"EOE" != 0
+ warning: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ certificate is for build2.org, "Code Synthesis" <info@build2.org>
+ certificate SHA256 fingerprint:
+ $cert_fp
+ trust this certificate? [y/n]$sc
+ error: unable to read y/n answer from STDOUT
+ EOE
+
+ : trust-fp
+ :
+ $rep_info --trust $cert_fp >'name:build2.org'
+
+ : trust-yes
+ :
+ $rep_info --trust-yes >'name:build2.org'
+
+ : trust-no
+ :
+ $rep_info --trust-no 2>>EOE != 0
+ error: authenticity of the certificate for repository build2.org/rep-auth/signed cannot be established
+ EOE
+
+ : already-trusted
+ :
+ {
+ $clone_root_cfg;
+ rep_info += -d cfg;
+
+ $rep_info --trust "$cert_fp" &cfg/.bpkg/certs/*** >'name:build2.org';
+ $rep_info >'name:build2.org'
+ }
+ }
+}
+
+: unsigned
+:
+{
+ : rep-fetch
+ :
+ {
+ +$clone_root_cfg && $rep_add $rep/unsigned1
+ rep_fetch += --auth all
+
+ : no-auth
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch 2>>~%EOE% != 0;
+ fetching build2.org/rep-auth/unsigned1
+ warning: repository build2.org/rep-auth/unsigned1 is unsigned
+ %continue without authenticating repositories at .+\? \[y/n\] %
+ error: unable to read y/n answer from STDOUT
+ EOE
+
+ $not_fetched
+ }
+
+ : trust-yes
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-yes 2>>EOE;
+ fetching build2.org/rep-auth/unsigned1
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched
+ }
+
+ : trust-no
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-no 2>>EOE != 0;
+ fetching build2.org/rep-auth/unsigned1
+ error: repository build2.org/rep-auth/unsigned1 is unsigned
+ EOE
+
+ $not_fetched
+ }
+
+ : already-trusted
+ :
+ {
+ $clone_cfg;
+
+ $rep_fetch --trust-yes 2>>EOE;
+ fetching build2.org/rep-auth/unsigned1
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $rep_fetch 2>>EOE;
+ fetching build2.org/rep-auth/unsigned1
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched;
+
+ $rep_fetch --trust-no 2>>EOE;
+ fetching build2.org/rep-auth/unsigned1
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $fetched;
+
+ $rep_add $rep/unsigned2;
+
+ $rep_fetch 2>>EOE;
+ fetching build2.org/rep-auth/unsigned1
+ fetching build2.org/rep-auth/unsigned2
+ 1 package(s) in 2 repository(s)
+ EOE
+
+ $fetched
+ }
+ }
+
+ : rep-info
+ :
+ {
+ rep_info += --name --auth all $rep/unsigned1
+
+ : no-auth
+ :
+ $rep_info 2>>~%EOE% != 0
+ warning: repository build2.org/rep-auth/unsigned1 is unsigned
+ %continue without authenticating repositories at .+\? \[y/n\] %
+ error: unable to read y/n answer from STDOUT
+ EOE
+
+ : trust-yes
+ :
+ $rep_info --trust-yes >"build2.org/rep-auth/unsigned1 ($rep/unsigned1)"
+
+ : trust-no
+ :
+ $rep_info --trust-no 2>>EOE != 0
+ error: repository build2.org/rep-auth/unsigned1 is unsigned
+ EOE
+
+ : already-trusted
+ :
+ {
+ $clone_root_cfg;
+ rep_info += -d cfg;
+
+ $rep_info --trust-yes >"build2.org/rep-auth/unsigned1 ($rep/unsigned1)";
+ $rep_info >"build2.org/rep-auth/unsigned1 ($rep/unsigned1)"
+ }
+ }
+}
+
+: faulty
+:
+{
+ rep_info += --auth all --trust-yes
+
+ : name-mismatch
+ :
+ $rep_info $rep/name-mismatch 2>>EOE != 0
+ error: certificate name mismatch for repository build2.org/rep-auth/name-mismatch
+ info: certificate name is build2.org/mismatched/name
+ EOE
+
+ : expired
+ :
+ $rep_info $rep/expired 2>>EOE != 0
+ error: certificate for repository build2.org/rep-auth/expired has expired
+ EOE
+
+ : sha256sum-mismatch
+ :
+ $rep_info $rep/sha256sum-mismatch 2>>EOE != 0
+ error: packages manifest file checksum mismatch for build2.org/rep-auth/sha256sum-mismatch
+ info: try again
+ EOE
+
+ : signature-mismatch
+ :
+ $rep_info $rep/signature-mismatch 2>>~%EOE% != 0
+ %.*
+ %error: unable to authenticate repository build2.org/rep-auth/signature-mismatch%
+ EOE
+
+ : create-rep
+ :
+ {
+ : no-email
+ :
+ {
+ cp -r $src/unsigned rep;
+
+ echo 'certificate: \' >+rep/repositories;
+ cat <<<$src_base/auth/noemail-cert.pem >+rep/repositories;
+ echo '\' >+rep/repositories;
+
+ $rep_create --key $key rep &rep/packages 2>>/EOE != 0
+ adding foo 1
+ error: invalid certificate for rep/: no email
+ EOE
+ }
+
+ : expired
+ :
+ {
+ cp -r $src/unsigned rep;
+
+ echo 'certificate: \' >+rep/repositories;
+ cat <<<$src_base/auth/expired-cert.pem >+rep/repositories;
+ echo '\' >+rep/repositories;
+
+ $rep_create --key $key rep &rep/packages 2>>/EOE != 0
+ adding foo 1
+ error: certificate for repository rep/ has expired
+ EOE
+ }
+ }
+}
diff --git a/tests/rep-auth/expired/foo-1.tar.gz b/tests/rep-auth/expired/foo-1.tar.gz
new file mode 120000
index 0000000..d771dc4
--- /dev/null
+++ b/tests/rep-auth/expired/foo-1.tar.gz
@@ -0,0 +1 @@
+../../common/foo-1.tar.gz \ No newline at end of file
diff --git a/tests/rep-auth/expired/packages b/tests/rep-auth/expired/packages
new file mode 100644
index 0000000..4fa075a
--- /dev/null
+++ b/tests/rep-auth/expired/packages
@@ -0,0 +1,11 @@
+: 1
+sha256sum: dbeea68d374f6ca66b5f65652e26a0d8324d3fe118341ac470c07214ceb34b60
+:
+name: foo
+version: 1
+summary: The "Foo" utility
+license: MIT
+url: http://www.example.org/foo
+email: foo-users@example.org
+location: foo-1.tar.gz
+sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
diff --git a/tests/pkg/1/build2.org/auth/expired/repositories b/tests/rep-auth/expired/repositories
index 8370fa4..7e68ee8 100644
--- a/tests/pkg/1/build2.org/auth/expired/repositories
+++ b/tests/rep-auth/expired/repositories
@@ -1,9 +1,9 @@
: 1
certificate: \
-----BEGIN CERTIFICATE-----
-MIIFLzCCAxegAwIBAgIJAPIoh0763iYdMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
+MIIFLzCCAxegAwIBAgIJAOx1KvcHxv3GMA0GCSqGSIb3DQEBCwUAMDMxFzAVBgNV
BAoMDkNvZGUgU3ludGhlc2lzMRgwFgYDVQQDDA9uYW1lOmJ1aWxkMi5vcmcwHhcN
-MTYwNTAxMTA1MDMyWhcNMTYwNTAyMTA1MDMyWjAzMRcwFQYDVQQKDA5Db2RlIFN5
+MTcwMzAxMTcwMTI0WhcNMTcwMzAyMTcwMTI0WjAzMRcwFQYDVQQKDA5Db2RlIFN5
bnRoZXNpczEYMBYGA1UEAwwPbmFtZTpidWlsZDIub3JnMIICIjANBgkqhkiG9w0B
AQEFAAOCAg8AMIICCgKCAgEA2rvxJe7MXMIygVTVGfMR4B/MTRRRgbKdLcXaUbu+
IfdyjGMu34GsUG51WzhcNOmNdLX2FHEiiESAPvVbWOEO+ZQL3IIxbXc8IgiNEpNP
@@ -18,16 +18,16 @@ u7jGNUzp9KuNFQXfiay5ZzP8cqj1bfnQDDbLkXn2TOI/6bsbq4FiuqYSW//XdVqa
DZlnVvfwozPlKzdKR9wMSs7PP8P7SFGU5oIh5a2zUbbNZxC8Gef7MYD6xMi7TEAU
4JECAwEAAaNGMEQwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUF
BwMDMBoGA1UdEQQTMBGBD2luZm9AYnVpbGQyLm9yZzANBgkqhkiG9w0BAQsFAAOC
-AgEAAb+Yxvqi4sOZ+Ti8wcxkxqFrIs32M3XgJIeZYJn9JZbtjuBx0JFZWnL/tz4M
-VTiM2nrUc4qIIpTqEt2If1NcdH0Cjvf6vysLvIOoB4q09B+aW4F+19moixYodoDp
-qq1Ki1MZrBMx+KUICagqRSklPyxaZ2rEFv2TY0pg8/QRFRWGCFgdWJleX6VsqIXC
-KDK6MyHfR1gsDnZZfgr7HJCq1SH3loqlchLBvAF6K/c1LdQyJFYoP4xAt6yaQWzv
-wEqqhhZ7tLpjrjK0K2pqsPoupNcNhE31k+6ZdM5Z5oHT844qKIVNJIdlvFwnQ3ed
-grP6gBCLVY7h7GJ0x2ZG/2hYt4My8RqLxFYHaHAzQsmXFATIzT1Yqz1nw+8V3l5P
-m+rXQNVAw7rgpl3T7klbHVfkg5rPa0kF66PkKq5ax46NS6KVj9sNOqkcXL7huQSG
-BnSLTkaLwwrSZWl+DPXeY8TgUGkkEMY6RvYdqoOGZiZSqtMfK9QKsFi79a4Munc8
-ypUPxE++jhtXcarDy0ta3BXrspIg63a2Ab6C5yv2fC31Ec5v75rUxt9BVxMMQdlX
-h9eMe5FmkgkSBcklOShE2kZvTOPUCSq8DK7JuKsKEH3istPto+PpoyT8RxuZ9K2Q
-rr78CskHtj+TVdFv7TAqn2YDx9ki4HJIxWKVanJ+zOBSrJw=
+AgEATQmuoB+NC/IF2qoNQnurJWrV63lC4Ozi/VLIqCSR6A4S9TCcoLNDAtcdiyf4
+GrM+/USyV3whpISesXn0ij10OEMe2/9NUoqkO0Q/woN9WtUQActeBxThOcz0NYMi
+1vg6krlx1fKpQ5g65yC3qka8VUaV9gtaCHFa6mOxZ9q5DaV2NdBAr+FOutRY6d4v
+UySkOyqxfZYLs5W2e+9ofEve17eVNFQwuJY29sw406X+18gYc+KiqldPlwKIhJs1
+CBsWhO0m1GP5dR0gRBmF9WQ4fzNyoYF293ix+WC7eMf2OtRTpo/GEAXDqLlRvpiF
+jALhFtcZjiIqrvnkQFq36jyVNcUnxbMKUgW4XJVpYv4uVII47eJk4a8XRGj0d+7b
+nuFfT4d6gACN3gfOmtd12uT7dNsn5q0fkGhzR4ppDIyTJpGA8UhHETTRPL+HFcb1
+6kXnRPFS7eoF9DoSGtBhdpRUefj8EPJWhfE7xQvMDTYIE/ccBWp173F+xShr2mgF
+xDkHH+vXGFzUZXSEAF2NW9U3bf4bRQpdOkYJsvHJmLYjcGNKdkHjJVWdXmoRpbsR
+IC8M7ZPp+/oV5JEinCXRsT1NN+7l8rkec9hNk5sbokVCcyYv+GxL8kRFt2jyLqny
+RlM2vM3uhgJNYVSlYsgjjg4QfikV6s+QawjSVi6y4ZnHEho=
-----END CERTIFICATE-----
\
diff --git a/tests/rep-auth/expired/signature b/tests/rep-auth/expired/signature
new file mode 100644
index 0000000..454653f
--- /dev/null
+++ b/tests/rep-auth/expired/signature
@@ -0,0 +1,13 @@
+: 1
+sha256sum: ad6c46b7c2b994957215025de0f0ce9be192f6973a8b36f5d3f3d1670172af1e
+signature: \
+PQrvkr6ONdIIrEaORzsgpXNpNkMVmdjW8Ahgpi+sdwyjsxkgMj/0gHjyF0amPi6ae+zUu4igDeKM
+JnWuShDMbxLy+zxy6IpjpchwtPymM3euqQnLWebRJ2b+9RlBVGIRCl25VnFn+mmHW76+yRnOT6nI
+fYNCM6eiLihWKLRUCnsj18PZSV7EK68Q3iPAUws4F4A63eKqJe/qSWkRjJrVpi+UFDjYkJi9542D
+MELmYFXV592UVoQ3PPK+ZU/Ja+cosHND9mHe2xvLKHFnBKUi5LKvZ+aZdiZXisnisX9PgvGzk+5j
+qzzJUse21NLA2J4D+jiH8r2fj4qjh1dLHgocQj3GQeN8r18XvaLtP9+tcLYfphWnyOfk3q12xtn8
+h9yNoVPHVsMiYrB7JXX2TM4qPqepi3f8iQmEfZxWqlI5/cpeQz3DTDZ4wagNbBoYzavUqTjriXCU
+eLWVZz89JkYhWYTBPx26XZp56TsN16ZrN6oMtHgVy6YmmbjIea7sZXhNc8a/7FCdxap8PZfJS1cW
+LieoZqQF5C0O8+sJnYl88Pp76mtQIgXEsfc5TnvgMosQfXbHzMbD7naD0woWqu5GVKWx6+AdK2uH
+KbuSXYrJYfmuS2Ptp/T7ZIkRE2YZPe4+lsMkIiqY1fg2qIdWgpQiH0ZE3Ki3GH4FUWEkurWgxYk=
+\
diff --git a/tests/rep-auth/unsigned/foo-1.tar.gz b/tests/rep-auth/unsigned/foo-1.tar.gz
new file mode 120000
index 0000000..d771dc4
--- /dev/null
+++ b/tests/rep-auth/unsigned/foo-1.tar.gz
@@ -0,0 +1 @@
+../../common/foo-1.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/system/t1/repositories b/tests/rep-auth/unsigned/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/system/t1/repositories
+++ b/tests/rep-auth/unsigned/repositories
diff --git a/tests/rep-create.test b/tests/rep-create.test
new file mode 100644
index 0000000..acc6957
--- /dev/null
+++ b/tests/rep-create.test
@@ -0,0 +1,184 @@
+# file : tests/rep-create.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test
+
+# Source repository:
+#
+# rep-create
+# |-- stable
+# | |-- foo-1.tar.gz
+# | `-- repositories
+# `-- testing -> stable (complement)
+# |-- foo-2.tar.gz (manifest with unknown name)
+# `-- repositories
+
+: unsigned
+:
+{
+ # Make sure the cloned repository has a valid location, so we can use
+ # rep-info command to validate the repository info.
+ #
+ clone_rep = mkdir 1/ && cp -r $src/stable 1/
+
+ : without-key
+ :
+ {
+ $clone_rep;
+
+ $* 1/stable/ 2>>/~%EOE% &1/stable/packages;
+ adding foo 1
+ %1 package\(s\) in .+/stable/%
+ EOE
+
+ $rep_info -p -m 1/stable/ >>EOO
+ : 1
+ sha256sum: 6cac7ffa1f02f90776fc89bcacf38604ba0eddf176f2314c75dc9bf1b10a8b32
+ :
+ name: foo
+ version: 1
+ summary: The "Foo" utility
+ license: MIT
+ url: http://www.example.org/foo
+ email: foo-users@example.org
+ location: foo-1.tar.gz
+ sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
+ EOO
+ }
+
+ : with-key
+ :
+ {
+ $clone_rep;
+
+ $* --key $key 1/stable/ 2>>/~%EOE% &1/stable/packages;
+ adding foo 1
+ warning: --key option ignored
+ info: repository manifest contains no certificate
+ info: run 'bpkg help rep-create' for more information
+ %1 package\(s\) in .+/stable/%
+ EOE
+
+ $rep_info -p -m 1/stable/ >>EOO
+ : 1
+ sha256sum: 6cac7ffa1f02f90776fc89bcacf38604ba0eddf176f2314c75dc9bf1b10a8b32
+ :
+ name: foo
+ version: 1
+ summary: The "Foo" utility
+ license: MIT
+ url: http://www.example.org/foo
+ email: foo-users@example.org
+ location: foo-1.tar.gz
+ sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
+ EOO
+ }
+}
+
+: signed
+:
+: Here we sign the 'stable' repository with the certificate prior to running
+: tests.
+:
+{
+ +cp -r $src/stable ./ && cat <<<$cert_manifest >+stable/repositories
+
+ # Make sure the cloned repository has a valid location, so we can use
+ # rep-info command to validate the repository info.
+ #
+ clone_rep = mkdir 1/ && cp -r ../stable 1/
+
+ : with-key
+ :
+ : Note that as we re-create the repositories file on the fly (see above) its
+ : sha256sum can vary due to CRs mix-in on Windows. That explains why we do
+ : not match it exactly.
+ :
+ {
+ $clone_rep;
+
+ $* --key $key 1/stable/ 2>>/~%EOE% &1/stable/packages &1/stable/signature;
+ adding foo 1
+ %1 package\(s\) in .+/stable/%
+ EOE
+
+ $rep_info --cert-fingerprint -p -m 1/stable/ >>~"%EOO%"
+ $cert_fp
+ : 1
+ %sha256sum: .+%
+ :
+ name: foo
+ version: 1
+ summary: The "Foo" utility
+ license: MIT
+ url: http://www.example.org/foo
+ email: foo-users@example.org
+ location: foo-1.tar.gz
+ sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
+ EOO
+ }
+
+ : without-key
+ :
+ $clone_rep;
+ $* 1/stable/ 2>>EOE &1/stable/packages != 0
+ adding foo 1
+ error: --key option required
+ info: repository manifest contains a certificate
+ info: run 'bpkg help rep-create' for more information
+ EOE
+}
+
+: unknown-name
+:
+: Test that package manifest that contains an unknown name is properly handled.
+:
+{
+ clone_rep = cp -r $src/testing ./
+
+ : fail
+ :
+ $clone_rep;
+ $* testing/ 2>>/EOE != 0
+ foo-2/manifest:8:1: error: unknown name 'color' in package manifest
+ info: package archive testing/foo-2.tar.gz
+ EOE
+
+ : ignore
+ :
+ $clone_rep;
+ $* --ignore-unknown testing/ 2>>/~%EOE% &testing/packages
+ adding foo 2
+ %1 package\(s\) in .+/testing/%
+ EOE
+}
+
+: broken-repo
+:
+: Here we break the 'stable' repository prior to running a test.
+:
+{
+ clone_rep = cp -r $src/stable ./
+
+ : no-repositories-file
+ :
+ {
+ $clone_rep &!stable/repositories;
+ rm stable/repositories;
+
+ $* stable/ 2>/'error: file stable/repositories does not exist' != 0
+ }
+
+ : unexpected-file
+ :
+ {
+ $clone_rep;
+ touch stable/foo;
+
+ $* stable/ 2>>/~%EOE% != 0
+ %.+
+ error: stable/foo does not appear to be a bpkg package
+ EOE
+ }
+}
diff --git a/tests/rep-create/stable/foo-1.tar.gz b/tests/rep-create/stable/foo-1.tar.gz
new file mode 120000
index 0000000..d771dc4
--- /dev/null
+++ b/tests/rep-create/stable/foo-1.tar.gz
@@ -0,0 +1 @@
+../../common/foo-1.tar.gz \ No newline at end of file
diff --git a/tests/pkg/1/build2.org/system/t2/repositories b/tests/rep-create/stable/repositories
index 5b70556..5b70556 100644
--- a/tests/pkg/1/build2.org/system/t2/repositories
+++ b/tests/rep-create/stable/repositories
diff --git a/tests/rep-create/testing/foo-2.tar.gz b/tests/rep-create/testing/foo-2.tar.gz
new file mode 100644
index 0000000..cb39194
--- /dev/null
+++ b/tests/rep-create/testing/foo-2.tar.gz
Binary files differ
diff --git a/tests/rep-create/testing/repositories b/tests/rep-create/testing/repositories
new file mode 100644
index 0000000..7411f25
--- /dev/null
+++ b/tests/rep-create/testing/repositories
@@ -0,0 +1,4 @@
+: 1
+location: ../stable
+role: complement
+:
diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test
new file mode 100644
index 0000000..e59ebf4
--- /dev/null
+++ b/tests/rep-fetch.test
@@ -0,0 +1,134 @@
+# file : tests/rep-fetch.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test config.test remote.test
+
+# Source repository:
+#
+# rep-fetch
+# |-- bar
+# | |-- stable -> ../foo/stable (prerequisite)
+# | | |-- libbar-1.0.0.tar.gz -> libfoo >= 1.0.0
+# | | `-- repositories
+# | |-- testing -> stable (complement),
+# | | | ../foo/testing (prerequisite)
+# | | |-- libbar-1.1.0.tar.gz -> libfoo >= 1.1.0
+# | | `-- repositories
+# | `-- unstable -> testing (complement),
+# | | ../foo/testing (prerequisite)
+# | |-- libbar-1.1.1.tar.gz -> libfoo >= 1.1.0
+# | `-- repositories
+# |-- foo
+# | |-- stable
+# | | |-- libfoo-1.0.0.tar.gz
+# | | `-- repositories
+# | `-- testing -> stable (complement)
+# | |-- libfoo-1.1.0.tar.gz
+# | `-- repositories
+# `-- hello
+# |-- libhello-1.0.0.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rep_create += 2>-
+
+ # Create the signed 'hello' repository.
+ #
+ cp -r $src/hello $out/hello
+ cat <<<$cert_manifest >+$out/hello/repositories
+ $rep_create --key $key $out/hello &$out/hello/packages &$out/hello/signature
+
+ # Create 'foo/*' repositories.
+ #
+ cp -r $src/foo $out/foo
+ $rep_create $out/foo/stable &$out/foo/stable/packages
+ $rep_create $out/foo/testing &$out/foo/testing/packages
+
+ # Create 'bar/*' repositories.
+ #
+ cp -r $src/bar $out/bar
+ $rep_create $out/bar/stable &$out/bar/stable/packages
+ $rep_create $out/bar/testing &$out/bar/testing/packages
+ $rep_create $out/bar/unstable &$out/bar/unstable/packages
+end
+
+test.options += --auth all
+
+rep_add += -d cfg 2>-
+
+: no-repositories
+:
+$clone_cfg;
+$* 2>>/EOE != 0
+ error: configuration cfg/ has no repositories
+ info: use 'bpkg rep-add' to add a repository
+ EOE
+
+: hello
+:
+{
+ $clone_cfg && $rep_add $rep/hello;
+
+ $* --trust $cert_fp 2>>EOE &cfg/.bpkg/certs/***;
+ fetching build2.org/rep-fetch/hello
+ 1 package(s) in 1 repository(s)
+ EOE
+
+ $* 2>>EOE
+ fetching build2.org/rep-fetch/hello
+ 1 package(s) in 1 repository(s)
+ EOE
+}
+
+: bar-unstable
+:
+{
+ $clone_cfg && $rep_add $rep/bar/unstable;
+
+ $* --trust-yes 2>>EOE;
+ fetching build2.org/rep-fetch/bar/unstable
+ fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
+ fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
+ 5 package(s) in 5 repository(s)
+ EOE
+
+ $* 2>>EOE
+ fetching build2.org/rep-fetch/bar/unstable
+ fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
+ fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
+ 5 package(s) in 5 repository(s)
+ EOE
+}
+
+: both
+:
+{
+ $clone_cfg && $rep_add $rep/hello && $rep_add $rep/bar/unstable;
+
+ $* --trust-yes 2>>EOE &cfg/.bpkg/certs/***;
+ fetching build2.org/rep-fetch/bar/unstable
+ fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
+ fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
+ fetching build2.org/rep-fetch/hello
+ 6 package(s) in 6 repository(s)
+ EOE
+
+ $* 2>>EOE
+ fetching build2.org/rep-fetch/bar/unstable
+ fetching build2.org/rep-fetch/foo/testing (prerequisite of build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/foo/stable (complements build2.org/rep-fetch/foo/testing)
+ fetching build2.org/rep-fetch/bar/testing (complements build2.org/rep-fetch/bar/unstable)
+ fetching build2.org/rep-fetch/bar/stable (complements build2.org/rep-fetch/bar/testing)
+ fetching build2.org/rep-fetch/hello
+ 6 package(s) in 6 repository(s)
+ EOE
+}
diff --git a/tests/rep-fetch/bar b/tests/rep-fetch/bar
new file mode 120000
index 0000000..7684b42
--- /dev/null
+++ b/tests/rep-fetch/bar
@@ -0,0 +1 @@
+../common/bar \ No newline at end of file
diff --git a/tests/rep-fetch/foo b/tests/rep-fetch/foo
new file mode 120000
index 0000000..4ee4799
--- /dev/null
+++ b/tests/rep-fetch/foo
@@ -0,0 +1 @@
+../common/foo \ No newline at end of file
diff --git a/tests/rep-fetch/hello b/tests/rep-fetch/hello
new file mode 120000
index 0000000..9312ba9
--- /dev/null
+++ b/tests/rep-fetch/hello
@@ -0,0 +1 @@
+../common/hello/ \ No newline at end of file
diff --git a/tests/rep-info.test b/tests/rep-info.test
new file mode 100644
index 0000000..43e455e
--- /dev/null
+++ b/tests/rep-info.test
@@ -0,0 +1,128 @@
+# file : tests/rep-info.test
+# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+.include common.test auth.test remote.test
+
+# Source repository:
+#
+# rep-info
+# `-- testing -> stable (complement), ../foo/testing (prerequisite)
+# |-- foo-1.tar.gz
+# `-- repositories
+
+# Prepare repositories used by tests if running in the local mode.
+#
++if ($remote != true)
+ rc = $rep_create 2>-
+
+ # Create the unsigned 'testing' repository.
+ #
+ cp -r $src/testing $out/testing
+ $rc $out/testing &$out/testing/packages
+
+ # Create the signed 'testing' repository.
+ #
+ cp -r $src/testing $out/signed
+ cat <<<$cert_manifest >+$out/signed/repositories
+ $rc --key $key $out/signed &$out/signed/packages &$out/signed/signature
+end
+
+test.options = --auth all --trust-yes
+
+: no-location
+:
+$* 2>>EOE != 0
+error: repository location argument expected
+ info: run 'bpkg help rep-info' for more information
+EOE
+
+: default
+:
+{
+ : unsigned
+ :
+ $* $rep/testing >>"EOO"
+ build2.org/rep-info/testing ($rep/testing)
+ prerequisite build2.org/foo/testing ($rep_root/foo/testing)
+ complement build2.org/rep-info/stable ($rep/stable)
+
+ foo/1
+ EOO
+
+ : signed
+ :
+ $* $rep/signed >>"EOO"
+ build2.org/rep-info/signed ($rep/signed)
+ CN=build2.org/O=Code Synthesis/info@build2.org
+ $cert_fp
+ prerequisite build2.org/foo/testing ($rep_root/foo/testing)
+ complement build2.org/rep-info/stable ($rep/stable)
+
+ foo/1
+ EOO
+}
+
+: name
+:
+$* --name $rep/testing >"build2.org/rep-info/testing ($rep/testing)"
+
+: packages
+:
+{
+ : list
+ :
+ $* --packages $rep/testing >>EOO
+
+ foo/1
+ EOO
+
+ : manifest
+ :
+ $* --packages --manifest $rep/testing >>EOO
+ : 1
+ sha256sum: 7cdc5965cf41742a7feb1c4b73f1438f35e6a6ed7e4e6b30d9fba36c26baca04
+ :
+ name: foo
+ version: 1
+ summary: The "Foo" utility
+ license: MIT
+ url: http://www.example.org/foo
+ email: foo-users@example.org
+ location: foo-1.tar.gz
+ sha256sum: fee330a362a4f87ff42a954aa305b6446d541b7b60000ebcd2fbf68f2b1ae58e
+ EOO
+}
+
+: repositories
+:
+{
+ : list
+ :
+ $* --repositories $rep/testing >>"EOO"
+ prerequisite build2.org/foo/testing ($rep_root/foo/testing)
+ complement build2.org/rep-info/stable ($rep/stable)
+ EOO
+
+ : manifest
+ :
+ $* --repositories --manifest $rep/testing >>EOO
+ : 1
+ location: ../../foo/testing
+ :
+ location: ../stable
+ role: complement
+ :
+ EOO
+}
+
+: cert
+:
+{
+ test.arguments += $rep/signed
+
+ $* --cert-fingerprint >"$cert_fp" : fingerprint
+ $* --cert-name >'name:build2.org' : name
+ $* --cert-organization >'Code Synthesis' : organization
+ $* --cert-email >'info@build2.org' : email
+}
diff --git a/tests/rep-info/testing/foo-1.tar.gz b/tests/rep-info/testing/foo-1.tar.gz
new file mode 120000
index 0000000..d771dc4
--- /dev/null
+++ b/tests/rep-info/testing/foo-1.tar.gz
@@ -0,0 +1 @@
+../../common/foo-1.tar.gz \ No newline at end of file
diff --git a/tests/rep-info/testing/repositories b/tests/rep-info/testing/repositories
new file mode 100644
index 0000000..3cc2531
--- /dev/null
+++ b/tests/rep-info/testing/repositories
@@ -0,0 +1,6 @@
+: 1
+location: ../../foo/testing
+:
+location: ../stable
+role: complement
+:
diff --git a/tests/test.sh b/tests/test.sh
deleted file mode 100755
index 6858ea6..0000000
--- a/tests/test.sh
+++ /dev/null
@@ -1,2003 +0,0 @@
-#! /usr/bin/env bash
-
-# Usage: test.sh [test-options] [bpkg-common-options]
-#
-# Test options are:
-#
-# -v
-# Run verbose. By default, this script runs bpkg quiet and suppresses
-# error messages in the fail tests. Note that when this options is
-# specified, bpkg is called with default verbosity level. If you want
-# more bpkg diagnostics, add the --verbose N option.
-#
-# --remote
-# Test using the remote repositories. Normally, you would first run the
-# local test in order to create the repositories, then publish them (see
-# pkg/publish.sh), and finally run the remote test.
-#
-# -c <compiler>
-# Use the compiler specified to configure cxx module.
-#
-# --valgrind
-# Run under valgrind (takes forever).
-#
-# Some common bpkg use-cases worth testing:
-#
-# --fetch wget
-# --fetch curl
-# --fetch fetch --fetch-option --no-verify-peer
-#
-# --tar bsdtar
-#
-# --sha256 shasum
-# --sha256 sha256-freebsd
-#
-
-trap 'exit 1' ERR
-
-tmp_file=`mktemp`
-
-# Remove temporary file on exit. Cover the case when exit due to an error.
-#
-trap 'rm -f $tmp_file' EXIT
-
-function error ()
-{
- echo "$*" 1>&2
- exit 1
-}
-
-bpkg="../bpkg/bpkg"
-cfg=/tmp/conf
-
-if [ "${MSYSTEM:0:5}" = "MINGW" -o "${MSYSTEM:0:4}" = "MSYS" ]; then
- msys=y
-fi
-
-verbose=n
-remote=n
-options=
-cxx_options=
-
-while [ $# -gt 0 ]; do
- case $1 in
- -v)
- verbose=y
- shift
- ;;
- --remote)
- remote=y
- shift
- ;;
- --valgrind)
- bpkg="valgrind -q $bpkg"
- shift
- ;;
- -c)
- shift
- cxx_options="config.cxx=$1"
- shift
- ;;
- *)
- # If this is the --verbose bpkg option, switch to the verbose
- # mode as well.
- #
- if [ "$1" == "--verbose" ]; then
- verbose=y
- fi
-
- options="$options $1"
- shift
- ;;
- esac
-done
-
-if [ "$verbose" != "y" ]; then
- options="$options -q"
-fi
-
-bpkg="$bpkg $options"
-
-# Repository location and name prefixes. Note that the local path is carefully
-# crafted so that we end up with the same repository names in both cases. This
-# is necessary for the authentication tests to work in both cases.
-#
-if [ "$remote" = "y" ]; then
- rep=https://build2.org/bpkg/1
- repn=build2.org/
-else
- rep=pkg/1/build2.org
- repn=build2.org/
-fi
-
-#
-#
-function test ()
-{
- local cmd=$1; shift
- local ops=
-
- if [ "$cmd" != "rep-create" -a \
- "$cmd" != "rep-info" -a \
- "$cmd" != "pkg-verify" ]; then
- ops="-d $cfg"
- fi
-
- if [ "$cmd" = "rep-fetch" -o \
- "$cmd" = "rep-info" ]; then
- ops="$ops --auth all"
- fi
-
- if [ -t 0 ]; then
- $bpkg $cmd $ops $*
- else
- $bpkg $cmd $ops $* >$tmp_file
- diff --strip-trailing-cr -u - $tmp_file
- fi
-
- if [ $? -ne 0 ]; then
- error "failed: $bpkg $cmd $ops $*"
- fi
-}
-
-function fail ()
-{
- local cmd=$1; shift
- local ops=
-
- if [ "$cmd" != "rep-create" -a \
- "$cmd" != "rep-info" -a \
- "$cmd" != "pkg-verify" ]; then
- ops="-d $cfg"
- fi
-
- if [ "$cmd" = "rep-fetch" -o \
- "$cmd" = "rep-info" ]; then
- ops="$ops --auth all"
- fi
-
- if [ "$verbose" = "y" ]; then
- $bpkg $cmd $ops $*
- else
- $bpkg $cmd $ops $* 2>/dev/null
- fi
-
- if [ $? -eq 0 ]; then
- error "succeeded: $bpkg $cmd $ops $*"
- fi
-
- return 0
-}
-
-# Verify package status.
-#
-function stat ()
-{
- local s=`$bpkg pkg-status -d $cfg $1`
-
- if [ "$s" != "$2" ]; then
- error "status $1: '$s', expected: '$2'"
- fi
-}
-
-# Verify path is gone (no longer exists)
-#
-function gone ()
-{
- if [ -e "$1" ]; then
- error "path $1 still exists"
- fi
-}
-
-# Repository certificate fingerprint.
-#
-function rep_cert_fp ()
-{
- cat $1/repositories | \
- sed -n '/^-----BEGIN CERTIFICATE-----$/,/^-----END CERTIFICATE-----$/p' | \
- openssl x509 -sha256 -noout -fingerprint | \
- sed -n 's/^SHA256 Fingerprint=\(.*\)$/\1/p'
-}
-
-# Edit file with sed.
-#
-function edit ()
-{
- local path=$1; shift
- sed "$@" $path > $path.bak
- mv $path.bak $path
-}
-
-# Repository absolute location from a relative path.
-#
-function location ()
-{
- if [ "$remote" = "y" ]; then
- echo "$rep/$1"
- elif [ "$msys" = "y" ]; then
- # Convert Windows path like c:/abc/xyz to the c:\abc\xyz canonical form.
- #
- echo "`pwd -W`/$rep/$1" | sed 's%/%\\%g'
- else
- echo "`pwd`/$rep/$1"
- fi
-}
-
-##
-## Low-level commands.
-##
-
-##
-## pkg-verify
-##
-fail pkg-verify # archive expected
-fail pkg-verify ./no-such-file # archive does not exist
-fail pkg-verify pkg/1/build2.org/common/not-a-package.tar.gz
-fail pkg-verify --silent pkg/1/build2.org/common/not-a-package.tar.gz
-test pkg-verify pkg/1/build2.org/common/hello/libhello-1.0.0.tar.gz
-
-
-##
-## rep-create
-##
-fail rep-create # no 'repositories' file
-fail rep-create pkg/1/build2.org/satisfy # unexpected files
-
-test rep-create pkg/1/build2.org/common/hello --key key.pem
-
-test rep-create pkg/1/build2.org/common/foo/stable
-test rep-create pkg/1/build2.org/common/foo/testing
-
-test rep-create pkg/1/build2.org/common/bar/stable
-test rep-create pkg/1/build2.org/common/bar/testing
-test rep-create pkg/1/build2.org/common/bar/unstable
-
-
-##
-## rep-info
-##
-fail rep-info # repository location expected
-
-test rep-info --trust-yes $rep/common/foo/testing <<EOF
-${repn}common/foo/testing `location common/foo/testing`
-complement ${repn}common/foo/stable `location common/foo/stable`
-
-libfoo/1.1.0
-EOF
-
-test rep-info -m -r -n --trust-yes $rep/common/bar/unstable <<EOF
-${repn}common/bar/unstable `location common/bar/unstable`
-: 1
-location: ../../foo/testing
-:
-location: ../testing
-role: complement
-:
-EOF
-
-test rep-info -m -p --trust-yes $rep/common/bar/unstable <<EOF
-: 1
-sha256sum: 3034b727288efbb52b7b6e41fe147b815e7b3aa704e8cef6c2ee8d7421ab5b72
-:
-name: libbar
-version: 1.1.1
-summary: libbar
-license: MIT
-description: \\
-libbar is a very modern C++ XML parser.
-
-It has an API that we believe should have already been in Boost or even in
-the C++ standard library.
-
-\\
-changes: \\
-* Applied upstream patch for critical bug bar.
-
-* Applied upstream patch for critical bug foo.
-
-\\
-url: http://example.org
-email: pkg@example.org
-depends: libfoo >= 1.1.0
-location: libbar-1.1.1.tar.gz
-sha256sum: d09700602ff78ae405b6d4850e34660e939d27676e015a23b549884497c8bb45
-EOF
-
-hello_fp=`rep_cert_fp pkg/1/build2.org/common/hello`
-
-test rep-info -m -p --trust $hello_fp $rep/common/hello <<EOF
-: 1
-sha256sum: 8d324fa7911038778b215d28805c6546e737e0092f79f7bd167cf2e28f4ad96f
-:
-name: libhello
-version: 1.0.0
-summary: The "Hello World" example library
-license: MIT
-tags: c++, hello, world, example
-description: \\
-A simple library that implements the "Hello World" example in C++. Its primary
-goal is to show a canonical build2/bpkg project/package.
-\\
-url: http://www.example.org/libhello
-email: hello-users@example.org
-requires: c++11
-requires: build2 >= 0.4.0
-location: libhello-1.0.0.tar.gz
-sha256sum: d18d1472980399dd1fdbc776cb3eb3f7b2f62447210c8cfbcf1a8dd52a468395
-EOF
-
-##
-## cfg-create
-##
-test cfg-create --wipe cxx $cxx_options config.install.root=/tmp/install
-stat libfoo unknown
-
-test cfg-create --wipe config.install.root=/tmp/install cxx $cxx_options
-stat libfoo unknown
-
-
-##
-## rep-add
-##
-test cfg-create --wipe
-
-fail rep-add # repository location expected
-fail rep-add stable # invalid location
-fail rep-add http:// # invalid location
-
-# relative path
-#
-test rep-add ./1/bar/stable
-fail rep-add ./1/../1/bar/stable # duplicate
-
-# absolute path
-#
-test rep-add /tmp/1/foo/stable
-fail rep-add /tmp/1/../1/foo/stable # duplicate
-
-# remote URL
-#
-test rep-add http://pkg.example.org/1/testing
-fail rep-add https://www.example.org/1/testing # duplicate
-
-
-##
-## rep-fetch
-##
-test cfg-create --wipe
-
-fail rep-fetch # no repositories
-
-# hello repository
-#
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-test rep-fetch
-
-# bar/unstable repository
-#
-test cfg-create --wipe
-test rep-add $rep/common/bar/unstable
-test rep-fetch --trust-yes
-test rep-fetch
-
-# both
-#
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-add $rep/common/bar/unstable
-test rep-fetch --trust-yes
-test rep-fetch
-
-
-##
-## pkg-fetch
-##
-test rep-create pkg/1/build2.org/fetch/t1
-test cfg-create --wipe
-
-fail pkg-fetch -e # archive expected
-fail pkg-fetch -e ./no-such-file # archive does not exist
-
-fail pkg-fetch # package name expected
-fail pkg-fetch libfoo # package version expected
-fail pkg-fetch libfoo/1/2/3 # invalid package version
-
-fail pkg-fetch libfoo/1.0.0 # no repositories
-test rep-add $rep/fetch/t1
-fail pkg-fetch libfoo/1.0.0 # no packages
-test rep-fetch --trust-yes
-fail pkg-fetch libfoo/2+1.0.0 # not available
-test cfg-create --wipe
-test rep-add $rep/fetch/t1
-test rep-fetch --trust-yes
-test pkg-fetch libfoo/1.0.0
-stat libfoo/1.0.0 "fetched; available"
-fail pkg-fetch libfoo/1.0.0
-fail pkg-fetch -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-test pkg-purge libfoo
-test pkg-fetch -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-stat libfoo/1.0.0 "fetched; available"
-test pkg-unpack libfoo
-test pkg-fetch -r libfoo/1.1.0
-stat libfoo/1.1.0 "fetched; available"
-test pkg-unpack libfoo
-test pkg-fetch -r -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-stat libfoo/1.0.0 "fetched; available"
-test pkg-fetch -r libfoo/1.1.0
-stat libfoo/1.1.0 "fetched; available"
-test pkg-fetch -r -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-stat libfoo/1.0.0 "fetched; available"
-test pkg-purge libfoo
-
-# hello
-#
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-test pkg-fetch libhello/1.0.0
-test pkg-purge libhello
-
-
-##
-## pkg-unpack
-##
-test cfg-create --wipe
-fail pkg-unpack -r # replace only with existing
-fail pkg-unpack -e # package directory expected
-fail pkg-unpack # package name expected
-
-test rep-add $rep/fetch/t1
-test rep-fetch --trust-yes
-
-# existing
-#
-fail pkg-unpack -e ./no-such-dir # package directory does not exist
-fail pkg-unpack -e ./pkg # not a package directory
-test pkg-fetch libfoo/1.0.0
-fail pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0 # already exists
-test pkg-purge libfoo
-test pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0
-stat libfoo/1.1.0 "unpacked; available"
-test pkg-purge libfoo
-
-# existing & replace
-#
-test pkg-fetch libfoo/1.0.0
-fail pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0
-test pkg-unpack -r -e pkg/1/build2.org/fetch/libfoo-1.1.0
-stat libfoo/1.1.0 "unpacked; available"
-test pkg-purge libfoo
-test pkg-fetch libfoo/1.0.0
-test pkg-unpack libfoo
-fail pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0
-test pkg-unpack -r -e pkg/1/build2.org/fetch/libfoo-1.1.0
-stat libfoo/1.1.0 "unpacked; available"
-test pkg-purge libfoo
-
-# package name
-#
-fail pkg-unpack libfoo # no such package in configuration
-test pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0
-fail pkg-unpack libfoo # wrong package state
-test pkg-purge libfoo
-test pkg-fetch libfoo/1.0.0
-stat libfoo/1.0.0 "fetched; available"
-test pkg-unpack libfoo
-stat libfoo/1.0.0 "unpacked; available"
-test pkg-purge libfoo
-
-# hello
-#
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-test pkg-fetch libhello/1.0.0
-test pkg-unpack libhello
-test pkg-purge libhello
-
-
-##
-## pkg-purge
-##
-test cfg-create --wipe
-
-fail pkg-purge # missing package name
-fail pkg-purge libfoo # no such package
-
-# purge fetched
-#
-test pkg-fetch -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-test pkg-purge libfoo
-stat libfoo unknown
-
-# --keep
-#
-test pkg-fetch -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-test pkg-purge -k libfoo
-stat libfoo "fetched 1.0.0"
-test pkg-purge libfoo
-
-# archive and --purge
-#
-cp pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz $cfg/
-test pkg-fetch -e -p $cfg/libfoo-1.0.0.tar.gz
-test pkg-purge libfoo
-stat libfoo unknown
-gone $cfg/libfoo-1.0.0.tar.gz
-
-# no archive but --keep
-#
-test pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0
-fail pkg-purge --keep libfoo
-stat libfoo "unpacked 1.1.0"
-test pkg-purge libfoo
-
-# purge unpacked directory
-#
-test pkg-unpack -e pkg/1/build2.org/fetch/libfoo-1.1.0
-test pkg-purge libfoo
-stat libfoo unknown
-
-# purge unpacked archive
-#
-test pkg-fetch -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-test pkg-unpack libfoo
-test pkg-purge libfoo
-stat libfoo unknown
-gone $cfg/libfoo-1.0.0
-
-# purge unpacked archive but --keep
-#
-test pkg-fetch -e pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz
-test pkg-unpack libfoo
-test pkg-purge --keep libfoo
-stat libfoo "fetched 1.0.0"
-gone $cfg/libfoo-1.0.0
-test pkg-purge libfoo
-stat libfoo unknown
-
-# directory and --purge
-#
-cp -r pkg/1/build2.org/fetch/libfoo-1.1.0 $cfg/
-test pkg-unpack -e -p $cfg/libfoo-1.1.0
-test pkg-purge libfoo
-stat libfoo unknown
-gone $cfg/libfoo-1.1.0
-
-# archive and --purge
-#
-cp pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz $cfg/
-test pkg-fetch -e -p $cfg/libfoo-1.0.0.tar.gz
-test pkg-unpack libfoo
-test pkg-purge libfoo
-stat libfoo unknown
-gone $cfg/libfoo-1.0.0
-gone $cfg/libfoo-1.0.0.tar.gz
-
-# broken
-#
-cp pkg/1/build2.org/fetch/libfoo-1.0.0.tar.gz $cfg/
-test pkg-fetch -e -p $cfg/libfoo-1.0.0.tar.gz
-test pkg-unpack libfoo
-chmod 000 $cfg/libfoo-1.0.0
-fail pkg-purge libfoo
-stat libfoo/1.0.0 broken
-fail pkg-purge libfoo # need --force
-fail pkg-purge -f -k libfoo # can't keep broken
-fail pkg-purge -f libfoo # out directory still exists
-chmod 755 $cfg/libfoo-1.0.0
-rm -r $cfg/libfoo-1.0.0
-fail pkg-purge -f libfoo # archive still exists
-rm $cfg/libfoo-1.0.0.tar.gz
-test pkg-purge -f libfoo
-stat libfoo unknown
-
-##
-## pkg-configure/pkg-disfigure
-##
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-
-fail pkg-configure # package name expected
-fail pkg-configure config.dist.root=/tmp # ditto
-fail pkg-configure libhello libhello # unexpected argument
-fail pkg-configure libhello1 # no such package
-
-fail pkg-disfigure # package name expected
-fail pkg-disfigure libhello1 # no such package
-
-test pkg-fetch libhello/1.0.0
-
-fail pkg-configure libhello $cxx_options # wrong package state
-fail pkg-disfigure libhello # wrong package state
-
-test pkg-purge libhello
-
-# src == out
-#
-test pkg-fetch libhello/1.0.0
-test pkg-unpack libhello
-test pkg-configure libhello $cxx_options
-stat libhello "configured 1.0.0; available sys:?"
-test pkg-disfigure libhello
-stat libhello "unpacked 1.0.0; available sys:?"
-test pkg-purge libhello
-stat libhello/1.0.0 "available"
-
-# src != out
-#
-test cfg-create --wipe
-test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
-test pkg-configure libhello $cxx_options
-stat libhello "configured 1.0.0"
-test pkg-disfigure libhello
-stat libhello "unpacked 1.0.0"
-test pkg-purge libhello
-stat libhello unknown
-gone $cfg/libhello-1.0.0
-
-# out still exists after disfigure
-#
-test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
-test pkg-configure libhello $cxx_options
-touch $cfg/libhello-1.0.0/stray
-fail pkg-disfigure libhello
-stat libhello/1.0.0 broken
-rm -r $cfg/libhello-1.0.0
-test pkg-purge -f libhello
-stat libhello unknown
-
-# disfigure failed
-#
-test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
-test pkg-configure libhello $cxx_options
-chmod 555 $cfg/libhello-1.0.0
-fail pkg-disfigure libhello
-stat libhello/1.0.0 broken
-chmod 755 $cfg/libhello-1.0.0
-rm -r $cfg/libhello-1.0.0
-test pkg-purge -f libhello
-stat libhello unknown
-
-# While it's forbidden to delete a directory with write permissions being
-# revoked with the 'chmod 555' command in MSYS, it's still allowed to create
-# subdirectories and files inside such a directory. This is why the following
-# 'fail pkg-configure libhello' test cases undesirably succeed in MSYS.
-#
-if [ "$msys" != "y" ]; then
- # configure failed but disfigure succeeds
- #
- test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
- mkdir -p $cfg/libhello-1.0.0/build
- chmod 555 $cfg/libhello-1.0.0/build
- fail pkg-configure libhello $cxx_options
- stat libhello "unpacked 1.0.0"
- test pkg-purge libhello
- stat libhello unknown
-
- # configure and disfigure both failed
- #
- test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
- mkdir -p $cfg/libhello-1.0.0/build
- # Trip both con/dis.
- #
- chmod 555 $cfg/libhello-1.0.0 $cfg/libhello-1.0.0/build
- fail pkg-configure libhello $cxx_options
- stat libhello/1.0.0 broken
- chmod 755 $cfg/libhello-1.0.0 $cfg/libhello-1.0.0/build
- rm -r $cfg/libhello-1.0.0
- test pkg-purge -f libhello
- stat libhello unknown
-fi
-
-# dependency management
-#
-test rep-create pkg/1/build2.org/depend/stable
-test cfg-create --wipe
-test rep-add $rep/depend/stable
-test rep-fetch --trust-yes
-
-test pkg-fetch libbar/1.0.0
-test pkg-unpack libbar
-fail pkg-configure libbar # no libfoo
-stat libbar/1.0.0 "unpacked; available"
-test pkg-fetch libfoo/1.0.0
-test pkg-unpack libfoo
-fail pkg-configure libbar # libfoo not configured
-test pkg-configure libfoo
-test pkg-configure libbar
-fail pkg-disfigure libfoo # libbar still depends on libfoo
-test pkg-disfigure libbar
-test pkg-disfigure libfoo
-test pkg-purge libbar
-test pkg-purge libfoo
-
-test pkg-fetch libfoo/1.0.0
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-fetch libbar/1.1.0
-test pkg-unpack libbar
-fail pkg-configure libbar # libfoo >= 1.1.0
-test pkg-disfigure libfoo
-test pkg-purge libfoo
-test pkg-fetch libfoo/1.1.0
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-configure libbar
-test pkg-disfigure libbar
-test pkg-disfigure libfoo
-test pkg-purge libfoo
-test pkg-purge libbar
-
-test pkg-fetch libfoo/1.1.0
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-fetch libbar/1.2.0
-test pkg-unpack libbar
-fail pkg-configure libbar # libfoo >= 1.2.0
-test pkg-disfigure libfoo
-test pkg-purge libfoo
-test pkg-fetch libfoo/1.2.0
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-configure libbar
-fail pkg-disfigure libfoo # "package libbar on libfoo >= 1.2.0"
-test pkg-disfigure libbar
-test pkg-disfigure libfoo
-test pkg-purge libfoo
-test pkg-purge libbar
-
-test pkg-fetch libfoo/1.1.0
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-fetch libbar/1.3.0
-test pkg-unpack libbar
-fail pkg-configure libbar # incompatible constraints
-test pkg-disfigure libfoo
-test pkg-purge libfoo
-test pkg-purge libbar
-
-
-##
-## pkg-status (also tested in pkg-{fetch,unpack,configure,disfigure,purge})
-##
-test rep-create pkg/1/build2.org/status/stable
-test rep-create pkg/1/build2.org/status/extra
-test rep-create pkg/1/build2.org/status/testing
-test rep-create pkg/1/build2.org/status/unstable
-
-# basics
-#
-test cfg-create --wipe
-stat libfoo/1.0.0 "unknown"
-stat libfoo "unknown"
-test rep-add $rep/status/stable
-test rep-fetch --trust-yes
-stat libfoo/1.0.0 "available"
-stat libfoo "available 1.0.0 sys:?"
-test pkg-fetch libfoo/1.0.0
-stat libfoo/1.0.0 "fetched; available"
-stat libfoo "fetched 1.0.0; available sys:?"
-
-# multiple versions/revisions
-#
-test cfg-create --wipe
-test rep-add $rep/status/extra
-test rep-fetch --trust-yes
-stat libbar "available 1.1.0+1 sys:?"
-test rep-add $rep/status/stable
-test rep-fetch --trust-yes
-stat libbar "available 1.1.0+1 1.0.0 sys:?"
-
-test cfg-create --wipe
-test rep-add $rep/status/testing
-test rep-fetch --trust-yes
-stat libbar "available 1.1.0 1.0.0+1 1.0.0 sys:?"
-
-test cfg-create --wipe
-test rep-add $rep/status/unstable
-test rep-fetch --trust-yes
-stat libbar "available 2.0.0 1.1.0 1.0.0+1 1.0.0 sys:?"
-test pkg-fetch libbar/1.0.0+1
-stat libbar "fetched 1.0.0+1; available 2.0.0 1.1.0 sys:?"
-test pkg-purge libbar
-test pkg-fetch libbar/2.0.0
-stat libbar "fetched 2.0.0; available sys:?"
-
-
-##
-## pkg-update
-##
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-
-fail pkg-update # package name expected
-fail pkg-update libhello # no such package
-test pkg-fetch libhello/1.0.0
-fail pkg-update libhello # wrong package state
-test pkg-purge libhello
-
-# src == out
-#
-test pkg-fetch libhello/1.0.0
-test pkg-unpack libhello
-test pkg-configure libhello $cxx_options
-test pkg-update libhello
-test pkg-update libhello
-test pkg-disfigure libhello
-test pkg-purge libhello
-
-# src != out
-#
-test cfg-create --wipe
-test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
-test pkg-configure libhello $cxx_options
-test pkg-update libhello
-test pkg-update libhello
-test pkg-disfigure libhello
-test pkg-purge libhello
-
-
-##
-## pkg-clean
-##
-test cfg-create --wipe
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-
-fail pkg-clean # package name expected
-fail pkg-clean libhello # no such package
-test pkg-fetch libhello/1.0.0
-fail pkg-clean libhello # wrong package state
-test pkg-purge libhello
-
-# src == out
-#
-test pkg-fetch libhello/1.0.0
-test pkg-unpack libhello
-test pkg-configure libhello $cxx_options
-test pkg-update libhello
-test pkg-clean libhello
-test pkg-clean libhello
-test pkg-disfigure libhello
-test pkg-purge libhello
-
-# src != out
-#
-test cfg-create --wipe
-test pkg-unpack -e pkg/1/build2.org/common/libhello-1.0.0
-test pkg-configure libhello $cxx_options
-test pkg-update libhello
-test pkg-clean libhello
-test pkg-clean libhello
-test pkg-disfigure libhello
-test pkg-purge libhello
-
-
-##
-## Low-level command scenarios.
-##
-
-
-# build and clean package
-#
-test cfg-create --wipe cxx $cxx_options
-test rep-add $rep/common/hello
-test rep-fetch --trust $hello_fp
-test pkg-fetch libhello/1.0.0
-test pkg-unpack libhello
-test pkg-configure libhello $cxx_options
-test pkg-update libhello
-test pkg-clean libhello
-test pkg-disfigure libhello
-test pkg-purge libhello
-
-##
-## pkg-build
-##
-
-# 1 (libfoo)
-#
-test rep-create pkg/1/build2.org/satisfy/t1
-test cfg-create --wipe
-
-fail pkg-build -p # package name expected
-fail pkg-build -p libfoo # unknown package
-fail pkg-build -p libfoo/1.0.0 # unknown package
-test pkg-build -p pkg/1/build2.org/satisfy/libfoo-1.1.0.tar.gz <<EOF
-build libfoo/1.1.0
-EOF
-test pkg-build -p pkg/1/build2.org/satisfy/libfoo-1.1.0/ <<EOF
-build libfoo/1.1.0
-EOF
-
-test pkg-unpack -e pkg/1/build2.org/satisfy/libfoo-1.1.0
-test pkg-build -p libfoo <<< "build libfoo/1.1.0"
-test pkg-build -p libfoo/1.1.0 <<< "build libfoo/1.1.0"
-test pkg-build -p libfoo libfoo <<< "build libfoo/1.1.0"
-fail pkg-build -p libfoo libfoo/1.1.0
-fail pkg-build -p libfoo/1.1.0 libfoo
-test pkg-build -p libfoo/1.1.0 libfoo/1.1.0 <<< "build libfoo/1.1.0"
-fail pkg-build -p libfoo/1.0.0
-test pkg-purge libfoo
-
-test rep-add $rep/satisfy/t1
-test rep-fetch --trust-yes
-test pkg-build -p libfoo <<< "build libfoo/1.0.0"
-test pkg-build -p libfoo/1.0.0 <<< "build libfoo/1.0.0"
-fail pkg-build -p libfoo/1.1.0
-
-test pkg-unpack -e pkg/1/build2.org/satisfy/libfoo-1.1.0
-test pkg-build -p libfoo <<< "build libfoo/1.1.0"
-test pkg-build -p libfoo/1.0.0 <<< "downgrade libfoo/1.0.0"
-fail pkg-build -p libfoo/0.0.1
-test pkg-purge libfoo
-
-test pkg-fetch -e pkg/1/build2.org/satisfy/libfoo-0.0.1.tar.gz
-test pkg-unpack libfoo
-test pkg-build -p libfoo <<< "upgrade libfoo/1.0.0"
-test pkg-build -p libfoo/0.0.1 <<< "build libfoo/0.0.1"
-fail pkg-build -p libfoo/1.1.0
-test pkg-purge libfoo
-
-# 2 (libbar depends on libfoo)
-#
-test rep-create pkg/1/build2.org/satisfy/t2
-test cfg-create --wipe
-
-fail pkg-build pkg/1/build2.org/satisfy/libbar-1.0.0.tar.gz
-
-test rep-add $rep/satisfy/t2
-test rep-fetch --trust-yes
-
-test pkg-build -p libbar <<EOF
-build libfoo/1.0.0 (required by libbar)
-build libbar/1.0.0
-EOF
-test pkg-build -p libbar libfoo <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0
-EOF
-test pkg-build -p libbar libfoo/1.0.0 <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0
-EOF
-fail pkg-build -p libbar libfoo libbar/1.0.0
-fail pkg-build -p libbar libfoo/1.1.0
-
-test pkg-fetch -e pkg/1/build2.org/satisfy/libfoo-0.0.1.tar.gz
-test pkg-unpack libfoo
-test pkg-build -p libbar <<EOF
-build libfoo/0.0.1 (required by libbar)
-build libbar/1.0.0
-EOF
-test pkg-build -p libbar libfoo <<EOF
-upgrade libfoo/1.0.0
-build libbar/1.0.0
-EOF
-test pkg-build -p libbar libfoo/0.0.1 <<EOF
-build libfoo/0.0.1
-build libbar/1.0.0
-EOF
-test pkg-purge libfoo
-
-test pkg-unpack -e pkg/1/build2.org/satisfy/libfoo-1.1.0
-test pkg-build -p libbar <<EOF
-build libfoo/1.1.0 (required by libbar)
-build libbar/1.0.0
-EOF
-test pkg-build -p libbar libfoo <<EOF
-build libfoo/1.1.0
-build libbar/1.0.0
-EOF
-test pkg-build -p libbar libfoo/1.0.0 <<EOF
-downgrade libfoo/1.0.0
-build libbar/1.0.0
-EOF
-test pkg-purge libfoo
-
-# 3 (libbaz depends on libbar; libbar in prerequisite repository)
-#
-test rep-create pkg/1/build2.org/satisfy/t3
-test cfg-create --wipe
-test rep-add $rep/satisfy/t3
-test rep-fetch --trust-yes
-
-# only in prerequisite repository
-#
-fail pkg-build -p libfoo
-fail pkg-build -p libbar
-fail pkg-build -p libbaz libbar
-
-test pkg-build -p libbaz <<EOF
-build libfoo/1.0.0 (required by libbar)
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test rep-add $rep/satisfy/t2
-test rep-fetch
-
-# order
-#
-test pkg-build -p libfox libfoo <<EOF
-build libfox/1.0.0
-build libfoo/1.0.0
-EOF
-
-test pkg-build -p libfoo libfox <<EOF
-build libfoo/1.0.0
-build libfox/1.0.0
-EOF
-
-test pkg-build -p libbaz libfoo <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libfoo libbaz <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libbaz libfox <<EOF
-build libfoo/1.0.0 (required by libbar)
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-build libfox/1.0.0
-EOF
-
-test pkg-build -p libfox libbaz <<EOF
-build libfox/1.0.0
-build libfoo/1.0.0 (required by libbar)
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libfox libfoo libbaz <<EOF
-build libfox/1.0.0
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libfox libbaz libfoo <<EOF
-build libfox/1.0.0
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libfoo libfox libbaz <<EOF
-build libfoo/1.0.0
-build libfox/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libfoo libbaz libfox <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-build libfox/1.0.0
-EOF
-
-# this one is contradictory: baz before fox but fox before foo
-#
-test pkg-build -p libbaz libfox libfoo <<EOF
-build libfox/1.0.0
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libbaz libfoo libfox <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0 (required by libbaz)
-build libbaz/1.0.0
-build libfox/1.0.0
-EOF
-
-test pkg-build -p libbaz libfoo libbar <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0
-build libbaz/1.0.0
-EOF
-
-test pkg-build -p libbaz libbar libfoo <<EOF
-build libfoo/1.0.0
-build libbar/1.0.0
-build libbaz/1.0.0
-EOF
-
-# 4 (libbaz depends on libfoo and libbar; libbar depends on libfoo >= 1.1.0)
-#
-test rep-create pkg/1/build2.org/satisfy/t4a
-test rep-create pkg/1/build2.org/satisfy/t4b
-test rep-create pkg/1/build2.org/satisfy/t4c
-test rep-create pkg/1/build2.org/satisfy/t4d
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-
-test pkg-build -p libbaz <<EOF
-build libfoo/1.1.0 (required by libbar libbaz)
-build libbar/1.1.0 (required by libbaz)
-build libbaz/1.1.0
-EOF
-
-test pkg-build -p libfoo libbaz <<EOF
-build libfoo/1.1.0
-build libbar/1.1.0 (required by libbaz)
-build libbaz/1.1.0
-EOF
-
-fail pkg-build -p libfoo/1.0.0 libbaz
-fail pkg-build -p libfoo/1.1.0 libbaz
-
-# upgrade warning
-#
-test pkg-fetch -e pkg/1/build2.org/satisfy/libfoo-0.0.1.tar.gz
-test pkg-unpack libfoo
-test pkg-build -p libbaz <<EOF
-upgrade libfoo/1.1.0 (required by libbar libbaz)
-build libbar/1.1.0 (required by libbaz)
-build libbaz/1.1.0
-EOF
-test pkg-purge libfoo
-
-# downgrade error
-#
-test pkg-fetch -e pkg/1/build2.org/satisfy/libfoo-1.2.0.tar.gz
-test pkg-unpack libfoo
-fail pkg-build -p libbaz
-test rep-add $rep/satisfy/t4a
-test rep-fetch --trust-yes
-test pkg-build -p libfoo/1.1.0 libbaz <<EOF
-downgrade libfoo/1.1.0
-build libbar/1.1.0 (required by libbaz)
-build libbaz/1.1.0
-EOF
-test pkg-purge libfoo
-
-# dependent prevents upgrade/downgrade
-#
-test pkg-fetch libfoo/1.1.0
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-fetch libbar/1.1.0
-test pkg-unpack libbar
-test pkg-configure libbar
-fail pkg-build -p pkg/1/build2.org/satisfy/libfoo-1.2.0.tar.gz
-fail pkg-build -p libfoo/1.0.0
-test pkg-build -p libfoo/1.1.0 <<< "build libfoo/1.1.0"
-test pkg-disfigure libbar
-test pkg-disfigure libfoo
-test pkg-purge libbar
-test pkg-purge libfoo
-
-# dependent reconfigure
-#
-test cfg-create --wipe
-
-test pkg-fetch -e pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gz
-test pkg-unpack libfoo
-test pkg-configure libfoo
-test pkg-fetch -e pkg/1/build2.org/satisfy/libbar-1.0.0.tar.gz
-test pkg-unpack libbar
-test pkg-configure libbar
-test pkg-fetch -e pkg/1/build2.org/satisfy/libbaz-1.1.0.tar.gz
-test pkg-unpack libbaz
-test pkg-configure libbaz
-
-test rep-add $rep/satisfy/t4a
-test rep-add $rep/satisfy/t4b
-test rep-fetch --trust-yes
-
-test pkg-build -p libbar <<EOF
-upgrade libfoo/1.1.0 (required by libbar libbaz)
-upgrade libbar/1.1.0
-reconfigure libbaz (dependent of libbar)
-EOF
-
-test pkg-build -p libfoo <<EOF
-upgrade libfoo/1.1.0
-reconfigure libbar (dependent of libfoo)
-reconfigure libbaz (dependent of libbar)
-EOF
-
-test pkg-build -p libfoo libbar/1.0.0 <<EOF
-upgrade libfoo/1.1.0
-reconfigure/build libbar/1.0.0
-reconfigure libbaz (dependent of libbar)
-EOF
-
-test pkg-build -p libbar/1.0.0 libfoo <<EOF
-upgrade libfoo/1.1.0
-reconfigure/build libbar/1.0.0
-reconfigure libbaz (dependent of libbar)
-EOF
-
-test pkg-build -p libbaz libfoo <<EOF
-upgrade libfoo/1.1.0
-reconfigure libbar (dependent of libbaz libfoo)
-reconfigure/build libbaz/1.1.0
-EOF
-
-test pkg-build -p libbaz libfoo/1.0.0 <<EOF
-build libfoo/1.0.0
-build libbaz/1.1.0
-EOF
-
-# actually build
-#
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libbaz
-stat libfoo/1.1.0 "configured; available"
-stat libbar/1.1.0 "configured"
-stat libbaz/1.1.0 "configured hold_package; available"
-
-# hold
-#
-test cfg-create --wipe
-test pkg-build -y pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gz
-stat libfoo "configured 1.0.0 hold_package hold_version"
-test pkg-build -y pkg/1/build2.org/satisfy/libfoo-1.1.0/
-stat libfoo "configured 1.1.0 hold_package hold_version"
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libfoo
-stat libfoo "configured 1.0.0 hold_package; available sys:?"
-test pkg-build -y libfoo/1.0.0
-stat libfoo "configured 1.0.0 hold_package hold_version; available sys:?"
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libfoo/1.0.0
-stat libfoo "configured 1.0.0 hold_package hold_version; available sys:?"
-
-test cfg-create --wipe
-test pkg-fetch -e pkg/1/build2.org/satisfy/libfoo-1.0.0.tar.gz
-test pkg-unpack libfoo
-test pkg-configure libfoo
-stat libfoo "configured 1.0.0"
-test pkg-build -y libfoo
-stat libfoo "configured 1.0.0 hold_package"
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libfoo
-stat libfoo "configured 1.0.0 hold_package; available sys:?"
-test pkg-build -y libbaz
-stat libfoo "configured 1.1.0 hold_package; available sys:?"
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libfoo/1.0.0
-stat libfoo "configured 1.0.0 hold_package hold_version; available sys:?"
-fail pkg-build -y libbaz
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libbaz
-stat libfoo "configured 1.1.0; available sys:?"
-
-# drop prerequisites on downgrade
-#
-test rep-create pkg/1/build2.org/satisfy/t5
-test cfg-create --wipe
-test rep-add $rep/satisfy/t2
-test rep-fetch --trust-yes
-
-test pkg-build -y libbar
-stat libfoo "configured 1.0.0; available sys:?"
-stat libbar "configured 1.0.0 hold_package; available sys:?"
-
-test rep-add $rep/satisfy/t5
-test rep-fetch --trust-yes
-
-test pkg-build -y libbar
-stat libfoo "available 1.0.0 sys:?"
-stat libbar "configured 1.2.0 hold_package; available sys:?"
-
-test pkg-build -y libbar/1.0.0 libfoo
-stat libfoo "configured 1.0.0 hold_package; available sys:?"
-stat libbar "configured 1.0.0 hold_package hold_version; available 1.2.0 sys:?"
-
-test pkg-build -y libbar
-stat libfoo "configured 1.0.0 hold_package; available sys:?"
-stat libbar "configured 1.2.0 hold_package; available sys:?"
-
-##
-## pkg-drop
-##
-test cfg-create --wipe
-
-fail pkg-drop -p # package name expected
-fail pkg-drop -p libfoo # unknown package
-fail pkg-drop -p libfoo/1.0.0 # unknown package
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4c
-test rep-fetch --trust-yes
-test pkg-build -y libbaz
-
-test pkg-drop -p -y libfoo libbaz libbar <<EOF
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-# dependents
-#
-fail pkg-drop -y libfoo
-fail pkg-drop -y libfoo libbar
-fail pkg-drop -y libfoo libbaz
-
-test pkg-drop -p -y --drop-dependent libfoo <<EOF
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-test pkg-drop -p --drop-dependent libfoo libbaz <<EOF
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-test pkg-drop -p --drop-dependent libbaz libfoo <<EOF
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-# prerequisites
-#
-test pkg-drop -p -y libbaz <<EOF
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-test pkg-drop -p -n libbaz <<EOF
-drop libbaz
-EOF
-
-test pkg-drop -p -n libbar libbaz <<EOF
-drop libbaz
-drop libbar
-EOF
-
-test pkg-drop -p -n libbaz libbar <<EOF
-drop libbaz
-drop libbar
-EOF
-
-# prerequisites and dependents
-#
-test pkg-drop -p -y --drop-dependent libbar <<EOF
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-test cfg-create --wipe
-test rep-add $rep/satisfy/t4d
-test rep-fetch --trust-yes
-test pkg-build -y libbiz
-
-test pkg-drop -p -y libbiz <<EOF
-drop libbiz
-drop libbaz
-drop libbar
-drop libfoo
-drop libfox
-EOF
-
-test pkg-drop -p -y libfox libbiz <<EOF
-drop libbiz
-drop libfox
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-test pkg-drop -p -y --drop-dependent libfox <<EOF
-drop libbiz
-drop libfox
-drop libbaz
-drop libbar
-drop libfoo
-EOF
-
-test pkg-drop -p -y --drop-dependent libbaz <<EOF
-drop libbiz
-drop libbaz
-drop libbar
-drop libfoo
-drop libfox
-EOF
-
-test pkg-drop -p -y --drop-dependent libbar <<EOF
-drop libbiz
-drop libbaz
-drop libbar
-drop libfoo
-drop libfox
-EOF
-
-test pkg-drop -p -y --drop-dependent libfoo <<EOF
-drop libbiz
-drop libbaz
-drop libbar
-drop libfoo
-drop libfox
-EOF
-
-test pkg-drop -p -n --drop-dependent libfox libbaz <<EOF
-drop libbiz
-drop libfox
-drop libbaz
-EOF
-
-test pkg-drop -p -n --drop-dependent libbaz libfox <<EOF
-drop libbiz
-drop libbaz
-drop libfox
-EOF
-
-test pkg-drop -p -n --drop-dependent libfox libbar <<EOF
-drop libbiz
-drop libfox
-drop libbaz
-drop libbar
-EOF
-
-test pkg-drop -p -n --drop-dependent libbar libfox <<EOF
-drop libbiz
-drop libbaz
-drop libbar
-drop libfox
-EOF
-
-# actually drop
-#
-test pkg-drop -y --drop-dependent libbar
-stat libfox/1.0.0 "available"
-stat libfoo/1.1.0 "unknown"
-stat libbar/1.1.0 "unknown"
-stat libbaz/1.1.0 "unknown"
-stat libbiz/1.0.0 "available"
-
-##
-## auth
-##
-
-# rep-create
-#
-fail rep-create pkg/1/build2.org/auth/create-noemail --key key.pem
-fail rep-create pkg/1/build2.org/auth/create-expired --key key.pem
-
-fail rep-create pkg/1/build2.org/auth/signed # no --key option
-test rep-create pkg/1/build2.org/auth/signed --key key.pem
-test rep-create pkg/1/build2.org/auth/unsigned1
-test rep-create pkg/1/build2.org/auth/unsigned2
-test rep-create pkg/1/build2.org/auth/name-mismatch --key key.pem
-
-test rep-create pkg/1/build2.org/auth/sha256sum-mismatch --key key.pem
-
-# Tamper signature manifest's sha256sum value.
-#
-s=d374c59b36fdbdbd0d4468665061d94fda9c6c687863dfe72b0bcc34ff9d5fb4
-edit pkg/1/build2.org/auth/sha256sum-mismatch/signature \
- "s/^\(sha256sum: \).*\$/\1$s/"
-
-test rep-create pkg/1/build2.org/auth/signature-mismatch --key key.pem
-
-# Tamper signature manifest's signature value.
-#
-edit pkg/1/build2.org/auth/signature-mismatch/signature \
- '/^signature: \\$/,/^\\$/d'
-cat >> pkg/1/build2.org/auth/signature-mismatch/signature << EOF
-signature: \\
-XBjnmXXVHY0RqMI0gL/P4t/vuWwK9JJkLl4Qf2gMxq5k2WQ2CIE56DfG0RaGklgKcI3UxsQZvMQI
-5PNtAHJDjteQ+BqY0io8A43KPX+2LKMU+I825sKmPRjCLYleGM3mNndDkWfYtAzYk5AmR2piqRz0
-D7CLq9GIoQQZO4Fw44muaQDMCRcXy8Txx2jDnretQjx/C0ZQw4M/cd6/cKEKUmLITDkBig9oVlSh
-tpxHqWz5NTbO3vm8ILc03AwiOJHwZweLb6ocJ6a467IJa+F/xUm9B09k8wFWMs+jHXXzHDE0syv7
-lqWL7SvHSjVFrGVFKS6nx7lCj2b8XFiGlwWIwjY4m/VK/5QmbL/lC4f+ww5XT5NG5iYh/eMaCxCJ
-zTg5iZsWNLhrx9uKNrL5xC4z0OONRVOwzu7gsqr0GLWewPyhH0AqJLgOSkw9N7FJwbv2IKNZ88YA
-u2YMXNkXytcQvENLVQDX5oxvUMEurUJFOCuYB/SEnpcwkV5h9RtXzIFVy4OCTU2MhQHDEldI8s7w
-Hga/ct4WupgE228gGdgwJLCbHx6AWBlS9iL10AdS8JkQ9LaZwTMHHz44f8y00X4MiT06gpgDeoQD
-rUyP0KNG65tdWnVTMqg6Q/YXhtRZLHoD6+QbiYLlruR1phu4y4fDt7AKxoXfeme/a86A37UogZY=
-\\
-EOF
-
-# rep-fetch
-#
-signed_fp=`rep_cert_fp pkg/1/build2.org/auth/signed`
-test cfg-create --wipe
-test rep-add $rep/auth/signed
-test rep-fetch --trust $signed_fp
-test rep-fetch
-
-test cfg-create --wipe
-test rep-add $rep/auth/signed
-test rep-fetch --trust-no --trust $signed_fp
-test rep-fetch
-test rep-fetch --trust-no # certificate is already trusted
-
-test cfg-create --wipe
-test rep-add $rep/auth/signed
-test rep-fetch --trust-yes
-test rep-fetch
-
-test cfg-create --wipe
-test rep-add $rep/auth/signed
-fail rep-fetch --trust-no
-
-test cfg-create --wipe
-test rep-add $rep/auth/signed
-fail rep-fetch --trust-yes --trust-no # inconsistent options
-
-test cfg-create --wipe
-test rep-add $rep/auth/unsigned1
-test rep-fetch --trust-yes
-test rep-fetch
-test rep-add $rep/auth/unsigned2
-test rep-fetch
-test rep-fetch --trust-no # certificates are already trusted
-
-test cfg-create --wipe
-test rep-add $rep/auth/unsigned1
-fail rep-fetch --trust-no
-
-test cfg-create --wipe
-test rep-add $rep/auth/name-mismatch
-fail rep-fetch --trust-yes # certificate name mismatch
-
-test cfg-create --wipe
-test rep-add $rep/auth/expired
-fail rep-fetch --trust-yes # certificate expired
-
-test cfg-create --wipe
-test rep-add $rep/auth/sha256sum-mismatch
-fail rep-fetch --trust-yes # packages file checksum mismatch
-
-test cfg-create --wipe
-test rep-add $rep/auth/signature-mismatch
-fail rep-fetch --trust-yes # packages file signature:mismatch
-
-# rep-info
-#
-test cfg-create --wipe
-test rep-info --trust-no --trust $signed_fp -d $cfg $rep/auth/signed <<EOF
-${repn}auth/signed `location auth/signed`
-CN=build2.org/O=Code Synthesis/info@build2.org
-$signed_fp
-
-libfoo/1.0.0
-EOF
-
-test rep-info --trust-no -d $cfg $rep/auth/signed <<EOF
-${repn}auth/signed `location auth/signed`
-CN=build2.org/O=Code Synthesis/info@build2.org
-$signed_fp
-
-libfoo/1.0.0
-EOF
-
-test cfg-create --wipe
-test rep-info --trust-yes $rep/auth/signed <<EOF
-${repn}auth/signed `location auth/signed`
-CN=build2.org/O=Code Synthesis/info@build2.org
-$signed_fp
-
-libfoo/1.0.0
-EOF
-
-fail rep-info --trust-no $rep/auth/signed <<EOF
-${repn}auth/signed `location auth/signed`
-CN=build2.org/O=Code Synthesis/info@build2.org
-$signed_fp
-
-libfoo/1.0.0
-EOF
-
-test cfg-create --wipe
-test rep-info --trust-yes -d $cfg $rep/auth/unsigned1 <<EOF
-${repn}auth/unsigned1 `location auth/unsigned1`
-
-libfoo/1.0.0
-EOF
-
-test rep-info --trust-no -d $cfg $rep/auth/unsigned2 <<EOF
-${repn}auth/unsigned2 `location auth/unsigned2`
-
-libfoo/1.0.0
-EOF
-
-test cfg-create --wipe
-test rep-info --trust-yes $rep/auth/unsigned1 <<EOF
-${repn}auth/unsigned1 `location auth/unsigned1`
-
-libfoo/1.0.0
-EOF
-
-fail rep-info --trust-no $rep/auth/unsigned1 <<EOF
-${repn}auth/unsigned1 `location auth/unsigned1`
-
-libfoo/1.0.0
-EOF
-
-##
-## system
-##
-
-test rep-create pkg/1/build2.org/system/t1 # foo/2 (->libbar>=2), libbar/2
-test rep-create pkg/1/build2.org/system/t2 # foo/2 (->libbar>=2), libbar/0+1
-test rep-create pkg/1/build2.org/system/t3 # ->t2; foo/2 (->libbar>=2)
-
-function build ()
-{
- test build -p $*
- test build -y $*
-}
-
-# Fetch system/t1 repository: foo/2 (->libbar/2), libbar/2
-#
-test cfg-create --wipe
-test rep-add $rep/system/t1
-test rep-fetch --trust-yes
-
-# Fail to build different combinations of package duplicates on the command
-# line.
-#
-fail build sys:libbar ?sys:libbar
-fail build ?sys:libbar sys:libbar
-fail build ?sys:libbar libbar
-fail build libbar ?sys:libbar
-fail build sys:libbar libbar
-fail build libbar sys:libbar
-
-# Build sys:libbar/*.
-#
-build sys:libbar <<< 'configure sys:libbar/*'
-stat libbar \
- 'configured,system * hold_package hold_version; available 2 1 sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Build foo with preconfigured sys:libbar/*.
-#
-build foo <<< "build foo/2"
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar \
- 'configured,system * hold_package hold_version; available 2 1 sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Reconfigure sys:libbar/* to 2.
-#
-build sys:libbar/2 <<EOF
-reconfigure sys:libbar/2
-reconfigure foo (dependent of libbar)
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Reconfigure sys:libbar/2 to libbar/2.
-#
-build libbar/2 <<EOF
-build libbaz/2 (required by libbar)
-reconfigure/build libbar/2
-reconfigure foo (dependent of libbar)
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured 2 hold_package hold_version; available sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-# Drop all, build foo and sys:libbar/2.
-#
-test pkg-drop -y foo libbar
-
-build foo sys:libbar/2 <<EOF
-configure sys:libbar/2
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Drop all, build sys:libbar/2 and foo.
-#
-test pkg-drop -y foo libbar
-
-build sys:libbar/2 foo <<EOF
-configure sys:libbar/2
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Drop all, build libbar/2, then foo and sys:libbar/2.
-#
-test pkg-drop -y foo libbar
-
-build libbar/2 <<EOF
-build libbaz/2 (required by libbar)
-build libbar/2
-EOF
-stat libbar 'configured 2 hold_package hold_version; available sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-build foo sys:libbar/2 <<EOF
-reconfigure sys:libbar/2
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Drop all, build libbar/2, then foo and sys:libbar/2.
-#
-test pkg-drop -y foo libbar
-
-build libbar/2 <<EOF
-build libbaz/2 (required by libbar)
-build libbar/2
-EOF
-stat libbar 'configured 2 hold_package hold_version; available sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-build foo sys:libbar <<EOF
-reconfigure sys:libbar/*
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar \
- 'configured,system * hold_package hold_version; available 2 1 sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Drop all, build sys:libbar/2, then foo and libbar/2, then reconfigure to
-# sys:libbar/2 and afterwards to libbar/2.
-#
-test pkg-drop -y foo libbar
-
-build sys:libbar/2 <<< "configure sys:libbar/2"
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-
-build foo libbar/2 <<EOF
-build libbaz/2 (required by libbar)
-reconfigure/build libbar/2
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured 2 hold_package hold_version; available sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-build sys:libbar/2 <<EOF
-reconfigure sys:libbar/2
-reconfigure foo (dependent of libbar)
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-build libbar/2 <<EOF
-build libbaz/2 (required by libbar)
-reconfigure/build libbar/2
-reconfigure foo (dependent of libbar)
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured 2 hold_package hold_version; available sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-# Drop all, configure sys:libbar/1, then fail to build foo but succeed to
-# build foo libbar.
-#
-test pkg-drop -y foo libbar
-
-build sys:libbar/1 <<< "configure sys:libbar/1"
-stat libbar 'configured,system 1 hold_package hold_version; available 2 sys:?'
-stat libbaz 'available 2 sys:?'
-
-fail build foo
-
-build foo libbar <<EOF
-build libbaz/2 (required by libbar)
-upgrade libbar/2
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured 2 hold_package; available sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-# Drop all, then build foo ?sys:libbar.
-#
-test pkg-drop -y foo libbar
-
-build foo ?sys:libbar<<EOF
-configure sys:libbar/* (required by foo)
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system *; available 2 1 sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Drop all, configure libbar/1, then fail to build foo and foo ?sys:libbar/2,
-# but succeed to build foo sys:libbar/2.
-#
-test pkg-drop -y foo libbar
-
-build libbar/1 <<EOF
-build libbaz/2 (required by libbar)
-build libbar/1
-EOF
-stat libbar 'configured 1 hold_package hold_version; available 2 sys:?'
-stat libbaz 'configured 2; available sys:?'
-
-fail build foo
-
-build foo ?sys:libbar/2<<EOF
-reconfigure sys:libbar/2 (required by foo)
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-build foo sys:libbar/2 <<EOF
-reconfigure sys:libbar/2
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-stat libbaz 'available 2 sys:?'
-
-# Fetch system/t2 repository: foo/2 (->libbar>=2), libbar/0+1
-#
-test cfg-create --wipe
-test rep-add $rep/system/t2
-test rep-fetch --trust-yes
-
-# Fail to build foo having no system package configured.
-#
-fail build foo
-fail build foo libbar
-stat foo 'available 2 sys:?'
-stat libbar 'available sys:?'
-
-# Build foo configuring sys:libbar.
-#
-build foo sys:libbar <<EOF
-configure sys:libbar/*
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system * hold_package hold_version; available sys:?'
-
-# Drop all, configure sys:libbar/1, then fail to build foo, but succeed to
-# build foo sys:libbar/2.
-#
-test pkg-drop -y foo libbar
-
-build sys:libbar/1 <<< "configure sys:libbar/1"
-stat libbar 'configured,system 1 hold_package hold_version; available sys:?'
-
-fail build foo
-build foo sys:libbar/2 <<EOF
-reconfigure sys:libbar/2
-build foo/2
-EOF
-
-# Drop all, fail to build build foo sys:libbar/1, then configure sys:libbar/2
-# but still fail to build foo sys:libbar/1.
-#
-test pkg-drop -y foo libbar
-
-fail build foo sys:libbar/1
-
-build sys:libbar/2 <<< "configure sys:libbar/2"
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-
-fail build foo sys:libbar/1
-
-# Drop all, configure sys:libbar/1, then fail to build sys:libbar/1.1 foo.
-#
-test pkg-drop -y libbar
-
-build sys:libbar/1 <<< "configure sys:libbar/1"
-stat libbar 'configured,system 1 hold_package hold_version; available sys:?'
-
-fail build sys:libbar/1.1 foo
-
-# Drop all, build foo ?sys:libbar, then drop foo and make sure libbar is purged
-# as well.
-#
-test pkg-drop -y libbar
-
-build foo ?sys:libbar<<EOF
-configure sys:libbar/* (required by foo)
-build foo/2
-EOF
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system *; available sys:?'
-
-test pkg-drop -y foo
-stat foo 'available 2 sys:?'
-stat libbar 'available sys:?'
-
-# Build sys:libbar/1, then build foo ?sys:libbar, then drop foo and make sure
-# libbar stays.
-#
-build sys:libbar/1<<EOF
-configure sys:libbar/1
-EOF
-stat libbar 'configured,system 1 hold_package hold_version; available sys:?'
-
-fail build foo
-
-build foo ?sys:libbar/2 <<EOF
-reconfigure sys:libbar/2 (required by foo)
-build foo/2
-EOF
-
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-
-test pkg-drop -y foo
-stat foo 'available 2 sys:?'
-stat libbar 'configured,system 2 hold_package hold_version; available sys:?'
-
-# Fetch system/t2 repository: foo/2 (->libbar>=2), libbar/0+1
-#
-test cfg-create --wipe
-test rep-add $rep/system/t3 # ->t2; foo/2 (->libbar>=2)
-test rep-fetch --trust-yes
-
-# After test number of faulty builds, then build foo ?sys:libbar/2. Afterwards
-# fail attempts to reconfigure libbar.
-#
-fail build foo
-fail build sys:libbar/1
-fail build foo sys:libbar/1
-fail build foo ?sys:libbar/1
-stat foo 'available 2 sys:?'
-stat libbar 'unknown'
-
-build foo ?sys:libbar/2 <<EOF
-configure sys:libbar/2 (required by foo)
-build foo/2
-EOF
-
-# libbar while being selected is still unknown.
-#
-fail build sys:libbar
-fail build foo sys:libbar
-
-build foo ?sys:libbar/3 <<EOF
-build foo/2
-EOF
-
-build foo ?sys:libbar <<EOF
-build foo/2
-EOF
-
-stat foo 'configured 2 hold_package; available sys:?'
-stat libbar 'configured,system 2'