From d937b04fb1cb5d3ca303bd458169c352a4b52669 Mon Sep 17 00:00:00 2001
From: Florian Festi <ffesti@redhat.com>
Date: Fri, 31 Jan 2020 12:27:26 +0100
Subject: [PATCH] Fix isUnorderedReq() for multiple qualifiers

isUnorderedReq() returned True as soon as any qualifier that does not
require ordering is passed. But some qulifiers - basically the scriptlets
run during installation and erasure of the package - may still require
the dependency to be taken into account during ordering.

Now isUnorderedReq() returns 0 if any of those are also set.

Resolves: #1030
---
 lib/rpmds.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/rpmds.h b/lib/rpmds.h
index 491d8738d..d160c948e 100644
--- a/lib/rpmds.h
+++ b/lib/rpmds.h
@@ -82,12 +82,14 @@ typedef rpmFlags rpmsenseFlags;
     _notpre(RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
 #define _UNORDERED_ONLY_MASK \
     _notpre(RPMSENSE_RPMLIB|RPMSENSE_CONFIG|RPMSENSE_PRETRANS|RPMSENSE_POSTTRANS|RPMSENSE_SCRIPT_VERIFY)
+#define _FORCE_ORDER_ONLY_MASK \
+    _notpre(RPMSENSE_SCRIPT_PRE|RPMSENSE_SCRIPT_POST|RPMSENSE_SCRIPT_PREUN|RPMSENSE_SCRIPT_POSTUN)
 
 #define	isLegacyPreReq(_x)  (((_x) & _ALL_REQUIRES_MASK) == RPMSENSE_PREREQ)
 #define	isInstallPreReq(_x)	((_x) & _INSTALL_ONLY_MASK)
 #define	isErasePreReq(_x)	((_x) & _ERASE_ONLY_MASK)
-#define	isUnorderedReq(_x)	((_x) & _UNORDERED_ONLY_MASK)
-
+#define	isUnorderedReq(_x)	((_x) & _UNORDERED_ONLY_MASK && \
+				 !((_x) & _FORCE_ORDER_ONLY_MASK))
 
 
 /** \ingroup rpmds
-- 
2.27.0

