[PATCH] Fix prereq flag checking

Ville Skyttä <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
Hi,

Currently createrepo on Fedora >= 10 flags all dependencies in the generated 
metadata as "pre" ones.  Fix attached, more info in its description.

_______________________________________________
Yum mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum
0003-Fix-prereq-flag-checking-flag-Requires-pre-and-Req.patch (text/x-patch, 1.3 KB)
From 61d2124502a336024d4dd3adc73449a8d225d781 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ville=20Skytt=C3=A4?= <[email protected]>
Date: Thu, 26 Mar 2009 23:49:16 +0200
Subject: [PATCH] Fix prereq flag checking, flag Requires(pre) and Requires(post) as pre=1.

The fix affects rpm versions that define RPMSENSE_PREREQ as 0, such as
vanilla upstream rpm >= 4.4 and Fedora's rpm >= 4.6 - with those
versions, all dependencies were flagged as "pre" ones.
---
 yum/packages.py |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/yum/packages.py b/yum/packages.py
index bb43b6c..4783b3e 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1172,13 +1172,12 @@ class YumHeaderPackage(YumAvailablePackage):
            is a pre-requires or a not"""
         # FIXME this should probably be put in rpmUtils.miscutils since 
         # - that's what it is
-        newflag = flag
         if flag is not None:
-            newflag = flag & rpm.RPMSENSE_PREREQ
-            if newflag == rpm.RPMSENSE_PREREQ:
+            # Note: RPMSENSE_PREREQ == 0 since rpm-4.4'ish
+            if flag & (rpm.RPMSENSE_PREREQ |
+                       rpm.RPMSENSE_SCRIPT_PRE |
+                       rpm.RPMSENSE_SCRIPT_POST):
                 return 1
-            else:
-                return 0
         return 0
 
     def _requires_with_pre(self):
-- 
1.6.0.6
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.