Blame SOURCES/0001-Backup-with-sqlite3-special-command.patch

ad10f4
From fc21b98dced2c78f90f917c1a45a28184024d604 Mon Sep 17 00:00:00 2001
ad10f4
From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Hor=C3=A1=C4=8Dek?=
ad10f4
 <shoracek@redhat.com>
ad10f4
Date: Tue, 6 Sep 2022 16:54:33 +0200
ad10f4
Subject: [PATCH 1/6] Backup with sqlite3 special command
ad10f4
MIME-Version: 1.0
ad10f4
Content-Type: text/plain; charset=UTF-8
ad10f4
Content-Transfer-Encoding: 8bit
ad10f4
ad10f4
Upstream uses method introduced in Python 3.7, but RHEL 8 uses
ad10f4
Python 3.6. This means that the method is not available and using the
ad10f4
command line interface seems to be the simplest solution.
ad10f4
ad10f4
Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
ad10f4
---
ad10f4
 tools/tpm2_pkcs11/db.py | 3 ++-
ad10f4
 1 file changed, 2 insertions(+), 1 deletion(-)
ad10f4
ad10f4
diff --git a/tools/tpm2_pkcs11/db.py b/tools/tpm2_pkcs11/db.py
ad10f4
index 7971028..1b18b8f 100644
ad10f4
--- a/tools/tpm2_pkcs11/db.py
ad10f4
+++ b/tools/tpm2_pkcs11/db.py
ad10f4
@@ -6,6 +6,7 @@ import sys
ad10f4
 import sqlite3
ad10f4
 import textwrap
ad10f4
 import yaml
ad10f4
+import subprocess
ad10f4
 
ad10f4
 from .pkcs11t import (
ad10f4
     CKA_ALLOWED_MECHANISMS,
ad10f4
@@ -258,8 +259,8 @@ class Db(object):
ad10f4
         if os.path.exists(dbpath):
ad10f4
             raise RuntimeError("Backup DB exists at {} not overwriting. "
ad10f4
                 "Refusing to run".format(dbpath))
ad10f4
+        subprocess.run(["sqlite3", self._path, ".backup {}".format(dbpath)])
ad10f4
         bck = sqlite3.connect(dbpath)
ad10f4
-        con.backup(bck)
ad10f4
         return (bck, dbpath)
ad10f4
 
ad10f4
     def _update_on_2(self, dbbakcon):
ad10f4
-- 
ad10f4
2.38.1
ad10f4