Hello community, here is the log from the commit of package suseRegister checked in at Mon Jan 21 01:14:13 CET 2008. -------- --- suseRegister/suseRegister.changes 2007-08-29 14:16:04.000000000 +0200 +++ /mounts/work_src_done/STABLE/suseRegister/suseRegister.changes 2008-01-18 12:17:29.711844000 +0100 @@ -1,0 +2,13 @@ +Fri Jan 18 12:11:53 CET 2008 - mc@suse.de + +- add virtual command cpu-count[FATE#302969] +- improve support for ServicePack migration +- use rug ping --if-active to detect full initialized zmd [#339771] + - cleanup init script +- add option(-r) to restore all repositories, even the once deleted + by the user [#309231] +- write cache file only when the configuration of the + update sources were successful. [#278163] +- increase client_version to 1.2.3 + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ suseRegister.spec ++++++ --- /var/tmp/diff_new_pack.o15593/_old 2008-01-21 01:13:38.000000000 +0100 +++ /var/tmp/diff_new_pack.o15593/_new 2008-01-21 01:13:38.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package suseRegister (Version 1.2) # -# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine # package are under the same license as the package itself. # @@ -12,7 +12,7 @@ Name: suseRegister Version: 1.2 -Release: 71 +Release: 91 Summary: Registration Tool Group: Productivity/Other License: GPL v2 or later @@ -34,9 +34,9 @@ %if %{sles_version} > 0 Requires: rug Requires: zmd -Prereq: %insserv_prereq %fillup_prereq +PreReq: %insserv_prereq %fillup_prereq %endif -BuildArchitectures: noarch +BuildArch: noarch %description Command line tool for registering Novell and SUSE products. @@ -91,88 +91,98 @@ %endif %changelog -* Wed Aug 29 2007 - mc@suse.de +* Fri Jan 18 2008 mc@suse.de +- add virtual command cpu-count[FATE#302969] +- improve support for ServicePack migration +- use rug ping --if-active to detect full initialized zmd [#339771] + - cleanup init script +- add option(-r) to restore all repositories, even the once deleted + by the user [#309231] +- write cache file only when the configuration of the + update sources were successful. [#278163] +- increase client_version to 1.2.3 +* Wed Aug 29 2007 mc@suse.de - drop --terse when calling zypper sl; --terse give wrong format -* Tue Aug 28 2007 - mc@suse.de +* Tue Aug 28 2007 mc@suse.de - add a "/" to the end of all urls, if not available, to avoid double update repositories -* Tue Aug 07 2007 - mc@suse.de +* Tue Aug 07 2007 mc@suse.de - make use of new zypper options --non-interactive and --no-gpg-checks [Feature #301998] -* Wed Jul 18 2007 - mc@suse.de +* Wed Jul 18 2007 mc@suse.de - use --loose-auth and --loose-query in zyppServiceDelete -* Tue Jul 17 2007 - mc@suse.de +* Tue Jul 17 2007 mc@suse.de - remove zypp_wrap - use zypper to configure update sources [partly fix for #292362] -* Thu Jul 12 2007 - mc@suse.de +* Thu Jul 12 2007 mc@suse.de - do not subscribe catalogs which were not added before [#271861] - use URL as alias fallback[#271861] -* Tue Jun 05 2007 - mc@suse.de +* Tue Jun 05 2007 mc@suse.de - ignore missing sysconfig file [#279757] - save cache only on success [#278163] - subscribe yum and zypp catalogs [#271861] -* Thu May 03 2007 - mc@suse.de +* Thu May 03 2007 mc@suse.de - Remove init script trigger only on success [Bug 270870] -* Thu Apr 26 2007 - mc@suse.de +* Thu Apr 26 2007 mc@suse.de - adding some sleeps to avoid races with zmd during refresh [#267917] -* Fri Apr 20 2007 - mc@suse.de +* Fri Apr 20 2007 mc@suse.de - search for xentools in /bin when not available in /usr/bin [#249157] -* Thu Mar 08 2007 - mc@suse.de +* Thu Mar 08 2007 mc@suse.de - wait in init script until zmd has finished initialization [#251634] -* Wed Mar 07 2007 - mc@suse.de +* Wed Mar 07 2007 mc@suse.de - ignore "not found" errors on catalogDelete [#252204] -* Tue Mar 06 2007 - mc@suse.de +* Tue Mar 06 2007 mc@suse.de - implement refresh to fix unknown catalogs after registration [#251634] -* Fri Mar 02 2007 - mc@suse.de +* Fri Mar 02 2007 mc@suse.de - fix fillURL -* Fri Mar 02 2007 - mc@suse.de +* Fri Mar 02 2007 mc@suse.de - workaround zypper delete problems [#219770] - create a copy of the cache and do a rollback, when configureZMD failed -* Fri Feb 23 2007 - mc@suse.de +* Fri Feb 23 2007 mc@suse.de - fix alias handling of manualy added URLs [#248230] -* Thu Feb 22 2007 - mc@suse.de +* Thu Feb 22 2007 mc@suse.de - when zyppServiceAdd is called via addCatalog add credentials to the URL -* Wed Feb 14 2007 - mc@suse.de +* Wed Feb 14 2007 mc@suse.de - --norug should only avoid adding and subscribing new sources. -* Mon Feb 12 2007 - mc@suse.de +* Mon Feb 12 2007 mc@suse.de - add client_version to register and listparams request [#243006] -* Fri Feb 09 2007 - mc@suse.de +* Fri Feb 09 2007 mc@suse.de - remove auth => digest,basic; this should be done by libzypp now [#243006] -* Wed Feb 07 2007 - mc@suse.de +* Wed Feb 07 2007 mc@suse.de - add basicAuth as fallback for NU catalogs [#242390] -* Thu Feb 01 2007 - mc@suse.de +* Thu Feb 01 2007 mc@suse.de - fix suseRegister blocks boot for a while [#237712] -* Thu Jan 25 2007 - mc@suse.de +* Thu Jan 25 2007 mc@suse.de - remove Requires: mailx - add runtime check for "mail" [#238676] -* Wed Jan 24 2007 - mc@suse.de +* Wed Jan 24 2007 mc@suse.de - move directory for the trigger to /var/lib/suseRegister/ because /usr might be read-only [#238102] - require mailx -* Fri Jan 12 2007 - mc@suse.de +* Fri Jan 12 2007 mc@suse.de - add NetworkManager dispatcher script [Fate #301822] -* Fri Jan 12 2007 - mc@suse.de +* Fri Jan 12 2007 mc@suse.de - support new zmd inventory preferences [fix Bug #233704] -* Mon Jan 08 2007 - mc@suse.de +* Mon Jan 08 2007 mc@suse.de - implement --norug, --nozypper and --batch command [Feature #301745] - fix call of rugPreferences @@ -180,164 +190,164 @@ - add init script to look for new catalogs during boot. [Feature #301745, #301822] - add cronjob to trigger register on boot [Fate #301822] -* Thu Dec 07 2006 - mc@suse.de +* Thu Dec 07 2006 mc@suse.de - version 1.2 * Feature #301790: modularize suse-register -* Mon Nov 20 2006 - mc@suse.de +* Mon Nov 20 2006 mc@suse.de - fix parameter List when --no-hw-data is given [#222625] -* Mon Nov 13 2006 - mc@suse.de +* Mon Nov 13 2006 mc@suse.de - remove Recommends: rug zmd for openSUSE release -* Thu Nov 09 2006 - mc@suse.de +* Thu Nov 09 2006 mc@suse.de - save check for requested data in evalInteractiveArgs [#219354 Comment#5] -* Tue Nov 07 2006 - mc@suse.de +* Tue Nov 07 2006 mc@suse.de - fix force registration -* Mon Oct 30 2006 - mc@suse.de +* Mon Oct 30 2006 mc@suse.de - got texts from proofread -* Wed Oct 25 2006 - mc@suse.de +* Wed Oct 25 2006 mc@suse.de - fix "Registration insists on hardware profile" [#214722] -* Tue Oct 24 2006 - mc@suse.de +* Tue Oct 24 2006 mc@suse.de - set default requested mirrors to 1 -* Tue Oct 24 2006 - mc@suse.de +* Tue Oct 24 2006 mc@suse.de - set temporarily default requested mirrors to 2 -* Fri Oct 20 2006 - mc@suse.de +* Fri Oct 20 2006 mc@suse.de - add installed-desktops to evaluateCommand[F#301240] - use new zypp-query-pool and try to get dist[product|version] from it [part fix for #205392] - require libzypp not libzypp-zmd-backend -* Tue Sep 26 2006 - mc@suse.de +* Tue Sep 26 2006 mc@suse.de - fixed fixed languages in output [#199161] - document UUID in the README [#198666] -* Fri Sep 22 2006 - mc@suse.de +* Fri Sep 22 2006 mc@suse.de - version 1.1 - implement request for more then one mirror (Feature #301267) -* Wed Aug 16 2006 - mc@suse.de +* Wed Aug 16 2006 mc@suse.de - configure proxy values for zmd (Bug #165891) -* Thu Jul 13 2006 - mc@suse.de +* Thu Jul 13 2006 mc@suse.de - add extra update sources feature (Feature #300728] - set envVar LANGUAGE to en_US to get english command output -* Mon Jul 10 2006 - mc@suse.de +* Mon Jul 10 2006 mc@suse.de - use Objects for XML parsing not the tree - detect FACTORY and exit with a special return code -* Fri Jul 07 2006 - mc@suse.de +* Fri Jul 07 2006 mc@suse.de - use uuidgen to create a guid if zmd is not available. -* Mon Jul 03 2006 - mc@suse.de +* Mon Jul 03 2006 mc@suse.de - add suseRegister-1.0.dif - add unsupported type rce [#189444, #189781] - fix incorrect sentence of a help text [#189408] - make zmd-ostarget available to the registration server [make fix possible for Bug #186220] -* Fri Jun 02 2006 - mc@suse.de +* Fri Jun 02 2006 mc@suse.de - partly fix for Bug #180820 suse_register, rug/zmd, key signing problem -* Tue May 09 2006 - mc@suse.de +* Tue May 09 2006 mc@suse.de - set connection timeout to 60 sec - do not print the secret to syslog -* Tue May 09 2006 - mc@suse.de +* Tue May 09 2006 mc@suse.de - add alias=<catalog-name> to URL for yast - do not use rug register, use -k paramter in rug service-add [fix parts of Bug #172336] -* Thu May 04 2006 - mc@suse.de +* Thu May 04 2006 mc@suse.de - add support for type 'nu' [#172336] -* Fri Apr 28 2006 - mc@suse.de +* Fri Apr 28 2006 mc@suse.de - require rug and zmd in sles; recommend in suse linux - log installed products -* Tue Apr 25 2006 - mc@suse.de +* Tue Apr 25 2006 mc@suse.de - prepare to use type zypp for update sources [#168739] - delete services with the same name as new update source -* Fri Apr 21 2006 - mc@suse.de +* Fri Apr 21 2006 mc@suse.de - Add Requires: libzypp-zmd-backend [#168345] -* Fri Apr 21 2006 - mc@suse.de +* Fri Apr 21 2006 mc@suse.de - add missing Requires: perl-URI -* Thu Apr 20 2006 - mc@suse.de +* Thu Apr 20 2006 mc@suse.de - switch back to curl to provide correct https proxy support [fix part of #165891] -* Fri Apr 07 2006 - mc@suse.de +* Fri Apr 07 2006 mc@suse.de - print update urls on success to STDERR -* Wed Apr 05 2006 - mc@suse.de +* Wed Apr 05 2006 mc@suse.de - add Recommends: rug zmd -* Tue Apr 04 2006 - mc@suse.de +* Tue Apr 04 2006 mc@suse.de - provide release in products - remove xen magic -* Fri Mar 31 2006 - mc@suse.de +* Fri Mar 31 2006 mc@suse.de - check location of query-pool [#162302] -* Thu Mar 30 2006 - mc@suse.de +* Thu Mar 30 2006 mc@suse.de - remove require rug/zmd; is a soft requirement now -* Thu Mar 30 2006 - mc@suse.de +* Thu Mar 30 2006 mc@suse.de - adapt new output of query-pool -* Thu Mar 30 2006 - mc@suse.de +* Thu Mar 30 2006 mc@suse.de - remove hack - use query-pool to get the products - remove rugProductArch -* Wed Mar 29 2006 - mc@suse.de +* Wed Mar 29 2006 mc@suse.de - add hack to make rug products work -* Wed Mar 29 2006 - mc@suse.de +* Wed Mar 29 2006 mc@suse.de - start zmd as soon as possible -* Wed Mar 29 2006 - mc@suse.de +* Wed Mar 29 2006 mc@suse.de - set accept=mandatory if auto-args are send back -* Tue Mar 28 2006 - mc@suse.de +* Tue Mar 28 2006 mc@suse.de - add --ignore-failure to rug sa command [#160069] -* Mon Mar 27 2006 - mc@suse.de +* Mon Mar 27 2006 mc@suse.de - exit, if no products available to register -* Fri Mar 24 2006 - mc@suse.de +* Fri Mar 24 2006 mc@suse.de - detect update_inventory outside of <service> -* Thu Mar 23 2006 - mc@suse.de +* Thu Mar 23 2006 mc@suse.de - add registration URL to text -* Wed Mar 22 2006 - mc@suse.de +* Wed Mar 22 2006 mc@suse.de - change xml namespace -* Wed Mar 22 2006 - mc@suse.de +* Wed Mar 22 2006 mc@suse.de - case yum: use catalog name as service name -* Tue Mar 21 2006 - mc@suse.de +* Tue Mar 21 2006 mc@suse.de - return empty value if lsb_release is not installed - remove Requires: lsb -* Mon Mar 20 2006 - mc@suse.de +* Mon Mar 20 2006 mc@suse.de - cleanup initial send values - send arch of product -* Mon Mar 20 2006 - mc@suse.de +* Mon Mar 20 2006 mc@suse.de - remove truncating too long hwinfo data it's the job of the server - first, wait for the deviceid file, then check status -* Fri Mar 17 2006 - mc@suse.de +* Fri Mar 17 2006 mc@suse.de - fixes for multiple services - ignore errors in yast mode when opening the logfile does not work - wait until deviceid file exists (max 10 sec when starting zmd) - create special dumpfiles for yast -* Tue Mar 14 2006 - mc@suse.de +* Tue Mar 14 2006 mc@suse.de - submit the architecture - implement listProducts - implement build intersection of products -* Tue Mar 14 2006 - mc@suse.de +* Tue Mar 14 2006 mc@suse.de - first code drop for products - add product informations to listParams request - add exitcode to logmessage - better handling of rug service-add - fix forceZmdConfiguration -* Fri Mar 10 2006 - mc@suse.de +* Fri Mar 10 2006 mc@suse.de - strip down the output of evaluateCommand because of database limits - update README -* Fri Mar 10 2006 - mc@suse.de +* Fri Mar 10 2006 mc@suse.de - set enviroment language to en_US to get english error messages for the logs - fix type handling - be more verbose in syslog when an error occours - remove ifstatus command -* Fri Mar 10 2006 - mc@suse.de +* Fri Mar 10 2006 mc@suse.de - implement new privacy statement handling - allow only https connections - change the URL and xml namespace - differ between type "yum" and "zenworks" -* Thu Mar 09 2006 - mc@suse.de +* Thu Mar 09 2006 mc@suse.de - return 0 in listPrarms() - beautify listParams output - add URL to Novell's Privacy Policy -* Mon Mar 06 2006 - mc@suse.de +* Mon Mar 06 2006 mc@suse.de - case -p: strip out the hwinfo commands if --no-hw-data was given - set $nooptional to 1 after the browser was closed. This prevent for optional parameters become mandatory - beautify commandline output - send empty <param> for not available hardware -* Fri Mar 03 2006 - mc@suse.de +* Fri Mar 03 2006 mc@suse.de - return 'DISCARDED' in case of requested hwinfo and provided --no-hw-data - if hardware data are not available say it in the response @@ -349,49 +359,49 @@ - fix type on ssl_error - return with success from rugRegister if no regcode is available this is ok in case of type is not zenworks -* Thu Mar 02 2006 - mc@suse.de +* Thu Mar 02 2006 mc@suse.de - replace curl with native implementation with LWP::UserAgent - start zmd if deviceid file does not exists -* Tue Feb 28 2006 - mc@suse.de +* Tue Feb 28 2006 mc@suse.de - implement rugPreferences for update_inventory - fix exit code handling from rug commands - update README -* Mon Feb 27 2006 - mc@suse.de +* Mon Feb 27 2006 mc@suse.de - change syslog calles to older syntax - better error messages if zmd failed to start - update README -* Mon Feb 27 2006 - mc@suse.de +* Mon Feb 27 2006 mc@suse.de - implement -y for yast - reformat the output - add (mandatory)/(optional) to output - submit timezone information as text, e.g. US/Mountain - fetch LANG from enviroment - change connect URL -* Fri Feb 24 2006 - mc@suse.de +* Fri Feb 24 2006 mc@suse.de - print URL to stdout and help text on stderr -* Fri Feb 24 2006 - mc@suse.de +* Fri Feb 24 2006 mc@suse.de - do not use die use explicite exit codes - use syslog for logging - add force-registration - use open3 for rug commands -* Wed Feb 22 2006 - mc@suse.de +* Wed Feb 22 2006 mc@suse.de - Abort, if last response is equal to current response - add --max-time 20 to curl options - search for default browser if -b default is given -* Mon Feb 20 2006 - mc@suse.de +* Mon Feb 20 2006 mc@suse.de - fix call of lsb_release command -* Fri Feb 17 2006 - mc@suse.de +* Fri Feb 17 2006 mc@suse.de - code drop for detecting and handling virtualization (xen) - fix browser handling for http errors from server - remove GUI browser because of blocking problems - submit version via url query option -* Thu Feb 16 2006 - mc@suse.de +* Thu Feb 16 2006 mc@suse.de - fix redirect - use vars for commands - cleanups - first code drop for virtualization feature -* Tue Feb 14 2006 - mc@suse.de +* Tue Feb 14 2006 mc@suse.de - initial version [Feature #110192] A tool to register SLES and SLES based products and to do the initial update configuration (zmd) for SUSE LINUX, ++++++ 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-08-29 14:14:47.000000000 +0200 +++ new/suseRegister-1.2/SRPrivate.pm 2008-01-18 12:11:25.000000000 +0100 @@ -16,7 +16,7 @@ # client version number -our $SRversion = "1.2.1"; +our $SRversion = "1.2.3"; sub readSystemValues { @@ -339,6 +339,25 @@ $out = $ctx->{ostarget}; } + elsif ($command =~ /^cpu-count$/) + { + $cmd = undef; + + if(!$ctx->{nohwdata}) + { + $out = cpuCount($ctx); + } + elsif($ctx->{mandatory}) + { + logPrintError($ctx, "Mandatory hardware data cannot be supplied because the option --no-hw-data was given.\n", + 3); + return undef; + } + else + { + return "DISCARDED"; + } + } elsif ($command =~ /^installed-desktops$/) { $cmd = undef; @@ -425,6 +444,127 @@ return $out; } +sub cpuCount +{ + my $ctx = shift; + + $ctx->{timeindent}++; + my $t0 = [gettimeofday] if($ctx->{time}); + print STDERR indent($ctx)."START: cpuCount\n" if($ctx->{time}); + + my $currentCPU = -1; + my $info = {}; + + my $haveCoreData = 0; + my $useCoreID = 0; + + my $pid = -1; # processor id + my $cos = -1; # cores + my $cid = -1; # core id + + my $out = ""; + + my $type = `uname -m`; + chomp($type); + + if($type =~ /ppc/i) + { + my $sockets = `grep cpu /proc/device-tree/cpus/*/device_type | wc -l`; + $out = "CPUSockets: ".($sockets)."\n"; + return $out; + } + + my $cpuinfo = `cat /proc/cpuinfo`; + my @lines = split(/\n/, $cpuinfo); + + foreach my $line (@lines) + { + if( $line =~ /^processor\s*:\s*(\d+)\s*$/) + { + if($pid >= 0 ) + { + if($cos >= 0) + { + $info->{$pid} = $cos; + $pid = -1; + $cos = -1; + $cid = -1; + } + elsif($cid >= 0) + { + # IA64 does have core id but not cores + if(! exists $info->{$pid} || $cid > $info->{$pid}) + { + $useCoreID = 1; + $info->{$pid} = $cid; + $pid = -1; + $cos = -1; + $cid = -1; + } + } + else + { + $out = "Read Error"; + } + } + + $currentCPU = $1; + } + elsif( $line =~ /^physical id\s*:\s*(\d+)\s*$/) + { + $haveCoreData = 1; + $pid = $1; + } + elsif( $line =~ /^cpu cores\s*:\s*(\d+)\s*$/) + { + $haveCoreData = 1; + $cos = $1; + } + elsif( $line =~ /^core id\s*:\s*(\d+)\s*$/) + { + $haveCoreData = 1; + $cid = $1; + } + elsif( $line =~ /^processor\s+(\d+):/) + { + # this is used for s390 + $currentCPU = $1; + } + } + + print STDERR " socket => cores \n" if($ctx->{debug} >= 2); + print STDERR Data::Dumper->Dump([$info]) if($ctx->{debug} >= 2); + + if(!$haveCoreData && $currentCPU >= 0) + { + $out = "CPUSockets: ".($currentCPU + 1)."\n"; + } + elsif(keys %{$info} > 0) + { + my $cores = 0; + foreach my $s (keys %{$info}) + { + $cores += $info->{$s}; + if($useCoreID) + { + $cores += 1; + } + } + $out = "CPUSockets: ".(keys %{$info})."\nCPUCores : $cores\n" + } + else + { + $out = "Read Error"; + } + + print $out if($ctx->{debug} >= 2); + + print STDERR indent($ctx)."END: cpuCount:".(tv_interval($t0))."\n" if($ctx->{time}); + $ctx->{timeindent}--; + + return $out; +} + sub evalNeedinfo { my $ctx = shift; @@ -1456,7 +1596,7 @@ $ctx->{"lastZmdConfig"} = undef; - if(-e $ctx->{zmdcache}) + if(-e $ctx->{zmdcache} && !$ctx->{ignoreCache}) { my $p = new XML::Parser(Style => 'Objects', Pkg => 'SR'); my $tree = $p->parsefile($ctx->{zmdcache}); @@ -2034,7 +2174,7 @@ my $type = shift || undef; my $id = shift || undef; my $regcode = shift || undef; - + my $msg = ""; $ctx->{timeindent}++; @@ -2061,8 +2201,20 @@ { return (0,""); } + my @rugArgs = (); + if(!$ctx->{interactive}) + { + push @rugArgs, "--quiet"; + } + + push @rugArgs, "sa"; + + if(!$ctx->{interactive}) + { + push @rugArgs, "--ignore-failure"; + } - my @rugArgs = ("--quiet", "sa", "--ignore-failure", "-t", "$type"); + push @rugArgs, "-t", "$type"; if(defined $regcode && $regcode ne "") { @@ -2082,25 +2234,34 @@ } print STDERR "rug add service command: $ctx->{rug} ".join(" ",@rugArgs)."\n" if($ctx->{debug} >= 1); - - my $pid = open3(\*IN, \*OUT, \*ERR, $ctx->{rug}, @rugArgs) or do { - return logPrintReturn($ctx, "Cannot execute $ctx->{rug} ".join(" ", @rugArgs).": $!\n",13); - }; - while (<OUT>) - { - $msg .= "$_"; + if(!$ctx->{interactive}) + { + my $pid = open3(\*IN, \*OUT, \*ERR, $ctx->{rug}, @rugArgs) or do { + return logPrintReturn($ctx, "Cannot execute $ctx->{rug} ".join(" ", @rugArgs).": $!\n",13); + }; + + while (<OUT>) + { + $msg .= "$_"; + } + #chomp($msg) if(defined $msg && $msg ne ""); + while (<ERR>) + { + $msg .= "$_"; + } + close OUT; + close ERR; + close IN; + waitpid $pid, 0; } - #chomp($msg) if(defined $msg && $msg ne ""); - while (<ERR>) + else { - $msg .= "$_"; + system($ctx->{rug}, @rugArgs) == 0 or do { + return logPrintReturn($ctx, "Cannot execute $ctx->{rug} ".join(" ", @rugArgs).": $!\n",13); + } } - close OUT; - close ERR; - close IN; - waitpid $pid, 0; - + my $code = ($?>>8); if($code != 0) { @@ -2558,8 +2719,10 @@ { $msg = `$ctx->{zmdInit} start 2>&1`; $code = ($?>>8); - - sleep 2; + + # --if-active returns after zmd initialization is completed [#339771] + $msg = `$ctx->{rug} --terse ping --if-active`; + $code = ($?>>8); foreach my $cnt (1..10) { @@ -2578,6 +2741,12 @@ return logPrintReturn($ctx, "Cannot start zmd: ".($msg?$msg:"").($msg2?$msg2."($code)":"($code)"), 7); } } + else + { + # --if-active returns after zmd initialization is completed [#339771] + $msg = `$ctx->{rug} --terse ping --if-active`; + $code = ($?>>8); + } } else { diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/suseRegister-1.2/suse_register new/suseRegister-1.2/suse_register --- old/suseRegister-1.2/suse_register 2007-08-29 14:14:47.000000000 +0200 +++ new/suseRegister-1.2/suse_register 2008-01-18 12:11:25.000000000 +0100 @@ -40,6 +40,9 @@ my $help = 0; my $debug = 0; my $yastcall = 0; +my $registerinpatch = 0; +my $zmdallowfile = "/var/run/zmd/.allow"; + my %args = ( processor => undef, platform => undef, @@ -49,6 +52,7 @@ my @extraCurlOption = (); my $mirrorCount = 1; +my $ignoreCache = 0; sub logPrintExit { @@ -86,6 +90,7 @@ mailToRoot($ctx, "Error during registration", $message); } + unlink $zmdallowfile if(-e $zmdallowfile); print STDERR "total time: ".(tv_interval($ctx->{programStartTime}))."\n" if($ctx->{time}); exit $code; @@ -134,6 +139,7 @@ print STDERR " for registration even though registration itself\n"; print STDERR " might be optional\n"; print STDERR " --no-hw-data do not send hardware data, even if they are mandatory\n"; + print STDERR " -r [--restore-repos] restore all repositories, also deleted once by the user\n"; print STDERR " -h -? [--help] show this help\n"; print STDERR " -a [--arg] <key>=<value> provide an additional argument 'key'\n"; print STDERR " with the value 'value'\n"; @@ -172,6 +178,7 @@ "no-optional|n" => \$nooptional, "force-registration|f" => \$forcereg, "no-hw-data" => \$nohwdata, + "restore-repos|r" => \$ignoreCache, "log|L=s" => \$logfile, "locale=s" => \$locale, "browser|b=s" => \$browser, @@ -182,7 +189,8 @@ "debug|d=i" => \$debug, "arg|a=s" => \%args, "extra-curl-options=s" => \@extraCurlOption, - "t" => \$time); + "t" => \$time, + "rip" => \$registerinpatch); if ($help) { @@ -206,6 +214,7 @@ $data->{logfile} = $logfile; $data->{locale} = $locale; $data->{forcereg} = $forcereg; +$data->{ignoreCache} = $ignoreCache; $data->{batch} = $batch; $data->{noproxy} = $noproxy; $data->{yastcall} = $yastcall; @@ -215,22 +224,28 @@ $data->{extraCurlOption} = \@extraCurlOption; $data->{time} = $time; - if($batch) { $interactive = 0; } +$data->{interactive} = $interactive; + + my $ctx = SUSE::SuseRegister::init_ctx($data); if($ctx->{errorcode} != 0) { logPrintExit($ctx, $ctx->{errormsg}, $ctx->{errorcode}); } -# set LANG to en_US to get the error messages in english -#$ENV{LANG} = "en_US"; -#$ENV{LANGUAGE} = "en_US"; +if($batch && $registerinpatch && !$listParams) +{ + open(ALLOWFILE, "> $zmdallowfile") or logPrintExit($ctx, "Cannot open zmd allow file: $!", 12); + print ALLOWFILE ""; + close ALLOWFILE; + print STDERR "Wrote zmd allow file\n" if($ctx->{debug}); +} my $ret = 0; @@ -277,6 +292,8 @@ defined $ctx->{xmloutput}) { print STDERR $ctx->{xmloutput}; + unlink $zmdallowfile if(-e $zmdallowfile); + exit $ret; } else @@ -291,6 +308,7 @@ print STDERR join("", @{$ctx->{registerReadableText}})."\n"; print $ctx->{registerManuallyURL}."\n"; } + unlink $zmdallowfile if(-e $zmdallowfile); exit 1; } } @@ -414,6 +432,7 @@ if(!defined $ctx->{querypool}) { # SLES 9 - finished successful + unlink $zmdallowfile if(-e $zmdallowfile); exit 0; } @@ -423,6 +442,7 @@ defined $ctx->{xmloutput}) { print STDERR $ctx->{xmloutput}; + unlink $zmdallowfile if(-e $zmdallowfile); exit $ret; } @@ -451,6 +471,7 @@ } } +unlink $zmdallowfile if(-e $zmdallowfile); print STDERR "total time: ".(tv_interval($programStartTime))."\n" if($ctx->{time}); exit 0; 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-08-29 14:14:47.000000000 +0200 +++ new/suseRegister-1.2/SuseRegister.pm 2008-01-18 12:11:25.000000000 +0100 @@ -171,6 +171,7 @@ $ctx->{forcereg} = 0; $ctx->{nohwdata} = 0; $ctx->{batch} = 0; + $ctx->{interactive} = 0; $ctx->{logfile} = undef; $ctx->{noproxy} = 0; $ctx->{debug} = 0; @@ -227,6 +228,7 @@ $ctx->{mirrorCount} = 1; $ctx->{zmdcache} = "/var/cache/SuseRegister/lastzmdconfig.cache"; + $ctx->{ignoreCache} = 0; if(exists $data->{products} && ref($data->{products}) eq "ARRAY") @@ -284,6 +286,11 @@ $ctx->{batch} = $data->{batch}; } + if(exists $data->{interactive} && defined $data->{interactive}) + { + $ctx->{interactive} = $data->{interactive}; + } + if(exists $data->{logfile} && defined $data->{logfile}) { $ctx->{logfile} = $data->{logfile}; @@ -346,7 +353,49 @@ $ctx->{mirrorCount} = 1; } + if(exists $data->{ignoreCache} && defined $data->{ignoreCache}) + { + $ctx->{ignoreCache} = $data->{ignoreCache}; + } + + if(exists $ENV{LANG} && $ENV{LANG} =~ /^([\w_]+)\.?/) + { + if(defined $1 && $1 ne "") + { + $ctx->{lang} = $1; + $ctx->{lang} =~ s/_/-/; + } + } + elsif(exists $ENV{LANGUAGE} && $ENV{LANGUAGE} =~ /^([\w_]+)\.?/) + { + if(defined $1 && $1 ne "") + { + $ctx->{lang} = $1; + $ctx->{lang} =~ s/_/-/; + } + } + + if (defined $ctx->{locale}) + { + my ($l, $e) = split(/\.|@/, $ctx->{locale}, 2); + + if (defined $l && $l ne "") + { + $l =~ s/_/-/; + $ctx->{lang} = $l; + } + + if (defined $e && $e ne "") + { + $ctx->{encoding} = $e; + } + } + + # set LANG to en_US to get the error messages in english + $ENV{LANG} = "en_US"; + $ENV{LANGUAGE} = "en_US"; + if(! -e $ctx->{querypool}) { # Code10 compat @@ -460,6 +509,7 @@ print STDERR "URL: $ctx->{URL}\n" if($ctx->{debug}); print STDERR "listParams: $ctx->{URLlistParams}\n" if($ctx->{debug}); print STDERR "register: $ctx->{URLregister}\n" if($ctx->{debug}); + print STDERR "lang: $ctx->{lang}\n" if($ctx->{debug}); my $iuri = URI->new($ctx->{URL}); @@ -469,46 +519,6 @@ print STDERR "initialDomain: $ctx->{initialDomain}\n" if($ctx->{debug}); - if(exists $ENV{LANG} && $ENV{LANG} =~ /^([\w_]+)\.?/) - { - if(defined $1 && $1 ne "") - { - $ctx->{lang} = $1; - $ctx->{lang} =~ s/_/-/; - } - } - elsif(exists $ENV{LANGUAGE} && $ENV{LANGUAGE} =~ /^([\w_]+)\.?/) - { - if(defined $1 && $1 ne "") - { - $ctx->{lang} = $1; - $ctx->{lang} =~ s/_/-/; - } - } - - if (defined $ctx->{locale}) - { - my ($l, $e) = split(/\.|@/, $ctx->{locale}, 2); - - if (defined $l && $l ne "") - { - $l =~ s/_/-/; - $ctx->{lang} = $l; - } - - if (defined $e && $e ne "") - { - $ctx->{encoding} = $e; - } - } - - print STDERR "lang: $ctx->{lang}\n" if($ctx->{debug}); - -# set LANG to en_US to get the error messages in english -$ENV{LANG} = "en_US"; -$ENV{LANGUAGE} = "en_US"; - - ($code, $msg) = SUSE::SRPrivate::listProducts($ctx); if($code != 0) { ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org