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

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