blob: 6d6219a155e581dd905e4df8ff34c01e804dccfc [file] [log] [blame]
Ying Wangbd93d422011-10-28 17:02:30 -07001#!/usr/bin/env python
2#
3# Copyright (C) 2011 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17"""
18Build image output_image_file from input_directory and properties_file.
19
20Usage: build_image input_directory properties_file output_image_file
21
22"""
23import os
Ying Wang69e9b4d2012-11-26 18:10:23 -080024import os.path
Ying Wangbd93d422011-10-28 17:02:30 -070025import subprocess
26import sys
Geremy Condrafd6f7512013-06-16 17:26:08 -070027import commands
28import shutil
Geremy Condra5b5f4952014-05-05 22:19:37 -070029import tempfile
Ying Wangbd93d422011-10-28 17:02:30 -070030
Geremy Condrae8e982a2014-05-16 19:14:30 -070031FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
32
Ying Wang69e9b4d2012-11-26 18:10:23 -080033def RunCommand(cmd):
34 """ Echo and run the given command
35
36 Args:
37 cmd: the command represented as a list of strings.
38 Returns:
39 The exit code.
40 """
41 print "Running: ", " ".join(cmd)
42 p = subprocess.Popen(cmd)
43 p.communicate()
44 return p.returncode
Ying Wangbd93d422011-10-28 17:02:30 -070045
Geremy Condrafd6f7512013-06-16 17:26:08 -070046def GetVerityTreeSize(partition_size):
Colin Cross477cf2b2014-04-16 18:49:56 -070047 cmd = "build_verity_tree -s %d"
Geremy Condrafd6f7512013-06-16 17:26:08 -070048 cmd %= partition_size
49 status, output = commands.getstatusoutput(cmd)
50 if status:
51 print output
52 return False, 0
53 return True, int(output)
54
55def GetVerityMetadataSize(partition_size):
56 cmd = "system/extras/verity/build_verity_metadata.py -s %d"
57 cmd %= partition_size
58 status, output = commands.getstatusoutput(cmd)
59 if status:
60 print output
61 return False, 0
62 return True, int(output)
63
64def AdjustPartitionSizeForVerity(partition_size):
65 """Modifies the provided partition size to account for the verity metadata.
66
67 This information is used to size the created image appropriately.
68 Args:
69 partition_size: the size of the partition to be verified.
70 Returns:
71 The size of the partition adjusted for verity metadata.
72 """
73 success, verity_tree_size = GetVerityTreeSize(partition_size)
74 if not success:
Dan Albert8b72aef2015-03-23 19:13:21 -070075 return 0
Geremy Condrafd6f7512013-06-16 17:26:08 -070076 success, verity_metadata_size = GetVerityMetadataSize(partition_size)
77 if not success:
78 return 0
79 return partition_size - verity_tree_size - verity_metadata_size
80
Colin Cross477cf2b2014-04-16 18:49:56 -070081def BuildVerityTree(sparse_image_path, verity_image_path, prop_dict):
Dan Albert8b72aef2015-03-23 19:13:21 -070082 cmd = "build_verity_tree -A %s %s %s" % (
83 FIXED_SALT, sparse_image_path, verity_image_path)
Geremy Condrafd6f7512013-06-16 17:26:08 -070084 print cmd
85 status, output = commands.getstatusoutput(cmd)
86 if status:
87 print "Could not build verity tree! Error: %s" % output
88 return False
89 root, salt = output.split()
90 prop_dict["verity_root_hash"] = root
91 prop_dict["verity_salt"] = salt
92 return True
93
94def BuildVerityMetadata(image_size, verity_metadata_path, root_hash, salt,
95 block_device, signer_path, key):
Dan Albert8b72aef2015-03-23 19:13:21 -070096 cmd_template = (
97 "system/extras/verity/build_verity_metadata.py %s %s %s %s %s %s %s")
98 cmd = cmd_template % (image_size, verity_metadata_path, root_hash, salt,
99 block_device, signer_path, key)
Geremy Condrafd6f7512013-06-16 17:26:08 -0700100 print cmd
101 status, output = commands.getstatusoutput(cmd)
102 if status:
103 print "Could not build verity metadata! Error: %s" % output
104 return False
105 return True
106
107def Append2Simg(sparse_image_path, unsparse_image_path, error_message):
108 """Appends the unsparse image to the given sparse image.
109
110 Args:
111 sparse_image_path: the path to the (sparse) image
112 unsparse_image_path: the path to the (unsparse) image
113 Returns:
114 True on success, False on failure.
115 """
116 cmd = "append2simg %s %s"
117 cmd %= (sparse_image_path, unsparse_image_path)
118 print cmd
119 status, output = commands.getstatusoutput(cmd)
120 if status:
121 print "%s: %s" % (error_message, output)
122 return False
123 return True
124
Dan Albert8b72aef2015-03-23 19:13:21 -0700125def BuildVerifiedImage(data_image_path, verity_image_path,
126 verity_metadata_path):
127 if not Append2Simg(data_image_path, verity_metadata_path,
128 "Could not append verity metadata!"):
Geremy Condrafd6f7512013-06-16 17:26:08 -0700129 return False
Dan Albert8b72aef2015-03-23 19:13:21 -0700130 if not Append2Simg(data_image_path, verity_image_path,
131 "Could not append verity tree!"):
Geremy Condrafd6f7512013-06-16 17:26:08 -0700132 return False
133 return True
134
Geremy Condra6e8f53c2013-12-05 17:09:18 -0800135def UnsparseImage(sparse_image_path, replace=True):
Geremy Condrafd6f7512013-06-16 17:26:08 -0700136 img_dir = os.path.dirname(sparse_image_path)
137 unsparse_image_path = "unsparse_" + os.path.basename(sparse_image_path)
138 unsparse_image_path = os.path.join(img_dir, unsparse_image_path)
139 if os.path.exists(unsparse_image_path):
Geremy Condra6e8f53c2013-12-05 17:09:18 -0800140 if replace:
141 os.unlink(unsparse_image_path)
142 else:
143 return True, unsparse_image_path
Geremy Condrafd6f7512013-06-16 17:26:08 -0700144 inflate_command = ["simg2img", sparse_image_path, unsparse_image_path]
145 exit_code = RunCommand(inflate_command)
146 if exit_code != 0:
147 os.remove(unsparse_image_path)
148 return False, None
149 return True, unsparse_image_path
150
151def MakeVerityEnabledImage(out_file, prop_dict):
152 """Creates an image that is verifiable using dm-verity.
153
154 Args:
155 out_file: the location to write the verifiable image at
Dan Albert8b72aef2015-03-23 19:13:21 -0700156 prop_dict: a dictionary of properties required for image creation and
157 verification
Geremy Condrafd6f7512013-06-16 17:26:08 -0700158 Returns:
159 True on success, False otherwise.
160 """
161 # get properties
162 image_size = prop_dict["partition_size"]
Geremy Condrafd6f7512013-06-16 17:26:08 -0700163 block_dev = prop_dict["verity_block_device"]
Paul Lawrencea37b2bb2014-11-13 17:54:30 -0800164 signer_key = prop_dict["verity_key"] + ".pk8"
Geremy Condrafd6f7512013-06-16 17:26:08 -0700165 signer_path = prop_dict["verity_signer_cmd"]
166
167 # make a tempdir
Geremy Condra5b5f4952014-05-05 22:19:37 -0700168 tempdir_name = tempfile.mkdtemp(suffix="_verity_images")
Geremy Condrafd6f7512013-06-16 17:26:08 -0700169
170 # get partial image paths
171 verity_image_path = os.path.join(tempdir_name, "verity.img")
172 verity_metadata_path = os.path.join(tempdir_name, "verity_metadata.img")
Geremy Condrafd6f7512013-06-16 17:26:08 -0700173
174 # build the verity tree and get the root hash and salt
Colin Cross477cf2b2014-04-16 18:49:56 -0700175 if not BuildVerityTree(out_file, verity_image_path, prop_dict):
Geremy Condra5b5f4952014-05-05 22:19:37 -0700176 shutil.rmtree(tempdir_name, ignore_errors=True)
Geremy Condrafd6f7512013-06-16 17:26:08 -0700177 return False
178
179 # build the metadata blocks
180 root_hash = prop_dict["verity_root_hash"]
181 salt = prop_dict["verity_salt"]
Dan Albert8b72aef2015-03-23 19:13:21 -0700182 if not BuildVerityMetadata(image_size, verity_metadata_path, root_hash, salt,
183 block_dev, signer_path, signer_key):
Geremy Condra5b5f4952014-05-05 22:19:37 -0700184 shutil.rmtree(tempdir_name, ignore_errors=True)
Geremy Condrafd6f7512013-06-16 17:26:08 -0700185 return False
186
187 # build the full verified image
188 if not BuildVerifiedImage(out_file,
189 verity_image_path,
190 verity_metadata_path):
Geremy Condra5b5f4952014-05-05 22:19:37 -0700191 shutil.rmtree(tempdir_name, ignore_errors=True)
Geremy Condrafd6f7512013-06-16 17:26:08 -0700192 return False
193
Geremy Condra5b5f4952014-05-05 22:19:37 -0700194 shutil.rmtree(tempdir_name, ignore_errors=True)
Geremy Condrafd6f7512013-06-16 17:26:08 -0700195 return True
196
Ying Wanga2292c92015-03-24 19:07:40 -0700197def BuildImage(in_dir, prop_dict, out_file):
Ying Wangbd93d422011-10-28 17:02:30 -0700198 """Build an image to out_file from in_dir with property prop_dict.
199
200 Args:
201 in_dir: path of input directory.
202 prop_dict: property dictionary.
203 out_file: path of the output image file.
204
205 Returns:
206 True iff the image is built successfully.
207 """
Tao Baof3282b42015-04-01 11:21:55 -0700208 # system_root_image=true: build a system.img that combines the contents of
209 # /system and the ramdisk, and can be mounted at the root of the file system.
Ying Wanga2292c92015-03-24 19:07:40 -0700210 origin_in = in_dir
211 fs_config = prop_dict.get("fs_config")
212 if (prop_dict.get("system_root_image") == "true"
213 and prop_dict["mount_point"] == "system"):
214 in_dir = tempfile.mkdtemp()
215 # Change the mount point to "/"
216 prop_dict["mount_point"] = "/"
217 if fs_config:
218 # We need to merge the fs_config files of system and ramdisk.
219 fd, merged_fs_config = tempfile.mkstemp(prefix="root_fs_config",
220 suffix=".txt")
221 os.close(fd)
222 with open(merged_fs_config, "w") as fw:
223 if "ramdisk_fs_config" in prop_dict:
224 with open(prop_dict["ramdisk_fs_config"]) as fr:
225 fw.writelines(fr.readlines())
226 with open(fs_config) as fr:
227 fw.writelines(fr.readlines())
228 fs_config = merged_fs_config
229
Ying Wangbd93d422011-10-28 17:02:30 -0700230 build_command = []
231 fs_type = prop_dict.get("fs_type", "")
Ying Wang69e9b4d2012-11-26 18:10:23 -0800232 run_fsck = False
Geremy Condrafd6f7512013-06-16 17:26:08 -0700233
Mohamad Ayyashdd063522015-03-24 12:42:03 -0700234 fs_spans_partition = True
235 if fs_type.startswith("squash"):
236 fs_spans_partition = False
237
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -0700238 is_verity_partition = "verity_block_device" in prop_dict
Geremy Condra5b5f4952014-05-05 22:19:37 -0700239 verity_supported = prop_dict.get("verity") == "true"
Mohamad Ayyashdd063522015-03-24 12:42:03 -0700240 # adjust the partition size to make room for the hashes if this is to be verified
241 if verity_supported and is_verity_partition and fs_spans_partition:
Geremy Condrafd6f7512013-06-16 17:26:08 -0700242 partition_size = int(prop_dict.get("partition_size"))
243 adjusted_size = AdjustPartitionSizeForVerity(partition_size)
244 if not adjusted_size:
245 return False
246 prop_dict["partition_size"] = str(adjusted_size)
247 prop_dict["original_partition_size"] = str(partition_size)
248
Ying Wangbd93d422011-10-28 17:02:30 -0700249 if fs_type.startswith("ext"):
250 build_command = ["mkuserimg.sh"]
251 if "extfs_sparse_flag" in prop_dict:
252 build_command.append(prop_dict["extfs_sparse_flag"])
Ying Wang69e9b4d2012-11-26 18:10:23 -0800253 run_fsck = True
Ying Wangbd93d422011-10-28 17:02:30 -0700254 build_command.extend([in_dir, out_file, fs_type,
255 prop_dict["mount_point"]])
Doug Zongker850b8072013-12-05 15:54:55 -0800256 build_command.append(prop_dict["partition_size"])
Ying Wangf3b86352014-11-18 18:03:13 -0800257 if "journal_size" in prop_dict:
258 build_command.extend(["-j", prop_dict["journal_size"]])
Doug Zongker850b8072013-12-05 15:54:55 -0800259 if "timestamp" in prop_dict:
260 build_command.extend(["-T", str(prop_dict["timestamp"])])
Ying Wanga2292c92015-03-24 19:07:40 -0700261 if fs_config:
Doug Zongker82822822014-06-16 09:10:55 -0700262 build_command.extend(["-C", fs_config])
Ying Wanga2292c92015-03-24 19:07:40 -0700263 if "block_list" in prop_dict:
264 build_command.extend(["-B", prop_dict["block_list"]])
Christoffer Dall8ed01f32014-12-17 21:34:12 +0100265 build_command.extend(["-L", prop_dict["mount_point"]])
Ying Wanga2292c92015-03-24 19:07:40 -0700266 if "selinux_fc" in prop_dict:
Kenny Rootf32dc712012-04-08 10:42:34 -0700267 build_command.append(prop_dict["selinux_fc"])
Mohamad Ayyashb97746e2015-03-03 12:30:37 -0800268 elif fs_type.startswith("squash"):
269 build_command = ["mksquashfsimage.sh"]
270 build_command.extend([in_dir, out_file])
Mohamad Ayyashfa6c8a92015-06-24 10:44:29 -0700271 build_command.extend(["-s"])
Mohamad Ayyashb97746e2015-03-03 12:30:37 -0800272 build_command.extend(["-m", prop_dict["mount_point"]])
Ying Wanga2292c92015-03-24 19:07:40 -0700273 if "selinux_fc" in prop_dict:
Mohamad Ayyashb97746e2015-03-03 12:30:37 -0800274 build_command.extend(["-c", prop_dict["selinux_fc"]])
JP Abgrall5bfed5a2014-06-16 14:17:40 -0700275 elif fs_type.startswith("f2fs"):
276 build_command = ["mkf2fsuserimg.sh"]
277 build_command.extend([out_file, prop_dict["partition_size"]])
Ying Wangbd93d422011-10-28 17:02:30 -0700278 else:
279 build_command = ["mkyaffs2image", "-f"]
280 if prop_dict.get("mkyaffs2_extra_flags", None):
281 build_command.extend(prop_dict["mkyaffs2_extra_flags"].split())
282 build_command.append(in_dir)
283 build_command.append(out_file)
Kenny Rootf32dc712012-04-08 10:42:34 -0700284 if "selinux_fc" in prop_dict:
285 build_command.append(prop_dict["selinux_fc"])
286 build_command.append(prop_dict["mount_point"])
Ying Wangbd93d422011-10-28 17:02:30 -0700287
Ying Wanga2292c92015-03-24 19:07:40 -0700288 if in_dir != origin_in:
289 # Construct a staging directory of the root file system.
290 ramdisk_dir = prop_dict.get("ramdisk_dir")
291 if ramdisk_dir:
292 shutil.rmtree(in_dir)
293 shutil.copytree(ramdisk_dir, in_dir, symlinks=True)
294 staging_system = os.path.join(in_dir, "system")
295 shutil.rmtree(staging_system, ignore_errors=True)
296 shutil.copytree(origin_in, staging_system, symlinks=True)
297 try:
298 exit_code = RunCommand(build_command)
299 finally:
300 if in_dir != origin_in:
301 # Clean up temporary directories and files.
302 shutil.rmtree(in_dir, ignore_errors=True)
303 if fs_config:
304 os.remove(fs_config)
Ying Wang69e9b4d2012-11-26 18:10:23 -0800305 if exit_code != 0:
306 return False
307
Mohamad Ayyashdd063522015-03-24 12:42:03 -0700308 if not fs_spans_partition:
309 mount_point = prop_dict.get("mount_point")
310 partition_size = int(prop_dict.get("partition_size"))
311 image_size = os.stat(out_file).st_size
312 if image_size > partition_size:
313 print "Error: %s image size of %d is larger than partition size of %d" % (mount_point, image_size, partition_size)
314 return False
315 if verity_supported and is_verity_partition:
316 if 2 * image_size - AdjustPartitionSizeForVerity(image_size) > partition_size:
317 print "Error: No more room on %s to fit verity data" % mount_point
318 return False
319 prop_dict["original_partition_size"] = prop_dict["partition_size"]
320 prop_dict["partition_size"] = str(image_size)
321
Geremy Condrafd6f7512013-06-16 17:26:08 -0700322 # create the verified image if this is to be verified
Geremy Condra5b5f4952014-05-05 22:19:37 -0700323 if verity_supported and is_verity_partition:
Geremy Condrafd6f7512013-06-16 17:26:08 -0700324 if not MakeVerityEnabledImage(out_file, prop_dict):
325 return False
326
Ying Wang6a42a252013-02-27 13:54:02 -0800327 if run_fsck and prop_dict.get("skip_fsck") != "true":
Geremy Condra6e8f53c2013-12-05 17:09:18 -0800328 success, unsparse_image = UnsparseImage(out_file, replace=False)
Geremy Condrafd6f7512013-06-16 17:26:08 -0700329 if not success:
Ying Wang69e9b4d2012-11-26 18:10:23 -0800330 return False
331
332 # Run e2fsck on the inflated image file
333 e2fsck_command = ["e2fsck", "-f", "-n", unsparse_image]
334 exit_code = RunCommand(e2fsck_command)
335
336 os.remove(unsparse_image)
337
338 return exit_code == 0
Ying Wangbd93d422011-10-28 17:02:30 -0700339
340
341def ImagePropFromGlobalDict(glob_dict, mount_point):
342 """Build an image property dictionary from the global dictionary.
343
344 Args:
345 glob_dict: the global dictionary from the build system.
346 mount_point: such as "system", "data" etc.
347 """
Doug Zongker1ad7ade2013-12-06 11:53:27 -0800348 d = {}
349 if "build.prop" in glob_dict:
350 bp = glob_dict["build.prop"]
351 if "ro.build.date.utc" in bp:
352 d["timestamp"] = bp["ro.build.date.utc"]
Ying Wang9f8e8db2011-11-04 11:37:01 -0700353
354 def copy_prop(src_p, dest_p):
355 if src_p in glob_dict:
356 d[dest_p] = str(glob_dict[src_p])
357
Ying Wangbd93d422011-10-28 17:02:30 -0700358 common_props = (
Ying Wangbd93d422011-10-28 17:02:30 -0700359 "extfs_sparse_flag",
360 "mkyaffs2_extra_flags",
Kenny Rootf32dc712012-04-08 10:42:34 -0700361 "selinux_fc",
Ying Wang6a42a252013-02-27 13:54:02 -0800362 "skip_fsck",
Geremy Condrafd6f7512013-06-16 17:26:08 -0700363 "verity",
Geremy Condrafd6f7512013-06-16 17:26:08 -0700364 "verity_key",
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -0700365 "verity_signer_cmd"
Ying Wangbd93d422011-10-28 17:02:30 -0700366 )
367 for p in common_props:
Ying Wang9f8e8db2011-11-04 11:37:01 -0700368 copy_prop(p, p)
Ying Wangbd93d422011-10-28 17:02:30 -0700369
370 d["mount_point"] = mount_point
371 if mount_point == "system":
Ying Wang9f8e8db2011-11-04 11:37:01 -0700372 copy_prop("fs_type", "fs_type")
Dan Albert8b72aef2015-03-23 19:13:21 -0700373 # Copy the generic sysetem fs type first, override with specific one if
374 # available.
Mohamad Ayyashb97746e2015-03-03 12:30:37 -0800375 copy_prop("system_fs_type", "fs_type")
Ying Wang9f8e8db2011-11-04 11:37:01 -0700376 copy_prop("system_size", "partition_size")
Ying Wangf3b86352014-11-18 18:03:13 -0800377 copy_prop("system_journal_size", "journal_size")
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -0700378 copy_prop("system_verity_block_device", "verity_block_device")
Tao Baof3282b42015-04-01 11:21:55 -0700379 copy_prop("system_root_image", "system_root_image")
380 copy_prop("ramdisk_dir", "ramdisk_dir")
Ying Wangbd93d422011-10-28 17:02:30 -0700381 elif mount_point == "data":
JP Abgrall5bfed5a2014-06-16 14:17:40 -0700382 # Copy the generic fs type first, override with specific one if available.
Ying Wang9f8e8db2011-11-04 11:37:01 -0700383 copy_prop("fs_type", "fs_type")
JP Abgrall5bfed5a2014-06-16 14:17:40 -0700384 copy_prop("userdata_fs_type", "fs_type")
Ying Wang9f8e8db2011-11-04 11:37:01 -0700385 copy_prop("userdata_size", "partition_size")
386 elif mount_point == "cache":
387 copy_prop("cache_fs_type", "fs_type")
388 copy_prop("cache_size", "partition_size")
Ying Wanga0febe52013-03-20 11:02:05 -0700389 elif mount_point == "vendor":
390 copy_prop("vendor_fs_type", "fs_type")
391 copy_prop("vendor_size", "partition_size")
Ying Wangf3b86352014-11-18 18:03:13 -0800392 copy_prop("vendor_journal_size", "journal_size")
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -0700393 copy_prop("vendor_verity_block_device", "verity_block_device")
Ying Wangb8888432014-03-11 17:13:27 -0700394 elif mount_point == "oem":
395 copy_prop("fs_type", "fs_type")
396 copy_prop("oem_size", "partition_size")
Ying Wangf3b86352014-11-18 18:03:13 -0800397 copy_prop("oem_journal_size", "journal_size")
Ying Wangbd93d422011-10-28 17:02:30 -0700398
399 return d
400
401
402def LoadGlobalDict(filename):
403 """Load "name=value" pairs from filename"""
404 d = {}
405 f = open(filename)
406 for line in f:
407 line = line.strip()
408 if not line or line.startswith("#"):
409 continue
410 k, v = line.split("=", 1)
411 d[k] = v
412 f.close()
413 return d
414
415
416def main(argv):
417 if len(argv) != 3:
418 print __doc__
419 sys.exit(1)
420
421 in_dir = argv[0]
422 glob_dict_file = argv[1]
423 out_file = argv[2]
424
425 glob_dict = LoadGlobalDict(glob_dict_file)
Ying Wangae61f502015-03-12 18:30:39 -0700426 if "mount_point" in glob_dict:
427 # The caller knows the mount point and provides a dictionay needed by BuildImage().
428 image_properties = glob_dict
Ying Wang9f8e8db2011-11-04 11:37:01 -0700429 else:
Ying Wangae61f502015-03-12 18:30:39 -0700430 image_filename = os.path.basename(out_file)
431 mount_point = ""
432 if image_filename == "system.img":
433 mount_point = "system"
434 elif image_filename == "userdata.img":
435 mount_point = "data"
436 elif image_filename == "cache.img":
437 mount_point = "cache"
438 elif image_filename == "vendor.img":
439 mount_point = "vendor"
440 elif image_filename == "oem.img":
441 mount_point = "oem"
442 else:
443 print >> sys.stderr, "error: unknown image file name ", image_filename
444 exit(1)
Ying Wangbd93d422011-10-28 17:02:30 -0700445
Ying Wangae61f502015-03-12 18:30:39 -0700446 image_properties = ImagePropFromGlobalDict(glob_dict, mount_point)
447
Ying Wangbd93d422011-10-28 17:02:30 -0700448 if not BuildImage(in_dir, image_properties, out_file):
Dan Albert8b72aef2015-03-23 19:13:21 -0700449 print >> sys.stderr, "error: failed to build %s from %s" % (out_file,
450 in_dir)
Ying Wangbd93d422011-10-28 17:02:30 -0700451 exit(1)
452
453
454if __name__ == '__main__':
455 main(sys.argv[1:])