Bug 1376550 - Support tar.gz (mac) regeneration of complete.mar r=mshal

Support OSX Signed nightlies (in the complete.mar too)

MozReview-Commit-ID: HXiFGE14wYJ

--HG--
extra : rebase_source : 1d02b4714c8fafe6cdcd74e6d9b5612c44dcb3b4
This commit is contained in:
Justin Wood 2017-06-27 14:00:52 -07:00
Родитель 152c0296f8
Коммит acdc65c932
1 изменённых файлов: 19 добавлений и 8 удалений

Просмотреть файл

@ -7,28 +7,39 @@ import sys
import tempfile import tempfile
import shutil import shutil
import zipfile import zipfile
import tarfile
import subprocess import subprocess
import mozpack.path as mozpath import mozpack.path as mozpath
from application_ini import get_application_ini_value from application_ini import get_application_ini_value
from mozbuild.util import ensureParentDir from mozbuild.util import ensureParentDir
def repackage_mar(topsrcdir, package, mar, output): def repackage_mar(topsrcdir, package, mar, output):
if not zipfile.is_zipfile(package): if not zipfile.is_zipfile(package) and not tarfile.is_tarfile(package):
raise Exception("Package file %s is not a valid .zip file." % package) raise Exception("Package file %s is not a valid .zip or .tar file." % package)
ensureParentDir(output) ensureParentDir(output)
tmpdir = tempfile.mkdtemp() tmpdir = tempfile.mkdtemp()
try: try:
z = zipfile.ZipFile(package) if zipfile.is_zipfile(package):
z.extractall(tmpdir) z = zipfile.ZipFile(package)
filelist = z.namelist() z.extractall(tmpdir)
z.close() filelist = z.namelist()
z.close()
else:
z = tarfile.open(package)
z.extractall(tmpdir)
filelist = z.getnames()
z.close()
toplevel_dirs = set([mozpath.split(f)[0] for f in filelist])
excluded_stuff = set([' ', '.background', '.DS_Store', '.VolumeIcon.icns'])
toplevel_dirs = toplevel_dirs - excluded_stuff
# Make sure the .zip file just contains a directory like 'firefox/' at # Make sure the .zip file just contains a directory like 'firefox/' at
# the top, and find out what it is called. # the top, and find out what it is called.
toplevel_dirs = set([mozpath.split(f)[0] for f in filelist])
if len(toplevel_dirs) != 1: if len(toplevel_dirs) != 1:
raise Exception("Package file is expected to have a single top-level directory (eg: 'firefox'), not: %s" % toplevel_dirs) raise Exception("Package file is expected to have a single top-level directory"
"(eg: 'firefox'), not: %s" % toplevel_dirs)
ffxdir = mozpath.join(tmpdir, toplevel_dirs.pop()) ffxdir = mozpath.join(tmpdir, toplevel_dirs.pop())
make_full_update = mozpath.join(topsrcdir, 'tools/update-packaging/make_full_update.sh') make_full_update = mozpath.join(topsrcdir, 'tools/update-packaging/make_full_update.sh')