SVN: toys/rsget.pl/RSGet: Dispatch.pm Main.pm Wait.pm
sparky
sparky at pld-linux.org
Fri Oct 2 17:28:26 CEST 2009
Author: sparky
Date: Fri Oct 2 17:28:26 2009
New Revision: 10652
Modified:
toys/rsget.pl/RSGet/Dispatch.pm
toys/rsget.pl/RSGet/Main.pm
toys/rsget.pl/RSGet/Wait.pm
Log:
- finished sub check_settings
- minor fixes
Modified: toys/rsget.pl/RSGet/Dispatch.pm
==============================================================================
--- toys/rsget.pl/RSGet/Dispatch.pm (original)
+++ toys/rsget.pl/RSGet/Dispatch.pm Fri Oct 2 17:28:26 2009
@@ -215,7 +215,9 @@
}
foreach my $uri ( sort {
- $num_by_pkg{ $pkg_by_uri{ $a} } <=> $num_by_pkg{ $pkg_by_uri{ $b } }
+ ( $num_by_pkg{ $pkg_by_uri{ $a } } || 0 )
+ <=>
+ ( $num_by_pkg{ $pkg_by_uri{ $b } } || 0 )
} keys %$uris ) {
my ( $getter, $options ) = @{ $uris->{ $uri } };
next EACH_LINE if run( "get", $uri, $getter, { %$options, %$globals } );
Modified: toys/rsget.pl/RSGet/Main.pm
==============================================================================
--- toys/rsget.pl/RSGet/Main.pm (original)
+++ toys/rsget.pl/RSGet/Main.pm Fri Oct 2 17:28:26 2009
@@ -40,7 +40,7 @@
$SIG{CHLD} = "IGNORE";
maybe_update( $argv );
RSGet::Line::init();
- print_settings() if setting( "verbose" ) >= 1;
+ print_settings() if verbose( 1 );
RSGet::FileList::set_file();
maybe_start_http();
set_interfaces( $ifs );
@@ -101,12 +101,30 @@
warn "Update successful, restarting\n";
exec $0, @$argv, "--use_svn", "yes";
}
+ set( "use_svn", "yes", "SVN updated" );
}
}
sub check_settings
{
- warn "Unable to check settings\n";
+ my $die = 0;
+ foreach my $s ( sort keys %main::settings ) {
+ my $v = $main::settings{ $s };
+ my $def = $main::def_settings{ $s };
+ unless ( $def ) {
+ warn "There is no setting '$s' -- defined at $v->[1].\n";
+ $die = 1;
+ next;
+ }
+ my $value = $v->[0];
+ my $re = $def->[2];
+ unless ( $value =~ m/^$re$/ ) {
+ warn "Setting '$s' has invalid value: '$value' -- defined at $v->[1].\n";
+ $die = 1;
+ next;
+ }
+ }
+ die "ERROR: Found invalid settings.\n" if $die;
}
sub print_settings
Modified: toys/rsget.pl/RSGet/Wait.pm
==============================================================================
--- toys/rsget.pl/RSGet/Wait.pm (original)
+++ toys/rsget.pl/RSGet/Wait.pm Fri Oct 2 17:28:26 2009
@@ -24,8 +24,7 @@
$self->{wait_until_should} = $time + $wait;
$wait = $rnd_wait;
}
- $wait = - $wait if $wait < 0;
- $wait += int rand 10;
+ $wait = $wait < 0 ? - $wait : $wait + int rand 10;
$self->{wait_next} = $next_stage;
$self->{wait_msg} = $msg;
More information about the pld-cvs-commit
mailing list