X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FTapelist.pm;h=4a2d28445a8416a6565356d0921a1ccceb26f02c;hb=refs%2Ftags%2Fupstream%2F3.2.1;hp=6a746ba623e6df860027e927dcf3f6f0f716cda0;hpb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;p=debian%2Famanda diff --git a/perl/Amanda/Tapelist.pm b/perl/Amanda/Tapelist.pm index 6a746ba..4a2d284 100644 --- a/perl/Amanda/Tapelist.pm +++ b/perl/Amanda/Tapelist.pm @@ -309,7 +309,8 @@ sub remove_tapelabel { sub add_tapelabel { my $self = shift; - my ($datestamp, $label, $comment, $reuse) = @_; + my ($datestamp, $label, $comment, $reuse, $meta, $barcode) = @_; + # $meta is unused $reuse = 1 if !defined $reuse; # prepend this (presumably new) volume to the beginning of the list @@ -317,6 +318,7 @@ sub add_tapelabel { 'datestamp' => $datestamp, 'label' => $label, 'reuse' => $reuse, + 'barcode' => $barcode, 'comment' => $comment, }; $self->_update_positions(); @@ -335,8 +337,9 @@ sub write { my $datestamp = $tle->{'datestamp'}; my $label = $tle->{'label'}; my $reuse = $tle->{'reuse'} ? 'reuse' : 'no-reuse'; + my $barcode = (defined $tle->{'barcode'})? (" BARCODE:" . $tle->{'barcode'}) : ''; my $comment = (defined $tle->{'comment'})? (" #" . $tle->{'comment'}) : ''; - $result &&= print $fhn "$datestamp $label $reuse$comment\n"; + $result &&= print $fhn "$datestamp $label $reuse$barcode$comment\n"; } my $result_close = close($fhn); $result &&= $result_close; @@ -388,13 +391,14 @@ sub _read_tapelist { my @tles; open(my $fh, "<", $self->{'filename'}) or return $self; while (my $line = <$fh>) { - my ($datestamp, $label, $reuse, $comment) - = $line =~ m/^([0-9]*)\s([^\s]*)\s(reuse|no-reuse)\s*(?:\#(.*))?$/mx; + my ($datestamp, $label, $reuse, $barcode, $comment) + = $line =~ m/^([0-9]*)\s([^\s]*)\s(reuse|no-reuse)\s*(?:BARCODE:([^\s]*))?\s*(?:\#(.*))?$/mx; next if !defined $datestamp; # silently filter out bogus lines push @tles, { 'datestamp' => $datestamp, 'label' => $label, 'reuse' => ($reuse eq 'reuse'), + 'barcode' => $barcode, 'comment' => $comment, }; }