From 582b7521cba4391845c167037cc1d362c7e76bd3 Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Sat, 24 Apr 2010 19:56:54 +0200
Subject: [PATCH] dup: ignore anything but digits and "." when comparing
 versions (Closes: #578987)

I'd love to use "dpkg --compare-versions" but we don't want backupninja to be
Debian-specific. Any similar tool?

Signed-off-by: intrigeri <intrigeri@boum.org>
---
 ChangeLog       | 2 ++
 handlers/dup.in | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7b8d3831..f9442018 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@ version 0.9.8 -- UNRELEASED
 	 . Use duplicity's --extra-clean option to get rid of unnecessary old
 	   cache files when cleaning up. This is enabled when using duplicity
 	   0.6.01 or newer, that depends on local caching (Closes: #572721)
+	 . dup: ignore anything but digits and "." when comparing versions
+	   (Closes: #578987)
 
 version 0.9.7 -- January 27, 2010
     backupninja changes
diff --git a/handlers/dup.in b/handlers/dup.in
index c8dfcba6..c8930176 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -95,8 +95,8 @@ else
    execstr_serverpart="scp://$destuser@$desthost/$destdir"
 fi
 
-### duplicity version
-duplicity_version="`duplicity --version | @AWK@ '{print $2}'`"
+### duplicity version (ignore anything else than 0-9 and ".")
+duplicity_version="`duplicity --version | @AWK@ '{print $2}' | @SED@ 's/[^.[:digit:]]//g'`"
 duplicity_major="`echo $duplicity_version | @AWK@ -F '.' '{print $1}'`"
 duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`"
 duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`"
-- 
GitLab