mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-06-16 06:18:17 +00:00
scripts: handle custom or empty extension when extracting
This commit is contained in:
@ -297,8 +297,8 @@ CT_SetLibPath() {
|
|||||||
|
|
||||||
# Get the file name extension of a component
|
# Get the file name extension of a component
|
||||||
# Usage: CT_GetFileExtension <component_name-component_version> [extension]
|
# Usage: CT_GetFileExtension <component_name-component_version> [extension]
|
||||||
# If found, echoes the extension to stdout
|
# If found, echoes the extension to stdout, and return 0
|
||||||
# If not found, echoes nothing on stdout.
|
# If not found, echoes nothing on stdout, and return !0.
|
||||||
CT_GetFileExtension() {
|
CT_GetFileExtension() {
|
||||||
local ext
|
local ext
|
||||||
local file="$1"
|
local file="$1"
|
||||||
@ -311,11 +311,11 @@ CT_GetFileExtension() {
|
|||||||
for ext in ${first_ext} .tar.gz .tar.bz2 .tgz .tar ''; do
|
for ext in ${first_ext} .tar.gz .tar.bz2 .tgz .tar ''; do
|
||||||
if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
|
if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
|
||||||
echo "${ext}"
|
echo "${ext}"
|
||||||
break
|
exit 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
return 0
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download an URL using wget
|
# Download an URL using wget
|
||||||
@ -389,8 +389,7 @@ CT_GetLocal() {
|
|||||||
local ext
|
local ext
|
||||||
|
|
||||||
# Do we already have it in *our* tarballs dir?
|
# Do we already have it in *our* tarballs dir?
|
||||||
ext=$(CT_GetFileExtension "${basename}" ${first_ext})
|
if ext="$( CT_GetFileExtension "${basename}" ${first_ext} )"; then
|
||||||
if [ -n "${ext}" ]; then
|
|
||||||
CT_DoLog DEBUG "Already have '${basename}'"
|
CT_DoLog DEBUG "Already have '${basename}'"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -571,8 +570,11 @@ CT_GetSVN() {
|
|||||||
CT_Extract() {
|
CT_Extract() {
|
||||||
local basename="$1"
|
local basename="$1"
|
||||||
local nochdir="$2"
|
local nochdir="$2"
|
||||||
local ext=$(CT_GetFileExtension "${basename}")
|
local ext
|
||||||
CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
|
|
||||||
|
if ! ext="$(CT_GetFileExtension "${basename}")"; then
|
||||||
|
CT_TestAndAbort "'${basename}' not found in '${CT_TARBALLS_DIR}'" -z "${ext}"
|
||||||
|
fi
|
||||||
local full_file="${CT_TARBALLS_DIR}/${basename}${ext}"
|
local full_file="${CT_TARBALLS_DIR}/${basename}${ext}"
|
||||||
|
|
||||||
# Check if already extracted
|
# Check if already extracted
|
||||||
|
Reference in New Issue
Block a user