@@ -0,0 +1,1433 @@
+#!/usr/bin/python%0A%0Aimport sys, os, os.path%0Aimport sqlite3%0Afrom optparse import OptionParser%0A%0A## Binary Analysis Tool%0A## Copyright 2013 Armijn Hemel for Tjaldur Software Governance Solutions%0A## Licensed under Apache 2.0, see LICENSE file for details%0A%0A'''%0AThis script is to merge avgstringscache into the normal stringscache. BAT 12 and earlier used two separate caches, BAT 13 and later use a single stringscache.%0A'''%0A%0Adef main(argv):%0A%09parser = OptionParser()%0A%09parser.add_option(%22-a%22, %22--avgs%22, action=%22store%22, dest=%22avgs%22, help=%22path to averages cache%22, metavar=%22FILE%22)%0A%09parser.add_option(%22-s%22, %22--stringscache%22, action=%22store%22, dest=%22stringscache%22, help=%22path to stringscache%22, metavar=%22FILE%22)%0A%0A%09(options, args) = parser.parse_args()%0A%09if options.avgs == None:%0A%09%09parser.error(%22Need path to averages cache%22)%0A%09if options.stringscache == None:%0A%09%09parser.error(%22Need path to stringscache%22)%0A%09try:%0A%09%09conn = sqlite3.connect(options.stringscache)%0A%09except:%0A%09%09print %22Can't open database%22%0A%09%09sys.exit(1)%0A%09cursor = conn.cursor()%0A%0A%09cursor.execute(%22create table if not exists avgstringscache (package text, avgstrings real, primary key (package))%22)%0A%09cursor.execute(%22create index if not exists package_index on avgstringscache(package)%22)%0A%0A%09cursor.execute(%22attach ? as avg%22, (options.avgs,))%0A%0A%09cursor.execute(%22insert into avgstringscache select * from avg.avgstringscache%22)%0A%09conn.commit()%0A%0A%09## first create%0A%0Aif __name__ == %22__main__%22:%0A%09main(sys.argv)%0A

add database conversion script