Skip to content

Commit

Permalink
Avoid calling CT_Abort from CT_Mirrors
Browse files Browse the repository at this point in the history
... see the comment for the reason. Defer aborting until the result of
CT_Mirrors is actually used (if it is used).

Signed-off-by: Alexey Neyman <stilor@att.net>
  • Loading branch information
stilor committed Feb 16, 2018
1 parent 85b86d8 commit 89181ae
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/functions
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,9 @@ CT_GetFile()
# Try all urls in turn
for url in "${URLS[@]}"; do
[ -n "${url}" ] || continue
if [ "${url}" = "-unknown-" ]; then
CT_Abort "Don't know how to download ${basename}"
fi
if CT_DoGetFile "${url}/${basename}${ext}"; then
if [ -n "${digest}" -a -n "${pkg_dir}" ] && ! CT_DoVerifyDigest \
"${CT_TARBALLS_DIR}/${basename}${ext}" \
Expand Down Expand Up @@ -1651,7 +1654,13 @@ CT_MultilibFixupLDSO()
}

# List the download mirrors. Usage:
# CT_Mirrors ORGANIZATION PROJECT [...]
# CT_Mirrors ORGANIZATION PROJECT [...]
# Important: this function should not call CT_Abort. Instead, print a special string,
# -unknown-, to indicate that a certain combination of ORGANIZATION/PROJECT is not handled.
# The reason is that this function is evaluated when config file is loaded - before ct-ng
# determines if it needs to download anything at all. On the other hand, if a component
# comes from a local source directory, it may have a version like "very new" or "very old"
# which will confuse, for example, Linux mirror selection below.
CT_Mirrors()
{
local org="${1}"
Expand Down Expand Up @@ -1683,7 +1692,7 @@ CT_Mirrors()
kernel.org)
# TBD move to linux.sh?
if [ "${project}" != "linux" ]; then
CT_Abort "Unsupported project"
echo "-unknown-"
fi
local version="${CT_LINUX_VERSION}"
case "${version}" in
Expand All @@ -1703,12 +1712,12 @@ CT_Mirrors()
esac
;;
*)
CT_Abort "Unsupported Linux kernel version '${version}'"
echo "-unknown-"
;;
esac
;;
*)
CT_Abort "Unknown mirror '${org}'"
echo "-unknown-"
;;
esac
}
Expand Down

0 comments on commit 89181ae

Please sign in to comment.