From 1081cbbfe080557c30cade030f278af34f4b1951 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Apr 05 2020 04:18:52 +0000 Subject: Add sqlite index to srpm column. --- diff --git a/mdapi-get_repo_md b/mdapi-get_repo_md index 2992edb..1471bd3 100755 --- a/mdapi-get_repo_md +++ b/mdapi-get_repo_md @@ -192,6 +192,16 @@ def decompress_db(name, archive, location): raise NotImplementedError(archive) +def index_db(name, tempdb): + print(f'{name.ljust(padding)} Indexing file: {tempdb}') + + if tempdb.endswith('primary.sqlite'): + conn = sqlite3.connect(tempdb) + conn.execute('CREATE INDEX packageSource ON packages (rpm_sourcerpm)') + conn.commit() + conn.close() + + def compare_dbs(name, db1, db2, cache1, cache2): print(f'{name.ljust(padding)} Comparing {db1} and {db2}') @@ -412,6 +422,7 @@ def process_repo(repo): download_db(name, repomd_url, archive) decompress_db(name, archive, tempdb) + index_db(name, tempdb) if PUBLISH_CHANGES: packages = compare_dbs(name, tempdb, destfile, cache1, cache2) publish_changes(name, packages, repomd_url)