Fix parsing cryptsetup version
Signed-off-by: Weifeng Su <suweifeng1@huawei.com>
This commit is contained in:
parent
d5f2755231
commit
e6a996f718
30
0001-Fix-parsing-cryptsetup-version.patch
Normal file
30
0001-Fix-parsing-cryptsetup-version.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From be59e3960e02663c4e46b3260c129b934f6b0ab4 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Mon, 27 Nov 2023 18:37:52 +0100
|
||||
Subject: [PATCH] Fix parsing cryptsetup version
|
||||
|
||||
'cryptsetup --version' now prints some additional flag information
|
||||
so the existing function for parsing its version is broken.
|
||||
|
||||
Fixes: #14
|
||||
---
|
||||
ssmlib/backends/crypt.py | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ssmlib/backends/crypt.py b/ssmlib/backends/crypt.py
|
||||
index 8d93fe9..e7bc377 100644
|
||||
--- a/ssmlib/backends/crypt.py
|
||||
+++ b/ssmlib/backends/crypt.py
|
||||
@@ -52,7 +52,11 @@
|
||||
def get_cryptsetup_version():
|
||||
try:
|
||||
output = misc.run(['cryptsetup', '--version'], can_fail=True)[1]
|
||||
- version = list(map(int, output.strip().split()[-1].split('.', 3)))
|
||||
+ m = re.search(r'cryptsetup ([\d\.]+)', output)
|
||||
+ if not m or len(m.groups()) != 1:
|
||||
+ version = [0, 0, 0]
|
||||
+ else:
|
||||
+ version = [int(v) for v in m.groups()[0].split(".")]
|
||||
except (OSError, AttributeError):
|
||||
version = [0, 0, 0]
|
||||
return version
|
||||
@ -2,12 +2,15 @@
|
||||
|
||||
Name: system-storage-manager
|
||||
Version: 1.4
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: A single tool to manage your storage
|
||||
License: GPLv2+
|
||||
URL: https://system-storage-manager.github.io/
|
||||
Source0: https://github.com/system-storage-manager/ssm/archive/system-storage-manager-%{version}.tar.gz
|
||||
|
||||
Patch0000: python3-sphinx.patch
|
||||
Patch0001: 0001-Fix-parsing-cryptsetup-version.patch
|
||||
|
||||
BuildArch: noarch
|
||||
Requires: util-linux which xfsprogs e2fsprogs python3-pwquality
|
||||
BuildRequires: python3-devel python3-sphinx python3-pwquality
|
||||
@ -47,6 +50,9 @@ fi
|
||||
%{python3_sitelib}/*
|
||||
|
||||
%changelog
|
||||
* Fri Feb 23 2024 Weifeng Su <suweifeng1@huawei.com> - 1.4-2
|
||||
- Fix parsing cryptsetup version
|
||||
|
||||
* Sun Jan 29 2023 lihaoxiang <lihaoxiang9@huawei.com> - 1.4-1
|
||||
- Upgrade to version 1.4.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user