From 36798da6b02677f0d8d3808bb0541148d8e1c314 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Fri, 10 Apr 2015 12:39:12 +0200 Subject: reproducible: new db table: removed_packages, to track removed package and subsequently clean up files the db now stores tuple of (pkgname, suite, architecture) of every removed packages, then reproducible_maintenance.sh pick up entries from it and find+remove files. For now the reproducible_maintenance only output what he would have remove. --- bin/reproducible_scheduler.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bin/reproducible_scheduler.py') diff --git a/bin/reproducible_scheduler.py b/bin/reproducible_scheduler.py index bb465ea6..78d6fcb6 100755 --- a/bin/reproducible_scheduler.py +++ b/bin/reproducible_scheduler.py @@ -102,11 +102,13 @@ def update_sources_tables(suite): rmed_pkgs = [x for x in cur_pkgs_name if x not in new_pkgs_name] log.info('Now deleting ' + str(len(rmed_pkgs)) + ' removed packages: ' + str(rmed_pkgs)) rmed_pkgs_id = [] + pkgs_to_rm = [] for pkg in rmed_pkgs: result = query_db(('SELECT id FROM sources ' + 'WHERE name="{name}" ' + 'AND suite="{suite}"').format(name=pkg, suite=suite)) rmed_pkgs_id.extend(result) + pkgs_to_rm.extend([(x[0], x[1], 'amd64') for x in result]) log.debug('removed packages ID: ' + str([str(x[0]) for x in rmed_pkgs_id])) cursor.executemany('DELETE FROM sources ' + 'WHERE id=?', rmed_pkgs_id) @@ -114,6 +116,9 @@ def update_sources_tables(suite): 'WHERE package_id=?', rmed_pkgs_id) cursor.executemany('DELETE FROM schedule ' + 'WHERE package_id=?', rmed_pkgs_id) + cursor.executemany('INSERT INTO removed_packages ' + + '(name, suite, architecture) ' + + 'VALUES (?, ?, ?)', pkgs_to_rm) conn_db.commit() # finally check whether the db has the correct number of packages pkgs_end = query_db('SELECT count(*) FROM sources WHERE suite="%s"' % suite) -- cgit v1.2.3-70-g09d2