Backed out 6 changesets (bug 1654994) for build bustage on fuzzy builds. DONTBUILD

Backed out changeset cd3e1074b785 (bug 1654994)
Backed out changeset 45ee50e76d61 (bug 1654994)
Backed out changeset 77f1b667baec (bug 1654994)
Backed out changeset 9fca8b0bf8c1 (bug 1654994)
Backed out changeset 7131943d8db9 (bug 1654994)
Backed out changeset 435b90f6ca70 (bug 1654994)
This commit is contained in:
Dorel Luca 2020-07-31 12:36:14 +03:00
Родитель 68aa4aa0fa
Коммит 0226b8feef
26 изменённых файлов: 142 добавлений и 215 удалений

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

@ -199,8 +199,8 @@ endif
.PHONY: symbolsfullarchive
symbolsfullarchive: prepsymbolsarchive
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
$(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
$(RM) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
$(call py_action,symbols_archive,'$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' \
$(abspath $(DIST)/crashreporter-symbols) \
--full-archive)
@ -211,20 +211,20 @@ symbolsarchive: prepsymbolsarchive
$(abspath $(DIST)/crashreporter-symbols))
ifdef MOZ_CRASHREPORTER
# Set MOZ_ENABLE_FULL_SYMBOLS to enable generation and upload of the full
# Set MOZ_DISABLE_FULL_SYMBOLS to disable generation and upload of the full
# crashreporter symbols archives
ifdef MOZ_ENABLE_FULL_SYMBOLS
buildsymbols: symbolsfullarchive symbolsarchive
else
ifdef MOZ_DISABLE_FULL_SYMBOLS
buildsymbols: symbolsarchive
endif # MOZ_ENABLE_FULL_SYMBOLS
else
buildsymbols: symbolsfullarchive symbolsarchive
endif # MOZ_DISABLE_FULL_SYMBOLS
else
buildsymbols:
endif
uploadsymbols:
ifdef MOZ_CRASHREPORTER
$(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst'
$(PYTHON3) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
endif
.PHONY: update-packaging

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

@ -15,6 +15,10 @@ export MAKENSISU="${MOZ_FETCHES_DIR}/nsis-3.01/makensis.exe"
if [ -d "${MAKENSISU%/*}" -a ! -x "${MAKENSISU}" ]; then
chmod +x "${MAKENSISU}"
fi
export MAKECAB="${TOOLTOOL_DIR}/makecab.exe"
if [ -f "${MAKECAB}" ]; then
chmod +x "${MAKECAB}"
fi
export UPX="${MOZ_FETCHES_DIR}/upx-3.95-win64/upx.exe"
if [ -f "${UPX}" ]; then
chmod +x "${UPX}"

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

@ -2,9 +2,12 @@
# MOZ_AUTOMATION flags
# SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE - shouldn't be used?
# TOOLTOOL_DIR
# MAKECAB - shouldn't be used?
# DUMP_SYMS - isn't used.
. "$topsrcdir/build/mozconfig.win-common"
# MinGW does not have (or need) makecab
unset MAKECAB
unset DUMP_SYMS
# Sets:

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

@ -15,6 +15,10 @@ export MAKENSISU="${MOZ_FETCHES_DIR}/nsis-3.01/makensis.exe"
if [ -d "${MAKENSISU%/*}" -a ! -x "${MAKENSISU}" ]; then
chmod +x "${MAKENSISU}"
fi
export MAKECAB="${TOOLTOOL_DIR}/makecab.exe"
if [ -f "${MAKECAB}" ]; then
chmod +x "${MAKECAB}"
fi
export UPX="${MOZ_FETCHES_DIR}/upx-3.95-win64/upx.exe"
if [ -f "${UPX}" ]; then
chmod +x "${UPX}"

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

@ -15,6 +15,10 @@ export MAKENSISU="${MOZ_FETCHES_DIR}/nsis-3.01/makensis.exe"
if [ -d "${MAKENSISU%/*}" -a ! -x "${MAKENSISU}" ]; then
chmod +x "${MAKENSISU}"
fi
export MAKECAB="${TOOLTOOL_DIR}/makecab.exe"
if [ -f "${MAKECAB}" ]; then
chmod +x "${MAKECAB}"
fi
export UPX="${MOZ_FETCHES_DIR}/upx-3.95-win64/upx.exe"
if [ -f "${UPX}" ]; then
chmod +x "${UPX}"

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

@ -2,9 +2,12 @@
# MOZ_AUTOMATION flags
# SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE - shouldn't be used?
# TOOLTOOL_DIR
# MAKECAB - shouldn't be used?
# DUMP_SYMS - isn't used.
. "$topsrcdir/build/mozconfig.win-common"
# MinGW does not have (or need) makecab
unset MAKECAB
unset DUMP_SYMS
# Sets:

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

@ -1,4 +1,5 @@
TOOLTOOL_DIR=${topsrcdir}
export MAKECAB=$TOOLTOOL_DIR/makecab.exe
export LLVM_CONFIG="${MOZ_FETCHES_DIR}/clang/bin/llvm-config"
export DUMP_SYMS="${MOZ_FETCHES_DIR}/dump_syms/dump_syms.exe"

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

@ -12,5 +12,14 @@
"algorithm": "sha512",
"filename": "vs2017_15.8.4.zip",
"unpack": true
},
{
"version": "makecab rev d2bc6797648b7a834782714a55d339d2fd4e58c8",
"algorithm": "sha512",
"visibility": "public",
"filename": "makecab.tar.bz2",
"unpack": true,
"digest": "196ac6a567c85559957dfe511c3d8654d23c94d5603259e19ccafe9d71e0e4ccee63ccc9a778f2699654b786cda54266108b7d4db543d01bb0b42545b4e6ec75",
"size": 297118
}
]

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

@ -13,5 +13,14 @@
"algorithm": "sha512",
"filename": "vs2017_15.9.6.zip",
"unpack": true
},
{
"version": "makecab rev d2bc6797648b7a834782714a55d339d2fd4e58c8",
"algorithm": "sha512",
"visibility": "public",
"filename": "makecab.tar.bz2",
"unpack": true,
"digest": "196ac6a567c85559957dfe511c3d8654d23c94d5603259e19ccafe9d71e0e4ccee63ccc9a778f2699654b786cda54266108b7d4db543d01bb0b42545b4e6ec75",
"size": 297118
}
]

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

@ -12,5 +12,14 @@
"algorithm": "sha512",
"filename": "vs2017_15.8.4.zip",
"unpack": true
},
{
"version": "makecab rev d2bc6797648b7a834782714a55d339d2fd4e58c8",
"algorithm": "sha512",
"visibility": "public",
"filename": "makecab.tar.bz2",
"unpack": true,
"digest": "196ac6a567c85559957dfe511c3d8654d23c94d5603259e19ccafe9d71e0e4ccee63ccc9a778f2699654b786cda54266108b7d4db543d01bb0b42545b4e6ec75",
"size": 297118
}
]

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

@ -11,7 +11,7 @@ settings set symbols.enable-external-lookup true
settings append target.exec-search-paths @topobjdir@/toolkit/library
settings append target.exec-search-paths @topobjdir@/mozglue/build
# This is where artifact builds unpacks "crashreporter-symbols-full" uncompressed ELF debug symbols.
# This is where artifact builds unpacks "crashreporter-symbols-full.zip" uncompressed ELF debug symbols.
settings append target.debug-file-search-paths @topobjdir@/dist/crashreporter-symbols
# These are specific paths encoded into Mozilla's automation outputs.

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

@ -492,3 +492,6 @@ host_link = check_prog('HOST_LINKER', ('lld-link',), input='HOST_LINKER',
when=host_is_windows, paths=host_toolchain_search_path)
add_old_configure_assignment('LINKER', link)
check_prog('MAKECAB', ('makecab.exe',), allow_missing=True, when=target_is_windows)

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

@ -2,7 +2,7 @@
# Enable the artifact build.
ac_add_options --enable-artifact-builds
if test -n "$MOZ_ARTIFACT_TASK_WIN32_OPT" -a -n "$MOZ_ENABLE_FULL_SYMBOLS"; then
if test -n "$MOZ_ARTIFACT_TASK_WIN32_OPT" -a -z "$MOZ_DISABLE_FULL_SYMBOLS"; then
ac_add_options --enable-artifact-build-symbols=full
else
ac_add_options --enable-artifact-build-symbols

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

@ -18,6 +18,7 @@ unset CARGO
unset RUSTDOC
unset RUSTFMT
unset CBINDGEN
unset MAKECAB
unset DUMP_SYMS
unset TOOLCHAIN_PREFIX
unset BINDGEN_CFLAGS

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

@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir}
export MAKECAB=$TOOLTOOL_DIR/makecab.exe
export DUMP_SYMS="${MOZ_FETCHES_DIR}/dump_syms/dump_syms"
if [ -z "$USE_ARTIFACT" ]; then

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

@ -9,6 +9,7 @@ import sys
import os
from mozpack.files import FileFinder
from mozpack.mozjar import JarWriter
import mozpack.path as mozpath
@ -18,54 +19,14 @@ def make_archive(archive_name, base, exclude, include):
if not include:
include = ['*']
archive_basename = os.path.basename(archive_name)
def fill_archive(add_file):
for pat in include:
for p, f in finder.find(pat):
print(' Adding to "%s":\n\t"%s"' % (archive_basename, p))
add_file(p, f)
with open(archive_name, 'wb') as fh:
if archive_basename.endswith('.zip'):
from mozpack.mozjar import JarWriter
with JarWriter(fileobj=fh, compress_level=5) as writer:
def add_file(p, f):
with JarWriter(fileobj=fh, compress_level=5) as writer:
for pat in include:
for p, f in finder.find(pat):
print(' Adding to "%s":\n\t"%s"' % (archive_basename, p))
should_compress = any(mozpath.match(p, pat) for pat in compress)
writer.add(p.encode('utf-8'), f, mode=f.mode,
compress=should_compress, skip_duplicates=True)
fill_archive(add_file)
elif archive_basename.endswith('.tar.zst'):
import subprocess
import tarfile
from buildconfig import topsrcdir
# Ideally, we'd do this:
# import zstandard
# ctx = zstandard.ZstdCompressor(threads=-1)
# zstdwriter = ctx.stream_writer(fh)
# and use `zstdwriter` as the fileobj input for `tarfile.open`.
# But this script is invoked with `PYTHON3` in a Makefile, which
# uses the virtualenv python where zstandard is not installed.
# Both `sys.executable` and `buildconfig.substs['PYTHON3']` would
# be the same. However, as invoking the virtualenv python doesn't
# fully activate the virtualenv and doesn't alter `PATH`, invoking
# `python3` will use the system python, which hopefully has
# zstandard available (and that's the case on automation, where
# this code path is expected to be followed).
proc = subprocess.Popen([
'python3',
os.path.join(topsrcdir, 'taskcluster', 'scripts', 'misc', 'zstdpy'),
'-T0',
], stdin=subprocess.PIPE, stdout=fh)
with tarfile.open(mode='w|', fileobj=proc.stdin, bufsize=1024*1024) as tar:
def add_file(p, f):
info = tar.gettarinfo(os.path.join(base, p), p)
tar.addfile(info, f.open())
fill_archive(add_file)
proc.stdin.close()
proc.wait()
else:
raise Exception('Unsupported archive format for {}'.format(archive_basename))
def main(argv):

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

@ -124,7 +124,7 @@ class PackageFrontend(MachCommandBase):
download_symbols=download_symbols,
download_host_bins=download_host_bins,
download_maven_zip=download_maven_zip,
no_process=no_process, mozbuild=self)
no_process=no_process)
return artifacts
@ArtifactSubCommand('artifact', 'install',

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

@ -142,7 +142,7 @@ class ArtifactJob(object):
download_symbols=False,
download_host_bins=False,
download_maven_zip=False,
substs=None, mozbuild=None):
substs=None):
self._package_re = re.compile(self.package_re)
self._tests_re = None
if download_tests:
@ -159,10 +159,9 @@ class ArtifactJob(object):
self._substs = substs
self._symbols_archive_suffix = None
if download_symbols == 'full':
self._symbols_archive_suffix = 'crashreporter-symbols-full.tar.zst'
self._symbols_archive_suffix = 'crashreporter-symbols-full.zip'
elif download_symbols:
self._symbols_archive_suffix = 'crashreporter-symbols.zip'
self._mozbuild = mozbuild
def log(self, *args, **kwargs):
if self._log:
@ -312,17 +311,18 @@ class ArtifactJob(object):
def process_symbols_archive(self, filename, processed_filename, skip_compressed=False):
with JarWriter(file=processed_filename, compress_level=5) as writer:
for filename, entry in self.iter_artifact_archive(filename):
reader = JarReader(filename)
for filename in reader.entries:
if skip_compressed and filename.endswith('.gz'):
self.log(logging.DEBUG, 'artifact',
{'filename': filename},
'Skipping compressed ELF debug symbol file {filename}')
continue
destpath = mozpath.join('crashreporter-symbols', filename)
self.log(logging.INFO, 'artifact',
self.log(logging.DEBUG, 'artifact',
{'destpath': destpath},
'Adding {destpath} to processed archive')
writer.add(destpath.encode('utf-8'), entry)
writer.add(destpath.encode('utf-8'), reader[filename])
def process_host_bin(self, filename, processed_filename):
with JarWriter(file=processed_filename, compress_level=5) as writer:
@ -333,25 +333,6 @@ class ArtifactJob(object):
destpath = mozpath.join('host/bin', orig_basename)
writer.add(destpath.encode('utf-8'), open(filename, 'rb'))
def iter_artifact_archive(self, filename):
if filename.endswith('.zip'):
reader = JarReader(filename)
for filename in reader.entries:
yield filename, reader[filename]
elif filename.endswith('.tar.zst') and self._mozbuild is not None:
self._mozbuild._ensure_zstd()
import zstandard
ctx = zstandard.ZstdDecompressor()
uncompressed = ctx.stream_reader(open(filename, 'rb'))
with tarfile.open(mode='r|', fileobj=uncompressed, bufsize=1024*1024) as reader:
while True:
info = reader.next()
if info is None:
break
yield info.name, reader.extractfile(info)
else:
raise RuntimeError('Unsupported archive type for %s' % filename)
class AndroidArtifactJob(ArtifactJob):
package_re = r'public/build/geckoview_example\.apk'
@ -383,13 +364,14 @@ class AndroidArtifactJob(ArtifactJob):
ArtifactJob.process_symbols_archive(
self, filename, processed_filename, skip_compressed=True)
if not self._symbols_archive_suffix.startswith('crashreporter-symbols-full.'):
if self._symbols_archive_suffix != 'crashreporter-symbols-full.zip':
return
import gzip
with JarWriter(file=processed_filename, compress_level=5) as writer:
for filename, entry in self.iter_artifact_archive(filename):
reader = JarReader(filename)
for filename in reader.entries:
if not filename.endswith('.gz'):
continue
@ -409,7 +391,7 @@ class AndroidArtifactJob(ArtifactJob):
'Adding uncompressed ELF debug symbol file '
'{destpath} to processed archive')
writer.add(destpath.encode('utf-8'),
gzip.GzipFile(fileobj=entry))
gzip.GzipFile(fileobj=reader[filename].uncompressed_data))
class LinuxArtifactJob(ArtifactJob):
@ -851,7 +833,7 @@ class Artifacts(object):
cache_dir='.', hg=None, git=None, skip_cache=False,
topsrcdir=None, download_tests=True, download_symbols=False,
download_host_bins=False,
download_maven_zip=False, no_process=False, mozbuild=None):
download_maven_zip=False, no_process=False):
if (hg and git) or (not hg and not git):
raise ValueError("Must provide path to exactly one of hg and git")
@ -877,7 +859,7 @@ class Artifacts(object):
download_symbols=download_symbols,
download_host_bins=download_host_bins,
download_maven_zip=download_maven_zip,
substs=self._substs, mozbuild=mozbuild)
substs=self._substs)
except KeyError:
self.log(logging.INFO, 'artifact',
{'job': self._job},

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

@ -2,9 +2,7 @@
# 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/.
---
loader: taskgraph.loader.multi_dep:loader
group-by: platform
loader: taskgraph.loader.single_dep:loader
transforms:
- taskgraph.transforms.upload_symbols:transforms
@ -13,36 +11,24 @@ transforms:
kind-dependencies:
- build
- toolchain
primary-dependency: build
not-for-build-platforms:
# Address Sanitizer builds don't have symbols to upload.
- linux64-asan-reporter-shippable/opt
- win64-asan-reporter-shippable/opt
- linux-geckodriver/opt
- linux64-geckodriver/opt
- macosx64-geckodriver/opt
- win32-geckodriver/opt
- win64-geckodriver/opt
job-template:
description: Upload Symbols
worker-type: b-linux
worker:
docker-image: {in-tree: "debian10-base"}
docker-image: {in-tree: "lint"}
max-run-time: 900
env:
# {level} gets replaced in the upload_symbols transform
SYMBOL_SECRET: "project/releng/gecko/build/level-{level}/gecko-symbol-upload"
MAKECAB: /builds/worker/fetches/makecab/makecab
run:
using: mach
mach: {artifact-reference: "python toolkit/crashreporter/tools/upload_symbols.py <build/public/build/target.crashreporter-symbols-full.tar.zst>"}
mach: {artifact-reference: "python toolkit/crashreporter/tools/upload_symbols.py <build/public/build/target.crashreporter-symbols-full.zip>"}
sparse-profile: upload-symbols
scopes:
- secrets:get:project/releng/gecko/build/level-{level}/gecko-symbol-upload
fetches:
toolchain:
- linux64-makecab

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

@ -188,8 +188,8 @@ def enable_full_crashsymbols(config, jobs):
enable_full_crashsymbols = job['attributes'].get('enable-full-crashsymbols')
if enable_full_crashsymbols and config.params['project'] in branches:
logger.debug("Enabling full symbol generation for %s", job['name'])
job['worker']['env']['MOZ_ENABLE_FULL_SYMBOLS'] = '1'
else:
logger.debug("Disabling full symbol generation for %s", job['name'])
job['worker']['env']['MOZ_DISABLE_FULL_SYMBOLS'] = '1'
job['attributes'].pop('enable-full-crashsymbols', None)
yield job

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

@ -40,7 +40,6 @@ def check_nightlies(config, tasks):
def fill_template(config, tasks):
for task in tasks:
dep = task['primary-dependency']
task.pop('dependent-tasks', None)
# Fill out the dynamic fields in the task description
task['label'] = dep.label + '-upload-symbols'

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

@ -752,10 +752,32 @@ class Dumper_Win32(Dumper):
def CopyDebug(self, file, debug_file, guid, code_file, code_id):
file = locate_pdb(file)
def compress(path):
compressed_file = path[:-1] + "_"
# ignore makecab's output
makecab = buildconfig.substs["MAKECAB"]
wine = buildconfig.substs.get("WINE")
if wine and makecab.lower().endswith(".exe"):
cmd = [wine, makecab]
else:
cmd = [makecab]
success = subprocess.call(
cmd + ["-D", "CompressionType=MSZIP", path, compressed_file],
stdout=open(os.devnull, "w"),
stderr=subprocess.STDOUT,
)
if success == 0 and os.path.exists(compressed_file):
os.unlink(path)
return True
return False
rel_path = os.path.join(debug_file, guid, debug_file).replace("\\", "/")
full_path = os.path.normpath(os.path.join(self.symbol_path, rel_path))
shutil.copyfile(file, full_path)
print(rel_path)
if compress(full_path):
print(rel_path[:-1] + "_")
else:
print(rel_path)
# Copy the binary file as well
if code_file and code_id:
@ -771,7 +793,10 @@ class Dumper_Win32(Dumper):
if e.errno != errno.EEXIST:
raise
shutil.copyfile(full_code_path, full_path)
print(rel_path)
if compress(full_path):
print(rel_path[:-1] + "_")
else:
print(rel_path)
def SourceServerIndexing(self, debug_file, guid, sourceFileStream, vcs_root):
# Creates a .pdb.stream file in the mozilla\objdir to be used for source indexing
@ -837,7 +862,9 @@ class Dumper_Linux(Dumper):
rel_path = os.path.join(debug_file, guid, debug_file + ".dbg")
full_path = os.path.normpath(os.path.join(self.symbol_path, rel_path))
shutil.move(file_dbg, full_path)
print(rel_path)
# gzip the shipped debug files
os.system("gzip -4 -f %s" % full_path)
print(rel_path + ".gz")
else:
if os.path.isfile(file_dbg):
os.unlink(file_dbg)
@ -962,15 +989,16 @@ class Dumper_Mac(Dumper):
def CopyDebug(self, file, debug_file, guid, code_file, code_id):
"""ProcessFile has already produced a dSYM bundle, so we should just
copy that to the destination directory. However, we'll package it
into a .tar because it's a bundle, so it's a directory. |file| here is
into a .tar.bz2 because the debug symbols are pretty huge, and
also because it's a bundle, so it's a directory. |file| here is the
the original filename."""
dsymbundle = file + ".dSYM"
rel_path = os.path.join(
debug_file, guid, os.path.basename(dsymbundle) + ".tar"
debug_file, guid, os.path.basename(dsymbundle) + ".tar.bz2"
)
full_path = os.path.abspath(os.path.join(self.symbol_path, rel_path))
success = subprocess.call(
["tar", "cf", full_path, os.path.basename(dsymbundle)],
["tar", "cjf", full_path, os.path.basename(dsymbundle)],
cwd=os.path.dirname(dsymbundle),
stdout=open(os.devnull, "w"),
stderr=subprocess.STDOUT,

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

@ -192,6 +192,7 @@ class TestCopyDebug(HelperMixin, unittest.TestCase):
d.Process(os.path.join(self.test_dir, add_extension(["foo"])[0]))
self.assertEqual(1, len(copied))
@patch.dict("buildconfig.substs._dict", {"MAKECAB": "makecab"})
def test_copy_debug_copies_binaries(self):
"""
Test that CopyDebug copies binaries as well on Windows.
@ -218,7 +219,7 @@ class TestCopyDebug(HelperMixin, unittest.TestCase):
d.Process(test_file)
self.assertTrue(
os.path.isfile(
os.path.join(self.symbol_dir, code_file, code_id, code_file)
os.path.join(self.symbol_dir, code_file, code_id, code_file[:-1] + "_")
)
)

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

@ -1,10 +1,10 @@
#!/usr/bin/env python3
#!/usr/bin/env python
#
# 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/.
#
# This script uploads a symbol archive file from a path or URL passed on the commandline
# This script uploads a symbol zip file from a path or URL passed on the commandline
# to the symbol server at https://symbols.mozilla.org/ .
#
# Using this script requires you to have generated an authentication
@ -19,9 +19,6 @@ from __future__ import absolute_import, print_function, unicode_literals
import argparse
import logging
import os
import redo
import requests
import shutil
import sys
from mozbuild.base import MozbuildObject
log = logging.getLogger('upload-symbols')
@ -46,6 +43,8 @@ def print_error(r):
def get_taskcluster_secret(secret_name):
import requests
secrets_url = 'http://taskcluster/secrets/v1/secret/{}'.format(secret_name)
log.info(
'Using symbol upload token from the secrets service: "{}"'.format(secrets_url))
@ -61,11 +60,14 @@ def main():
config = MozbuildObject.from_environment()
config.activate_virtualenv()
import redo
import requests
logging.basicConfig()
parser = argparse.ArgumentParser(
description='Upload symbols in ZIP using token from Taskcluster secrets service.')
parser.add_argument('archive',
help='Symbols archive file - URL or path to local file')
parser.add_argument('zip',
help='Symbols zip file - URL or path to local file')
parser.add_argument('--ignore-missing',
help='No error on missing files',
action='store_true')
@ -81,100 +83,17 @@ def main():
log.info('Retrying...')
return False
zip_path = args.archive
if args.archive.endswith('.tar.zst'):
from mozpack.files import File
from mozpack.mozjar import JarWriter
import tarfile
import tempfile
config._ensure_zstd()
import zstandard
def prepare_zip_from(archive, tmpdir):
if archive.startswith('http'):
resp = requests.get(archive, allow_redirects=True, stream=True)
resp.raise_for_status()
reader = resp.raw
else:
reader = open(archive, 'rb')
ctx = zstandard.ZstdDecompressor()
uncompressed = ctx.stream_reader(reader)
with tarfile.open(mode='r|', fileobj=uncompressed, bufsize=1024*1024) as tar:
while True:
info = tar.next()
if info is None:
break
log.info(info.name)
data = tar.extractfile(info)
path = os.path.join(tmpdir, info.name.lstrip('/'))
if info.name.endswith('.dbg'):
import gzip
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'wb') as fh:
with gzip.GzipFile(fileobj=fh, mode='wb', compresslevel=5) as c:
shutil.copyfileobj(data, c)
jar.add(info.name + '.gz', File(path), compress=False)
elif info.name.endswith('.dSYM.tar'):
import bz2
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'wb') as fh:
c = bz2.BZ2Compressor()
while True:
buf = data.read(16384)
if not buf:
break
fh.write(c.compress(buf))
fh.write(c.flush())
jar.add(info.name + '.bz2', File(path), compress=False)
elif info.name.endswith('.pdb'):
import subprocess
makecab = os.environ.get('MAKECAB', 'makecab')
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, 'wb') as fh:
shutil.copyfileobj(data, fh)
subprocess.check_call(
[makecab, '-D', 'CompressionType=MSZIP', path, path + '_'],
stdout=subprocess.DEVNULL,
stderr=subprocess.STDOUT)
jar.add(info.name[:-1] + '_', File(path + '_'), compress=False)
else:
jar.add(info.name, data)
reader.close()
tmpdir = tempfile.TemporaryDirectory()
zip_path = os.path.join(tmpdir.name, 'symbols.zip')
log.info('Preparing symbol archive "{0}" from "{1}"'.format(zip_path, args.archive))
is_existing = False
try:
for i, _ in enumerate(redo.retrier(attempts=MAX_RETRIES), start=1):
with JarWriter(zip_path, compress_level=5) as jar:
try:
prepare_zip_from(args.archive, tmpdir.name)
is_existing = True
break
except requests.exceptions.RequestException as e:
log.error('Error: {0}'.format(e))
log.info('Retrying...')
except Exception:
os.remove(zip_path)
raise
elif args.archive.startswith('http'):
is_existing = check_file_exists(args.archive)
if args.zip.startswith('http'):
is_existing = check_file_exists(args.zip)
else:
is_existing = os.path.isfile(args.archive)
is_existing = os.path.isfile(args.zip)
if not is_existing:
if args.ignore_missing:
log.info('Archive file "{0}" does not exist!'.format(args.archive))
log.info('Zip file "{0}" does not exist!'.format(args.zip))
return 0
else:
log.error('Error: archive file "{0}" does not exist!'.format(args.archive))
log.error('Error: zip file "{0}" does not exist!'.format(args.zip))
return 1
secret_name = os.environ.get('SYMBOL_SECRET')
@ -198,15 +117,15 @@ def main():
else:
url = DEFAULT_URL
log.info('Uploading symbol file "{0}" to "{1}"'.format(zip_path, url))
log.info('Uploading symbol file "{0}" to "{1}"'.format(args.zip, url))
for i, _ in enumerate(redo.retrier(attempts=MAX_RETRIES), start=1):
log.info('Attempt %d of %d...' % (i, MAX_RETRIES))
try:
if zip_path.startswith('http'):
zip_arg = {'data': {'url': zip_path}}
if args.zip.startswith('http'):
zip_arg = {'data': {'url': args.zip}}
else:
zip_arg = {'files': {'symbols.zip': open(zip_path, 'rb')}}
zip_arg = {'files': {'symbols.zip': open(args.zip, 'rb')}}
r = requests.post(
url,
headers={'Auth-Token': auth_token},
@ -214,7 +133,7 @@ def main():
# Allow a longer read timeout because uploading by URL means the server
# has to fetch the entire zip file, which can take a while. The load balancer
# in front of symbols.mozilla.org has a 300 second timeout, so we'll use that.
timeout=(300, 300),
timeout=(10, 300),
**zip_arg)
# 429 or any 5XX is likely to be a transient failure.
# Break out for success or other error codes.

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

@ -60,9 +60,9 @@ ifdef MOZ_ARTIFACT_BUILD_SYMBOLS
cd $(DIST)/crashreporter-symbols && \
zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'
ifeq ($(MOZ_ARTIFACT_BUILD_SYMBOLS),full)
$(call py_action,symbols_archive,'../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst' \
$(abspath $(DIST)/crashreporter-symbols) \
--full-archive)
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
cd $(DIST)/crashreporter-symbols && \
zip -r5D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' .
endif
endif # MOZ_ARTIFACT_BUILD_SYMBOLS
endif # MOZ_AUTOMATION

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

@ -380,7 +380,7 @@ UPLOAD_FILES= \
$(call QUOTED_WILDCARD,$(MOZ_MOZINFO_FILE)) \
$(call QUOTED_WILDCARD,$(MOZ_TEST_PACKAGES_FILE)) \
$(call QUOTED_WILDCARD,$(PKG_JSSHELL)) \
$(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).tar.zst) \
$(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip) \
$(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup.exe) \
$(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup-stub.exe) \
$(call QUOTED_WILDCARD,$(topsrcdir)/toolchains.json) \