Verified Commit 90d3b8ba authored by Morten Linderud's avatar Morten Linderud 🏄
Browse files

db-move: Implement maybe_getpkgfile and simplify debug handling


Signed-off-by: Morten Linderud's avatarMorten Linderud <morten@linderud.pw>
parent cd98434f
......@@ -275,6 +275,20 @@ check_builddir() {
[[ -n $_builddir && $_builddir = '/build' ]]
}
# Non fatal getpkgfile expanding globs
maybe_getpkgfile() {
if (( $# != 1 )); then
exit 1
elif [[ ! -f ${1} ]]; then
exit 1
elif [[ ! -f ${1}.sig ]]; then
error "Package signature %s not found!" "$1.sig"
exit 1
fi
echo "${1}"
}
getpkgfile() {
if (( $# != 1 )); then
error 'No canonical package found!'
......
......@@ -112,17 +112,18 @@ for pkgbase in "${args[@]:2}"; do
add_pkgs+=("${FTP_BASE}/${PKGPOOL}/${pkgfile}")
remove_pkgs+=("${pkgname}")
done
debug_pkgpath=$(getpkgfile "${ftppath_debug_from}/${tarch}/${pkgbase}-debug-${pkgver}-${pkgarch}"${PKGEXTS})
if ! debug_pkgpath=$(maybe_getpkgfile "${ftppath_debug_from}/${tarch}/${pkgbase}-debug-${pkgver}-${pkgarch}"${PKGEXTS}); then
continue
fi
debug_pkgfile="${debug_pkgpath##*/}"
if [[ -f ${debug_pkgpath} ]]; then
msg2 "Found debug package %s (%s)" "${pkgbase}-debug" "${tarch}"
ln -s "../../../${DEBUGPKGPOOL}/${debug_pkgfile}" "${ftppath_debug_to}/${tarch}/"
if [[ -f ${FTP_BASE}/${DEBUGPKGPOOL}/${debug_pkgfile}.sig ]]; then
ln -s "../../../${DEBUGPKGPOOL}/${debug_pkgfile}.sig" "${ftppath_debug_to}/${tarch}/"
fi
add_debug_pkgs+=("${FTP_BASE}/${DEBUGPKGPOOL}/${debug_pkgfile}")
remove_debug_pkgs+=("${pkgbase}-debug")
msg2 "Found debug package %s (%s)" "${pkgbase}-debug" "${tarch}"
ln -s "../../../${DEBUGPKGPOOL}/${debug_pkgfile}" "${ftppath_debug_to}/${tarch}/"
if [[ -f ${FTP_BASE}/${DEBUGPKGPOOL}/${debug_pkgfile}.sig ]]; then
ln -s "../../../${DEBUGPKGPOOL}/${debug_pkgfile}.sig" "${ftppath_debug_to}/${tarch}/"
fi
add_debug_pkgs+=("${FTP_BASE}/${DEBUGPKGPOOL}/${debug_pkgfile}")
remove_debug_pkgs+=("${pkgbase}-debug")
done
fi
done
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment