From 9eeb0aed958ed81b37b049604704fc0f7c4fe6cc Mon Sep 17 00:00:00 2001
From: Yaakov Selkowitz <yselkowi@redhat.com>
Date: Mon, 24 Apr 2023 21:08:02 -0400
Subject: [PATCH] Disable btrfs in RHEL builds

btrfs-progs is not supported on RHEL.
---
 buildah.spec | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/buildah.spec b/buildah.spec
index be80dd9..b7d9a2a 100644
--- a/buildah.spec
+++ b/buildah.spec
@@ -7,6 +7,12 @@
 %global debug_package   %{nil}
 %endif
 
+%if 0%{?rhel}
+%bcond_with btrfs
+%else
+%bcond_without btrfs
+%endif
+
 %global provider github
 %global provider_tld com
 %global project containers
@@ -39,7 +45,9 @@ BuildRequires: gpgme-devel
 BuildRequires: libassuan-devel
 BuildRequires: make
 BuildRequires: ostree-devel
+%if %{with btrfs}
 BuildRequires: btrfs-progs-devel
+%endif
 BuildRequires: shadow-utils-subid-devel
 %if 0%{?fedora} > 37
 Requires: containers-common-extra >= 4:1-78
@@ -226,6 +234,9 @@ export LDFLAGS="-X main.buildInfo=`date +%s` -X main.cniVersion=${CNI_VERSION}"
 
 export BUILDTAGS='seccomp exclude_graphdriver_devicemapper'
 export BUILDTAGS+=' libsubid selinux'
+%if %{without btrfs}
+export BUILDTAGS+=' btrfs_noversion exclude_graphdriver_btrfs'
+%endif
 %gobuild -o bin/%{name} %{import_path}/cmd/%{name}
 %gobuild -o bin/imgtype %{import_path}/tests/imgtype
 %gobuild -o bin/copy %{import_path}/tests/copy