summaryrefslogtreecommitdiffstats
path: root/redhat/build/is_latest_package_built.sh
blob: 27b8b8dd43e1a1e398e79199bf0e85caf7a6e25e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

PKGNAME="${1##*/}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.9}}"

BUILT="$(get_latest_built_package_version.sh ${PKGNAME} ${TDE_VERSION})"
TARBALL="$(get_latest_tarball_version.sh ${PKGNAME} ${TDE_VERSION})"
RPM_PKGNAME="$(get_rpm_package_name.sh ${PKGNAME})"

[ -z "${TARBALL}" ] && exit 1

# If package version contains a "~": it's a pre-release
if [ "${BUILT/~/}" != "${BUILT}" ]; then
  if [ "${BUILT#*_pre}" = "${TARBALL#*~pre}" ]; then
    echo "Latest development package '${PKGNAME}' version '${BUILT}' is already built."
    exit 0
  fi
# Nominal case: no "~" caracter
else
  if [ "${TARBALL%-*}" = "${BUILT%-*}" ] || [[ "${BUILT}" =~ ${TARBALL}_[0-9]* ]]; then
    echo "Latest stable package '${PKGNAME}' version '${BUILT}' is already built."
    exit 0
  fi
fi

exit 1