scripts/functions: do not abort on failed extract
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 30 23:24:45 2011 +0200 (2011-05-30)
changeset 2493b0eac0056942
parent 2492 b6495ef0193c
child 2494 feee36c11ccc
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>
scripts/functions
     1.1 --- a/scripts/functions	Mon May 30 23:24:11 2011 +0200
     1.2 +++ b/scripts/functions	Mon May 30 23:24:45 2011 +0200
     1.3 @@ -700,7 +700,8 @@
     1.4      shift
     1.5  
     1.6      if ! ext="$(CT_GetFileExtension "${basename}")"; then
     1.7 -      CT_Abort "'${basename}' not found in '${CT_TARBALLS_DIR}'"
     1.8 +        CT_DoLog WARN "'${basename}' not found in '${CT_TARBALLS_DIR}'"
     1.9 +        return 1
    1.10      fi
    1.11      local full_file="${CT_TARBALLS_DIR}/${basename}${ext}"
    1.12  
    1.13 @@ -728,7 +729,9 @@
    1.14          .tar.gz|.tgz) CT_DoExecLog FILE tar xvzf "${full_file}";;
    1.15          .tar)         CT_DoExecLog FILE tar xvf  "${full_file}";;
    1.16          /.git)        CT_ExtractGit "${basename}" "${@}";;
    1.17 -        *)            CT_Abort "Don't know how to handle '${basename}${ext}': unknown extension";;
    1.18 +        *)            CT_DoLog WARN "Don't know how to handle '${basename}${ext}': unknown extension"
    1.19 +                      return 1
    1.20 +                      ;;
    1.21      esac
    1.22  
    1.23      # Don't mark as being extracted for git