diff options
author | Jesse Keating <jkeating@redhat.com> | 2008-10-30 21:28:27 +0000 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2008-10-30 21:28:27 +0000 |
commit | 1d411d09c5782555ff3db840264f90f7582b0829 (patch) | |
tree | d1409e6fccf74a96e35b2201697908b0454fb02a | |
parent | 5a13846a7429da93f2de8f21bcb669a0d2531856 (diff) | |
download | live-scripts-master.tar.gz live-scripts-master.tar.xz live-scripts-master.zip |
-rwxr-xr-x[-rw-r--r--] | livesizediff.py | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/livesizediff.py b/livesizediff.py index 195f58b..fc79385 100644..100755 --- a/livesizediff.py +++ b/livesizediff.py @@ -24,16 +24,54 @@ new = sys.argv[2] oldpkgs = readfile(old) newpkgs = readfile(new) +newlist = [] +gonelist = [] +growths = [] +shrinkage = [] + for (pkg, size) in newpkgs.items(): if not oldpkgs.has_key(pkg): - print "new package %s: %s" %(pkg, size) + newlist.append((pkg, int(size))) + #print "new package %s: %s" %(pkg, size) continue oldsize = oldpkgs[pkg] if oldsize == "0": continue - deltapct = (int(size) - int(oldsize)) / float(oldsize) - if deltapct > THRESH: - print "%s grew by %.2f%% (%s->%s)" %(pkg, deltapct*100, oldsize, size) + if size > oldsize: + deltapct = (int(size) - int(oldsize)) / float(oldsize) + if deltapct > THRESH: + growths.append((pkg, int(size) - int(oldsize), deltapct*100, oldsize, size)) + #print "%s grew by %.2f%% (%s->%s)" %(pkg, deltapct*100, oldsize, size) + elif size < oldsize: + deltapct = (int(oldsize) - int(size)) / float(size) + if deltapct > THRESH: + shrinkage.append((pkg, int(oldsize) - int(size), deltapct*100, oldsize, size)) + #print "%s shrank by %.2f%% (%s->%s)" %(pkg, deltapct*100, oldsize, size) + +for (pkg, size) in oldpkgs.items(): + if not newpkgs.has_key(pkg): + gonelist.append((pkg, int(size))) print "old has %d packages" %(len(oldpkgs),) print "new has %d packages" %(len(newpkgs),) + +growths.sort(key=lambda x: -x[1]) +shrinkage.sort(key=lambda x: -x[1]) +newlist.sort(key=lambda x: -x[1]) +gonelist.sort(key=lambda x: -x[1]) + +print "\nGrowths:" +for growth in growths: + print "%s grew by %s (%.2f%%) (%s->%s)" % growth + +print "\nShrinkage:" +for shrink in shrinkage: + print "%s shrank by %s (%.2f%%) (%s->%s)" % shrink + +print "\nNew packages:" +for new in newlist: + print "%s: %s" % new + +print "\nRemoved packages:" +for gone in gonelist: + print "%s: %s" % gone |