Bug 1237182: remove mock(chroot) support r=Callek

--HG--
extra : source : 806b003761cee8d8f0bc1da6405caf8000708be9
extra : intermediate-source : bbf1842aa32ec180664a714e415775947e39849c
This commit is contained in:
Chris AtLee 2018-05-16 12:31:33 -04:00
Родитель 3892646752
Коммит abedb6c83d
22 изменённых файлов: 4 добавлений и 593 удалений

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

@ -97,7 +97,6 @@ fi
cd /builds/worker
python2.7 $WORKSPACE/build/src/testing/${MOZHARNESS_SCRIPT} \
--disable-mock \
$actions \
$options \
${config_path_cmds} \

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

@ -28,15 +28,6 @@ config = {
'arch': 'aarch64',
# https://dxr.mozilla.org/mozilla-central/rev/5322c03f4c8587fe526172d3f87160031faa6d75/mobile/android/config/mozconfigs/android-aarch64/nightly#6
'min_sdk': 21,
'use_mock': True,
'mock_target': 'mozilla-centos6-x86_64',
'mock_packages': ['make', 'git', 'nasm', 'glibc-devel.i686',
'libstdc++-devel.i686', 'zip', 'yasm',
'mozilla-python27'],
'mock_files': [
('/home/cltbld/.ssh', '/home/mock_mozilla/.ssh'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
],
'operating_system': 'android',
'partial_env': {
'PATH': '%(abs_work_dir)s/android-sdk-linux/tools:%(PATH)s',

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

@ -28,15 +28,6 @@ config = {
'arch': 'arm',
# https://dxr.mozilla.org/mozilla-central/rev/5322c03f4c8587fe526172d3f87160031faa6d75/mobile/android/config/mozconfigs/android-api-15/nightly#6
'min_sdk': 16,
'use_mock': True,
'mock_target': 'mozilla-centos6-x86_64',
'mock_packages': ['make', 'git', 'nasm', 'glibc-devel.i686',
'libstdc++-devel.i686', 'zip', 'yasm',
'mozilla-python27'],
'mock_files': [
('/home/cltbld/.ssh', '/home/mock_mozilla/.ssh'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
],
'operating_system': 'android',
'partial_env': {
'PATH': '%(abs_work_dir)s/android-sdk-linux/tools:%(PATH)s',

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

@ -29,15 +29,6 @@ config = {
'arch': 'x86',
# https://dxr.mozilla.org/mozilla-central/rev/5322c03f4c8587fe526172d3f87160031faa6d75/mobile/android/config/mozconfigs/android-x86/nightly#4
'min_sdk': 16,
'use_mock': True,
'mock_target': 'mozilla-centos6-x86_64',
'mock_packages': ['make', 'git', 'nasm', 'glibc-devel.i686',
'libstdc++-devel.i686', 'zip', 'yasm',
'mozilla-python27'],
'mock_files': [
('/home/cltbld/.ssh', '/home/mock_mozilla/.ssh'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
],
'operating_system': 'android',
'partial_env': {
'PATH': '%(abs_work_dir)s/android-sdk-linux/tools:%(PATH)s',

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

@ -16,15 +16,6 @@ config = {
},
'dump_syms_binary': 'dump_syms',
'arch': 'x86',
'use_mock': True,
'avoid_avx2': True,
'mock_target': 'mozilla-centos6-x86_64',
'mock_packages': ['make', 'git', 'nasm', 'glibc-devel.i686',
'libstdc++-devel.i686', 'zip', 'yasm',
'mozilla-python27'],
'mock_files': [
('/home/cltbld/.ssh', '/home/mock_mozilla/.ssh'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
],
'operating_system': 'linux',
}

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

@ -16,15 +16,6 @@ config = {
},
'dump_syms_binary': 'dump_syms',
'arch': 'x64',
'use_mock': True,
'avoid_avx2': True,
'mock_target': 'mozilla-centos6-x86_64',
'mock_packages': ['make', 'git', 'nasm', 'glibc-devel.i686',
'libstdc++-devel.i686', 'zip', 'yasm',
'mozilla-python27'],
'mock_files': [
('/home/cltbld/.ssh', '/home/mock_mozilla/.ssh'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
],
'operating_system': 'linux',
}

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

@ -53,33 +53,4 @@ config = {
# Balrog
"build_target": "Android_arm-eabi-gcc3",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
}

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

@ -50,33 +50,4 @@ config = {
# Balrog
"build_target": "Android_arm-eabi-gcc3",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
}

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

@ -51,33 +51,4 @@ config = {
# Balrog
"build_target": "Android_arm-eabi-gcc3",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
}

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

@ -57,33 +57,4 @@ config = {
# Balrog
"build_target": "Android_arm-eabi-gcc3",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
}

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

@ -50,34 +50,4 @@ config = {
"upload_branch": "%s-android-api-16" % BRANCH,
"signature_verification_script": "tools/release/signing/verify-android-signature.sh",
"key_alias": "release",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
('/builds/mozilla-fennec-geoloc-api.key', '/builds/mozilla-fennec-geoloc-api.key'),
('/builds/adjust-sdk-beta.token', '/builds/adjust-sdk-beta.token'),
],
}

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

@ -57,33 +57,4 @@ config = {
# Balrog
"build_target": "Android_arm-eabi-gcc3",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
}

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

@ -50,34 +50,4 @@ config = {
"upload_branch": "%s-android-api-16" % BRANCH,
"signature_verification_script": "tools/release/signing/verify-android-signature.sh",
"key_alias": "release",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
('/builds/mozilla-fennec-geoloc-api.key', '/builds/mozilla-fennec-geoloc-api.key'),
('/builds/adjust-sdk.token', '/builds/adjust-sdk.token'),
],
}

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

@ -54,33 +54,4 @@ config = {
# Balrog
"build_target": "Android_arm-eabi-gcc3",
# Mock
"mock_target": "mozilla-centos6-x86_64-android",
"mock_packages": ['autoconf213', 'python', 'zip', 'mozilla-python27-mercurial', 'git', 'ccache',
'glibc-static', 'libstdc++-static', 'perl-Test-Simple', 'perl-Config-General',
'gtk2-devel', 'libnotify-devel', 'yasm',
'alsa-lib-devel', 'libcurl-devel',
'wireless-tools-devel', 'libX11-devel',
'libXt-devel', 'mesa-libGL-devel',
'gnome-vfs2-devel', 'GConf2-devel', 'wget',
'mpfr', # required for system compiler
'xorg-x11-font*', # fonts required for PGO
'imake', # required for makedepend!?!
'gcc45_0moz3', 'gcc454_0moz1', 'gcc472_0moz1', 'gcc473_0moz1', 'yasm', 'ccache', # <-- from releng repo
'valgrind', 'dbus-x11',
'pulseaudio-libs-devel',
'gstreamer-devel', 'gstreamer-plugins-base-devel',
'freetype-2.3.11-6.el6_1.8.x86_64',
'freetype-devel-2.3.11-6.el6_1.8.x86_64',
'java-1.7.0-openjdk-devel',
'openssh-clients',
'zlib-devel-1.2.3-27.el6.i686',
],
"mock_files": [
("/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
}

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

@ -1,3 +0,0 @@
config = {
"mock_target": "mozilla-centos6-x86_64",
}

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

@ -37,14 +37,6 @@ mozharness.mozilla.mapper module
:undoc-members:
:show-inheritance:
mozharness.mozilla.mock module
------------------------------
.. automodule:: mozharness.mozilla.mock
:members:
:undoc-members:
:show-inheritance:
mozharness.mozilla.mozbase module
---------------------------------

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

@ -1,251 +0,0 @@
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# ***** END LICENSE BLOCK *****
"""Code to integrate with mock
"""
import os.path
import hashlib
import subprocess
import os
ERROR_MSGS = {
'undetermined_buildroot_lock': 'buildroot_lock_path does not exist.\
Nothing to remove.'
}
# MockMixin {{{1
class MockMixin(object):
"""Provides methods to setup and interact with mock environments.
https://wiki.mozilla.org/ReleaseEngineering/Applications/Mock
This is dependent on ScriptMixin
"""
done_mock_setup = False
mock_enabled = False
default_mock_target = None
def init_mock(self, mock_target):
"Initialize mock environment defined by `mock_target`"
cmd = ['mock_mozilla', '-r', mock_target, '--init']
return super(MockMixin, self).run_command(cmd, halt_on_failure=True,
fatal_exit_code=3)
def install_mock_packages(self, mock_target, packages):
"Install `packages` into mock environment `mock_target`"
cmd = ['mock_mozilla', '-r', mock_target, '--install'] + packages
# TODO: parse output to see if packages actually were installed
return super(MockMixin, self).run_command(cmd, halt_on_failure=True,
fatal_exit_code=3)
def delete_mock_files(self, mock_target, files):
"""Delete files from the mock environment `mock_target`. `files` should
be an iterable of 2-tuples: (src, dst). Only the dst component is
deleted."""
cmd_base = ['mock_mozilla', '-r', mock_target, '--shell']
for src, dest in files:
cmd = cmd_base + ['rm -rf %s' % dest]
super(MockMixin, self).run_command(cmd, halt_on_failure=True,
fatal_exit_code=3)
def copy_mock_files(self, mock_target, files):
"""Copy files into the mock environment `mock_target`. `files` should
be an iterable of 2-tuples: (src, dst)"""
cmd_base = ['mock_mozilla', '-r', mock_target, '--copyin', '--unpriv']
for src, dest in files:
cmd = cmd_base + [src, dest]
super(MockMixin, self).run_command(cmd, halt_on_failure=True,
fatal_exit_code=3)
super(MockMixin, self).run_command(
['mock_mozilla', '-r', mock_target, '--shell',
'chown -R mock_mozilla %s' % dest],
halt_on_failure=True,
fatal_exit_code=3)
def get_mock_target(self):
if self.config.get('disable_mock'):
return None
return self.default_mock_target or self.config.get('mock_target')
def enable_mock(self):
"""Wrap self.run_command and self.get_output_from_command to run inside
the mock environment given by self.config['mock_target']"""
if not self.get_mock_target():
return
self.mock_enabled = True
self.run_command = self.run_command_m
self.get_output_from_command = self.get_output_from_command_m
def disable_mock(self):
"""Restore self.run_command and self.get_output_from_command to their
original versions. This is the opposite of self.enable_mock()"""
if not self.get_mock_target():
return
self.mock_enabled = False
self.run_command = super(MockMixin, self).run_command
self.get_output_from_command = super(MockMixin, self).get_output_from_command
def _do_mock_command(self, func, mock_target, command, cwd=None, env=None, **kwargs):
"""Internal helper for preparing commands to run under mock. Used by
run_mock_command and get_mock_output_from_command."""
cmd = ['mock_mozilla', '-r', mock_target, '-q']
if cwd:
cmd += ['--cwd', cwd]
if not kwargs.get('privileged'):
cmd += ['--unpriv']
cmd += ['--shell']
if not isinstance(command, basestring):
command = subprocess.list2cmdline(command)
# XXX - Hack - gets around AB_CD=%(locale)s type arguments
command = command.replace("(", "\\(")
command = command.replace(")", "\\)")
if env:
env_cmd = ['/usr/bin/env']
for key, value in env.items():
# $HOME won't work inside the mock chroot
if key == 'HOME':
continue
value = value.replace(";", "\\;")
env_cmd += ['%s=%s' % (key, value)]
cmd.append(subprocess.list2cmdline(env_cmd) + " " + command)
else:
cmd.append(command)
return func(cmd, cwd=cwd, **kwargs)
def run_mock_command(self, mock_target, command, cwd=None, env=None, **kwargs):
"""Same as ScriptMixin.run_command, except runs command inside mock
environment `mock_target`."""
return self._do_mock_command(
super(MockMixin, self).run_command,
mock_target, command, cwd, env, **kwargs)
def get_mock_output_from_command(self, mock_target, command, cwd=None, env=None, **kwargs):
"""Same as ScriptMixin.get_output_from_command, except runs command
inside mock environment `mock_target`."""
return self._do_mock_command(
super(MockMixin, self).get_output_from_command,
mock_target, command, cwd, env, **kwargs)
def reset_mock(self, mock_target=None):
"""rm mock lock and reset"""
c = self.config
if mock_target is None:
if not c.get('mock_target'):
self.fatal("Cound not determine: 'mock_target'")
mock_target = c.get('mock_target')
buildroot_lock_path = os.path.join(c.get('mock_mozilla_dir', ''),
mock_target,
'buildroot.lock')
self.info("Removing buildroot lock at path if exists:O")
self.info(buildroot_lock_path)
if not os.path.exists(buildroot_lock_path):
self.info(ERROR_MSGS['undetermined_buildroot_lock'])
else:
rm_lock_cmd = ['rm', '-f', buildroot_lock_path]
super(MockMixin, self).run_command(rm_lock_cmd,
halt_on_failure=True,
fatal_exit_code=3)
cmd = ['mock_mozilla', '-r', mock_target, '--orphanskill']
return super(MockMixin, self).run_command(cmd, halt_on_failure=True,
fatal_exit_code=3)
def setup_mock(self, mock_target=None, mock_packages=None, mock_files=None):
"""Initializes and installs packages, copies files into mock
environment given by configuration in self.config. The mock
environment is given by self.config['mock_target'], the list of packges
to install given by self.config['mock_packages'], and the list of files
to copy in is self.config['mock_files']."""
if self.done_mock_setup or self.config.get('disable_mock'):
return
c = self.config
if mock_target is None:
assert 'mock_target' in c
t = c['mock_target']
else:
t = mock_target
self.default_mock_target = t
# Don't re-initialize mock if we're using the same packages as before
# Put the cache inside the mock root so that if somebody else resets
# the environment, it invalidates the cache
mock_root = super(MockMixin, self).get_output_from_command(
['mock_mozilla', '-r', t, '--print-root-path']
)
package_hash_file = os.path.join(mock_root, "builds/package_list.hash")
if os.path.exists(package_hash_file):
old_packages_hash = self.read_from_file(package_hash_file)
self.info("old package hash: %s" % old_packages_hash)
else:
self.info("no previous package list found")
old_packages_hash = None
if mock_packages is None:
mock_packages = list(c.get('mock_packages'))
package_list_hash = hashlib.new('sha1')
if mock_packages:
for p in sorted(mock_packages):
package_list_hash.update(p)
package_list_hash = package_list_hash.hexdigest()
did_init = True
# This simple hash comparison doesn't take into account depedency
# changes. If you really care about dependencies, then they should be
# explicitly listed in the package list.
if old_packages_hash != package_list_hash:
self.init_mock(t)
else:
self.info("Our list of packages hasn't changed; skipping re-initialization")
did_init = False
# Still try and install packages here since the package version may
# have been updated on the server
if mock_packages:
self.install_mock_packages(t, mock_packages)
# Save our list of packages
self.write_to_file(package_hash_file,
package_list_hash)
if mock_files is None:
mock_files = list(c.get('mock_files'))
if mock_files:
if not did_init:
# mock complains if you try and copy in files that already
# exist, so we need to delete them here first
self.info("Deleting old mock files")
self.delete_mock_files(t, mock_files)
self.copy_mock_files(t, mock_files)
self.done_mock_setup = True
def run_command_m(self, *args, **kwargs):
"""Executes self.run_mock_command if we have a mock target set,
otherwise executes self.run_command."""
mock_target = self.get_mock_target()
if mock_target:
self.setup_mock()
return self.run_mock_command(mock_target, *args, **kwargs)
else:
return super(MockMixin, self).run_command(*args, **kwargs)
def get_output_from_command_m(self, *args, **kwargs):
"""Executes self.get_mock_output_from_command if we have a mock target
set, otherwise executes self.get_output_from_command."""
mock_target = self.get_mock_target()
if mock_target:
self.setup_mock()
return self.get_mock_output_from_command(mock_target, *args, **kwargs)
else:
return super(MockMixin, self).get_output_from_command(*args, **kwargs)

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

@ -92,18 +92,11 @@ class TooltoolMixin(object):
toolchains = os.environ.get('MOZ_TOOLCHAINS')
if toolchains:
cmd.extend(toolchains.split())
# when mock is enabled run tooltool in mock. We can't use
# run_command_m in all cases because it won't exist unless
# MockMixin is used on the parent class
if self.config.get('mock_target'):
cmd_runner = self.run_command_m
else:
cmd_runner = self.run_command
timeout = self.config.get('tooltool_timeout', 10 * 60)
self.retry(
cmd_runner,
self.run_command,
args=(cmd, ),
kwargs={'cwd': output_dir,
'error_list': TooltoolErrorList,

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

@ -8,12 +8,7 @@ from mozharness.base.log import INFO
class BalrogMixin(object):
def query_python(self):
python = sys.executable
# A mock environment is a special case, the system python isn't
# available there
if 'mock_target' in self.config:
python = 'python2.7'
return python
return sys.executable
def generate_balrog_props(self, props_path):
balrog_props = {}

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

@ -149,11 +149,6 @@ class DesktopSingleLocale(LocalesMixin, ReleaseMixin, BuildbotMixin,
"dest": "en_us_installer_url",
"type": "string",
"help": "Specify the url of the en-us binary"}
], [
["--disable-mock"], {
"dest": "disable_mock",
"action": "store_true",
"help": "(deprecated) no-op for CLI compatability with mobile_l10n.py"}
], [
['--scm-level'], { # Ignored on desktop for now: see Bug 1414678.
"action": "store",

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

@ -33,14 +33,13 @@ from mozharness.mozilla.release import ReleaseMixin
from mozharness.mozilla.tooltool import TooltoolMixin
from mozharness.base.vcs.vcsbase import MercurialScript
from mozharness.mozilla.l10n.locales import LocalesMixin
from mozharness.mozilla.mock import MockMixin
from mozharness.mozilla.secrets import SecretsMixin
from mozharness.mozilla.updates.balrog import BalrogMixin
from mozharness.base.python import VirtualenvMixin
# MobileSingleLocale {{{1
class MobileSingleLocale(MockMixin, LocalesMixin, ReleaseMixin,
class MobileSingleLocale(LocalesMixin, ReleaseMixin,
TransferMixin, TooltoolMixin, BuildbotMixin,
PurgeMixin, MercurialScript, BalrogMixin,
VirtualenvMixin, SecretsMixin):
@ -102,12 +101,6 @@ class MobileSingleLocale(MockMixin, LocalesMixin, ReleaseMixin,
"type": "int",
"help": "Specify the total number of chunks of locales"
}
], [
["--disable-mock"],
{"dest": "disable_mock",
"action": "store_true",
"help": "do not run under mock despite what gecko-config says",
}
], [
['--revision', ],
{"action": "store",
@ -505,16 +498,12 @@ class MobileSingleLocale(MockMixin, LocalesMixin, ReleaseMixin,
total_count += 1
signed_path = os.path.join(base_package_dir,
base_package_name % {'locale': locale})
# We need to wrap what this function does with mock, since
# MobileSigningMixin doesn't know about mock
self.enable_mock()
status = self.verify_android_signature(
signed_path,
script=c['signature_verification_script'],
env=repack_env,
key_alias=c['key_alias'],
)
self.disable_mock()
if status:
self.add_failure(locale, message="Errors verifying %s binary!" % locale)
# No need to rm because upload is per-locale

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

@ -17,7 +17,6 @@ import mozharness
from mozharness.base.vcs.vcsbase import VCSScript
from mozharness.base.log import ERROR
from mozharness.base.transfer import TransferMixin
from mozharness.mozilla.mock import MockMixin
from mozharness.mozilla.tooltool import TooltoolMixin
@ -27,7 +26,7 @@ external_tools_path = os.path.join(
)
class OpenH264Build(MockMixin, TransferMixin, VCSScript, TooltoolMixin):
class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin):
all_actions = [
'clobber',
'get-tooltool',
@ -73,12 +72,6 @@ class OpenH264Build(MockMixin, TransferMixin, VCSScript, TooltoolMixin):
"dest": "operating_system",
"help": "Specify the operating system to build for",
}],
[["--use-mock"], {
"dest": "use_mock",
"help": "use mock to set up build environment",
"action": "store_true",
"default": False,
}],
[["--use-yasm"], {
"dest": "use_yasm",
"help": "use yasm instead of nasm",
@ -117,10 +110,6 @@ class OpenH264Build(MockMixin, TransferMixin, VCSScript, TooltoolMixin):
default_actions=default_actions,
)
if self.config['use_mock']:
self.setup_mock()
self.enable_mock()
def get_tooltool(self):
c = self.config
if not c.get('tooltool_manifest_file'):
@ -309,15 +298,9 @@ class OpenH264Build(MockMixin, TransferMixin, VCSScript, TooltoolMixin):
cmd = [python, os.path.join(external_tools_path, 'packagesymbols.py'),
'--symbol-zip', symbol_zip_path,
dump_syms, os.path.join(srcdir, package_name)]
if self.config['use_mock']:
self.disable_mock()
self.run_command(cmd, **kwargs)
if self.config['use_mock']:
self.enable_mock()
def upload(self):
if self.config['use_mock']:
self.disable_mock()
dirs = self.query_abs_dirs()
self.scp_upload_directory(
dirs['abs_upload_dir'],
@ -326,8 +309,6 @@ class OpenH264Build(MockMixin, TransferMixin, VCSScript, TooltoolMixin):
self.query_upload_ssh_host(),
self.query_upload_ssh_path(),
)
if self.config['use_mock']:
self.enable_mock()
def test(self):
retval = self.run_make('test')