Skip to content
Snippets Groups Projects
Verified Commit f6750fb2 authored by Levente Polyak's avatar Levente Polyak :rocket:
Browse files

feat(db-move): fail on error and pipefail for more expected behavior

parent 10a92db9
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,9 @@
. "$(dirname "$(readlink -e "$0")")/config"
. "$(dirname "$(readlink -e "$0")")/db-functions"
set -eo pipefail
shopt -s nullglob
if (( $# < 3 )); then
msg "usage: %s <repo-from> <repo-to> <pkgname|pkgbase> ..." "${0##*/}"
exit 1
......@@ -57,9 +60,10 @@ for pkgbase in "${pkgbases[@]}"; do
if ! git_tag_exists "${pkgbase}" "${_pkgver}" && ! fetch_pkgbuild "${pkgbase}"; then
die "Couldn't find package %s in git!" "${pkgbase}"
fi
read -rd'\n' pkgver pkgnames < <(source_pkgbuild "${pkgbase}" "${_pkgver}"; \
mapfile -t result < <(source_pkgbuild "${pkgbase}" "${_pkgver}"; \
get_full_version; echo "${pkgname[@]}")
read -ra pkgnames <<<"$pkgnames"
pkgver="${result[0]}"
read -ra pkgnames <<<"${result[1]}"
if (( ${#pkgnames[@]} < 1 )); then
die "Could not read pkgname"
fi
......@@ -94,7 +98,9 @@ done
for pkgbase in "${pkgbases[@]}"; do
tag_list=""
for pkgarch in "${ARCHES[@]}" 'any'; do
vcsrepo_from=$(find_repo_for_package "${pkgbase}" "${pkgarch}" "${repo_from}")
if ! vcsrepo_from=$(find_repo_for_package "${pkgbase}" "${pkgarch}" "${repo_from}"); then
continue
fi
if [[ ${vcsrepo_from} = ${repo_from}-${pkgarch} ]]; then
if [[ ${pkgarch} = any ]]; then
......@@ -106,9 +112,10 @@ for pkgbase in "${pkgbases[@]}"; do
if ! _pkgver=$(pkgver_from_state_repo "${pkgbase}" "${vcsrepo_from}"); then
die "%s has no entry in %s" "${pkgbase}" "${vcsrepo_from}"
fi
read -rd'\n' pkgver pkgnames < <(source_pkgbuild "${pkgbase}" "${_pkgver}"; \
mapfile -t result < <(source_pkgbuild "${pkgbase}" "${_pkgver}"; \
get_full_version; echo "${pkgname[@]}")
read -ra pkgnames <<<"$pkgnames"
pkgver="${result[0]}"
read -ra pkgnames <<<"${result[1]}"
tag_list+=", $pkgarch"
pkgbase_arches[$pkgbase]+="$pkgarch "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment