use a local copy of repoq so we don't inadvertently pollute the one for is_installed

reviewable/pr18780/r1
Seth Vidal 12 years ago
parent 7d3f6fdb3c
commit 51a1e0ebb7

25
yum

@ -168,15 +168,17 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
return [ po_to_nevra(p) for p in pkgs ] return [ po_to_nevra(p) for p in pkgs ]
else: else:
myrepoq = list(repoq)
for repoid in en_repos: for repoid in en_repos:
r_cmd = ['--enablerepo', repoid] r_cmd = ['--enablerepo', repoid]
repoq.extend(r_cmd) myrepoq.extend(r_cmd)
for repoid in dis_repos: for repoid in dis_repos:
r_cmd = ['--disablerepo', repoid] r_cmd = ['--disablerepo', repoid]
repoq.extend(r_cmd) myrepoq.extend(r_cmd)
cmd = repoq + ["--qf", qf, pkgspec] cmd = myrepoq + ["--qf", qf, pkgspec]
rc,out,err = module.run_command(cmd) rc,out,err = module.run_command(cmd)
if rc == 0: if rc == 0:
return [ p for p in out.split('\n') if p.strip() ] return [ p for p in out.split('\n') if p.strip() ]
@ -216,16 +218,17 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_rep
return set([ po_to_nevra(p) for p in retpkgs ]) return set([ po_to_nevra(p) for p in retpkgs ])
else: else:
myrepoq = list(repoq)
for repoid in en_repos: for repoid in en_repos:
r_cmd = ['--enablerepo', repoid] r_cmd = ['--enablerepo', repoid]
repoq.extend(r_cmd) myrepoq.extend(r_cmd)
for repoid in dis_repos: for repoid in dis_repos:
r_cmd = ['--disablerepo', repoid] r_cmd = ['--disablerepo', repoid]
repoq.extend(r_cmd) myrepoq.extend(r_cmd)
cmd = repoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec] cmd = myrepoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec]
rc,out,err = module.run_command(cmd) rc,out,err = module.run_command(cmd)
if rc == 0: if rc == 0:
@ -261,18 +264,18 @@ def what_provides(module, repoq, req_spec, conf_file, qf=def_qf, en_repos=[], d
return set([ po_to_nevra(p) for p in pkgs ]) return set([ po_to_nevra(p) for p in pkgs ])
else: else:
myrepoq = list(repoq)
for repoid in en_repos: for repoid in en_repos:
r_cmd = ['--enablerepo', repoid] r_cmd = ['--enablerepo', repoid]
repoq.extend(r_cmd) myrepoq.extend(r_cmd)
for repoid in dis_repos: for repoid in dis_repos:
r_cmd = ['--disablerepo', repoid] r_cmd = ['--disablerepo', repoid]
repoq.extend(r_cmd) myrepoq.extend(r_cmd)
cmd = repoq + ["--qf", qf, "--whatprovides", req_spec] cmd = myrepoq + ["--qf", qf, "--whatprovides", req_spec]
rc,out,err = module.run_command(cmd) rc,out,err = module.run_command(cmd)
cmd = repoq + ["--qf", qf, req_spec] cmd = myrepoq + ["--qf", qf, req_spec]
rc2,out2,err2 = module.run_command(cmd) rc2,out2,err2 = module.run_command(cmd)
if rc == 0 and rc2 == 0: if rc == 0 and rc2 == 0:
out += out2 out += out2

Loading…
Cancel
Save