def rebuild_db(files=False): filesdb = pisi.db.filesdb.FilesDB() installdb = pisi.db.installdb.InstallDB() def rebuild_filesdb(): for pkg in list_installed(): ctx.ui.info(_('Adding \'%s\' to db... ') % pkg, noln=True) files = installdb.get_files(pkg) filesdb.add_files(pkg, files) ctx.ui.info(_('OK.')) # save parameters and shutdown pisi options = ctx.config.options ui = ctx.ui comar = ctx.comar pisi._cleanup() filesdb.close() filesdb.destroy() filesdb.init() # reinitialize everything set_userinterface(ui) set_options(options) set_comar(comar) # construct new database rebuild_filesdb()