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 --- lib/App/BorgRestore/Borg.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/App/BorgRestore') 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