equal
deleted
inserted
replaced
10 # Nokia Corporation - initial contribution. |
10 # Nokia Corporation - initial contribution. |
11 # |
11 # |
12 # Contributors: |
12 # Contributors: |
13 # |
13 # |
14 # Description: |
14 # Description: |
15 # Filter class for doing CLEAN, CLEANEXPORT and REALLYCLEAN efficiently. |
15 # Filter class for copying files in serial in python. This |
|
16 # is important in cluster builds where file copying is |
|
17 # very inefficient. |
|
18 # The one-to-many <copy> tag is searched for and copy |
|
19 # instructions are built up in a hash table. |
|
20 # <copy source='sourcefilename'>destfilename1 destfilename2 . . . .destfilenameN</copy> |
|
21 # destinations must be full filenames not directories. |
16 # |
22 # |
|
23 # This filter monitors build progress |
|
24 # via the <progress> tags and flushes copies as build |
|
25 # stages end (e.g. after resource so resources are ready for the next stage) |
|
26 # |
17 |
27 |
18 import os |
28 import os |
19 import sys |
29 import sys |
20 import tempfile |
30 import tempfile |
21 import filter_interface |
31 import filter_interface |
46 |
56 |
47 if source in self.files: |
57 if source in self.files: |
48 self.files[source].update(destinations) |
58 self.files[source].update(destinations) |
49 else: |
59 else: |
50 self.files[source] = set(destinations) |
60 self.files[source] = set(destinations) |
51 |
61 elif line.startswith("<progress:end object_type='makefile' task='build'"): |
|
62 self.flushcopies() # perform copies at end of each invocation of the make engine |
|
63 # to ensure dependencies are in place for the next one. |
52 |
64 |
53 return self.ok |
65 return self.ok |
54 |
66 |
55 |
67 |
56 def summary(self): |
68 def summary(self): |
57 "finish off" |
69 "finish off" |
|
70 self.flushcopies() |
|
71 return self.ok |
|
72 |
|
73 def flushcopies(self): |
58 for source in self.files.keys(): |
74 for source in self.files.keys(): |
59 #print "<debug>self.files %s</debug>" % self.files[source] |
75 #print "<debug>self.files %s</debug>" % self.files[source] |
60 for dest in self.files[source]: |
76 for dest in self.files[source]: |
61 self.copyfile(source, dest) |
77 self.copyfile(source, dest) |
|
78 self.files = {} |
62 |
79 |
63 return self.ok |
|
64 |
80 |
65 |
81 |
66 def close(self): |
82 def close(self): |
67 "nop" |
83 "nop" |
68 |
84 |