44 """Similar to _GetOutput() but ignores stderr. If there's an error launching
45 the child (like file not found), the exception will be caught and (None, 1)
46 will be returned to mimic quiet failure."""
48 proc = subprocess.Popen(
49 args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
52 (stdout, stderr) = proc.communicate()
53 return (stdout, proc.returncode)
66 """Adds the product version number into the plist. Returns True on success and
67 False on error. The error will be printed to stderr."""
69 match = re.match(
'\d+\.\d+\.(\d+\.\d+)$', version)
71 print(
'Invalid version string specified: "%s"' % version,
75 full_version = match.group(0)
76 bundle_version = match.group(1)
80 VERSION_TOOL = os.path.join(TOP,
'build/util/version.py')
81 VERSION_FILE = os.path.join(TOP,
'chrome/VERSION')
84 VERSION_TOOL,
'-f', VERSION_FILE,
'-t',
85 '@MAJOR@.@MINOR@.@BUILD@.@PATCH@'
87 full_version = stdout.rstrip()
90 [VERSION_TOOL,
'-f', VERSION_FILE,
'-t',
'@BUILD@.@PATCH@'])
91 bundle_version = stdout.rstrip()
95 if retval1
or retval2:
99 plist[
'CFBundleShortVersionString'] = full_version
108 plist[
'CFBundleVersion'] = bundle_version
161 components = (
'32bit',
'full')
162 assert tuple(sorted(components)) == components
164 components_len = len(components)
165 combinations = 1 << components_len
167 for combination
in range(0, combinations):
169 for component_index
in range(0, components_len):
170 if combination & (1 << component_index):
171 tag_suffix +=
'-' + components[component_index]
172 tag_suffixes.append(tag_suffix)
200 parser = optparse.OptionParser(
'%prog [options]')
207 help=
'Enable Breakpad [1 or 0]')
209 '--breakpad_uploads',
210 dest=
'breakpad_uploads',
214 help=
'Enable Breakpad\'s uploading of crash dumps [1 or 0]')
221 help=
'Enable Keystone [1 or 0]')
228 help=
'Add SCM metadata [1 or 0]')
235 help=
'The branding of the binary')
238 dest=
'bundle_identifier',
242 help=
'The bundle id of the binary')
249 help=
'The version string [major.minor.build.patch]')
250 (options, args) = parser.parse_args(argv)
253 print(parser.get_usage(), file=sys.stderr)
257 DEST_INFO_PLIST = os.path.join(env[
'TARGET_BUILD_DIR'],
258 env[
'INFOPLIST_PATH'])
259 plist = plistlib.readPlist(DEST_INFO_PLIST)
266 if options.use_breakpad:
267 if options.branding
is None:
268 print(
'Use of Breakpad requires branding.', file=sys.stderr)
271 if options.breakpad_uploads:
272 plist[
'BreakpadURL'] =
'https://clients2.google.com/cr/report'
280 plist[
'BreakpadURL'] =
'none'
285 if options.use_keystone
and env[
'CONFIGURATION'] ==
'Release':
286 if options.bundle_identifier
is None:
287 print(
'Use of Keystone requires the bundle id.', file=sys.stderr)
294 if not _DoSCMKeys(plist, options.add_scm_info):
298 temp_info_plist = tempfile.NamedTemporaryFile()
299 plistlib.writePlist(plist, temp_info_plist.name)
303 proc = subprocess.Popen([
304 'plutil',
'-convert',
'xml1',
'-o', DEST_INFO_PLIST,
308 return proc.returncode