[PATCH] Add comps groups for new repos that are added (#470653)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For new repos that are added, we should also be sure to add their comps
information to the base comps object.  This largely cut and pastes bits from
yum's doGroupSetup(), but that can't be done on a per-repo basis.  We should
add some API, but this will do for now
---
 iw/task_gui.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/iw/task_gui.py b/iw/task_gui.py
index 8296e83..8abbc9c 100644
--- a/iw/task_gui.py
+++ b/iw/task_gui.py
@@ -43,6 +43,21 @@ def setupRepo(anaconda, repo):
         anaconda.backend.doRepoSetup(anaconda, thisrepo=repo.id, fatalerrors=False)
         anaconda.backend.doSackSetup(anaconda, thisrepo=repo.id, fatalerrors=False)
         log.info("added repository %s with with source URL %s" % (repo.name, repo.mirrorlist or repo.baseurl))
+        # FIXME: need a per-repo way of doing this; largely cut and paste
+        # from yum right now
+        if not repo.groups_added:
+            try:
+                groupfile = repo.getGroups()
+                # open it up as a file object so iterparse can cope 
+                # with our gz file
+                if groupfile is not None and groupfile.endswith('.gz'):
+                    groupfile = gzip.open(groupfile)
+                anaconda.backend.ayum._comps.add(groupfile)
+            except (yum.Errors.GroupsErrors, yum.Errors.CompsException, yum.Errors.RepoMDError), e:
+                log.debug("unable to add group information for repository %s" %(repo.name))
+            else:
+                repo.groups_added = True
+                log.info("added group information for repository %s" %(repo.name))
     except yum.Errors.RepoError, e:
         anaconda.intf.messageWindow(_("Error"),
               _("Unable to read package metadata from repository.  "
-- 
1.6.0.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux