Anton Gladky pushed to branch fix_987283 at Debian Security Tracker / security-tracker
Commits: aff4d306 by Anton Gladky at 2023-05-24T17:31:27+02:00 Remove one more print - - - - - 351ff96d by Anton Gladky at 2023-05-24T18:16:58+02:00 Fix failure - - - - - 1 changed file: - lib/python/security_db.py Changes: ===================================== lib/python/security_db.py ===================================== @@ -910,6 +910,8 @@ class DB: print("readBugs:") def clear_db(cleared=[False]): + if self.verbose: + print(" clearing database") # Avoid clearing the database multiple times. if cleared[0]: return @@ -922,9 +924,11 @@ class DB: for table in tables: # check first, whether the table exists try: - cursor.execute(f"SELECT 1 FROM sqlite_schema WHERE type = 'table' AND name = {table}") + cursor.execute(f"SELECT * FROM {table} LIMIT 1") except: # table does not exist + if self.verbose: + print(f"Table {table} does not exist") continue cursor.execute(f"DELETE FROM {table}") @@ -966,15 +970,13 @@ class DB: return True source_removed_packages = '/packages/removed-packages' - source_ignored_unreported = 'data/packages/ignored-debian-bug-packages' + source_ignored_unreported = '/packages/ignored-debian-bug-packages' sources = self.getSources() source_paths = [src["path"] for src in sources] unchanged = True - for filename in source_paths + [source_removed_packages, source_ignored_unreported]: - print (path + filename) if has_changed(path + filename): unchanged = False break @@ -1005,9 +1007,8 @@ class DB: print(" update removed packages") self.readRemovedAndIgnoredPackages(cursor, path + source_removed_packages, table = "removed_packages") - # Add file print to database for ignored packages - current_print = self.filePrint(source_ignored_unreported) + current_print = self.filePrint(path + source_ignored_unreported) cursor.execute( """INSERT OR REPLACE INTO inodeprints (inodeprint, file) VALUES (?, ?)""", (current_print, source_ignored_unreported)) @@ -1016,7 +1017,7 @@ class DB: print(" update ignored packages") # Read list of packages, which should be ignored for the status/unreported - self.readRemovedAndIgnoredPackages(cursor, source_ignored_unreported, table = "ignored_packages") + self.readRemovedAndIgnoredPackages(cursor, path + source_ignored_unreported, table = "ignored_packages") errors = [] @@ -1993,7 +1994,7 @@ class DB: yield bug_name def readRemovedAndIgnoredPackages(self, cursor, filename, table='removed_packages'): - """Reads a file of removed packages and stores it in the database. + """Reads a file of removed or ignored packages and stores it in the database. For that the table parameter must be set to 'removed_packages'. This is the default value. The original contents of the removed_packages table is preserved. View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/bac5fccf07af52fc6a3085cd6be7f829283d6ed8...351ff96d1b9e172d4908521e6f7f12fecb5bd656 -- View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/bac5fccf07af52fc6a3085cd6be7f829283d6ed8...351ff96d1b9e172d4908521e6f7f12fecb5bd656 You're receiving this email because of your account on salsa.debian.org.
_______________________________________________ debian-security-tracker-commits mailing list debian-security-tracker-commits@alioth-lists.debian.net https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/debian-security-tracker-commits