aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-11-14 22:18:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-11-15 23:06:43 +0300
commit05912fbf27846af1f4ca1b824cc39815179d430e (patch)
tree60c44466d29ceed659f11e8ae201d483d253d8ed
parent29b5a3d01b5c2228ae1db6c9237989f54f5f2b52 (diff)
Add support for repository typed URLs (git+https://..., etc)
-rw-r--r--libbbot/manifest.cxx15
-rw-r--r--tests/manifest/task-response.testscript2
-rw-r--r--tests/manifest/task.testscript40
3 files changed, 41 insertions, 16 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index cc8afb5..2f70b75 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -581,9 +581,6 @@ namespace bbot
if (!repo_url)
bad_value ("no task repository URL specified");
- if (!repo_type)
- bad_value ("no task repository type specified");
-
if (machine.empty ())
bad_value ("no task machine specified");
@@ -594,11 +591,10 @@ namespace bbot
//
try
{
- // Call remote/absolute repository location constructor (throws
+ // Create remote/absolute repository location (will throw
// invalid_argument for relative location).
//
- repository = repository_location (repository_url (repo_url->value),
- *repo_type);
+ repository = repository_location (repo_url->value, repo_type);
}
catch (const invalid_argument& e)
{
@@ -624,8 +620,13 @@ namespace bbot
s.next ("name", name.string ());
s.next ("version", version.string ());
+
+ // Note that the repository location is assumed to be remote or absolute,
+ // and so the URL schema encapsulates the repository type if it is
+ // unguessable otherwise. Thus we don't serialize the repository-type
+ // manifest value.
+ //
s.next ("repository-url", repository.string ());
- s.next ("repository-type", to_string (repository.type ()));
for (const auto& v: trust)
s.next ("trust", v);
diff --git a/tests/manifest/task-response.testscript b/tests/manifest/task-response.testscript
index b424cbf..b66313f 100644
--- a/tests/manifest/task-response.testscript
+++ b/tests/manifest/task-response.testscript
@@ -23,7 +23,6 @@ test.options += -ts
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
machine: windows_10-msvc_14
target: x86_64-microsoft-win32-msvc14.0
EOF
@@ -38,7 +37,6 @@ test.options += -ts
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
machine: windows_10-msvc_14
target: x86_64-microsoft-win32-msvc14.0
EOF
diff --git a/tests/manifest/task.testscript b/tests/manifest/task.testscript
index e68bd09..413338f 100644
--- a/tests/manifest/task.testscript
+++ b/tests/manifest/task.testscript
@@ -16,7 +16,6 @@ test.options += -t
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
trust: AB:0D:3F:C1:B0:13:E4:0E:AD:4A:08:06:AE:F3:85:DB:E2:27:5F:83:11:47:A2:7\
8:64:3C:73:60:F8:66:3A:A4
machine: windows_10-msvc_14
@@ -32,11 +31,40 @@ test.options += -t
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
machine: windows_10-msvc_14
target: x86_64-microsoft-win32-msvc14.0
EOF
+ : typed-url
+ :
+ $* <<EOF >>EOF
+ : 1
+ name: libfoo
+ version: 1.0
+ repository-url: git+http://example.org/math
+ machine: windows_10-msvc_14
+ target: x86_64-microsoft-win32-msvc14.0
+ EOF
+
+ : repo-type
+ :
+ $* <<EOI >>EOO
+ : 1
+ name: libfoo
+ version: 1.0
+ repository-url: http://git.example.org/math
+ repository-type: git
+ machine: windows_10-msvc_14
+ target: x86_64-microsoft-win32-msvc14.0
+ EOI
+ : 1
+ name: libfoo
+ version: 1.0
+ repository-url: git+http://git.example.org/math
+ machine: windows_10-msvc_14
+ target: x86_64-microsoft-win32-msvc14.0
+ EOO
+
: config
:
{
@@ -47,7 +75,6 @@ test.options += -t
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
machine: windows
target: x86_64-microsoft-win32-msvc14.0
config: abc=
@@ -60,7 +87,6 @@ test.options += -t
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
machine: windows
target: x86_64-microsoft-win32-msvc14.0
config: abc='a "b '"d\e x y="
@@ -74,7 +100,6 @@ test.options += -t
name: libfoo
version: 1.0
repository-url: http://pkg.example.org/1/math
- repository-type: pkg
trust: yes
machine: windows_10-msvc_14
target: x86_64-microsoft-win32-msvc14.0
@@ -312,12 +337,13 @@ EOI
: repository-type
:
- $* <<EOI 2>'stdin:6:1: error: no task repository type specified' == 1
+ $* <<EOI 2>'stdin:4:17: error: invalid task repository URL: missing repository version' == 1
: 1
name: libfoo
version: 1.0
- repository-url: http://pkg.example.org/1/math
+ repository-url: http://git.example.org/math
machine: windows_10-msvc_14
+ target: x86_64-microsoft-win32-msvc14.0
EOI
: machine