X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FTaper%2FScan%2Foldest.pm;fp=perl%2FAmanda%2FTaper%2FScan%2Foldest.pm;h=f27d4514faec672251f1a5e43d1958f1d208d656;hb=691567b16c13087b31ee4c2b6d038e57872fae82;hp=c2bcb6d356aba1cfe9c9c5975f9675eed9cd4e46;hpb=cc7d7b45afc706099acf7ff2490ec5667d370651;p=debian%2Famanda diff --git a/perl/Amanda/Taper/Scan/oldest.pm b/perl/Amanda/Taper/Scan/oldest.pm index c2bcb6d..f27d451 100644 --- a/perl/Amanda/Taper/Scan/oldest.pm +++ b/perl/Amanda/Taper/Scan/oldest.pm @@ -1,8 +1,9 @@ # Copyright (c) 2010-2012 Zmanda, Inc. All Rights Reserved. # -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License version 2 as published -# by the Free Software Foundation. +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY @@ -127,17 +128,25 @@ sub analyze { push @reusable, $sl; } else { my $vol_tle = $self->{'tapelist'}->lookup_tapelabel($sl->{'label'}); - if ($vol_tle) { + if ($vol_tle && $sl->{'label'} =~ /$self->{'labelstr'}/) { if ($vol_tle->{'datestamp'} eq '0') { push @new_labeled, $sl; } } elsif ($self->volume_is_labelable($sl)) { + $sl->{'label'} = $self->{'chg'}->make_new_tape_label( + barcode => $sl->{'barcode'}, + slot => $sl->{'slot'}, + meta => $sl->{'meta'}); $first_new_volume = $sl if !$first_new_volume; $new_volume = $sl if $current && !$new_volume; push @new_volume, $sl; } } } elsif ($self->volume_is_labelable($sl)) { + $sl->{'label'} = $self->{'chg'}->make_new_tape_label( + barcode => $sl->{'barcode'}, + slot => $sl->{'slot'}, + meta => $sl->{'meta'}); $first_new_volume = $sl if !$first_new_volume; $new_volume = $sl if $current && !$new_volume; push @new_volume, $sl; @@ -178,10 +187,6 @@ sub analyze { } for my $sl (@new_volume) { - $sl->{'label'} = $self->{'chg'}->make_new_tape_label( - barcode => $sl->{'barcode'}, - slot => $sl->{'slot'}, - meta => $sl->{'meta'}); $new_volume = $sl if defined $last_label and $new_volume->{'label'} ne $sl->{'label'} and (($sl->{'label'} gt $last_label and