scripts/functions
branch1.2
changeset 731 65614732cfe7
parent 695 320862b2d6f1
child 733 f1257533021a
     1.1 --- a/scripts/functions	Sat Jul 19 22:45:17 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