Mass Deface
Email Grabber
Already installed : %s' % instreq[0])
continue
try:
pkg = self.returnPackageByDep(dep)
self.logger.info(' --> %s' % pkg)
self.install(pkg)
except yum.Errors.YumBaseError, e:
errors.add(exception2msg(e))
if errors:
for i in sorted(errors):
self.logger.error("Error: %s" % i)
if not opts.tolerant:
sys.exit(1)
# go through each of the pkgs, figure out what they are/where they are
# if they are not a local package then run
# Setup source repos
#self.setupSourceRepos()
# get all of their deps
# throw them into a ts
# run the ts
def get_build_deps(self,opts):
srcnames = []
specnames = []
srpms = []
specworks = False
reloadworks = False
# See if we can use spec files for buildrequires
if hasattr(rpm, 'spec') and hasattr(rpm.spec, 'sourceHeader'):
specworks = True
# See if we can reload rpm configuration
if hasattr(rpm, 'reloadConfig'):
reloadworks = True
for arg in self.cmds:
if arg.endswith('.src.rpm'):
try:
srpms.append(yum.packages.YumLocalPackage(self.ts, arg))
except yum.Errors.MiscError, e:
self.logger.error("Error: Could not open %s .\nTry"
" running yum-builddep with the --nogpgcheck option." % arg)
raise
elif arg.endswith('.src'):
srcnames.append(arg)
elif specworks and arg.endswith('.spec'):
specnames.append(arg)
else:
srcnames.append(arg)
toActOn = []
if srcnames:
pkgs = self.pkgSack.returnPackages(patterns=srcnames)
exact, match, unmatch = yum.packages.parsePackages(pkgs, srcnames, casematch=1)
srpms += exact + match
if len(unmatch):
pkgs = self.rpmdb.returnPackages(patterns=unmatch)
exact, match, unmatch = yum.packages.parsePackages(pkgs, unmatch, casematch=1)
if len(unmatch):
self.logger.error("No such package(s): %s" %
", ".join(unmatch))
sys.exit(1)
toActOn = []
# Get the best matching srpms
for newpkg in srpms:
srcpkg = _best_convert_pkg2srcpkgs(self, opts, newpkg)
toActOn.extend(self.bestPackagesFromList(srcpkg, 'src'))
for srpm in toActOn:
self.logger.info('Getting requirements for %s' % srpm)
self.install_deps(srpm.requiresList(), opts)
# Parse macro defines
macros = []
error = False
for define in opts.define:
words = define.split(None, 1)
if len(words) == 1:
self.logger.error('Error: No EXPR given for MACRO %%%s'
% words[0])
error = True
continue
macros.append(words)
if error:
sys.exit(1)
for name in specnames:
# (re)load rpm config for target if set
if reloadworks and opts.target:
rpm.reloadConfig(opts.target)
for macro in macros:
rpm.addMacro(*macro)
try:
spec = rpm.spec(name)
except ValueError:
self.logger.error("Bad spec: %s" % name)
continue
# reset default rpm config after each parse to avoid side-effects
if reloadworks:
rpm.reloadConfig()
buildreqs = []
for d in rpm.ds(spec.sourceHeader, 'requires'):
buildreqs.append(d.DNEVR()[2:])
self.logger.info('Getting requirements for %s' % name)
self.install_deps(buildreqs, opts)
if __name__ == '__main__':
setup_locale()
util = YumBuildDep()