Mailinglist Archive: zypp-commit (731 mails)

< Previous Next >
[zypp-commit] r6601 - /trunk/libzypp/zypp/repo/Applydeltarpm.cc
  • From: dmacvicar@xxxxxxxxxxxxxxxx
  • Date: Fri, 10 Aug 2007 14:08:38 -0000
  • Message-id: <20070810140838.F28ACCE21C@xxxxxxxxxxxxxxxx>
Author: dmacvicar
Date: Fri Aug 10 16:08:38 2007
New Revision: 6601

URL: http://svn.opensuse.org/viewcvs/zypp?rev=6601&view=rev
Log:
go back to regexes here as well to reduce diff

Modified:
    trunk/libzypp/zypp/repo/Applydeltarpm.cc

Modified: trunk/libzypp/zypp/repo/Applydeltarpm.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/repo/Applydeltarpm.cc?rev=6601&r1=6600&r2=6601&view=diff
==============================================================================
--- trunk/libzypp/zypp/repo/Applydeltarpm.cc (original)
+++ trunk/libzypp/zypp/repo/Applydeltarpm.cc Fri Aug 10 16:08:38 2007
@@ -13,6 +13,7 @@
 
 #include "zypp/base/Logger.h"
 #include "zypp/base/String.h"
+#include "zypp/base/Regex.h"
 #include "zypp/repo/Applydeltarpm.h"
 #include "zypp/ExternalProgram.h"
 #include "zypp/AutoDispose.h"
@@ -32,6 +33,7 @@
     { /////////////////////////////////////////////////////////////////
 
       const Pathname   applydeltarpm_prog( "/usr/bin/applydeltarpm" );
+      const str::regex applydeltarpm_tick ( "([0-9]+) percent finished" );
 
       /******************************************************************
        **
@@ -42,13 +44,16 @@
                           const Progress & report_r  = Progress() )
       {
         ExternalProgram prog( argv_r, ExternalProgram::Stderr_To_Stdout );
+        str::smatch what;
         for ( std::string line = prog.receiveLine(); ! line.empty(); line = prog.receiveLine() )
           {
-            if ( report_r )
-              report_r( str::strtonum<unsigned>( line ));
+            if ( report_r && str::regex_match( line, what, applydeltarpm_tick ) )
+              {
+                report_r( str::strtonum<unsigned>( what[1] ) );
+              }
             else
               DBG << "Applydeltarpm : " << line;
-          }
+        }
         return( prog.close() == 0 );
       }
 

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages