aboutsummaryrefslogtreecommitdiff
path: root/brep/submit/submit-dir.in
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-23 17:36:06 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-28 11:50:26 +0300
commit7e0e141273032c7afc1a9129512aa42c672fcf5d (patch)
tree970aa6fbe006df14c245363c3ce47d863ca3e4e1 /brep/submit/submit-dir.in
parent6e7616b5ea02b61e15e4a8dcbbcf2978822730ce (diff)
Always serialize reference submit result manifest value if available and restructure handlers dir
Diffstat (limited to 'brep/submit/submit-dir.in')
-rw-r--r--brep/submit/submit-dir.in107
1 files changed, 0 insertions, 107 deletions
diff --git a/brep/submit/submit-dir.in b/brep/submit/submit-dir.in
deleted file mode 100644
index 4bcbe5f..0000000
--- a/brep/submit/submit-dir.in
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/env bash
-
-# file : brep/submit/submit-dir.in
-# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
-# license : MIT; see accompanying LICENSE file
-
-# Simple package submission handler with directory storage.
-#
-# Validate the package archive located in the specified submission directory
-# extracting and parsing the package manifest (saved as package.manifest in
-# the submission directory). Keep the submission directory unless simulating.
-# Write the submission result manifest to stdout.
-#
-usage="usage: $0 <dir>"
-
-verbose= #true
-
-trap "{ exit 1; }" ERR
-set -o errtrace # Trap ERR in functions.
-
-@import brep/submit/submit@
-
-if [ "$#" != 1 ]; then
- error "$usage"
-fi
-
-# Submission data directory (last and the only argument).
-#
-data_dir="${!#/}"
-
-if [ -z "$data_dir" ]; then
- error "$usage"
-fi
-
-if [ ! -d "$data_dir" ]; then
- error "'$data_dir' does not exist or is not a directory"
-fi
-
-reference="$(basename "$data_dir")"
-
-# Parse the submission request manifest and obtain the archive path as well
-# as the simulate value.
-#
-manifest_parser_start "$data_dir/request.manifest"
-
-archive=
-simulate=
-
-while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do
- case "$n" in
- archive) archive="$v" ;;
- simulate) simulate="$v" ;;
- esac
-done
-
-manifest_parser_finish
-
-if [ -z "$archive" ]; then
- error "archive manifest value expected"
-fi
-
-if [ -n "$simulate" -a "$simulate" != "success" ]; then
- exit_with_manifest 400 "unrecognized simulation outcome '$simulate'"
-fi
-
-m="$data_dir/package.manifest"
-extract_package_manifest "$data_dir/$archive" "$m"
-
-# Parse the package manifest and obtain the package name, version, and
-# project.
-#
-manifest_parser_start "$m"
-
-name=
-version=
-project=
-
-while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do
- case "$n" in
- name) name="$v" ;;
- version) version="$v" ;;
- project) project="$v" ;;
- esac
-done
-
-manifest_parser_finish
-
-if [ -z "$name" ]; then
- error "name manifest value expected"
-fi
-
-if [ -z "$version" ]; then
- error "version manifest value expected"
-fi
-
-if [ -z "$project" ]; then
- project="$name"
-fi
-
-if [ -n "$simulate" ]; then
- rm -r "$data_dir"
- trace "$name/$version submission is simulated"
-else
- trace "$name/$version submission is queued"
-fi
-
-exit_with_manifest 200 "$name/$version submission is queued" "$reference"