aboutsummaryrefslogtreecommitdiff
path: root/brep/handler/submit/submit-git.in
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-09-21 17:52:52 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-09-24 19:28:18 +0300
commit8c3da8abdb16ecad007dc60068deb90e151737ea (patch)
treedb69db08961a042dcac9e21d84b7f2c8fe4ba8bc /brep/handler/submit/submit-git.in
parent880f96e9325646dc792e1c4e37879f3810b9e8f1 (diff)
Fix submission handler issues arising due to package archive name ambiguity
Now we take into account the fact that the foo-bar-1.0.tar.gz archive may contain either foo-bar/1.0 or foo/bar-1.0 package.
Diffstat (limited to 'brep/handler/submit/submit-git.in')
-rw-r--r--brep/handler/submit/submit-git.in29
1 files changed, 7 insertions, 22 deletions
diff --git a/brep/handler/submit/submit-git.in b/brep/handler/submit/submit-git.in
index 54cd230..c67c30c 100644
--- a/brep/handler/submit/submit-git.in
+++ b/brep/handler/submit/submit-git.in
@@ -639,28 +639,11 @@ for i in {1..11}; do
exit_with_manifest 400 "unrecognized section '$section'"
fi
- # Strips the version revision part, if present.
- #
- v="$(sed -n -re 's%^(\+?[^+]+)(\+[0-9]+)?$%\1%p' <<<"$version")"
-
- # Make sure the section directory exists before we run find in it.
- #
- d="$tgt_dir/$s/$project"
- run mkdir -p "$d" # Create all the parent directories as well.
-
- # Go through the potentially matching archives (for example, for
- # foo-1.2.3+2: foo-1.2.3.tar.gz, foo-1.2.3+1.tar.gz, foo-1.2.30.tar.gz, etc)
- # and remove those that match exactly.
- #
- # Change CWD to the section directory to make sure that the found archive
- # paths don't contain spaces.
- #
- fs=($(run cd "$tgt_dir/$s" && run find -name "$name-$v*"))
+ IFS=$'\n' eval \
+ 'arcs=($(run pkg_find_archives "$name" "$version*" "$tgt_dir/$s"))'
- for f in "${fs[@]}"; do
- if [[ "$f" =~ ^\./[^/]+/"$name-$v"(\+[0-9]+)?\.[^/]+$ ]]; then
- run git -C "$tgt_dir" rm $gqo "$s/$f" >&2
- fi
+ for f in "${arcs[@]}"; do
+ run git -C "$tgt_dir" rm $gqo "${f#$tgt_dir/}" >&2
done
# Finally, add the package archive to the target repository.
@@ -669,8 +652,10 @@ for i in {1..11}; do
# Make sure the project directory exists before we copy the archive into it.
# Note that it was removed by git-rm if it became empty.
#
+ d="$tgt_dir/$s/$project"
+ run mkdir -p "$d" # Create all the parent directories as well.
+
a="$d/$archive"
- run mkdir -p "$d" # Create all the parent directories as well.
run cp "$data_dir/$archive" "$a"
git_add "$tgt_dir" "${a#$tgt_dir/}"