aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brep/handler/submit/submit-dir.in6
-rw-r--r--brep/handler/submit/submit-git.in26
-rw-r--r--doc/manual.cli2
-rw-r--r--mod/mod-package-details.cxx3
-rw-r--r--mod/mod-package-version-details.cxx2
-rw-r--r--mod/mod-submit.cxx2
-rw-r--r--tests/submit/submit-dir.testscript4
-rw-r--r--tests/submit/submit-git.testscript63
8 files changed, 74 insertions, 34 deletions
diff --git a/brep/handler/submit/submit-dir.in b/brep/handler/submit/submit-dir.in
index 685cf06..1f677e4 100644
--- a/brep/handler/submit/submit-dir.in
+++ b/brep/handler/submit/submit-dir.in
@@ -100,9 +100,9 @@ fi
if [ -n "$simulate" ]; then
run rm -r "$data_dir"
- trace "$name/$version submission is simulated"
+ trace "package submission is simulated: $name/$version"
else
- trace "$name/$version submission is queued"
+ trace "package submission is queued: $name/$version"
fi
-exit_with_manifest 200 "$name/$version submission is queued"
+exit_with_manifest 200 "package submission is queued: $name/$version"
diff --git a/brep/handler/submit/submit-git.in b/brep/handler/submit/submit-git.in
index bc8ecf0..cc9927b 100644
--- a/brep/handler/submit/submit-git.in
+++ b/brep/handler/submit/submit-git.in
@@ -161,6 +161,12 @@
# Email to use for the target repository commits. noreply@example.com if
# unspecified.
#
+# --result-url <url>
+#
+# Result URL base for the response. If specified, the handler will append
+# the <package>/<version> to this value and include the resulting URL in the
+# response message.
+#
usage="usage: $0 [<options>] <tgt-repo> [<ref-repo>] <dir>"
# Diagnostics.
@@ -190,6 +196,7 @@ set -o errtrace # Trap ERR in functions.
#
committer_name="Submission Handler"
committer_email="noreply@example.com"
+result_url=
while [ $# -gt 0 ]; do
case $1 in
@@ -203,6 +210,11 @@ while [ $# -gt 0 ]; do
committer_email="$1"
shift
;;
+ --result-url)
+ shift
+ result_url="${1%/}"
+ shift
+ ;;
*)
break; # The end of options is encountered.
;;
@@ -367,6 +379,12 @@ if [ -z "$project" ]; then
project="$name"
fi
+if [ -n "$result_url" ]; then
+ message_suffix=": $result_url/$name/$version"
+else
+ message_suffix=": $name/$version"
+fi
+
# Exit with the 'submission is queued' result manifest if simulating.
#
# Note that we can't expect a real control repository URL to be specified for
@@ -375,8 +393,8 @@ fi
if [ -n "$simulate" ]; then
run rm -r -f "$data_dir"
- trace "$name/$version submission is simulated"
- exit_with_manifest 200 "$name/$version submission is queued" "$reference"
+ trace "package submission is simulated$message_suffix"
+ exit_with_manifest 200 "package submission is queued$message_suffix"
fi
function git_add () # <repo-dir> <path>...
@@ -655,5 +673,5 @@ fi
#
run rm -r -f "$data_dir"
-trace "$name/$version submission is queued"
-exit_with_manifest 200 "$name/$version submission is queued"
+trace "package submission is queued$message_suffix"
+exit_with_manifest 200 "package submission is queued$message_suffix"
diff --git a/doc/manual.cli b/doc/manual.cli
index 4c10689..8a960e1 100644
--- a/doc/manual.cli
+++ b/doc/manual.cli
@@ -115,7 +115,7 @@ manifest is implied:
\
status: 200
-message: submission is queued
+message: package submission is queued
reference: <abbrev-checksum>
\
diff --git a/mod/mod-package-details.cxx b/mod/mod-package-details.cxx
index a36d4c0..68e6530 100644
--- a/mod/mod-package-details.cxx
+++ b/mod/mod-package-details.cxx
@@ -111,7 +111,8 @@ handle (request& rq, response& rs)
latest_package lp;
if (!package_db_->query_one<latest_package> (
"(" + query::_val (tenant) + "," + query::_val (n) + ")", lp))
- throw invalid_request (404, "Package '" + n.string () + "' not found");
+ throw invalid_request (404,
+ "Package " + n.string () + " not (yet) found");
pkg = package_db_->load<package> (lp.id);
}
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index ee7457a..bd06d76 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -145,7 +145,7 @@ handle (request& rq, response& rs)
if (not_found)
throw invalid_request (
- 404, "Package '" + pn.string () + ' ' + sver + "' not found");
+ 404, "Package " + pn.string () + '/' + sver + " not (yet) found");
const string& name (pkg->name.string ());
diff --git a/mod/mod-submit.cxx b/mod/mod-submit.cxx
index 1b93756..9fa5d82 100644
--- a/mod/mod-submit.cxx
+++ b/mod/mod-submit.cxx
@@ -601,7 +601,7 @@ handle (request& rq, response& rs)
add ("", "1"); // Start of manifest.
add ("status", "200");
- add ("message", "submission is queued");
+ add ("message", "package submission is queued");
add ("reference", ref);
add ("", ""); // End of manifest.
}
diff --git a/tests/submit/submit-dir.testscript b/tests/submit/submit-dir.testscript
index 595792d..0b43aa7 100644
--- a/tests/submit/submit-dir.testscript
+++ b/tests/submit/submit-dir.testscript
@@ -34,7 +34,7 @@
$* >>"EOO";
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
@@ -49,7 +49,7 @@
$* >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript
index 8a00714..e99c1d5 100644
--- a/tests/submit/submit-git.testscript
+++ b/tests/submit/submit-git.testscript
@@ -106,7 +106,7 @@ pkg_ctl="$prj_ctl/hello.git"
"$tgt_url" $root_ref_dir $data_dir >>"EOO";
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
@@ -191,7 +191,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" ref $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
@@ -201,14 +201,16 @@ pkg_ctl="$prj_ctl/hello.git"
: Test that on the first package submit the project and package names
: ownership is successfully aquired. Reference repo is absent.
:
+ : Note that here we also pass the --result-url option.
+ :
{
$clone_root_data;
$clone_root_tgt;
- $* "file:///$~/tgt.git" $data_dir >>"EOO"
+ $* --result-url 'https://example.com/' "file:///$~/tgt.git" $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: https://example.com/libhello/0.1.0
reference: $checksum
EOO
}
@@ -249,7 +251,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" $root_ref_dir $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
@@ -303,7 +305,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" ref $data_dir >>"EOO";
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
@@ -357,7 +359,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" ref $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
@@ -392,7 +394,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" ref $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
@@ -422,7 +424,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
@@ -451,7 +453,7 @@ pkg_ctl="$prj_ctl/hello.git"
$* "file:///$~/tgt.git" $root_ref_dir $data_dir >>"EOO"
: 1
status: 200
- message: libhello/0.1.0 submission is queued
+ message: package submission is queued: libhello/0.1.0
reference: $checksum
EOO
}
@@ -461,17 +463,36 @@ pkg_ctl="$prj_ctl/hello.git"
: Test that the simulated submission still succeeds given no control URL.
:
{
- $clone_root_data;
- sed -i -e 's%^control: .+$%simulate: success%' $data_dir/request.manifest;
-
- $clone_root_tgt;
-
- $* "file:///$~/tgt.git" $data_dir >>"EOO"
- : 1
- status: 200
- message: libhello/0.1.0 submission is queued
- reference: $checksum
- EOO
+ +$clone_root_data_clean
+ +sed -i -e 's%^control: .+$%simulate: success%' $data_dir/request.manifest
+
+ : no-result-url
+ :
+ {
+ $clone_data;
+ $clone_root_tgt;
+
+ $* "file:///$~/tgt.git" $data_dir >>"EOO"
+ : 1
+ status: 200
+ message: package submission is queued: libhello/0.1.0
+ reference: $checksum
+ EOO
+ }
+
+ : result-url
+ :
+ {
+ $clone_data;
+ $clone_root_tgt;
+
+ $* --result-url 'https://example.com' "file:///$~/tgt.git" $data_dir >>"EOO"
+ : 1
+ status: 200
+ message: package submission is queued: https://example.com/libhello/0.1.0
+ reference: $checksum
+ EOO
+ }
}
}