Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: src/platform/update_engine/SConstruct

Issue 2037002: AU: DBus support. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fixes for review Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import os 5 import os
6 6
7 # Protobuffer compilation 7 # Protobuffer compilation
8 """ Inputs:
9 target: list of targets to compile to
10 source: list of sources to compile
11 env: the scons environment in which we are compiling
12 Outputs:
13 target: the list of targets we'll emit
14 source: the list of sources we'll compile"""
15 def ProtocolBufferEmitter(target, source, env): 8 def ProtocolBufferEmitter(target, source, env):
9 """ Inputs:
10 target: list of targets to compile to
11 source: list of sources to compile
12 env: the scons environment in which we are compiling
13 Outputs:
14 target: the list of targets we'll emit
15 source: the list of sources we'll compile"""
16 output = str(source[0]) 16 output = str(source[0])
17 output = output[0:output.rfind('.proto')] 17 output = output[0:output.rfind('.proto')]
18 target = [ 18 target = [
19 output + '.pb.cc', 19 output + '.pb.cc',
20 output + '.pb.h', 20 output + '.pb.h',
21 ] 21 ]
22 return target, source 22 return target, source
23 23
24 """ Inputs:
25 source: list of sources to process
26 target: list of targets to generate
27 env: scons environment in which we are working
28 for_signature: unused
29 Outputs: a list of commands to execute to generate the targets from
30 the sources."""
31 def ProtocolBufferGenerator(source, target, env, for_signature): 24 def ProtocolBufferGenerator(source, target, env, for_signature):
25 """ Inputs:
26 source: list of sources to process
27 target: list of targets to generate
28 env: scons environment in which we are working
29 for_signature: unused
30 Outputs: a list of commands to execute to generate the targets from
31 the sources."""
32 commands = [ 32 commands = [
33 '/usr/bin/protoc ' 33 '/usr/bin/protoc '
34 ' --proto_path . ${SOURCES} --cpp_out .'] 34 ' --proto_path . ${SOURCES} --cpp_out .']
35 return commands 35 return commands
36 36
37 proto_builder = Builder(generator = ProtocolBufferGenerator, 37 proto_builder = Builder(generator = ProtocolBufferGenerator,
38 emitter = ProtocolBufferEmitter, 38 emitter = ProtocolBufferEmitter,
39 single_source = 1, 39 single_source = 1,
40 suffix = '.pb.cc') 40 suffix = '.pb.cc')
41 41
42 """ Inputs:
43 target: unused
44 source: list containing the source .xml file
45 env: the scons environment in which we are compiling
46 Outputs:
47 target: the list of targets we'll emit
48 source: the list of sources we'll process"""
49 def DbusBindingsEmitter(target, source, env): 42 def DbusBindingsEmitter(target, source, env):
43 """ Inputs:
44 target: unused
45 source: list containing the source .xml file
46 env: the scons environment in which we are compiling
47 Outputs:
48 target: the list of targets we'll emit
49 source: the list of sources we'll process"""
50 output = str(source[0]) 50 output = str(source[0])
51 output = output[0:output.rfind('.xml')] 51 output = output[0:output.rfind('.xml')]
52 target = [ 52 target = [
53 output + '.dbusserver.h', 53 output + '.dbusserver.h',
54 output + '.dbusclient.h' 54 output + '.dbusclient.h'
55 ] 55 ]
56 return target, source 56 return target, source
57 57
58 """ Inputs:
59 source: list of sources to process
60 target: list of targets to generate
61 env: scons environment in which we are working
62 for_signature: unused
63 Outputs: a list of commands to execute to generate the targets from
64 the sources."""
65 def DbusBindingsGenerator(source, target, env, for_signature): 58 def DbusBindingsGenerator(source, target, env, for_signature):
59 """ Inputs:
60 source: list of sources to process
61 target: list of targets to generate
62 env: scons environment in which we are working
63 for_signature: unused
64 Outputs: a list of commands to execute to generate the targets from
65 the sources."""
66 commands = [] 66 commands = []
67 for target_file in target: 67 for target_file in target:
68 if str(target_file).endswith('.dbusserver.h'): 68 if str(target_file).endswith('.dbusserver.h'):
69 mode_flag = '--mode=glib-server ' 69 mode_flag = '--mode=glib-server '
70 else: 70 else:
71 mode_flag = '--mode=glib-client ' 71 mode_flag = '--mode=glib-client '
72 cmd = '/usr/bin/dbus-binding-tool %s --prefix=update_engine_service ' \ 72 cmd = '/usr/bin/dbus-binding-tool %s --prefix=update_engine_service ' \
73 '%s > %s' % (mode_flag, str(source[0]), str(target_file)) 73 '%s > %s' % (mode_flag, str(source[0]), str(target_file))
74 commands.append(cmd) 74 commands.append(cmd)
75 return commands 75 return commands
76 76
77 dbus_bindings_builder = Builder(generator = DbusBindingsGenerator, 77 dbus_bindings_builder = Builder(generator = DbusBindingsGenerator,
78 emitter = DbusBindingsEmitter, 78 emitter = DbusBindingsEmitter,
79 single_source = 1, 79 single_source = 1,
80 suffix = 'dbusclient.h') 80 suffix = 'dbusclient.h')
81 81
82 def GlibMarshalEmitter(target, source, env):
83 """ Inputs:
84 target: unused
85 source: list containing the source .list file
86 env: the scons environment in which we are compiling
87 Outputs:
88 target: the list of targets we'll emit
89 source: the list of sources we'll process"""
90 output = str(source[0])
91 output = output[0:output.rfind('.list')]
92 target = [
93 output + '.glibmarshal.c',
94 output + '.glibmarshal.h'
95 ]
96 return target, source
97
98 def GlibMarshalGenerator(source, target, env, for_signature):
99 """ Inputs:
100 source: list of sources to process
101 target: list of targets to generate
102 env: scons environment in which we are working
103 for_signature: unused
104 Outputs: a list of commands to execute to generate the targets from
105 the sources."""
106 commands = []
107 for target_file in target:
108 if str(target_file).endswith('.glibmarshal.h'):
109 mode_flag = '--header '
110 else:
111 mode_flag = '--body '
112 cmd = '/usr/bin/glib-genmarshal %s --prefix=update_engine ' \
113 '%s > %s' % (mode_flag, str(source[0]), str(target_file))
114 commands.append(cmd)
115 return commands
116
117 glib_marshal_builder = Builder(generator = GlibMarshalGenerator,
118 emitter = GlibMarshalEmitter,
119 single_source = 1,
120 suffix = 'glibmarshal.c')
121
82 env = Environment() 122 env = Environment()
83 for key in Split('CC CXX AR RANLIB LD NM'): 123 for key in Split('CC CXX AR RANLIB LD NM'):
84 value = os.environ.get(key) 124 value = os.environ.get(key)
85 if value != None: 125 if value != None:
86 env[key] = value 126 env[key] = value
87 for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'): 127 for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'):
88 value = os.environ.get(key) 128 value = os.environ.get(key)
89 if value != None: 129 if value != None:
90 env[key] = Split(value) 130 env[key] = Split(value)
91 131
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 libpcrecpp 164 libpcrecpp
125 protobuf 165 protobuf
126 pthread 166 pthread
127 ssl 167 ssl
128 xml2 168 xml2
129 z""") 169 z""")
130 env['CPPPATH'] = ['..', '../../third_party/chrome/files', '../../common'] 170 env['CPPPATH'] = ['..', '../../third_party/chrome/files', '../../common']
131 env['LIBPATH'] = ['../../third_party/chrome'] 171 env['LIBPATH'] = ['../../third_party/chrome']
132 env['BUILDERS']['ProtocolBuffer'] = proto_builder 172 env['BUILDERS']['ProtocolBuffer'] = proto_builder
133 env['BUILDERS']['DbusBindings'] = dbus_bindings_builder 173 env['BUILDERS']['DbusBindings'] = dbus_bindings_builder
174 env['BUILDERS']['GlibMarshal'] = glib_marshal_builder
134 175
135 # Fix issue with scons not passing pkg-config vars through the environment. 176 # Fix issue with scons not passing pkg-config vars through the environment.
136 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'): 177 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'):
137 if os.environ.has_key(key): 178 if os.environ.has_key(key):
138 env['ENV'][key] = os.environ[key] 179 env['ENV'][key] = os.environ[key]
139 180
140 env.ParseConfig('pkg-config --cflags --libs ' 181 env.ParseConfig('pkg-config --cflags --libs '
141 'dbus-1 dbus-glib-1 gio-2.0 gio-unix-2.0 glib-2.0') 182 'dbus-1 dbus-glib-1 gio-2.0 gio-unix-2.0 glib-2.0')
142 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto') 183 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto')
143 184
144 env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml') 185 env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml')
145 186
187 env.GlibMarshal('marshal.glibmarshal.c', 'marshal.list')
188
146 if ARGUMENTS.get('debug', 0): 189 if ARGUMENTS.get('debug', 0):
147 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage' 190 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage'
148 env['LIBS'] += ['bz2', 'gcov'] 191 env['LIBS'] += ['bz2', 'gcov']
149 192
150 sources = Split("""action_processor.cc 193 sources = Split("""action_processor.cc
151 bzip.cc 194 bzip.cc
152 bzip_extent_writer.cc 195 bzip_extent_writer.cc
153 cycle_breaker.cc 196 cycle_breaker.cc
154 dbus_service.cc 197 dbus_service.cc
155 decompressing_file_writer.cc 198 decompressing_file_writer.cc
156 delta_diff_generator.cc 199 delta_diff_generator.cc
157 delta_performer.cc 200 delta_performer.cc
158 download_action.cc 201 download_action.cc
159 extent_mapper.cc 202 extent_mapper.cc
160 extent_writer.cc 203 extent_writer.cc
161 filesystem_copier_action.cc 204 filesystem_copier_action.cc
162 filesystem_iterator.cc 205 filesystem_iterator.cc
163 file_writer.cc 206 file_writer.cc
164 graph_utils.cc 207 graph_utils.cc
165 gzip.cc 208 gzip.cc
166 libcurl_http_fetcher.cc 209 libcurl_http_fetcher.cc
210 marshal.glibmarshal.c
167 omaha_hash_calculator.cc 211 omaha_hash_calculator.cc
168 omaha_request_prep_action.cc 212 omaha_request_prep_action.cc
169 omaha_response_handler_action.cc 213 omaha_response_handler_action.cc
170 postinstall_runner_action.cc 214 postinstall_runner_action.cc
171 set_bootable_flag_action.cc 215 set_bootable_flag_action.cc
172 split_file_writer.cc 216 split_file_writer.cc
173 subprocess.cc 217 subprocess.cc
174 tarjan.cc 218 tarjan.cc
175 topological_sort.cc 219 topological_sort.cc
176 update_attempter.cc 220 update_attempter.cc
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 delta_generator_main) 271 delta_generator_main)
228 272
229 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc') 273 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc')
230 274
231 unittest_env = env.Clone() 275 unittest_env = env.Clone()
232 unittest_env.Append(LIBS=['gtest']) 276 unittest_env.Append(LIBS=['gtest'])
233 unittest_cmd = unittest_env.Program('update_engine_unittests', 277 unittest_cmd = unittest_env.Program('update_engine_unittests',
234 unittest_sources + unittest_main) 278 unittest_sources + unittest_main)
235 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + 279 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') +
236 Split('html app.info')) 280 Split('html app.info'))
OLDNEW
« no previous file with comments | « no previous file | src/platform/update_engine/UpdateEngine.conf » ('j') | src/platform/update_engine/update_attempter.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698