Blame SOURCES/BZ-1024070-yum-builddep-requires-source-repos-disabled.patch

a72215
commit 8d1f2b4a8ba6306152c25591ab6b14b6ad9915bd
a72215
Author: Zdenek Pavlas <zpavlas@redhat.com>
a72215
Date:   Fri Jan 17 14:45:46 2014 +0100
a72215
a72215
    yum-builddep: Use srpms in already enabled repos. BZ 1024070
a72215
    
a72215
    Enable "src" arch first, then source repos, then init sacks.
a72215
    Fixes BZ and we don't have to disable/enable to change arches.
a72215
a72215
diff --git a/yum-builddep.py b/yum-builddep.py
a72215
index b9e682a..216066e 100755
a72215
--- a/yum-builddep.py
a72215
+++ b/yum-builddep.py
a72215
@@ -92,6 +92,10 @@ class YumBuildDep(YumUtilBase):
a72215
             self.logger.error("Error: You must be root to install packages")
a72215
             sys.exit(1)
a72215
 
a72215
+        # Use source rpms
a72215
+        self.arch.archlist.append('src')
a72215
+        self.setupSourceRepos()
a72215
+
a72215
         # Setup yum (Ts, RPM db, Repo & Sack)
a72215
         self.doUtilYumSetup()
a72215
         # Do the real action
a72215
@@ -122,7 +126,6 @@ class YumBuildDep(YumUtilBase):
a72215
         
a72215
     def setupSourceRepos(self):
a72215
         # enable the -source repos for enabled primary repos
a72215
-        archlist = rpmUtils.arch.getArchList() + ['src']    
a72215
         for repo in self.repos.listEnabled():
a72215
             issource_repo = repo.id.endswith('-source')
a72215
             if rhn_source_repos and repo.id.endswith('-source-rpms'):
a72215
@@ -133,24 +136,13 @@ class YumBuildDep(YumUtilBase):
a72215
             elif not issource_repo:
a72215
                 srcrepo = '%s-source' % repo.id
a72215
             else:
a72215
-                # Need to change the arch.
a72215
-                repo.close()
a72215
-                self.repos.disableRepo(repo.id)
a72215
-                srcrepo = repo.id
a72215
+                continue
a72215
             
a72215
             for r in self.repos.findRepos(srcrepo):
a72215
                 if r in self.repos.listEnabled():
a72215
                     continue
a72215
                 self.logger.info('Enabling %s repository' % r.id)
a72215
                 r.enable()
a72215
-                # Setup the repo, without a cache
a72215
-                r.setup(0)
a72215
-                # Setup pkgSack with 'src' in the archlist
a72215
-                try:
a72215
-                    self._getSacks(archlist=archlist,thisrepo=r.id)
a72215
-                except yum.Errors.RepoError, e:
a72215
-                    print "Could not setup repo %s: %s" % (r.id, e)
a72215
-                    sys.exit(1)
a72215
 
a72215
     def install_deps(self, deplist):
a72215
         errors = set()
a72215
@@ -213,7 +205,6 @@ class YumBuildDep(YumUtilBase):
a72215
 
a72215
         toActOn = []     
a72215
         if srcnames:
a72215
-            self.setupSourceRepos()
a72215
             pkgs = self.pkgSack.returnPackages(patterns=srcnames)
a72215
             exact, match, unmatch = yum.packages.parsePackages(pkgs, srcnames, casematch=1)
a72215
             srpms += exact + match