Hi,

cElementTree_iterparse in yum.misc is only available in new versions of yum.
Attached you can find a patch which uses the old style, used in older versions 
of yum. 

Don't know if it makes sense to try also the new version with try/execpt.

Am Dienstag, 12. April 2011, 11:10:58 schrieb Jan Pazdziora:
> On Tue, Apr 12, 2011 at 10:56:47AM +0200, Marcus Moeller wrote:
> > Hi all,
> > 
> > beginning with the testing of 1.4-RC I have noticed that
> > spacewalk-repo-sync does not seem to work, anymore:
> > 
> > spacewalk-repo-sync -c fedora-13-x86-tools-os -u
> > http://spacewalk.redhat.com/yum/1.4-RC-client/Fedora/13/i386/
> > Traceback (most recent call last):
> >   File "/usr/bin/spacewalk-repo-sync", line 69, in ?
> >     sys.exit(abs(main() or 0))
> >   File "/usr/bin/spacewalk-repo-sync", line 63, in main
> >     sync.main()
> >   File "/usr/lib/python2.4/site-
packages/spacewalk/satellite_tools/reposync.py",
> > line 108, in main
> >     plugin = self.load_plugin()(url, self.channel_label)
> >   File "/usr/lib/python2.4/site-
packages/spacewalk/satellite_tools/reposync.py",
> > line 137, in load_plugin
> >     mod = __import__('spacewalk.satellite_tools.repo_plugins',
> > globals(), locals(), [name])
> >   File "/usr/lib/python2.4/site-
packages/spacewalk/satellite_tools/repo_plugins/yum_src.py",
> > line 22, in ?
> >     from yum.misc import cElementTree_iterparse as iterparse
> > ImportError: cannot import name cElementTree_iterparse
> 
> Michael,
> 
> the updateinfo patch seems to have broken spacewalk-repo-sync
> on RHELs (5 and 6).
> 
> Could you please come up with a patch for the issue?
> 
> Thank you,
> 
> -- 
> Jan Pazdziora
> Principal Software Engineer, Satellite Engineering, Red Hat
> 


-- 
MFG

        Michael Calmer

--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575  - e-mail: michael.cal...@suse.com
--------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
From 83a4493c1aa9d0f20cbe2687ca5e32e5d8120c10 Mon Sep 17 00:00:00 2001
From: Michael Calmer <m...@suse.de>
Date: Tue, 12 Apr 2011 12:37:23 +0200
Subject: [PATCH] fix provide iterparse

cElementTree_iterparse is only available in new versions of yum.
Import it directly like in older versions of yum.
---
 backend/satellite_tools/repo_plugins/yum_src.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/backend/satellite_tools/repo_plugins/yum_src.py b/backend/satellite_tools/repo_plugins/yum_src.py
index 93f5d60..d4d440c 100644
--- a/backend/satellite_tools/repo_plugins/yum_src.py
+++ b/backend/satellite_tools/repo_plugins/yum_src.py
@@ -19,10 +19,15 @@ import sys
 import gzip
 from yum.update_md import UpdateMetadata, UpdateNoticeException, UpdateNotice
 from yum.yumRepo import YumRepository
-from yum.misc import cElementTree_iterparse as iterparse
 from spacewalk.satellite_tools.reposync import ContentPackage
 from spacewalk.common import CFG, initCFG
 
+try:
+    from xml.etree import cElementTree
+except ImportError:
+    import cElementTree
+iterparse = cElementTree.iterparse
+
 class YumWarnings:
     def write(self, s):
         pass
-- 
1.7.3.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to