From 7e4b2dcd0e5ddd37276879e699fd84059183f5e2 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 6 Mar 2018 23:52:11 +0300 Subject: Add support for dir repository --- tests/pkg-build.test | 18 +++++++++++- tests/pkg-checkout.test | 2 +- tests/pkg-fetch.test | 8 +++--- tests/pkg-status.test | 2 +- tests/pkg-unpack.test | 74 ++++++++++++++++++++++++++++++++++++++++++++----- tests/rep-fetch.test | 33 ++++++++++++++++++++-- tests/rep-info.test | 2 +- tests/rep-list.test | 2 +- tests/rep-remove.test | 2 +- 9 files changed, 124 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/pkg-build.test b/tests/pkg-build.test index 879fc43..03ed040 100644 --- a/tests/pkg-build.test +++ b/tests/pkg-build.test @@ -1447,7 +1447,23 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! } } -: git-repos +: dir-rep +: +{ + $clone_root_cfg && $rep_add $src/libfoo-1.1.0 --type dir && $rep_fetch; + + $* libfoo 2>>~%EOE%; + using libfoo/1.1.0 (external) + configured libfoo/1.1.0 + %info: .+dir\{libfoo-1.1.0.\} is up to date% + updated libfoo/1.1.0 + EOE + + $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0'; + $pkg_purge libfoo 2>'purged libfoo/1.1.0' +} + +: git-rep : if ($git_supported != true) { diff --git a/tests/pkg-checkout.test b/tests/pkg-checkout.test index ec750e6..714ad5b 100644 --- a/tests/pkg-checkout.test +++ b/tests/pkg-checkout.test @@ -21,7 +21,7 @@ $git_extract $src/git/style-basic1.tar &$out_git/state1/*** end -: git-repos +: git-rep : if ($git_supported != true) { diff --git a/tests/pkg-fetch.test b/tests/pkg-fetch.test index a63bfbb..919db7d 100644 --- a/tests/pkg-fetch.test +++ b/tests/pkg-fetch.test @@ -145,7 +145,7 @@ $* libfoo/1.0.0 2>>/EOE != 0 { $clone_cfg; - $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'fetched libfoo/1.0.0'; + $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'using libfoo/1.0.0 (external)'; $pkg_status libfoo/1.0.0 1>'fetched; available'; $pkg_unpack libfoo 2>'unpacked libfoo/1.0.0'; @@ -158,7 +158,7 @@ $* libfoo/1.0.0 2>>/EOE != 0 $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'; + $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'using libfoo/1.0.0 (external)'; $pkg_status libfoo/1.0.0 1>'fetched; available'; $* libfoo/1.1.0 2>>~%EOE%; @@ -167,7 +167,7 @@ $* libfoo/1.0.0 2>>/EOE != 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'; + $* -e $src/t1/libfoo-1.0.0.tar.gz 2>'using libfoo/1.0.0 (external)'; $pkg_status libfoo/1.0.0 1>'fetched; available'; $pkg_purge libfoo 2>'purged libfoo/1.0.0' @@ -179,7 +179,7 @@ $* libfoo/1.0.0 2>>/EOE != 0 $clone_cfg; cp --no-cleanup $src/t1/libfoo-1.0.0.tar.gz ./; - $* -p -e libfoo-1.0.0.tar.gz 2>'fetched libfoo/1.0.0'; + $* -p -e libfoo-1.0.0.tar.gz 2>'using libfoo/1.0.0 (external)'; $pkg_purge libfoo 2>'purged libfoo/1.0.0' } diff --git a/tests/pkg-status.test b/tests/pkg-status.test index b2ecb57..8d3fc36 100644 --- a/tests/pkg-status.test +++ b/tests/pkg-status.test @@ -178,7 +178,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! } } -: git-repos +: git-rep : if ($git_supported != true) { diff --git a/tests/pkg-unpack.test b/tests/pkg-unpack.test index e4f07d4..af07fc5 100644 --- a/tests/pkg-unpack.test +++ b/tests/pkg-unpack.test @@ -47,8 +47,8 @@ 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 +$* foo -r 2>>EOE != 0 + error: --replace|-r can only be specified with external package EOE : no-dir @@ -98,7 +98,7 @@ $* 2>>EOE != 0 EOE $pkg_purge libfoo 2>'purged libfoo/1.0.0'; - $* -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0'; + $* -e $src/libfoo-1.1.0 2>'using libfoo/1.1.0 (external)'; $pkg_status libfoo/1.1.0 1>'unpacked; available'; $pkg_purge libfoo 2>'purged libfoo/1.1.0' @@ -115,7 +115,7 @@ $* 2>>EOE != 0 info: use 'pkg-unpack --replace|-r' to replace EOE - $* -r -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0'; + $* -r -e $src/libfoo-1.1.0 2>'using libfoo/1.1.0 (external)'; $pkg_status libfoo/1.1.0 1>'unpacked; available'; $pkg_purge libfoo 2>'purged libfoo/1.1.0' @@ -134,7 +134,7 @@ $* 2>>EOE != 0 info: use 'pkg-unpack --replace|-r' to replace EOE - $* -r -e $src/libfoo-1.1.0 2>'unpacked libfoo/1.1.0'; + $* -r -e $src/libfoo-1.1.0 2>'using libfoo/1.1.0 (external)'; $pkg_status libfoo/1.1.0 1>'unpacked; available'; $pkg_purge libfoo 2>'purged libfoo/1.1.0' @@ -149,7 +149,7 @@ $* 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'; + $* -e $src/libfoo-1.1.0 2>'using libfoo/1.1.0 (external)'; $* libfoo 2>>EOE != 0; error: package libfoo is unpacked @@ -177,7 +177,7 @@ $* 2>>EOE != 0 $clone_cfg; cp --no-cleanup -r $src/libfoo-1.1.0 ./; - $* -p -e libfoo-1.1.0 2>'unpacked libfoo/1.1.0'; + $* -p -e libfoo-1.1.0 2>'using libfoo/1.1.0 (external)'; $pkg_purge libfoo 2>'purged libfoo/1.1.0' } @@ -194,3 +194,63 @@ $* 2>>EOE != 0 $pkg_purge libhello 2>'purged libhello/1.0.0' } + +: dir-rep +: +{ + rep_add += --type dir + + : no-repos + : + { + $clone_root_cfg; + + $* libfoo/1.1.0 2>>/EOE != 0 + error: configuration cfg/ has no repositories + info: use 'bpkg rep-add' to add a repository + EOE + } + + : unfetched + : + { + $clone_root_cfg && $rep_add $src/libfoo-1.1.0; + + $* libfoo/1.1.0 2>>/EOE != 0 + error: configuration cfg/ has no available packages + info: use 'bpkg rep-fetch' to fetch available packages list + EOE + } + + : unavailable + : + { + $clone_root_cfg && $rep_add $src/libfoo-1.1.0 && $rep_fetch; + + $* libfoo/1.0.0 2>>EOE != 0 + error: package libfoo 1.0.0 is not available + EOE + } + + : unavailable-dir-based + : + { + $clone_root_cfg && $rep_add $rep/t1 --type pkg && $rep_fetch --trust-yes; + + $* libfoo/1.0.0 2>>EOE != 0 + error: package libfoo 1.0.0 is not available from a directory-based repository + EOE + } + + : available + : + { + $clone_root_cfg && $rep_add $src/libfoo-1.1.0 && $rep_fetch; + + $* libfoo/1.1.0 2>>EOE; + using libfoo/1.1.0 (external) + EOE + + $pkg_status libfoo 1>'unpacked 1.1.0; available sys:?' + } +} diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test index ffc833c..f7be436 100644 --- a/tests/rep-fetch.test +++ b/tests/rep-fetch.test @@ -114,7 +114,7 @@ $* 2>>/EOE != 0 info: use 'bpkg rep-add' to add a repository EOE -: pkg-repos +: pkg-rep : { test.options += --auth all @@ -319,7 +319,36 @@ $* 2>>/EOE != 0 } } -: git-repos +: dir-rep +: +{ + rep_add += --type dir + + : prerequisites + : + if ($remote != true) + { + # Let's reuse local git repositories that have the same repository + # structure as for dir type. + # + rep = $canonicalize([dir_path] $out_git/state0) + + $clone_root_cfg && $rep_add $rep/libbar.git; + + $* 2>>"EOE"; + fetching dir:($rep/libbar.git) + fetching dir:($rep/style-basic.git) \(prerequisite of dir:($rep/libbar.git)\) + 3 package\(s\) in 2 repository\(s\) + EOE + + $rep_list >>"EOO" + dir:($rep/libbar.git) ($rep/libbar.git) + prerequisite dir:($rep/style-basic.git) ($rep/style-basic.git) + EOO + } +} + +: git-rep : if ($git_supported != true) { diff --git a/tests/rep-info.test b/tests/rep-info.test index 13a1148..9a70b49 100644 --- a/tests/rep-info.test +++ b/tests/rep-info.test @@ -138,7 +138,7 @@ $* --name $rep/testing >"pkg:build2.org/rep-info/testing ($rep/testing)" $* --cert-email >'info@build2.org' : email } -: git-repos +: git-rep : if ($git_supported != true) { diff --git a/tests/rep-list.test b/tests/rep-list.test index c2a2900..970379a 100644 --- a/tests/rep-list.test +++ b/tests/rep-list.test @@ -121,7 +121,7 @@ rep_fetch += -d cfg --auth all --trust-yes 2>! EOO } -: git-repos +: git-rep : if ($git_supported != true) { diff --git a/tests/rep-remove.test b/tests/rep-remove.test index 98d566f..01e91d4 100644 --- a/tests/rep-remove.test +++ b/tests/rep-remove.test @@ -183,7 +183,7 @@ pkg_status += -d cfg $pkg_status libbar >'unknown' } -: git-repos +: git-rep : if ($git_supported != true) { -- cgit v1.1