summaryrefslogtreecommitdiffstats
path: root/redhat/build/get_latest_built_package_version.sh
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2021-01-30 14:34:02 +0100
committerFrançois Andriot <albator78@libertysurf.fr>2021-01-30 22:29:41 +0100
commit6581dc50b83f203d65eac61c00a159ab2a6ddb5d (patch)
tree85c02d38ca9dcedc28798ee41c4b16ec7260e9bc /redhat/build/get_latest_built_package_version.sh
parent87e57a1a070839a44db16a0410ef57902db2df3e (diff)
downloadtde-packaging-6581dc50b83f203d65eac61c00a159ab2a6ddb5d.tar.gz
tde-packaging-6581dc50b83f203d65eac61c00a159ab2a6ddb5d.zip
RPM: massive update and cleanup
Diffstat (limited to 'redhat/build/get_latest_built_package_version.sh')
-rwxr-xr-xredhat/build/get_latest_built_package_version.sh21
1 files changed, 15 insertions, 6 deletions
diff --git a/redhat/build/get_latest_built_package_version.sh b/redhat/build/get_latest_built_package_version.sh
index 990ca873f..869efc93b 100755
--- a/redhat/build/get_latest_built_package_version.sh
+++ b/redhat/build/get_latest_built_package_version.sh
@@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="$1"
-TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
+TDE_VERSION="${2:-${TDE_VERSION:-14.0.7}}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
@@ -9,9 +9,18 @@ RPM=$(get_latest_built_package_filename.sh "${PKGNAME}" ${TDE_VERSION})
[ ! -r "${RPM}" ] && echo "No package found for '${PKGNAME}' !" && exit 2
-VERSION=$(rpm -qp --qf "%{version}-%{release}" "${RPM}")
-VERSION=${VERSION%.opt} # Remove '.opt' suffix
-VERSION=${VERSION%.[a-z]*} # Remove distro suffix (e.g. '.el6')
-VERSION=${VERSION/-*_0_/\~}
+pkg_version="$(rpm -qp --qf "%{version}" "${RPM}")"
+pkg_release="$(rpm -qp --qf "%{release}" "${RPM}")"
-echo $VERSION
+# Application packages: version does not match TDE version
+if [[ "${pkg_release}" =~ _0_ ]] || [[ "${pkg_release}" =~ ${TDE_VERSION}_ ]] ; then
+ eval VERSION="${pkg_release/_0_/\~}"
+else
+ # Base package (tdelibs ...)
+ eval VERSION="${pkg_version}_${pkg_release/0_/\~}"
+fi
+
+VERSION="${VERSION%.opt}" # Remove '.opt' suffix
+VERSION="${VERSION%.[a-z]*}" # Remove distro suffix (e.g. '.el6')
+
+echo "${VERSION}"