Skip to content

Commit

Permalink
use a local copy of repoq so we don't inadvertently pollute the one f…
Browse files Browse the repository at this point in the history
…or is_installed
  • Loading branch information
skvidal committed Feb 1, 2013
1 parent 1c06784 commit 808554d
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions library/yum
Original file line number Diff line number Diff line change
Expand Up @@ -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() ]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 808554d

Please sign in to comment.