Bug 1380297 - Mac nightly repackage fails trying to read CodeName r=mshal
MozReview-Commit-ID: LauJRihWxJ0
--- a/python/mozbuild/mozbuild/repackaging/application_ini.py
+++ b/python/mozbuild/mozbuild/repackaging/application_ini.py
@@ -1,21 +1,29 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import ConfigParser
import mozpack.path as mozpath
-def get_application_ini_value(application_directory, section, value):
+
+def get_application_ini_value(application_directory, section, value,
+ fallback=None):
rc = None
for root, dirs, files in os.walk(application_directory):
if 'application.ini' in files:
parser = ConfigParser.ConfigParser()
parser.read(mozpath.join(root, 'application.ini'))
- rc = parser.get(section, value)
+ try:
+ rc = parser.get(section, value)
+ except ConfigParser.NoOptionError:
+ if not fallback:
+ raise
+ else:
+ rc = parser.get(section, fallback)
break
if rc is None:
raise Exception("Input package does not contain an application.ini file")
return rc
--- a/python/mozbuild/mozbuild/repackaging/dmg.py
+++ b/python/mozbuild/mozbuild/repackaging/dmg.py
@@ -23,17 +23,18 @@ def repackage_dmg(infile, output):
# Remove the /Applications symlink. If we don't, an rsync command in
# create_dmg() will break, and create_dmg() re-creates the symlink anyway.
try:
os.remove(mozpath.join(tmpdir, ' '))
except OSError as e:
if e.errno != errno.ENOENT:
raise
- volume_name = get_application_ini_value(tmpdir, 'App', 'CodeName')
+ volume_name = get_application_ini_value(tmpdir, 'App', 'CodeName',
+ fallback='Name')
# The extra_files argument is empty [] because they are already a part
# of the original dmg produced by the build, and they remain in the
# tarball generated by the signing task.
create_dmg(tmpdir, output, volume_name, [])
finally:
shutil.rmtree(tmpdir)