FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 03-02-2012, 04:02 PM
David Lehman
 
Default Get yum repo metadata in setup so it's there when we want it later.

---
pyanaconda/packaging/yumpayload.py | 48 +++++++++++++++++++++--------------
1 files changed, 29 insertions(+), 19 deletions(-)

diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 4528737..bf4db18 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -133,6 +133,12 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
if flags.testing:
self._yum.setCacheDir()

+ # go ahead and get metadata for all enabled repos now
+ for repoid in self.repos:
+ repo = self._yum.repos.getRepo(repoid)
+ if repo.enabled:
+ self._getRepoMetadata(repo)
+
###
### METHODS FOR WORKING WITH REPOSITORIES
###
@@ -293,10 +299,30 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t

# TODO: enable addons

- def _addYumRepo(self, name, baseurl, mirrorlist=None, **kwargs):
- """ Add a yum repo to the YumBase instance. """
+ def _getRepoMetadata(self, yumrepo):
+ """ Retrieve repo metadata if we don't already have it. """
from yum.Errors import RepoError, RepoMDError

+ # And try to grab its metadata. We do this here so it can be done
+ # on a per-repo basis, so we can then get some finer grained error
+ # handling and recovery.
+ try:
+ yumrepo.getPrimaryXML()
+ yumrepo.getOtherXML()
+ except RepoError as e:
+ raise MetadataError(e.value)
+
+ # Not getting group info is bad, but doesn't seem like a fatal error.
+ # At the worst, it just means the groups won't be displayed in the UI
+ # which isn't too bad, because you may be doing a kickstart install and
+ # picking packages instead.
+ try:
+ yumrepo.getGroups()
+ except RepoMDError:
+ log.error("failed to get groups for repo %s" % yumrepo.id)
+
+ def _addYumRepo(self, name, baseurl, mirrorlist=None, **kwargs):
+ """ Add a yum repo to the YumBase instance. """
# First, delete any pre-existing repo with the same name.
if name in self._yum.repos.repos:
self._yum.repos.delete(name)
@@ -315,23 +341,7 @@ reposdir=/etc/yum.repos.d,/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/t
mirrorlist=mirrorlist,
**kwargs)

- # And try to grab its metadata. We do this here so it can be done
- # on a per-repo basis, so we can then get some finer grained error
- # handling and recovery.
- try:
- obj.getPrimaryXML()
- obj.getOtherXML()
- except RepoError as e:
- raise MetadataError(e.value)
-
- # Not getting group info is bad, but doesn't seem like a fatal error.
- # At the worst, it just means the groups won't be displayed in the UI
- # which isn't too bad, because you may be doing a kickstart install and
- # picking packages instead.
- try:
- obj.getGroups()
- except RepoMDError:
- log.error("failed to get groups for repo %s" % repo.id)
+ self._getRepoMetadata(obj)

# Adding a new repo means the cached packages and groups lists
# are out of date. Clear them out now so the next reference to
--
1.7.9.1

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

Thread Tools




All times are GMT. The time now is 09:50 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org