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

Side by Side Diff: SConstruct

Issue 3592008: AU: Verify delta payload signature and signed hash. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: move /tmp files to /var/run Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « .gitignore ('k') | action_processor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 def ProtocolBufferEmitter(target, source, env): 8 def ProtocolBufferEmitter(target, source, env):
9 """ Inputs: 9 """ Inputs:
10 target: list of targets to compile to 10 target: list of targets to compile to
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 cmd = '/usr/bin/glib-genmarshal %s --prefix=update_engine ' \ 112 cmd = '/usr/bin/glib-genmarshal %s --prefix=update_engine ' \
113 '%s > %s' % (mode_flag, str(source[0]), str(target_file)) 113 '%s > %s' % (mode_flag, str(source[0]), str(target_file))
114 commands.append(cmd) 114 commands.append(cmd)
115 return commands 115 return commands
116 116
117 glib_marshal_builder = Builder(generator = GlibMarshalGenerator, 117 glib_marshal_builder = Builder(generator = GlibMarshalGenerator,
118 emitter = GlibMarshalEmitter, 118 emitter = GlibMarshalEmitter,
119 single_source = 1, 119 single_source = 1,
120 suffix = 'glibmarshal.c') 120 suffix = 'glibmarshal.c')
121 121
122 # Public key generation
123 def PublicKeyEmitter(target, source, env):
124 """ Inputs:
125 target: list of targets to compile to
126 source: list of sources to compile
127 env: the scons environment in which we are compiling
128 Outputs:
129 target: the list of targets we'll emit
130 source: the list of sources we'll compile"""
131 targets = []
132 for source_file in source:
133 output = str(source_file)
134 output = output[0:output.rfind('.pem')]
135 output += '.pub.pem'
136 targets.append(output)
137 return targets, source
138
139 def PublicKeyGenerator(source, target, env, for_signature):
140 """ Inputs:
141 source: list of sources to process
142 target: list of targets to generate
143 env: scons environment in which we are working
144 for_signature: unused
145 Outputs: a list of commands to execute to generate the targets from
146 the sources."""
147 commands = []
148 for source_file in source:
149 output = str(source_file)
150 output = output[0:output.rfind('.pem')]
151 output += '.pub.pem'
152 cmd = '/usr/bin/openssl rsa -in %s -pubout -out %s' % (source_file, output)
153 commands.append(cmd)
154 return commands
155
156 public_key_builder = Builder(generator = PublicKeyGenerator,
157 emitter = PublicKeyEmitter,
158 suffix = '.pub.pem')
159
122 env = Environment() 160 env = Environment()
123 for key in Split('CC CXX AR RANLIB LD NM'): 161 for key in Split('CC CXX AR RANLIB LD NM'):
124 value = os.environ.get(key) 162 value = os.environ.get(key)
125 if value != None: 163 if value != None:
126 env[key] = value 164 env[key] = value
127 for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'): 165 for key in Split('CFLAGS CCFLAGS CPPPATH LIBPATH'):
128 value = os.environ.get(key) 166 value = os.environ.get(key)
129 if value != None: 167 if value != None:
130 env[key] = Split(value) 168 env[key] = Split(value)
131 169
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 protobuf 205 protobuf
168 pthread 206 pthread
169 rootdev 207 rootdev
170 ssl 208 ssl
171 xml2 209 xml2
172 z""") 210 z""")
173 env['CPPPATH'] = ['..'] 211 env['CPPPATH'] = ['..']
174 env['BUILDERS']['ProtocolBuffer'] = proto_builder 212 env['BUILDERS']['ProtocolBuffer'] = proto_builder
175 env['BUILDERS']['DbusBindings'] = dbus_bindings_builder 213 env['BUILDERS']['DbusBindings'] = dbus_bindings_builder
176 env['BUILDERS']['GlibMarshal'] = glib_marshal_builder 214 env['BUILDERS']['GlibMarshal'] = glib_marshal_builder
215 env['BUILDERS']['PublicKey'] = public_key_builder
177 216
178 # Fix issue with scons not passing pkg-config vars through the environment. 217 # Fix issue with scons not passing pkg-config vars through the environment.
179 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'): 218 for key in Split('PKG_CONFIG_LIBDIR PKG_CONFIG_PATH'):
180 if os.environ.has_key(key): 219 if os.environ.has_key(key):
181 env['ENV'][key] = os.environ[key] 220 env['ENV'][key] = os.environ[key]
182 221
183 env.ParseConfig('pkg-config --cflags --libs ' 222 env.ParseConfig('pkg-config --cflags --libs '
184 'dbus-1 dbus-glib-1 gio-2.0 gio-unix-2.0 glib-2.0') 223 'dbus-1 dbus-glib-1 gio-2.0 gio-unix-2.0 glib-2.0')
185 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto') 224 env.ProtocolBuffer('update_metadata.pb.cc', 'update_metadata.proto')
225 env.PublicKey('unittest_key.pub.pem', 'unittest_key.pem')
186 226
187 env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml') 227 env.DbusBindings('update_engine.dbusclient.h', 'update_engine.xml')
188 228
189 env.GlibMarshal('marshal.glibmarshal.c', 'marshal.list') 229 env.GlibMarshal('marshal.glibmarshal.c', 'marshal.list')
190 230
191 if ARGUMENTS.get('debug', 0): 231 if ARGUMENTS.get('debug', 0):
192 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage' 232 env['CCFLAGS'] += ' -fprofile-arcs -ftest-coverage'
193 env['LIBS'] += ['bz2', 'gcov'] 233 env['LIBS'] += ['bz2', 'gcov']
194 234
195 sources = Split("""action_processor.cc 235 sources = Split("""action_processor.cc
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 # of generating other files (usually their corresponding .c(c) files), 316 # of generating other files (usually their corresponding .c(c) files),
277 # so we make all sources depend on those other files. 317 # so we make all sources depend on those other files.
278 all_sources = [] 318 all_sources = []
279 all_sources.extend(sources) 319 all_sources.extend(sources)
280 all_sources.extend(unittest_sources) 320 all_sources.extend(unittest_sources)
281 all_sources.extend(main) 321 all_sources.extend(main)
282 all_sources.extend(unittest_main) 322 all_sources.extend(unittest_main)
283 all_sources.extend(client_main) 323 all_sources.extend(client_main)
284 all_sources.extend(delta_generator_main) 324 all_sources.extend(delta_generator_main)
285 for source in all_sources: 325 for source in all_sources:
326 if source.endswith('_unittest.cc'):
327 env.Depends(source, 'unittest_key.pub.pem')
286 if source.endswith('.glibmarshal.c') or source.endswith('.pb.cc'): 328 if source.endswith('.glibmarshal.c') or source.endswith('.pb.cc'):
287 continue 329 continue
288 env.Depends(source, 'update_metadata.pb.cc') 330 env.Depends(source, 'update_metadata.pb.cc')
289 env.Depends(source, 'marshal.glibmarshal.c') 331 env.Depends(source, 'marshal.glibmarshal.c')
290 env.Depends(source, 'update_engine.dbusclient.h') 332 env.Depends(source, 'update_engine.dbusclient.h')
291 333
292 update_engine_core = env.Library('update_engine_core', sources) 334 update_engine_core = env.Library('update_engine_core', sources)
293 env.Prepend(LIBS=[update_engine_core]) 335 env.Prepend(LIBS=[update_engine_core])
294 336
295 env.Program('update_engine', main) 337 env.Program('update_engine', main)
296 338
297 client_cmd = env.Program('update_engine_client', client_main); 339 client_cmd = env.Program('update_engine_client', client_main);
298 340
299 delta_generator_cmd = env.Program('delta_generator', 341 delta_generator_cmd = env.Program('delta_generator',
300 delta_generator_main) 342 delta_generator_main)
301 343
302 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc') 344 http_server_cmd = env.Program('test_http_server', 'test_http_server.cc')
303 345
304 unittest_env = env.Clone() 346 unittest_env = env.Clone()
305 unittest_env.Append(LIBS=['gmock', 'gtest']) 347 unittest_env.Append(LIBS=['gmock', 'gtest'])
306 unittest_cmd = unittest_env.Program('update_engine_unittests', 348 unittest_cmd = unittest_env.Program('update_engine_unittests',
307 unittest_sources + unittest_main) 349 unittest_sources + unittest_main)
308 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') + 350 Clean(unittest_cmd, Glob('*.gcda') + Glob('*.gcno') + Glob('*.gcov') +
309 Split('html app.info')) 351 Split('html app.info'))
OLDNEW
« no previous file with comments | « .gitignore ('k') | action_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698