From 03229ed620fb5bd5a19f2ffac8c9a87a7e23a3f9 Mon Sep 17 00:00:00 2001 From: "martin@piware.de" <> Date: Tue, 29 Jun 2010 14:22:10 +0200 Subject: [PATCH] add iso-deb-size-compare --- iso-deb-size-compare | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100755 iso-deb-size-compare diff --git a/iso-deb-size-compare b/iso-deb-size-compare new file mode 100755 index 0000000..c98bb28 --- /dev/null +++ b/iso-deb-size-compare @@ -0,0 +1,68 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + +import subprocess, sys + +def deb_size_map(iso_path): + map = {} # package -> (version, size) + isoinfo = subprocess.Popen(['isoinfo', '-lR', '-i', iso_path], + stdout=subprocess.PIPE) + out = isoinfo.communicate()[0] + assert isoinfo.returncode == 0 + + for l in out.splitlines(): + l = l.strip() + if not l.endswith('.deb'): + continue + + fields = l.split() + size = int(fields[4]) + fname = fields[11] + + (pkg, version, _) = fname.split('_') + map[pkg] = (version, size) + + return map + +# +# main +# + +if len(sys.argv) != 3: + print >> sys.stderr, 'Usage: %s ' % sys.argv[0] + sys.exit(1) + +old_map = deb_size_map(sys.argv[1]) +new_map = deb_size_map(sys.argv[2]) + +print '== Removed packages ==' +sum = 0 +for p, (v, s) in old_map.iteritems(): + if p not in new_map: + print '%s (%.1f MB)' % (p, s / 1000000.) + sum += s +print 'TOTAL: -%.1f MB' % (sum/1000000.) + +sum = 0 +print '\n== Added packages ==' +for p, (v, s) in new_map.iteritems(): + if p not in old_map: + print '%s (%.1f MB)' % (p, s / 1000000.) + sum += s +print 'TOTAL: +%.1f MB' % (sum/1000000.) + +print '\n== Changed packages ==' +sum = 0 +for p, (v, s) in old_map.iteritems(): + if p not in new_map: + continue + + new_s = new_map[p][1] + sum += new_s - s + + # only show differences > 100 kB to filter out noise + if new_s - s > 100000: + print '%s (Δ %.1f MB - %s: %.1f MB %s: %.1f MB)' % ( + p, (new_s-s)/1000000., v, s/1000000., new_map[p][0], new_s/1000000.) + +print 'TOTAL difference: %.1f MB' % (sum/1000000.) -- 2.39.2