Re: Update 0.4.11-0.9.8: AttributeError: 'module' object has no attribute 'RPMSENSE_PREREQ'

Anders F Björklund <[email protected]> Tue, 14 Sep 2010 23:40:55 +0200
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
David C. Rankin wrote:

> 	I updated my createrepo install to the current 0.9.8 package on my  
> Arch Linux server. I have 4 openSUSE repos I maintain. All updates  
> with createrepo worked fine with 0.4.11. After updating to the  
> following:
>
> [...]
>  File "/usr/lib/python2.6/site-packages/yum/packages.py", line  
> 1359, in _is_pre_req
>     rpm.RPMSENSE_SCRIPT_PRE |
> AttributeError: 'module' object has no attribute 'RPMSENSE_PREREQ'
>
>     I know very little about python, so I need a bit of help on  
> where I should start trying to figure out what is going on. Any ideas?

Yum needs a patch to work with 4.4.3 and beyond (such as your 5.1.9)

Easiest is just adding the enum values, rather than conditionals...

--anders

_______________________________________________
Rpm-metadata mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/rpm-metadata
patch-yum-packages.py (text/x-python-script, 765 B)
--- yum/packages.py.orig
+++ yum/packages.py
@@ -1353,11 +1353,14 @@
            is a pre-requires or a not"""
         # FIXME this should probably be put in rpmUtils.miscutils since 
         # - that's what it is
+        RPMSENSE_PREREQ = (1 << 6)
+        RPMSENSE_SCRIPT_PRE = (1 << 9)
+        RPMSENSE_SCRIPT_POST = (1 << 10)
         if flag is not None:
             # Note: RPMSENSE_PREREQ == 0 since rpm-4.4'ish
-            if flag & (rpm.RPMSENSE_PREREQ |
-                       rpm.RPMSENSE_SCRIPT_PRE |
-                       rpm.RPMSENSE_SCRIPT_POST):
+            if flag & (RPMSENSE_PREREQ |
+                       RPMSENSE_SCRIPT_PRE |
+                       RPMSENSE_SCRIPT_POST):
                 return 1
         return 0
 
-- 
1.6.0.2