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

This commit is contained in:
Seth Vidal 2013-02-01 16:47:53 -05:00
parent 1c067845f2
commit 808554dee6

View file

@ -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 ]
else:
myrepoq = list(repoq)
for repoid in en_repos:
r_cmd = ['--enablerepo', repoid]
repoq.extend(r_cmd)
myrepoq.extend(r_cmd)
for repoid in dis_repos:
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)
if rc == 0:
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 ])
else:
myrepoq = list(repoq)
for repoid in en_repos:
r_cmd = ['--enablerepo', repoid]
repoq.extend(r_cmd)
myrepoq.extend(r_cmd)
for repoid in dis_repos:
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)
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 ])
else:
myrepoq = list(repoq)
for repoid in en_repos:
r_cmd = ['--enablerepo', repoid]
repoq.extend(r_cmd)
myrepoq.extend(r_cmd)
for repoid in dis_repos:
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)
cmd = repoq + ["--qf", qf, req_spec]
cmd = myrepoq + ["--qf", qf, req_spec]
rc2,out2,err2 = module.run_command(cmd)
if rc == 0 and rc2 == 0:
out += out2