aboutsummaryrefslogtreecommitdiff
path: root/brep
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-22 20:32:18 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-22 20:32:18 +0300
commitc45a4cfd29e36df8d9a019877e5af4721fdc66bc (patch)
treedbf2d027b1631e51cd61e51607e7b0e62a7e55dc /brep
parent8b72bd7e42181fde2a02e0d1d382d17dda184199 (diff)
Add support for author-* request manifest values in submit-git handler
Diffstat (limited to 'brep')
-rw-r--r--brep/submit/submit-git.bash.in20
-rw-r--r--brep/submit/submit-git.in60
2 files changed, 49 insertions, 31 deletions
diff --git a/brep/submit/submit-git.bash.in b/brep/submit/submit-git.bash.in
index d19caaf..06d9b7c 100644
--- a/brep/submit/submit-git.bash.in
+++ b/brep/submit/submit-git.bash.in
@@ -94,14 +94,15 @@ function check_package_duplicate () # <name> <version> <repo-dir>
# Serialize the project or package owner manifest (they have the same set of
# values) to the specified manifest file.
#
-function create_owner_manifest () # <name> <email> <control> <file>
-{
+function create_owner_manifest () # <name> <author-name> <author-email>
+{ # <control> <file>
trace_func "$@"
local nam="$1"
- local eml="$2"
- local ctl="$3"
- local man="$4"
+ local anm="$2"
+ local aem="$3"
+ local ctl="$4"
+ local man="$5"
if [ -f "$man" ]; then
error "'$man' already exists"
@@ -109,10 +110,11 @@ function create_owner_manifest () # <name> <email> <control> <file>
manifest_serializer_start "$man"
- manifest_serialize "" "1" # Start of manifest.
- manifest_serialize "name" "$nam"
- manifest_serialize "email" "$eml"
- manifest_serialize "control" "$ctl"
+ manifest_serialize "" "1" # Start of manifest.
+ manifest_serialize "name" "$nam"
+ manifest_serialize "author-name" "$anm"
+ manifest_serialize "author-email" "$aem"
+ manifest_serialize "control" "$ctl"
manifest_serializer_finish
}
diff --git a/brep/submit/submit-git.in b/brep/submit/submit-git.in
index badc084..0c90309 100644
--- a/brep/submit/submit-git.in
+++ b/brep/submit/submit-git.in
@@ -79,8 +79,9 @@
# creates a new project subdirectory and saves project-owner.manifest. The
# project owner manifest contains the following values in the specified order:
#
-# name: <project-name>
-# email: <submitter-email>
+# name: <project-name>
+# author-name: <name>
+# author-email: <email>
# control: <url-prefix>
#
# The 'control' value is the control repository URL prefix and there can be
@@ -98,8 +99,9 @@
# The package owner manifest contains the following values in the specified
# order:
#
-# name: <package-name>
-# email: <submitter-email>
+# name: <package-name>
+# author-name: <name>
+# author-email: <email>
# control: <url>
#
# The 'control' value is the control repository URL and there can be multiple
@@ -288,18 +290,20 @@ manifest_parser_start "$data_dir/request.manifest"
archive=
sha256sum=
section=
-email=
+author_name=
+author_email=
control=
simulate=
while IFS=: read -ru "$manifest_parser_ofd" -d '' n v; do
case "$n" in
- archive) archive="$v" ;;
- sha256sum) sha256sum="$v" ;;
- section) section="$v" ;;
- email) email="$v" ;;
- control) control="$v" ;;
- simulate) simulate="$v" ;;
+ archive) archive="$v" ;;
+ sha256sum) sha256sum="$v" ;;
+ section) section="$v" ;;
+ author-name) author_name="$v" ;;
+ author-email) author_email="$v" ;;
+ control) control="$v" ;;
+ simulate) simulate="$v" ;;
esac
done
@@ -317,7 +321,17 @@ if [ -n "$simulate" -a "$simulate" != "success" ]; then
exit_with_manifest 400 "unrecognized simulation outcome '$simulate'"
fi
-# Note: checking for section, email, and control later.
+# The author-* manifest values should both be present or absent.
+#
+if [ -z "$author_name" -a -n "$author_email" ]; then
+ exit_with_manifest 400 "author-name manifest value expected"
+fi
+
+if [ -z "$author_email" -a -n "$author_name" ]; then
+ exit_with_manifest 400 "author-email manifest value expected"
+fi
+
+# Note: checking for section, author-*, and control later.
m="$data_dir/package.manifest"
extract_package_manifest "$data_dir/$archive" "$m"
@@ -501,8 +515,8 @@ for i in {1..11}; do
# Check that the necessary request manifest values are specified.
#
- if [ -z "$email" ]; then
- exit_with_manifest 400 "email manifest value expected"
+ if [ -z "$author_name" ]; then
+ exit_with_manifest 400 "author-name manifest value expected"
fi
# Check that the package doesn't belong yet to some other project.
@@ -524,7 +538,9 @@ for i in {1..11}; do
run mkdir -p "$d" # Also creates the owners directory if not exist.
ctl="$(repository_base "$control")"
- create_owner_manifest "$project" "$email" "$ctl" "$prj_man"
+
+ create_owner_manifest \
+ "$project" "$author_name" "$author_email" "$ctl" "$prj_man"
# Add the project owners manifest file to git repository using the path
# relative to the repository directory.
@@ -538,7 +554,9 @@ for i in {1..11}; do
run mkdir "$d"
pkg_man="$d/package-owner.manifest"
- create_owner_manifest "$name" "$email" "$control" "$pkg_man"
+
+ create_owner_manifest \
+ "$name" "$author_name" "$author_email" "$control" "$pkg_man"
# Add the package owners manifest file using path relative to the
# repository directory.
@@ -595,15 +613,13 @@ for i in {1..11}; do
git_add "$tgt_dir" "${a#$tgt_dir/}"
- if [ -n "$email" ]; then
- e="$email"
- else
- e="$committer_email"
+ author=()
+ if [ -n "$author_name" ]; then
+ author=(--author="$author_name <$author_email>")
fi
- GIT_AUTHOR_EMAIL="$e" \
run git -c "user.name=$committer_name" -c "user.email=$committer_email" \
--C "$tgt_dir" commit $gqo $gvo -F - <<EOF >&2
+-C "$tgt_dir" commit "${author[@]}" $gqo $gvo -F - <<EOF >&2
Add $name/$version to $s/$project
$(cat "$data_dir/request.manifest")