summaryrefslogtreecommitdiffstats
path: root/redhat/build/get_latest_tarball_filename.sh
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2018-11-27 21:34:48 +0100
committerFrançois Andriot <albator78@libertysurf.fr>2018-11-27 21:34:48 +0100
commita615d19df88eb2e989316b480519161945dbc7dc (patch)
tree369970b98042998b86c11024598155e037b76fec /redhat/build/get_latest_tarball_filename.sh
parent76a93e0011ade1583a1ec672f33411dfd35454f3 (diff)
downloadtde-packaging-a615d19df88eb2e989316b480519161945dbc7dc.tar.gz
tde-packaging-a615d19df88eb2e989316b480519161945dbc7dc.zip
RPM: merge redhat directory with master branch
Diffstat (limited to 'redhat/build/get_latest_tarball_filename.sh')
-rwxr-xr-xredhat/build/get_latest_tarball_filename.sh47
1 files changed, 31 insertions, 16 deletions
diff --git a/redhat/build/get_latest_tarball_filename.sh b/redhat/build/get_latest_tarball_filename.sh
index 3cdeb904d..7901d0915 100755
--- a/redhat/build/get_latest_tarball_filename.sh
+++ b/redhat/build/get_latest_tarball_filename.sh
@@ -6,22 +6,37 @@ TDE_VERSION="${2:-14.0.0}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
[ -d "${TARBALLS_DIR}" ] || TARBALLS_DIR=~/tde/tde-tarballs/${TDE_VERSION}/
[ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR=~/tde/tde-packaging
-[ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${PACKAGING_DIR}/redhat/
+[ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${TDE_PACKAGING_DIR}/redhat/
+
+EXTRA_DIR="$(cd ${TARBALLS_DIR}/../extras/; pwd)"
+
+RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-${TDE_VERSION}*.tar.gz" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+RET=$(find "${TARBALLS_DIR}" "${EXTRA_DIR}" -follow -name "${PKGNAME}-${TDE_VERSION}*.tar.gz" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-[0-9]*.tar.gz" | sort -n | tail -n 1)
-if [ -z "${RET}" ]; then
- RET=$(find "${TARBALLS_DIR}/../extras/" -name "${PKGNAME}[-_][0-9]*.tar.*" | sort -n | tail -n 1)
-fi
-if [ ! -r "${RET}" ]; then
- # Retry without 'trinity-*', and allow any TAR extension.
- RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1)
- if [ ! -r "${RET}" ]; then
- # Retry by removing numbers in package name, e.g "imlib1" => "imlib"
- RET=$(find "${DIST_PACKAGING_DIR}" -name "$(tr -d "[0-9]" <<< ${PKGNAME})-[0-9]*.tar*" | sort -n | tail -n 1)
- fi
-fi
-
-[ -z "${RET}" ] && exit 2
-
-echo "${RET}"
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+RET=$(find "${EXTRA_DIR}" -follow -name "${PKGNAME}[-_][0-9]*.tar.*" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+# Now look in the 'tde-packaging' directory
+RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+# Retry without 'trinity-*', and allow any TAR extension.
+RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+# Retry without 'trinity-*', and allow any TAR extension.
+RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+# Retry by removing numbers in package name, e.g "imlib1" => "imlib"
+RET=$(find "${DIST_PACKAGING_DIR}" -name "$(tr -d "[0-9]" <<< ${PKGNAME})-[0-9]*.tar*" | sort -n | tail -n 1)
+[ -r "${RET}" ] && echo "${RET}" && exit 0
+
+
exit 0