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

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