Commit 37c872e6 authored by Sandro Santilli's avatar Sandro Santilli
Browse files

Do not try testing downgrades

Closes #4064

git-svn-id: http://svn.osgeo.org/postgis/trunk@16530 b70326c6-7e19-0410-871a-916f4a2858ee
parent 94507c54
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -6,6 +6,36 @@ if test -z "$1"; then
fi
to_version="$1"

# Return -1, 1 or 0 if the first version
# is respectively smaller, greater or equal
# to the second version
semver_compare()
{
  V1=`echo "$1" | tr '.' ' '`
  V2=$2
  # echo "V1: $V1" >&2
  # echo "V2: $V2" >&2
  for v1 in $V1; do
    v2=`echo "$V2" | cut -d. -f1`
    if [ -z "$v2" ]; then
      echo 1; return;
    fi
    V2=`echo "$V2" | cut -d. -sf2-`
    # echo "v: $v1 - $v2" >&2
    if expr "$v1" '<' "$v2" > /dev/null; then
      echo -1; return;
    fi
    if expr "$v1" '>' "$v2" > /dev/null; then
      echo 1; return;
    fi
  done
  if [ -n "$V2" ]; then
    echo -1; return;
  fi
  echo 0; return;
}


BUILDDIR=$PWD
EXTDIR=`pg_config --sharedir`/extension/

@@ -14,8 +44,9 @@ failures=0
files=`'ls' postgis--* | grep -v -- '--.*--' | sed 's/^postgis--\(.*\)\.sql/\1/'`
for fname in unpackaged $files; do
  from_version="$fname"
  if test "${from_version}" = "${to_version}"; then
    # TODO: upgrade to ${from_version}next instead ?
  # only consider versions older than ${to_version}
  cmp=`semver_compare "${from_version}" "${to_version}"`
  if test $cmp -ge 0; then
    continue
  fi
  UPGRADE_PATH="${from_version}--${to_version}"