Repository: apache/arrow
File: dev/release/verify-apt.sh (Shell)

Code before:
echo "::endgroup::"

echo "::group::Test Apache Arrow Flight SQL"
${APT_INSTALL} libarrow-flight-sql-glib-dev=${package_version}
${APT_INSTALL} libarrow-flight-sql-glib-doc=${package_version}
ruby -r gi -e "p GI.load('ArrowFlightSQL')"
echo "::endgroup::"


echo "::group::Test Gandiva"
${APT_INSTALL} libgandiva-glib-dev=${package_version}
${APT_INSTALL} libgandiva-glib-doc=${package_version}
ruby -r gi -e "p GI.load('Gandiva')"
echo "::endgroup::"


echo "::group::Test Apache Parquet"
${APT_INSTALL} libparquet-glib-dev=${package_version}
${APT_INSTALL} libparquet-glib-doc=${package_version}
ruby -r gi -e "p GI.load('Parquet')"
echo "::endgroup::"

echo "::group::Prepare downgrade test"
can_downgrade=false
if [ "${distribution}" = 'debian' ] && [[ "$(cat /etc/debian_version)" =~ /sid$ ]]; then
  # Skip downgrade test on Debian sid (unstable)
  :
elif [ -f /etc/apt/sources.list.d/apache-arrow.sources.bak ]; then
  mv /etc/apt/sources.list.d/apache-arrow.sources \
     /etc/apt/sources.list.d/apache-arrow-current.sources
  mv /etc/apt/sources.list.d/apache-arrow.sources{.bak,}
  cp -a /usr/share/keyrings/apache-arrow-apt-source{,-current}.asc
  sed \
    -i.bak \
    -e 's/\.asc$/-current.asc/g' \
    /etc/apt/sources.list.d/apache-arrow-current.sources
  if curl \
       --fail \
       --output "apache-arrow-apt-source-latest.deb" \
       https://packages.apache.org/artifactory/arrow/${distribution}/apache-arrow-apt-source-latest-${code_name}.deb; then
    ${APT_INSTALL} --allow-downgrades ./apache-arrow-apt-source-latest.deb
    apt update
    can_downgrade=true
  fi
fi

# 22.0.0.dev54 -> 22
# 22.0.0 -> 22
current_major_version=${package_version%%.*}
# 22 -> 21
previous_major_version=$[current_major_version -1]

Review comment (suggestion):
```suggestion
  # Skip downgrade test on Debian testing.
  # Debian testing and unstable use "${testing_code_name}/"sid" as /etc/debian_version content.
```

Code after:
echo "::endgroup::"

echo "::group::Test Apache Arrow Flight SQL"
${APT_INSTALL} libarrow-flight-sql-glib-dev=${package_version}
${APT_INSTALL} libarrow-flight-sql-glib-doc=${package_version}
ruby -r gi -e "p GI.load('ArrowFlightSQL')"
echo "::endgroup::"


echo "::group::Test Gandiva"
${APT_INSTALL} libgandiva-glib-dev=${package_version}
${APT_INSTALL} libgandiva-glib-doc=${package_version}
ruby -r gi -e "p GI.load('Gandiva')"
echo "::endgroup::"


echo "::group::Test Apache Parquet"
${APT_INSTALL} libparquet-glib-dev=${package_version}
${APT_INSTALL} libparquet-glib-doc=${package_version}
ruby -r gi -e "p GI.load('Parquet')"
echo "::endgroup::"

echo "::group::Prepare downgrade test"
can_downgrade=false
if [ "${distribution}" = 'debian' ] && [[ "$(cat /etc/debian_version)" =~ /sid$ ]]; then
  # Skip downgrade test on Debian testing.
  # Debian testing and unstable use "${testing_code_name}/"sid" as /etc/debian_version content.
  :
elif [ -f /etc/apt/sources.list.d/apache-arrow.sources.bak ]; then
  mv /etc/apt/sources.list.d/apache-arrow.sources \
     /etc/apt/sources.list.d/apache-arrow-current.sources
  mv /etc/apt/sources.list.d/apache-arrow.sources{.bak,}
  cp -a /usr/share/keyrings/apache-arrow-apt-source{,-current}.asc
  sed \
    -i.bak \
    -e 's/\.asc$/-current.asc/g' \
    /etc/apt/sources.list.d/apache-arrow-current.sources
  if curl \
       --fail \
       --output "apache-arrow-apt-source-latest.deb" \
       https://packages.apache.org/artifactory/arrow/${distribution}/apache-arrow-apt-source-latest-${code_name}.deb; then
    ${APT_INSTALL} --allow-downgrades ./apache-arrow-apt-source-latest.deb
    apt update
    can_downgrade=true
  fi
fi

# 22.0.0.dev54 -> 22
# 22.0.0 -> 22
current_major_version=${package_version%%.*}
# 22 -> 21