[Git][security-tracker-team/security-tracker][master] 2 commits: Add file print of the removed_packages into DB

Anton Gladky (@gladk) gladk at debian.org
Thu May 25 14:01:36 BST 2023



Anton Gladky pushed to branch master at Debian Security Tracker / security-tracker


Commits:
b232fb0b by Anton Gladky at 2023-05-25T13:51:43+02:00
Add file print of the removed_packages into DB

- - - - -
704ed519 by Anton Gladky at 2023-05-25T13:01:23+00:00
Merge branch 'add_removed_files_to_DB' into 'master'

Add file print of the removed_packages into DB

See merge request security-tracker-team/security-tracker!134
- - - - -


1 changed file:

- lib/python/security_db.py


Changes:

=====================================
lib/python/security_db.py
=====================================
@@ -963,14 +963,19 @@ class DB:
         source_paths = [src["path"] for src in sources]
 
         unchanged = True
+        changed_source = None
         for filename in source_paths + [source_removed_packages]:
             if has_changed(path + filename):
                 unchanged = False
+                changed_source = path + filename
                 break
         if unchanged:
             if self.verbose:
                 print("  finished (no changes)")
             return
+        else:
+            if self.verbose:
+                print(f"  clearing database, because some files have changed ({changed_source})")
 
         clear_db()
 
@@ -1992,6 +1997,14 @@ class DB:
         cursor.executemany(
             "INSERT OR IGNORE INTO removed_packages (name) VALUES (?)", gen())
 
+
+        # Add file print to database for removed packages
+        current_print = self.filePrint(filename)
+        cursor.execute(
+            """INSERT OR REPLACE INTO inodeprints (inodeprint, file)
+            VALUES (?, ?)""", (current_print, filename))
+
+
     def getUnknownPackages(self, cursor):
         """Returns a generator for a list of unknown packages.
         Each entry has the form (PACKAGE, BUG-LIST)."""



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/8c27ceb23a1fb7f06dc717f560846b4b6b0fa2a8...704ed519f6cfb075bf6932b4e0888098f7b7bba3

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/8c27ceb23a1fb7f06dc717f560846b4b6b0fa2a8...704ed519f6cfb075bf6932b4e0888098f7b7bba3
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20230525/ebb9e9a2/attachment-0001.htm>


More information about the debian-security-tracker-commits mailing list