From e2a3a0bedf4b0ca532578201727eca70075b81a6 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 30 May 2021 17:55:39 +0200 Subject: [PATCH] Fix 'from_version' issue because of ~alpha in current bullseye version name --- src/yunohost/backup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/yunohost/backup.py b/src/yunohost/backup.py index 862c07690..b94eda683 100644 --- a/src/yunohost/backup.py +++ b/src/yunohost/backup.py @@ -860,9 +860,13 @@ class RestoreManager: # FIXME this way to get the info is not compatible with copy or custom # backup methods self.info = backup_info(name, with_details=True) - if not self.info["from_yunohost_version"] or version.parse( - self.info["from_yunohost_version"] - ) < version.parse("3.8.0"): + + from_version = self.info.get("from_yunohost_version", "") + # Remove any '~foobar' in the version ... c.f ~alpha, ~beta version during + # early dev for next debian version + from_version = re.sub(r'~\w+', '', from_version) + + if not from_version or version.parse(from_version) < version.parse("3.8.0"): raise YunohostValidationError("restore_backup_too_old") self.archive_path = self.info["path"]