From 8c3da8abdb16ecad007dc60068deb90e151737ea Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 21 Sep 2020 17:52:52 +0300 Subject: 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. --- brep/handler/submit/submit-git.bash.in | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'brep/handler/submit/submit-git.bash.in') diff --git a/brep/handler/submit/submit-git.bash.in b/brep/handler/submit/submit-git.bash.in index 9f25c28..983d7b5 100644 --- a/brep/handler/submit/submit-git.bash.in +++ b/brep/handler/submit/submit-git.bash.in @@ -77,15 +77,20 @@ function check_package_duplicate () # # local s for s in "${!sections[@]}"; do - local d="$rep/${sections[$s]}" + local p + IFS=$'\n' eval \ + 'p=($(run pkg_find_archive "$nam-$ver.*" "$rep/${sections[$s]}"))' - if [ -d "$d" ]; then - local f - f="$(run find "$d" -name "$nam-$ver.*")" + if [ "${#p[@]}" -ne 0 ]; then + local n="${p[0]}" + local v="${p[1]}" - if [ -n "$f" ]; then - trace "found: $f" + trace "found: $n/$v in ${p[3]}" + + if [ "$n" == "$nam" ]; then exit_with_manifest 422 "duplicate submission" + else + exit_with_manifest 422 "submission conflicts with $n/$v" fi fi done -- cgit v1.1