Index: lib/Spine/Registry.pm =================================================================== --- lib/Spine/Registry.pm (revision 44) +++ lib/Spine/Registry.pm (working copy) @@ -346,7 +346,7 @@ sub error { - print STDERR 'REGISTRY ERROR: ', @_, "\n"; + warn 'REGISTRY ERROR: ', @_, "\n"; } @@ -355,7 +355,7 @@ my $lvl = shift; if ($DEBUG >= $lvl) { - print STDERR "REGISTRY DEBUG($lvl): ", @_, "\n"; + warn "REGISTRY DEBUG($lvl): ", @_, "\n"; } } @@ -593,7 +593,7 @@ { my $self = shift; - print STDERR "REGISTRY ERROR($self->{name}): ", @_, "\n"; + warn "REGISTRY ERROR($self->{name}): ", @_, "\n"; } @@ -603,7 +603,7 @@ my $lvl = shift; if ($DEBUG >= $lvl) { - print STDERR "REGISTRY DEBUG($self->{name}:$lvl): ", @_, "\n"; + warn "REGISTRY DEBUG($self->{name}:$lvl): ", @_, "\n"; } } Index: lib/Spine/Data.pm =================================================================== --- lib/Spine/Data.pm (revision 44) +++ lib/Spine/Data.pm (working copy) @@ -69,7 +69,7 @@ if (not defined($data_object->{c_release})) { - print STDERR "Spine::Data::new(): we require the config release number!"; + warn "Spine::Data::new(): we require the config release number!"; return undef; } @@ -1030,7 +1030,7 @@ unless ($self->{c_verbosity} == -1) { - print STDERR $self->{c_label} . ": \[$level\] $msg\n"; + warn $self->{c_label} . ": \[$level\] $msg\n"; } syslog("$level", "spine: $msg") @@ -1067,7 +1067,7 @@ my $lvl = shift; if ($DEBUG >= $lvl) { - print STDERR "DATA DEBUG($lvl): ", @_, "\n"; + warn "DATA DEBUG($lvl): ", @_, "\n"; } } Index: lib/Spine/ConfigSource/ISO9660.pm =================================================================== --- lib/Spine/ConfigSource/ISO9660.pm (revision 44) +++ lib/Spine/ConfigSource/ISO9660.pm (working copy) @@ -360,7 +360,7 @@ if (not defined($self->{_cache}->add(Buffer => $resp->content, Filename => $file))) { - print STDERR "Failed to save file to cache!\n"; + warn "Failed to save file to cache!\n"; goto retrieve_error; } Index: lib/Spine/Plugin.pm =================================================================== --- lib/Spine/Plugin.pm (revision 44) +++ lib/Spine/Plugin.pm (working copy) @@ -46,13 +46,13 @@ my $module = ${ "$klass\::MODULE" }; unless (defined($module) and ref($module) eq 'HASH') { - print STDERR "Invalid plugin definition: \"$klass\"\n"; + warn "Invalid plugin definition: \"$klass\"\n"; undef $self; return undef; } unless ($self->register($module)) { - print STDERR "Whoops. Failed to register $klass plugin.\n"; + warn "Whoops. Failed to register $klass plugin.\n"; return undef; } @@ -70,7 +70,7 @@ { my $self = shift; - print STDERR ref($self), ': ', @_, "\n"; + warn ref($self), ': ', @_, "\n"; } @@ -86,7 +86,7 @@ { my $self = shift; - print STDERR 'PLUGIN ERROR(', ref($self), '): ', @_, "\n"; + warn 'PLUGIN ERROR(', ref($self), '): ', @_, "\n"; } @@ -96,7 +96,7 @@ my $lvl = shift; if ($DEBUG >= $lvl) { - print STDERR 'PLUGIN DEBUG(', ref($self), ":$lvl): ", @_, "\n"; + warn 'PLUGIN DEBUG(', ref($self), ":$lvl): ", @_, "\n"; } } Index: lib/Spine/RPM.pm =================================================================== --- lib/Spine/RPM.pm (revision 44) +++ lib/Spine/RPM.pm (working copy) @@ -65,10 +65,10 @@ my @delete = grep { not exists $requires{$_} } sort keys %{$self->{nodes}}; - print STDERR "cleanup packages are : ", + warn "cleanup packages are : ", map { $_ . "\n" } sort keys %requires if DEBUG; - print STDERR "Deleting attempted : ", map { $_ . "\n" } @delete + warn "Deleting attempted : ", map { $_ . "\n" } @delete if DEBUG; return grep { not exists $requires{$_} } $self->remove(@delete); @@ -95,22 +95,22 @@ $removes{$p->name} = $p; } - print STDERR "Ideal removing yields :\n", + warn "Ideal removing yields :\n", map { "$_\n" } keys %removes if DEBUG; my %invalid; foreach my $pkg (keys %removes) { - print STDERR "Looking at $pkg\n" if DEBUG; + warn "Looking at $pkg\n" if DEBUG; while (my ($dname, $dnode) = each %{$removes{$pkg}->required_by}) { if (not exists $removes{$dname}) { - print STDERR "Unsafe : $dname\n" if DEBUG; + warn "Unsafe : $dname\n" if DEBUG; $invalid{$dname} = $dnode; } else { - print STDERR "Safe : $dname\n" if DEBUG; + warn "Safe : $dname\n" if DEBUG; } } } @@ -123,13 +123,13 @@ $invalid{$p->name} = $p; } - print STDERR "invalids:\n", map { "$_\n" } keys %invalid if DEBUG; + warn "invalids:\n", map { "$_\n" } keys %invalid if DEBUG; my %safe; foreach my $pkg (keys %removes) { $safe{$pkg} = $removes{$pkg} unless exists $invalid{$pkg}; } - print STDERR "Removing yields :\n", map { "$_\n" } keys %safe + warn "Removing yields :\n", map { "$_\n" } keys %safe if DEBUG; return sort { $a cmp $b } keys %safe; @@ -142,7 +142,7 @@ if (DEBUG) { my $is = $desc ? " is required($desc) by " : " is required by "; - print STDERR $pkg->tag("Name"), $is, $req->tag('Name'), + warn $pkg->tag("Name"), $is, $req->tag('Name'), "\n"; } my $req_node = $self->get_node($req); Index: scripts/rcrb.pl =================================================================== --- scripts/rcrb.pl (revision 44) +++ scripts/rcrb.pl (working copy) @@ -71,7 +71,7 @@ my $d = new IO::Dir($src); if (not defined($d)) { - print STDERR "Failed to open $src: $!\n"; + warn "Failed to open $src: $!\n"; return undef; } Index: spine =================================================================== --- spine (revision 44) +++ spine (working copy) @@ -139,19 +139,19 @@ { if ($cfile ne DEFAULT_CONFIGFILE) { - print STDERR $Spine::ConfigFile::ERROR; + warn $Spine::ConfigFile::ERROR; goto failure; } if (-f $cfile and (not -r $cfile)) { - print STDERR "Default config file $cfile exists but isn't readable.\n"; + warn "Default config file $cfile exists but isn't readable.\n"; goto failure; } if (not -f DEFAULT_CONFIGFILE) { - print STDERR "No config file found at default $cfile. Using hardcoded defaults.\n"; + warn "No config file found at default $cfile. Using hardcoded defaults.\n"; $CONFIG = DEFAULT_CONFIG; } @@ -174,7 +174,7 @@ my $action_profile = {}; foreach my $action (@actions) { unless (exists $CONFIG->{'action_' . $action}) { - print STDERR "Action $action is not a valid action!\n"; + warn "Action $action is not a valid action!\n"; goto failure; } @@ -219,14 +219,14 @@ my @plugins = split(/(?:\s*,?\s+)/, $plugins); unless ($registry->load_plugin(@plugins) == SPINE_SUCCESS) { - print STDERR "Failed to load at least one plugin!\n"; + warn "Failed to load at least one plugin!\n"; goto failure; } } # No plugins loaded? Not ok! unless (scalar(keys(%{$registry->{PLUGINS}}))) { - print STDERR "Didn't load any plugins. Library path or config problem!\n"; + warn "Didn't load any plugins. Library path or config problem!\n"; goto failure; } @@ -262,7 +262,7 @@ # Now we get our plugin options unless (GetOptions(%{$registry->get_options()})) { - print STDERR "Invalid option.\n"; + warn "Invalid option.\n"; goto failure; } @@ -293,7 +293,7 @@ if (not defined($release)) # There was an error { - print STDERR "Couldn't find a config for that release. Bailing.\n"; + warn "Couldn't find a config for that release. Bailing.\n"; goto failure; } @@ -345,7 +345,7 @@ # # rtilder Tue Jun 27 12:23:39 PDT 2006 if (not defined($c)) { - print STDERR "spine initialization: Errors encountered parsing data tree.\n"; + warn "spine initialization: Errors encountered parsing data tree.\n"; goto failure; } @@ -353,7 +353,7 @@ # have had a critical parsing error. if ($c->getval('c_failure')) { - print STDERR "spine initialization: Errors encountered parsing data tree.\n"; + warn "spine initialization: Errors encountered parsing data tree.\n"; $c->error("failure: " . $c->getval('c_failure'), 'crit'); goto failure; } @@ -361,8 +361,8 @@ # A quick sanity check, just to be sure if ($c->{c_release} != $source->release()) { - print STDERR "Requested release \"$c->{c_release}\" doesn't match release parsed\n"; - print STDERR 'from config source "', $source->release(), "\"\n"; + warn "Requested release \"$c->{c_release}\" doesn't match release parsed\n"; + warn 'from config source "', $source->release(), "\"\n"; goto failure; } @@ -390,7 +390,7 @@ my $point = $registry->get_hook_point($phase); unless ($point->register_hooks() == SPINE_SUCCESS) { - print STDERR "Error registering hooks!\n"; + warn "Error registering hooks!\n"; last; } @@ -402,15 +402,15 @@ my $rc = $point->run_hook($hook, $c, $prev_state); if ($rc == PLUGIN_FATAL) { - print STDERR "\t\t", $hook->{module}, "::$hook->{name} ", + warn "\t\t", $hook->{module}, "::$hook->{name} ", "encountered fatal errors: \"$hook->{msg}\"\n"; - print STDERR "\tExiting as gracelessly as possible.\n"; + warn "\tExiting as gracelessly as possible.\n"; goto failure; } elsif ($rc == PLUGIN_ERROR) { - print STDERR "\t\t", $hook->{module}, "::$hook->{name} ", + warn "\t\t", $hook->{module}, "::$hook->{name} ", "encountered errors: \"$hook->{msg}\"\n"; - print STDERR "\tContinuing with run.\n"; + warn "\tContinuing with run.\n"; } elsif ($rc == PLUGIN_EXIT) { # @@ -431,7 +431,7 @@ if ($SAVE_STATE) { # Store our config object to disk. - print STDERR "Saving state...\n"; + warn "Saving state...\n"; unless ($state->store()) { $c->error('failed to write session object [' . $state->error . ']', @@ -451,7 +451,7 @@ # unless (freeze_release($release, \%OPTIONS, $CONFIG, catfile($state->{StateDir}, 'FrozenAtRelease'))) { - print STDERR "Failed to freeze state!\n"; + warn "Failed to freeze state!\n"; goto failure; } } @@ -478,14 +478,14 @@ my $hostname = undef; unless (-f $file) { - print STDERR "Node file \"$file\" doesn't exist!\n"; + warn "Node file \"$file\" doesn't exist!\n"; return undef; } my $fh = new IO::File("< $file"); unless (defined($fh)) { - print STDERR "Couldn't open node file \"$file\": $!\n"; + warn "Couldn't open node file \"$file\": $!\n"; return undef; } @@ -512,7 +512,7 @@ my $fh = new IO::File("> $file"); unless (defined($fh)) { - print STDERR "Couldn't open node file \"$file\": $!\n"; + warn "Couldn't open node file \"$file\": $!\n"; return 0; } @@ -546,7 +546,7 @@ my $signal = shift; $SIG{$signal} = 'IGNORE'; - print STDERR "Caught signal $signal.\n"; + warn "Caught signal $signal.\n"; if (-t STDIN and ($signal eq 'INT' or $signal eq 'TERM')) { release_lock(); @@ -569,7 +569,7 @@ if (-z $frozen) { - print STDERR "Frozen release file \"$frozen\" exists but is 0 bytes.\n"; + warn "Frozen release file \"$frozen\" exists but is 0 bytes.\n"; return undef; } @@ -577,7 +577,7 @@ if (not defined($fh)) { - print STDERR "Failed to open frozen release file \"$frozen\": $!\n"; + warn "Failed to open frozen release file \"$frozen\": $!\n"; return undef; } @@ -614,8 +614,8 @@ Path => $options->{croot}); if (not defined($source)) { - print STDERR "Failed to initialize config root from command line: $Spine::ConfigSource::FileSystem::ERROR\n"; - print STDERR "Falling back to configuration file settings.\n"; + warn "Failed to initialize config root from command line: $Spine::ConfigSource::FileSystem::ERROR\n"; + warn "Falling back to configuration file settings.\n"; } } # If --config-source was provided, use that. @@ -636,7 +636,7 @@ eval "require $source_type"; if ($@) { - print STDERR "Failed to load the $source_type configuration source: $@\n"; + warn "Failed to load the $source_type configuration source: $@\n"; return undef; } @@ -648,7 +648,7 @@ }; if ($@) { - print STDERR "Failed to initialize configuration source: $@\n"; + warn "Failed to initialize configuration source: $@\n"; return undef; } } @@ -662,7 +662,7 @@ no strict 'refs'; eval { $foo = ${$source_type . '::ERROR'} }; - print STDERR "Failure to initialize configuration source $source_type: $foo\n"; + warn "Failure to initialize configuration source $source_type: $foo\n"; use strict 'refs'; return undef; } @@ -685,7 +685,7 @@ # if (not defined($release)) { - print STDERR "Can't parse frozen release. Bailing. Delete or fix.\n"; + warn "Can't parse frozen release. Bailing. Delete or fix.\n"; goto release_failed; } @@ -709,20 +709,20 @@ } if (not defined($release)) { - print STDERR "Failed while checking for newer configuration releases: $source->{error}\n"; + warn "Failed while checking for newer configuration releases: $source->{error}\n"; goto release_failed; } if ($release) { if (not defined($source->retrieve($release))) { - print STDERR "Failed to retrieve latest configuration release: $source->{error}\n"; + warn "Failed to retrieve latest configuration release: $source->{error}\n"; goto release_failed; } } if (not defined($source->config_root())) { - print STDERR "Couldn't mount or find the configuration source: $source->{error}\n"; + warn "Couldn't mount or find the configuration source: $source->{error}\n"; goto release_failed; } @@ -764,7 +764,7 @@ # Print out a special warning for --release=latest and --freeze on the # command line if ($options->{release} eq 'latest' and exists($options->{freeze})) { - print STDERR "WARNING: Won't freeze when --release=\"latest\"\n"; + warn "WARNING: Won't freeze when --release=\"latest\"\n"; # Don't return an error, though. return 1; @@ -778,7 +778,7 @@ my $fh = new IO::File("> $freeze_file"); if (not defined($fh)) { - print STDERR "Failed to open $freeze_file: $!\n"; + warn "Failed to open $freeze_file: $!\n"; return 0; } @@ -793,7 +793,7 @@ sub usage { - print STDERR (<