new_contents: #!/usr/bin/python
  
  ## Binary Analysis Tool
  ## Copyright 2013 Armijn Hemel for Tjaldur Software Governance Solutions
  ## Licensed under Apache 2.0, see LICENSE file for details
  
  '''
  '''
  
  import os, os.path, sys, sqlite3
  from optparse import OptionParser
  
  def main(argv):
  	parser = OptionParser()
  	parser.add_option("-c", "--correctedlist", action="store", dest="correctedlist", help="path to corrected list", metavar="FILE")
  	parser.add_option("-n", "--newlist", action="store", dest="newlist", help="path to new list", metavar="FILE")
  	(options, args) = parser.parse_args()
  
  	if options.correctedlist == None:
  		parser.error("Need corrected list")
  	if options.newlist == None:
  		parser.error("Need new list")
  
  	if not os.path.exists(options.correctedlist):
  		parser.error("Need corrected list")
  	if not os.path.exists(options.newlist):
  		parser.error("Need new list")
  
  	## first suck in the corrected data, filename is key
  	correctedfiles = {}
  	correctedfile_list = open(options.correctedlist).readlines()
  	for c in correctedfile_list:
  		(package, version, filename, origin) = c.strip().split()
  		## this should actually not happen
  		if correctedfiles.has_key(filename):
  			continue
  		else:
  			correctedfiles[filename] = (package, version, origin)
  
  	## then suck in the new data, filename is key
  	newfiles = {}
  	newfile_list = open(options.newlist).readlines()
  	for c in newfile_list:
  		(package, version, filename, origin) = c.strip().split()
  		## this should actually not happen
  		if newfiles.has_key(filename):
  			continue
  		else:
  			newfiles[filename] = (package, version, origin)
  	listentries = []
  	for i in newfiles.keys():
  		if correctedfiles.has_key(i):
  			## entries are not the same!
  			if newfiles[i] != correctedfiles[i]:
  				listentries.append("%s\t%s\t%s\t%s" % (correctedfiles[i][0], correctedfiles[i][1], i, correctedfiles[i][2]))
  			else:
  				listentries.append("%s\t%s\t%s\t%s" % (newfiles[i][0], newfiles[i][1], i, newfiles[i][2]))
  		else:
  			listentries.append("%s\t%s\t%s\t%s" % (newfiles[i][0], newfiles[i][1], i, newfiles[i][2]))
  	for i in listentries:
  		print i
  if __name__ == "__main__":
  	main(sys.argv)
  
subject: add script to rewrite lists based on output of dumplist and generatelist