[yum-commits] yumdownloader.py
zpavlas at osuosl.org
zpavlas at osuosl.org
Fri Aug 3 13:53:34 UTC 2012
yumdownloader.py | 47 +++++++++++------------------------------------
1 file changed, 11 insertions(+), 36 deletions(-)
New commits:
commit a4eb3957dbf36f29d2fe49b380f7399b73dedbc1
Author: ZdenÄk Pavlas <zpavlas at redhat.com>
Date: Thu Aug 2 15:13:53 2012 +0200
setupSourceRepos: Never disable source repos. BZ 808339, 808347.
Previously, we were disabling source repos if the primary repo
was disabled OR it did not exist.
diff --git a/yumdownloader.py b/yumdownloader.py
index 03ad62c..4cdd595 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -99,45 +99,20 @@ class YumDownloader(YumUtilBase):
def setupSourceRepos(self):
# enable the -source repos for enabled primary repos
- archlist = rpmUtils.arch.getArchList() + ['src']
- # Ok, we have src and bin repos. What we want to do here is:
- #
- # 1. _enable_ source repos for which the bin repos are enabled.
- # 2. _disable_ the _other_ src repos.
- #
- # ...also we don't want to disable the src repos. for #1 and then
- # re-enable them as then we get annoying messages and call .close() on
- # them losing the primarydb data etc.
- # Get all src repos.
- src_repos = {}
- repos_source = self.repos.findRepos('*-source')
- if rhn_source_repos: # RHN
- repos_source += self.repos.findRepos('*-source-rpms')
- for repo in repos_source:
- src_repos[repo.id] = False
+ enabled = {}
+ for repo in self.repos.findRepos('*'):
+ enabled[repo.id] = repo.isEnabled()
- # Find the enabled bin repos, and mark their respective *-source repo.
- # as good.
- for repo in self.repos.listEnabled():
- if repo.id not in src_repos:
- srcrepo = '%s-source' % repo.id
- if srcrepo in src_repos:
- src_repos[srcrepo] = True
- if not rhn_source_repos:
- continue
- if not repo.id.endswith("-rpms"):
- continue
- srcrepo = repo.id[:-len('-rpms')] + '-source-rpms'
- if srcrepo in src_repos:
- src_repos[srcrepo] = True
+ for repo in self.repos.findRepos('*'):
+ if repo.id.endswith('-source'):
+ primary = repo.id[:-7]
+ elif rhn_source_repos and repo.id.endswith('-source-rpms'):
+ primary = repo.id[:-12] + '-rpms'
+ else:
+ continue
- # Toggle src repos that are set the wrong way
- for repo in repos_source:
- if repo.isEnabled() and not src_repos[repo.id]:
- repo.close()
- self.repos.disableRepo(repo.id)
- if not repo.isEnabled() and src_repos[repo.id]:
+ if not repo.isEnabled() and enabled.get(primary):
self.logger.info('Enabling %s repository' % repo.id)
repo.enable()
More information about the Yum-commits
mailing list