[yum-git] yumdownloader.py
James Antill
james at linux.duke.edu
Thu Jan 17 00:50:24 UTC 2008
yumdownloader.py | 39 ++++++++++++++++++++++++++++-----------
1 file changed, 28 insertions(+), 11 deletions(-)
New commits:
commit a54a0960471a400b09564aed780b21c7843518c2
Author: James Antill <james at and.org>
Date: Wed Jan 16 19:50:20 2008 -0500
Real fix for the __len__ problem. Don't disableRepo() and then enable it, this
even do the disable last ... oops.
diff --git a/yumdownloader.py b/yumdownloader.py
index 026451b..551ea08 100755
--- a/yumdownloader.py
+++ b/yumdownloader.py
@@ -78,23 +78,40 @@ 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 = {}
+ for repo in self.repos.findRepos('*-source'):
+ src_repos[repo.id] = False
+
+ # Find the enabled bin repos, and mark their respective *-source repo.
+ # as good.
for repo in self.repos.listEnabled():
- if not repo.id.endswith('-source'):
+ if repo.id not in src_repos:
srcrepo = '%s-source' % repo.id
- else:
+ if srcrepo in src_repos:
+ src_repos[srcrepo] = True
+
+ # Toggle src repos that are set the wrong way
+ for repo in self.repos.findRepos('*-source'):
+ if repo.isEnabled() and not src_repos[repo.id]:
repo.close()
self.repos.disableRepo(repo.id)
- srcrepo = repo.id
-
- for r in self.repos.findRepos(srcrepo):
- if r in self.repos.listEnabled():
- continue
- self.logger.info('Enabling %s repository' % r.id)
- r.enable()
+ 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
- r.setup(0)
+ repo.setup(0)
# Setup pkgSack with 'src' in the archlist
- self._getSacks(archlist=archlist,thisrepo=r.id)
+ self._getSacks(archlist=archlist, thisrepo=repo.id)
def downloadPackages(self,opts):
More information about the Yum-cvs-commits
mailing list