Browse Source

replace batch rsync with tar/upload/untar

[SVN r23685]
Aleksey Gurtovoy 22 years ago
parent
commit
846349db22

+ 1 - 1
tools/regression/xsl_reports/merger/merge_logs.py

@@ -52,7 +52,7 @@ def merge_test_runs( incoming_dir, tag, writer ):
             zip_path = os.path.join( test_runs_dir, test_run )
             unzip( zip_path, test_runs_dir )
             utils.log( '  Removing "%s" ...' % test_run )
-            #os.unlink( zip_path )
+            os.unlink( zip_path )
         except Exception, msg:
             utils.log( '  Skipping "%s" due to errors (%s)' % ( test_run, msg ) )
 

+ 7 - 3
tools/regression/xsl_reports/report.py

@@ -227,11 +227,15 @@ def build_xsl_reports(
         upload_dir = 'regression-logs/incoming/all/'
         utils.log( 'Uploading v2 results into "%s" [connecting as %s]...' % ( upload_dir, user ) )
         
-        utils.sourceforge.upload( 
+        archive_name = '%s.tar.gz' % result_file_prefix
+        utils.tar( 
               os.path.join( results_dir, result_file_prefix )
-            , upload_dir
-            , user
+            , archive_name
             )
+        
+        archive_path = os.path.join( results_dir, archive_name )
+        utils.sourceforge.upload( archive_path, upload_dir, user )
+        utils.sourceforge.untar( archive_path, user, background = True )
 
 
 def accept_args( args ):

+ 1 - 1
tools/regression/xsl_reports/utils/__init__.py

@@ -5,6 +5,6 @@ from checked_system import *
 from libxslt import *
 from log import *
 from makedirs import *
+from tar import *
 
 import sourceforge
-

+ 24 - 0
tools/regression/xsl_reports/utils/sourceforge.py

@@ -14,6 +14,7 @@ def download( source, destination, user ):
                 % { 'user': user, 'site_dir': site_dir, 'source': source, 'dest': destination }
         ] )
 
+
 def upload( source, destination, user ):
     if sys.platform == 'win32':
         source = os.popen( 'cygpath "%s"' % source ).read().splitlines()[0]
@@ -22,3 +23,26 @@ def upload( source, destination, user ):
           'rsync -v -r -z --progress %(source)s %(user)s@shell.sourceforge.net:%(site_dir)s/%(dest)s'
                 % { 'user': user, 'site_dir': site_dir, 'source': source, 'dest': destination }
         ] )
+
+
+def checked_system( commands, user, background = False ):
+    if not background:
+        cmd = 'ssh -l %s shell.sourceforge.net "%s"'
+    else:
+        cmd = 'ssh -f -l %s shell.sourceforge.net "%s"'
+
+    utils.checked_system( 
+          [ cmd % ( user, '&&'.join( commands ) ) ]
+        )
+
+
+def untar( archive, user, background ):
+    checked_system( 
+          [
+              'cd %s' % os.path.dirname( archive )
+            , 'tar -x -z --overwrite --mode=+w -f %s' % os.path.basename( archive )
+            , 'rm -f %s' % archive
+            ]
+        , user = user
+        , background = background
+        )

+ 8 - 0
tools/regression/xsl_reports/utils/tar.py

@@ -0,0 +1,8 @@
+
+import utils.checked_system
+
+def tar( source_dir, archive_name ):
+    utils.checked_system( [
+          'cd %s' % source_dir
+        , 'tar -c -f ../%s -z *' % archive_name
+        ] )

粤ICP备19079148号