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