Subversion Repositories DevTools

Rev

Rev 4092 | Rev 4127 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4092 Rev 4093
Line 41... Line 41...
41
my $opt_test;
41
my $opt_test;
42
my $opt_limit;
42
my $opt_limit;
43
my $opt_quick;
43
my $opt_quick;
44
my $opt_phase = '123';                      # Default - do all, but don't save data
44
my $opt_phase = '123';                      # Default - do all, but don't save data
45
my $opt_purge;
45
my $opt_purge;
-
 
46
my $opt_pcount = 0;
46
 
47
 
47
#
48
#
48
#   Globals
49
#   Globals
49
#
50
#
50
my $RM_DB;
51
my $RM_DB;
Line 94... Line 95...
94
                "test:+"        => \$opt_test,          # Test a version string
95
                "test:+"        => \$opt_test,          # Test a version string
95
                "limit:n"       => \$opt_limit,         #
96
                "limit:n"       => \$opt_limit,         #
96
                "phase:s"       => \$opt_phase,         # Phase to do
97
                "phase:s"       => \$opt_phase,         # Phase to do
97
                "quick"         => \$opt_quick,         # Don't look for indirects
98
                "quick"         => \$opt_quick,         # Don't look for indirects
98
                "purge"         => \$opt_purge,         # Purge old quarantined packages
99
                "purge"         => \$opt_purge,         # Purge old quarantined packages
-
 
100
                "pcount:n"      => \$opt_pcount,        # Count of packages to purge in one hit
99
                );
101
                );
100
 
102
 
101
#
103
#
102
#   Process help and manual options
104
#   Process help and manual options
103
#
105
#
Line 891... Line 893...
891
# Returns         : 
893
# Returns         : 
892
#
894
#
893
sub doQuarantine
895
sub doQuarantine
894
{
896
{
895
    my $testMsg = $opt_test ? 'Test,' : '';
897
    my $testMsg = $opt_test ? 'Test,' : '';
-
 
898
 
-
 
899
    # Process entries - oldest first
-
 
900
    #
896
    foreach my $entry ( @quarantineItems )
901
    foreach my $entry (sort {$b->{age} <=> $a->{age} } @quarantineItems)
897
    {
902
    {
898
        my $rv;
903
        my $rv;
899
        my $emsg = ' - with error';
904
        my $emsg = ' - with error';
900
 
905
 
901
        my $path = $entry->{path};
906
        my $path = $entry->{path};
Line 937... Line 942...
937
            $emsg = '';
942
            $emsg = '';
938
        }
943
        }
939
 
944
 
940
        # Log operation with frills
945
        # Log operation with frills
941
        Log (sprintf("Quarantined:%s%s,%4.4s,%s%s", $testMsg, $entry->{reason}, $entry->{age}, $path, $emsg));
946
        Log (sprintf("Quarantined:%s%s,%4.4s,%s%s", $testMsg, $entry->{reason}, $entry->{age}, $path, $emsg));
-
 
947
 
-
 
948
        # Limit packages quarantined
-
 
949
        if ($opt_pcount > 0)
-
 
950
        {
-
 
951
            $opt_pcount--;
-
 
952
            if ($opt_pcount == 0)
-
 
953
            {
-
 
954
                Log ("Quarantine package count exceeded. Quarantine terminated");
-
 
955
                last;
-
 
956
            }
-
 
957
        }
942
    }
958
    }
943
}
959
}
944
 
960
 
945
#-------------------------------------------------------------------------------
961
#-------------------------------------------------------------------------------
946
# Function        : Log
962
# Function        : Log
Line 952... Line 968...
952
# Returns         : 
968
# Returns         : 
953
#
969
#
954
sub Log
970
sub Log
955
{
971
{
956
    my ($line) = @_;
972
    my ($line) = @_;
-
 
973
    Verbose("Log: " . $line);
957
 
974
 
958
    if (open ( LF, '+>>', $logPath ) )
975
    if (open ( LF, '+>>', $logPath ) )
959
    {
976
    {
960
        print LF $line . "\n";
977
        print LF $line . "\n";
961
        close LF;
978
        close LF;
Line 1022... Line 1039...
1022
    -verbose[=n]       - Control output
1039
    -verbose[=n]       - Control output
1023
    -phase=nn          - Perform named phases
1040
    -phase=nn          - Perform named phases
1024
    -purge             - Just purge the old quarantined files
1041
    -purge             - Just purge the old quarantined files
1025
    -test              - Do not delete files
1042
    -test              - Do not delete files
1026
    -limit=n           - Limit packages processed. Test only
1043
    -limit=n           - Limit packages processed. Test only
-
 
1044
    -pcount=n          - Limit package count
1027
 
1045
 
1028
=head1 OPTIONS
1046
=head1 OPTIONS
1029
 
1047
 
1030
=over 8
1048
=over 8
1031
 
1049