scripts/functions: do not abort on failed extract

For glibc/eglibc, if the add-on can not be extracted, we want to catch
the error to print a meaningful error message.

So:
 - try to extract the tarball
 - if it fails, print a waring instead of calling CT_Abort
 - return 1

So, components that want to catch the error and want to handle it can,
while components that do not will gracefuly fail thanks to our catching
every errors.

Bonus: it works without changing any existing extract procedure! :-)

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
Yann E. MORIN" 2011-05-30 23:24:45 +02:00
parent 0c73370023
commit 1c3c90d0d4

View File

@ -700,7 +700,8 @@ CT_Extract() {
shift
if ! ext="$(CT_GetFileExtension "${basename}")"; then
CT_Abort "'${basename}' not found in '${CT_TARBALLS_DIR}'"
CT_DoLog WARN "'${basename}' not found in '${CT_TARBALLS_DIR}'"
return 1
fi
local full_file="${CT_TARBALLS_DIR}/${basename}${ext}"
@ -728,7 +729,9 @@ CT_Extract() {
.tar.gz|.tgz) CT_DoExecLog FILE tar xvzf "${full_file}";;
.tar) CT_DoExecLog FILE tar xvf "${full_file}";;
/.git) CT_ExtractGit "${basename}" "${@}";;
*) CT_Abort "Don't know how to handle '${basename}${ext}': unknown extension";;
*) CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
return 1
;;
esac
# Don't mark as being extracted for git