Hello community, here is the log from the commit of package suseRegister checked in at Tue Mar 6 18:13:55 CET 2007. -------- --- suseRegister/suseRegister.changes 2007-03-02 19:18:01.000000000 +0100 +++ /mounts/work_src_done/NOARCH/suseRegister/suseRegister.changes 2007-03-06 12:40:34.155961000 +0100 @@ -1,0 +2,6 @@ +Tue Mar 6 12:39:34 CET 2007 - mc@suse.de + +- implement refresh to fix unknown catalogs after registration + [#251634] + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ suseRegister.spec ++++++ --- /var/tmp/diff_new_pack.f19529/_old 2007-03-06 18:07:28.000000000 +0100 +++ /var/tmp/diff_new_pack.f19529/_new 2007-03-06 18:07:28.000000000 +0100 @@ -12,7 +12,7 @@ Name: suseRegister Version: 1.2 -Release: 25 +Release: 26 Summary: Registration Tool Group: Productivity/Other License: GNU General Public License (GPL) @@ -95,6 +95,9 @@ %endif %changelog +* Tue Mar 06 2007 - mc@suse.de +- implement refresh to fix unknown catalogs after registration + [#251634] * Fri Mar 02 2007 - mc@suse.de - fix fillURL * Fri Mar 02 2007 - mc@suse.de ++++++ suseRegister-1.2.tar.bz2 ++++++ diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/suseRegister-1.2/SRPrivate.pm new/suseRegister-1.2/SRPrivate.pm --- old/suseRegister-1.2/SRPrivate.pm 2007-03-02 19:17:17.000000000 +0100 +++ new/suseRegister-1.2/SRPrivate.pm 2007-03-06 12:37:53.000000000 +0100 @@ -2223,6 +2223,60 @@ return logPrintReturn($ctx, $msg, $code); } +sub rugRefresh +{ + my $ctx = shift; + + my $code = 0; + my $msg = ""; + + $ctx->{timeindent}++; + my $t0 = [gettimeofday] if($ctx->{time}); + print STDERR indent($ctx)."START: rugRefresh\n" if($ctx->{time}); + + if(!$ctx->{rugzmdInstalled} || $ctx->{norug}) + { + # If rug/zmd are not installed we are done here. + syslog("info", "rug/zmd are not installed. finish."); + return (0, ""); + } + + my @rugArgs = ("--quiet", "refresh"); + + print STDERR "rug refresh command: $ctx->{rug} ".join(" ",@rugArgs)."\n" if($ctx->{debug} >= 1); + + my $pid = open3(\*IN, \*OUT, \*ERR, $ctx->{rug}, @rugArgs) or do { + logPrintReturn($ctx, "Cannot execute $ctx->{rug} ".join(" ", @rugArgs).": $!\n", 13); + }; + + while (<OUT>) + { + $msg .= "$_"; + } + while (<ERR>) + { + $msg .= "$_"; + } + waitpid $pid, 0; + #chomp($msg) if(defined $msg && $msg ne ""); + close IN; + close OUT; + close ERR; + + $code = ($?>>8); + if($code != 0) + { + $code += 20; + } + + print STDERR "Refresh failed($code): $msg\n" if($ctx->{debug} && $code != 0); + + print STDERR indent($ctx)."END: rugRefresh:".(tv_interval($t0))."\n" if($ctx->{time}); + $ctx->{timeindent}--; + + return logPrintReturn($ctx, $msg, $code); +} + sub rugCatalogAdd { my $ctx = shift; @@ -2344,7 +2398,11 @@ print STDERR indent($ctx)."END: rugCatalogDelete:".(tv_interval($t0))."\n" if($ctx->{time}); $ctx->{timeindent}--; - return logPrintReturn($ctx, $msg, $code); + # ignore errors: Very often it is "unknown catalog". + # We want to unsubscribe a catalog which is not available => well, no problem. + logPrintReturn($ctx, $msg, $code); + + return (0, ""); } sub rugServiceDelete diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/suseRegister-1.2/SuseRegister.pm new/suseRegister-1.2/SuseRegister.pm --- old/suseRegister-1.2/SuseRegister.pm 2007-03-02 19:17:17.000000000 +0100 +++ new/suseRegister-1.2/SuseRegister.pm 2007-03-06 12:37:53.000000000 +0100 @@ -997,6 +997,19 @@ print Data::Dumper->Dump([$taskList])."\n" if($ctx->{debug} >= 2); + # search for sources of type NU, RCE or Zenwork, which might need a refresh + foreach my $service (keys %{$taskList}) + { + if(lc($ctx->{currentSources}->{$service}->{type}) eq "nu" || + lc($ctx->{currentSources}->{$service}->{type}) eq "rce" || + lc($ctx->{currentSources}->{$service}->{type}) eq "zenworks") + { + # found sources which needs to be refreshed + SUSE::SRPrivate::rugRefresh($ctx); + last; + } + } + foreach my $service (keys %{$taskList}) { if($taskList->{$service}->{task} eq "a") @@ -1173,6 +1186,13 @@ } } + print STDERR "---------------- lastZmdConfig --------------------\n". + Data::Dumper->Dump([$ctx->{lastZmdConfig}])."\n" if($ctx->{debug} >= 3); + print STDERR "---------------- zmdConfig --------------------\n". + Data::Dumper->Dump([$ctx->{zmdConfig}])."\n" if($ctx->{debug} >= 3); + print STDERR "---------------- currentSources --------------------\n". + Data::Dumper->Dump([$ctx->{currentSources}])."\n" if($ctx->{debug} >= 3); + push @allServices, (keys %{$ctx->{lastZmdConfig}}); push @allServices, (keys %{$ctx->{zmdConfig}}); @@ -1192,6 +1212,7 @@ ! exists $ctx->{currentSources}->{$service}) { # nothing to do + print STDERR "$service exists only in lastZmdConfig: do nothing\n" if($ctx->{debug} >= 3); } # $services exists only in zmdConfig elsif(! exists $ctx->{lastZmdConfig}->{$service} && @@ -1199,6 +1220,7 @@ ! exists $ctx->{currentSources}->{$service}) { # add it + print STDERR "$service exists only in zmdConfig: add it\n" if($ctx->{debug} >= 3); $taskList->{$service} = {}; SUSE::SRPrivate::copyService($taskList->{$service}, $ctx->{zmdConfig}->{$service}); $taskList->{$service}->{task} = "a"; @@ -1209,6 +1231,7 @@ exists $ctx->{currentSources}->{$service}) { # leave enabled + print STDERR "$service exists only in currentSource: leave enabled\n" if($ctx->{debug} >= 3); $taskList->{$service} = {}; SUSE::SRPrivate::copyService($taskList->{$service}, $ctx->{currentSources}->{$service}); $taskList->{$service}->{task} = "le"; @@ -1219,6 +1242,7 @@ ! exists $ctx->{currentSources}->{$service}) { # leave disabled + print STDERR "$service exists in lastZmdConfig and zmdConfig: leave disabled\n" if($ctx->{debug} >= 3); $taskList->{$service} = {}; SUSE::SRPrivate::copyService($taskList->{$service}, $ctx->{zmdConfig}->{$service}); $taskList->{$service}->{task} = "ld"; @@ -1229,6 +1253,7 @@ exists $ctx->{currentSources}->{$service}) { # delete it + print STDERR "$service exists in lastZmdConfig and currentSOurce: delete it\n" if($ctx->{debug} >= 3); $taskList->{$service} = {}; SUSE::SRPrivate::copyService($taskList->{$service}, $ctx->{lastZmdConfig}->{$service}); $taskList->{$service}->{task} = "d"; @@ -1239,6 +1264,7 @@ exists $ctx->{currentSources}->{$service}) { # leave enabled + print STDERR "$service exists in zmdConfig and currentSource: leave enabled\n" if($ctx->{debug} >= 3); $taskList->{$service} = {}; SUSE::SRPrivate::copyService($taskList->{$service}, $ctx->{zmdConfig}->{$service}); $taskList->{$service}->{task} = "le"; @@ -1249,6 +1275,7 @@ exists $ctx->{currentSources}->{$service}) { # leave enabled + print STDERR "$service exists in all: leave enabled\n" if($ctx->{debug} >= 3); $taskList->{$service} = {}; SUSE::SRPrivate::copyService($taskList->{$service}, $ctx->{zmdConfig}->{$service}); $taskList->{$service}->{task} = "le"; @@ -1285,7 +1312,7 @@ # copy the subscribed tag to task foreach my $name (keys %{$taskList->{$service}->{catalog}}) { - my $task = ($taskList->{$service}->{catalog}->{$name}->{subscribed})?"le":"ld"; + my $task = ($taskList->{$service}->{catalog}->{$name}->{subscribed} == 1)?"le":"ld"; $taskList->{$service}->{catalog}->{$name}->{task} = $task; } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org