From 7d6d3eab0db08f6905c90061cacb2b26c42949f2 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 3 Sep 2023 13:50:27 +0200 Subject: Fix deprecation warning with borg 1.2.x Signed-off-by: Florian Pritz --- Changes | 1 + lib/App/BorgRestore/Borg.pm | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 0fa7341..8d12e49 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for Perl extension App-BorgRestore {{$NEXT}} + - Fix deprecation warning with borg 1.2.x 3.4.4 2020-10-14T12:37:04Z - Require DBD::SQLite 1.60 or newer to fix issues with schema migration 2 diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm index 04ad89c..9884b21 100644 --- a/lib/App/BorgRestore/Borg.pm +++ b/lib/App/BorgRestore/Borg.pm @@ -55,7 +55,14 @@ method borg_list() { my @archives; my $backup_prefix = $self->{backup_prefix}; - if (Version::Compare::version_compare($self->{borg_version}, "1.1") >= 0) { + if (Version::Compare::version_compare($self->{borg_version}, "1.2") >= 0) { + $log->debug("Getting archive list via json"); + run [qw(borg list --glob-archives), "$backup_prefix*", qw(--json), $self->{borg_repo}], '>', \my $output or die $log->error("borg list returned $?")."\n"; + my $json = decode_json($output); + for my $archive (@{$json->{archives}}) { + push @archives, $archive->{archive}; + } + } elsif (Version::Compare::version_compare($self->{borg_version}, "1.1") >= 0) { $log->debug("Getting archive list via json"); run [qw(borg list --prefix), $backup_prefix, qw(--json), $self->{borg_repo}], '>', \my $output or die $log->error("borg list returned $?")."\n"; my $json = decode_json($output); -- cgit v1.2.3-24-g4f1b