diff --git a/security/python-keyring/debian/deb_patches/debian-depend-tsconfig.patch b/security/python-keyring/debian/deb_patches/debian-depend-tsconfig.patch deleted file mode 100644 index 06f9f854f..000000000 --- a/security/python-keyring/debian/deb_patches/debian-depend-tsconfig.patch +++ /dev/null @@ -1,13 +0,0 @@ -The source patch keyring_path_change.patch import -tsconfig, so add tsconfig to Depends - ---- a/debian/control -+++ b/debian/control -@@ -20,6 +20,7 @@ Package: python3-keyring - Architecture: all - Depends: python3-jeepney (>= 0.4.2), - python3-secretstorage (>= 3.2), -+ tsconfig - ${misc:Depends}, - ${python3:Depends} - Suggests: gnome-keyring, libkf5wallet-bin, python3-dbus, python3-keyrings.alt diff --git a/security/python-keyring/debian/deb_patches/series b/security/python-keyring/debian/deb_patches/series deleted file mode 100644 index bcc061558..000000000 --- a/security/python-keyring/debian/deb_patches/series +++ /dev/null @@ -1 +0,0 @@ -debian-depend-tsconfig.patch diff --git a/security/python-keyring/debian/patches/0001-Determine-the-SW_VERSION-at-run-time.patch b/security/python-keyring/debian/patches/0001-Determine-the-SW_VERSION-at-run-time.patch new file mode 100644 index 000000000..c3767c9f4 --- /dev/null +++ b/security/python-keyring/debian/patches/0001-Determine-the-SW_VERSION-at-run-time.patch @@ -0,0 +1,46 @@ +From 6cceddb03a3cad7a09a70d0c2fdc901d9758c025 Mon Sep 17 00:00:00 2001 +From: Yue Tao +Date: Wed, 20 Apr 2022 14:29:27 +0800 +Subject: [PATCH] Determine the SW_VERSION at run time + +Get the SW_VERSION via parsing the /etc/build.info file instead of +tsconfig.tsconfig module at run time to break python-keyring run depends +on tsconfig. + +Signed-off-by: Yue Tao +--- + keyring/util/platform_.py | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/keyring/util/platform_.py b/keyring/util/platform_.py +index bb4d297..5eebd70 100644 +--- a/keyring/util/platform_.py ++++ b/keyring/util/platform_.py +@@ -21,7 +21,23 @@ def _data_root_Linux(): + Use freedesktop.org Base Dir Specfication to determine storage + location. + """ +- fallback = os.path.expanduser('/opt/platform/.keyring/') ++ build_info = "/etc/build.info" ++ try: ++ with open(build_info, 'r') as binfo: ++ lines = list(line for line in (p.strip() for p in binfo) if line) ++ except Exception as e: ++ print(e, file=sys.stderr) ++ raise IOError ++ ++ sw_version = None ++ for entry in lines: ++ if entry.startswith('SW_VERSION='): ++ sw_version = entry.split("=")[1].strip('"') ++ break ++ if sw_version == None: ++ raise ValueError(f"No SW_VERSION found in {build_info}") ++ keyring_dir = os.path.join('/opt/platform/.keyring', sw_version) ++ fallback = os.path.expanduser(keyring_dir) + root = os.environ.get('XDG_DATA_HOME', None) or fallback + return os.path.join(root, 'python_keyring') + +-- +2.25.1 + diff --git a/security/python-keyring/debian/patches/keyring_path_change.patch b/security/python-keyring/debian/patches/keyring_path_change.patch deleted file mode 100644 index 8aecd304b..000000000 --- a/security/python-keyring/debian/patches/keyring_path_change.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- - keyring/util/platform_.py | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/keyring/util/platform_.py -+++ b/keyring/util/platform_.py -@@ -1,5 +1,6 @@ - import os - import platform -+from tsconfig.tsconfig import SW_VERSION - - - def _settings_root_XP(): -@@ -21,7 +22,8 @@ def _data_root_Linux(): - Use freedesktop.org Base Dir Specfication to determine storage - location. - """ -- fallback = os.path.expanduser('/opt/platform/.keyring/') -+ keyring_dir = os.path.join('/opt/platform/.keyring', SW_VERSION) -+ fallback = os.path.expanduser(keyring_dir) - root = os.environ.get('XDG_DATA_HOME', None) or fallback - return os.path.join(root, 'python_keyring') - diff --git a/security/python-keyring/debian/patches/series b/security/python-keyring/debian/patches/series index d40f47b09..23e8ae60e 100644 --- a/security/python-keyring/debian/patches/series +++ b/security/python-keyring/debian/patches/series @@ -1,2 +1,2 @@ no_keyring_password.patch -keyring_path_change.patch +0001-Determine-the-SW_VERSION-at-run-time.patch