[yum-commits] yumdownloader.py

zpavlas at osuosl.org zpavlas at osuosl.org
Fri May 18 11:56:40 UTC 2012


 yumdownloader.py |   21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

New commits:
commit f0aac86691f8b5467adcaf75dfee3e084d74d72d
Author: Zdeněk Pavlas <zpavlas at redhat.com>
Date:   Thu May 17 14:16:56 2012 +0200

    yumdownloader: enable/disable source repos before reposetup. BZ 819064.
    
    Quite a hack, but seems to work fine and fixes the BZ.
    --{enable,disable}repo options tested and work as expected.

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


More information about the Yum-commits mailing list