crossrepomove: fix moving debug packages to the target repo

We did not copy over the optional debug packages to the staging
environment before db-updating the moved state. Afterwards the db-remove
call removed the debug packages from the source repo. This lead to
dropping debug packages when using crossrepomove.

This approach ensures we have a uniform shell to avoid shell glob
behavior inconsistencies. The copy of the package path is mandatory and
will error out if missing while the debug package path is optional as
reflected by a subshell that succeeds either way.

Fixes #92
This commit is contained in:
Levente Polyak 2022-08-13 16:48:50 +02:00
parent 1e23bbc164
commit 2e4060445a
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 7 additions and 2 deletions

View File

@ -57,9 +57,14 @@ for _arch in "${arch[@]}"; do
fi
for _pkgname in "${pkgname[@]}"; do
fullver=$(get_full_version "$_pkgname")
pkgpath="/srv/ftp/$source_repo/os/$repo_arch/$_pkgname-$fullver-${_arch}.pkg.tar.*"
pkgpath="/srv/ftp/${source_repo}/os/${repo_arch}/${_pkgname}-${fullver}-${_arch}.pkg.tar.*"
debugpath="/srv/ftp/${source_repo}-debug/os/${repo_arch}/${_pkgname}-debug-${fullver}-${_arch}.pkg.tar.*"
# Fail if $pkgpath doesn't match but keep $debugpath optional
# shellcheck disable=2029
ssh "$server" "cp $pkgpath staging/$target_repo" || die
ssh "${server}" "bash -c '
install ${pkgpath} -Dt staging/${target_repo} &&
(install ${debugpath} -Dt staging/${target_repo} 2>/dev/null || true)
'" || die
done
done