scripts/functions
changeset 722 37968404e9b9
parent 712 32ad25a4765e
child 726 8b628f8dc108
     1.1 --- a/scripts/functions	Thu Jul 24 06:42:29 2008 +0000
     1.2 +++ b/scripts/functions	Fri Jul 25 14:08:03 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 @@ -343,7 +345,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