diff --git a/systemd.spec b/systemd.spec
index 73a6d69..b436ad8 100644
--- a/systemd.spec
+++ b/systemd.spec
@@ -108,7 +108,7 @@ GIT_DIR=../../src/systemd/.git git diffab -M v233..master@{2017-06-15} -- hwdb/[
 # applying upstream pull requests.
 
 %if %{without upstream}
-%if ! (0%{?fedora} >= 40 || 0%{?rhel} >= 10)
+%if 0%{?fedora} < 40 && 0%{?rhel} < 10
 # Work-around for dracut issue: run generators directly when we are in initrd
 # https://bugzilla.redhat.com/show_bug.cgi?id=2164404
 # Drop when dracut-060 is available.
@@ -186,7 +186,7 @@ BuildRequires:  openssl-devel-engine
 %if %{with gnutls}
 BuildRequires:  gnutls-devel
 %endif
-%if %{undefined rhel}
+%if 0%{?fedora}
 BuildRequires:  qrencode-devel
 %endif
 BuildRequires:  libmicrohttpd-devel
@@ -214,7 +214,7 @@ BuildRequires:  python3-devel
 BuildRequires:  python3dist(jinja2)
 BuildRequires:  python3dist(lxml)
 BuildRequires:  python3dist(pefile)
-%if %{undefined rhel}
+%if 0%{?fedora}
 BuildRequires:  python3dist(pillow)
 BuildRequires:  python3dist(pytest-flakes)
 %endif
@@ -322,7 +322,7 @@ Recommends:     libidn2.so.0(IDN2_0.0.0)%{?elf_bits}
 Recommends:     libpcre2-8.so.0%{?elf_suffix}
 Recommends:     libpwquality.so.1%{?elf_suffix}
 Recommends:     libpwquality.so.1(LIBPWQUALITY_1.0)%{?elf_bits}
-%if %{undefined rhel}
+%if 0%{?fedora}
 Recommends:     libqrencode.so.4%{?elf_suffix}
 %endif
 Recommends:     libbpf.so.1%{?elf_suffix}
@@ -489,7 +489,7 @@ Requires:       %{name} = %{version}-%{release}
 
 Requires:       systemd-boot
 Requires:       python3dist(pefile)
-%if %{undefined rhel}
+%if 0%{?fedora}
 Requires:       python3dist(zstd)
 %endif
 Requires:       python3dist(cryptography)