From 9043b816d47e4b88255f8aee8980832766f99283 Mon Sep 17 00:00:00 2001
From: Chris Evich <cevich@redhat.com>
Date: Tue, 9 Jul 2019 12:06:51 -0400
Subject: Cirrus: Fix missing removal of packaged podman

This was originally intended, but somehow omitted from #1936

Signed-off-by: Chris Evich <cevich@redhat.com>
---
 contrib/cirrus/check_image.sh       | 4 +++-
 contrib/cirrus/lib.sh               | 9 ++++++++-
 contrib/cirrus/setup_environment.sh | 6 ++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

(limited to 'contrib')

diff --git a/contrib/cirrus/check_image.sh b/contrib/cirrus/check_image.sh
index 948039234..67e807d61 100755
--- a/contrib/cirrus/check_image.sh
+++ b/contrib/cirrus/check_image.sh
@@ -16,7 +16,9 @@ MIN_MEM_MB=2000
 read JUNK TOTAL USED MEM_FREE JUNK <<<$(free -tm | tail -1)
 item_test 'Minimum available memory' $MEM_FREE -ge $MIN_MEM_MB || let "RET+=1"
 
-item_test "podman command NOT found on path" -z "$(type -P podman)" || let "RET+=1"
+# We're testing a custom-built podman; make sure there isn't a distro-provided
+# binary anywhere; that could potentially taint our results.
+item_test "remove_packaged_podman_files() did it's job" -z "$(type -P podman)" || let "RET+=1"
 
 MIN_ZIP_VER='3.0'
 VER_RE='.+([[:digit:]]+\.[[:digit:]]+).+'
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index ea0f9e326..b2fcaa749 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -323,8 +323,15 @@ install_test_configs(){
                            /etc/containers/registries.conf
 }
 
+# Remove all files (except conmon, for now) provided by the distro version of podman.
+# Except conmon, for now as it's expected to eventually be  packaged separately.
+# All VM cache-images used for testing include the distro podman because (1) it's
+# required for podman-in-podman testing and (2) it somewhat simplifies the task
+# of pulling in necessary prerequisites packages as the set can change over time.
+# For general CI testing however, calling this function makes sure the system
+# can only run the compiled source version.
 remove_packaged_podman_files(){
-    show_and_store_warning "Removing packaged podman files to prevent conflicts with source build and testing."
+    echo "Removing packaged podman files to prevent conflicts with source build and testing."
     req_env_var OS_RELEASE_ID
     if [[ "$OS_RELEASE_ID" =~ "ubuntu" ]]
     then
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index f312e593a..e49bb98fe 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -52,7 +52,9 @@ install_test_configs
 make install.tools
 
 case "$SPECIALMODE" in
-    none) ;;  # Do the normal thing
+    none)
+        remove_packaged_podman_files  # we're building from source
+        ;;
     rootless)
         # Only do this once, even if ROOTLESS_USER (somehow) changes
         if ! grep -q 'ROOTLESS_USER' /etc/environment
@@ -65,9 +67,9 @@ case "$SPECIALMODE" in
                 tee -a /etc/environment) && eval "$X" && echo "$X"
             setup_rootless
         fi
+        remove_packaged_podman_files
         ;;
     in_podman)  # Assumed to be Fedora
-        dnf install -y podman
         $SCRIPT_BASE/setup_container_environment.sh
         ;;
     windows) ;&  # for podman-remote building only
-- 
cgit v1.2.3-54-g00ecf