X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fpysolv;h=b69234efc5294d4b1c22200827059b2566dceeed;hb=1aac48dff40ef592968a18058bad270da65ed847;hp=75067f2e73ded17f004aa0a2009893ff64386da1;hpb=2d757ccc60324e7bfcc07f6f46d7f38e30642fcb;p=platform%2Fupstream%2Flibsolv.git diff --git a/examples/pysolv b/examples/pysolv index 75067f2..b69234e 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -43,6 +43,7 @@ from optparse import OptionParser #import gc #gc.set_debug(gc.DEBUG_LEAK) +#rpm.setVerbosity(rpm.RPMLOG_DEBUG) class repo_generic(dict): def __init__(self, name, type, attribs = {}): @@ -787,6 +788,11 @@ while True: sys.stdout.write("Please choose a solution: ") sys.stdout.flush() sol = sys.stdin.readline().strip() + if sol == 'p': + print('') + for decisionset in problem.get_decisionsetlist(): + print("%s: %s" % (decisionset, decisionset.reasonstr())) + print('') if sol == 's': continue # skip problem if sol == 'q': @@ -802,7 +808,6 @@ while True: # no problems, show transaction trans = solver.transaction() -del solver if trans.isempty(): print("Nothing to do.") sys.exit(0) @@ -838,6 +843,20 @@ for cl in trans.classify(solv.Transaction.SOLVER_TRANSACTION_SHOW_OBSOLETES | so print("install size change: %d K" % trans.calc_installsizechange()) print('') +alternatives = solver.alternatives() +if alternatives: + print('Alternatives:') + for a in alternatives: + print('') + print(a) + aidx = 1 + for ac in a.choices(): + print("%6d: %s" % (aidx, ac)) + aidx = aidx + 1 + print('') + +del solver + while True: sys.stdout.write("OK to continue (y/n)? ") sys.stdout.flush() @@ -944,7 +963,9 @@ if checkproblems: ts.order() def runCallback(reason, amount, total, p, d): if reason == rpm.RPMCALLBACK_INST_OPEN_FILE: - return newpkgsfp[p.id].fileno() + f = newpkgsfp[p.id] + os.lseek(f.fileno(), 0, os.SEEK_SET) + return f.fileno() if reason == rpm.RPMCALLBACK_INST_START: print("install %s" % p) if reason == rpm.RPMCALLBACK_UNINST_START: