diff -r e6381a1f4952 -r 9fe7d0ab0f8f sbsv2/raptor/python/plugins/filter_copyfile.py --- a/sbsv2/raptor/python/plugins/filter_copyfile.py Tue May 11 13:33:47 2010 +0100 +++ b/sbsv2/raptor/python/plugins/filter_copyfile.py Tue May 11 14:36:11 2010 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available # under the terms of the License "Eclipse Public License v1.0" @@ -15,9 +15,9 @@ # Filter class for copying files in serial in python. This # is important in cluster builds where file copying is # very inefficient. -# The one-to-many tag is searched for and copy +# The one-to-many tag is searched for and copy # instructions are built up in a hash table. -# destfilename1 destfilename2 . . . .destfilenameN +# destfilename1 destfilename2 . . . .destfilenameN # destinations must be full filenames not directories. # # This filter monitors build progress @@ -32,6 +32,7 @@ import shutil import generic_path import stat +from raptor_utilities import copyfile class FilterCopyFile(filter_interface.Filter): @@ -49,10 +50,10 @@ "process some log text" for line in text.splitlines(): - if line.startswith("",source_start)+1:line.find("")].split(" ") + if line.startswith("",source_start)+1:line.find("")].split(" ") if source in self.files: self.files[source].update(destinations) @@ -60,7 +61,7 @@ self.files[source] = set(destinations) elif line.startswith("self.files %s" % self.files[source] for dest in self.files[source]: - self.copyfile(source, dest) + copyfile(source, dest) self.files = {} @@ -85,50 +85,5 @@ return self.ok - def copyfile(self, _source, _destination): - """Copy the source file to the destination file (create a directory - to copy into if it does not exist). Don't copy if the destination - file exists and has an equal or newer modification time.""" - source = generic_path.Path(str(_source).replace('%20',' ')) - destination = generic_path.Path(str(_destination).replace('%20',' ')) - dest_str = str(destination) - source_str = str(source) - - try: - - - destDir = destination.Dir() - if not destDir.isDir(): - os.makedirs(str(destDir)) - shutil.copyfile(source_str, dest_str) - return - - # Destination file exists so we have to think about updating it - sourceMTime = 0 - destMTime = 0 - sourceStat = 0 - try: - sourceStat = os.stat(source_str) - sourceMTime = sourceStat[stat.ST_MTIME] - destMTime = os.stat(dest_str)[stat.ST_MTIME] - except OSError, e: - if sourceMTime == 0: - message = "Source of copyfile does not exist: " + str(source) - print message - - if destMTime == 0 or destMTime < sourceMTime: - if os.path.exists(dest_str): - os.chmod(dest_str,stat.S_IREAD | stat.S_IWRITE) - shutil.copyfile(source_str, dest_str) - - # Ensure that the destination file remains executable if the source was also: - os.chmod(dest_str,sourceStat[stat.ST_MODE] | stat.S_IREAD | stat.S_IWRITE | stat.S_IWGRP ) - - - except Exception,e: - message = "Could not export " + source_str + " to " + dest_str + " : " + str(e) - - return - # the end