Backport #857 from trunk: 1.2
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jul 26 15:14:48 2008 +0000 (2008-07-26)
branch1.2
changeset 73165614732cfe7
parent 730 823ac8f8e9fd
child 732 683fe8c2851f
Backport #857 from trunk:
While retrieving files, propagate the preferred extension down to sub-functions.

/branches/1.2/scripts/functions | 8 5 3 0 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
scripts/functions
     1.1 --- a/scripts/functions	Sat Jul 26 15:12:33 2008 +0000
     1.2 +++ b/scripts/functions	Sat Jul 26 15:14:48 2008 +0000
     1.3 @@ -262,18 +262,20 @@
     1.4  }
     1.5  
     1.6  # Get the file name extension of a component
     1.7 -# Usage: CT_GetFileExtension <component_name-component_version>
     1.8 +# Usage: CT_GetFileExtension <component_name-component_version> [extension]
     1.9  # If found, echoes the extension to stdout
    1.10  # If not found, echoes nothing on stdout.
    1.11  CT_GetFileExtension() {
    1.12      local ext
    1.13      local file="$1"
    1.14 +    shift
    1.15 +    local first_ext="$1"
    1.16  
    1.17      CT_Pushd "${CT_TARBALLS_DIR}"
    1.18      # we need to also check for an empty extension for those very
    1.19      # peculiar components that don't have one (such as sstrip from
    1.20      # buildroot).
    1.21 -    for ext in .tar.gz .tar.bz2 .tgz .tar ''; do
    1.22 +    for ext in ${first_ext} .tar.gz .tar.bz2 .tgz .tar ''; do
    1.23          if [ -f "${file}${ext}" ]; then
    1.24              echo "${ext}"
    1.25              break
    1.26 @@ -342,7 +344,7 @@
    1.27      esac
    1.28  
    1.29      # Do we already have it?
    1.30 -    ext=$(CT_GetFileExtension "${file}")
    1.31 +    ext=$(CT_GetFileExtension "${file}" ${first_ext})
    1.32      if [ -n "${ext}" ]; then
    1.33          CT_DoLog DEBUG "Already have '${file}'"
    1.34          return 0