[Yum-devel] [PATCH] yumdownloader: enable/disable source repos before reposetup. BZ 819064.
Zdeněk Pavlas
zpavlas at redhat.com
Thu May 17 12:30:06 UTC 2012
Quite a hack, but seems to work fine and fixes the BZ.
--{enable,disable}repo options tested and work as expected.
---
yumdownloader.py | 21 +++------------------
1 files changed, 3 insertions(+), 18 deletions(-)
diff --git a/yumdownloader.py b/yumdownloader.py
index d37f15d..5942956 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -94,9 +94,6 @@ class YumDownloader(YumUtilBase):
# Setup yum (Ts, RPM db, Repo & Sack)
self.doUtilYumSetup(opts)
- # Setup source repos
- if opts.source:
- self.setupSourceRepos()
# Do the real action
self.exit_code = self.downloadPackages(opts)
@@ -143,14 +140,6 @@ class YumDownloader(YumUtilBase):
if not repo.isEnabled() and src_repos[repo.id]:
self.logger.info('Enabling %s repository' % repo.id)
repo.enable()
- # Setup the repo, without a cache
- repo.setup(0)
- try:
- # Setup pkgSack with 'src' in the archlist
- self._getSacks(archlist=archlist, thisrepo=repo.id)
- except yum.Errors.YumBaseError, msg:
- self.logger.critical(str(msg))
- sys.exit(1)
def downloadPackages(self,opts):
@@ -291,6 +280,9 @@ class YumDownloader(YumUtilBase):
"""do a default setup for all the normal/necessary yum components,
really just a shorthand for testing"""
try:
+ # Setup source repos
+ if opts.source:
+ self.setupSourceRepos()
self._getRepos(doSetup = True)
# if '--source' is used the add src to the archlist
if opts.source:
@@ -306,13 +298,6 @@ class YumDownloader(YumUtilBase):
self.logger.critical(str(msg))
sys.exit(1)
- def _removeEnabledSourceRepos(self):
- ''' Disable all enabled *-source repos.'''
- for repo in self.repos.listEnabled():
- if repo.id.endswith('-source'):
- repo.close()
- self.repos.disableRepo(repo.id)
-
def addCmdOptions(self):
# this if for compability with old API (utils.py from yum < 3.2.23)
if hasattr(self,'getOptionGroup'): # check if the group option API is available
--
1.7.4.4
More information about the Yum-devel
mailing list