Commit ded0eb57 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan

cerbero: Add new option --offline to bootstrap

It hasn't been hooked up everywhere yet, the next commits will do that

https://bugzilla.gnome.org/show_bug.cgi?id=797316
parent 5aa23032
......@@ -19,8 +19,9 @@
class BootstrapperBase (object):
def __init__(self, config):
def __init__(self, config, offline):
self.config = config
self.offline = offline
def start(self):
raise NotImplemented("'start' must be implemented by subclasses")
......@@ -34,10 +34,10 @@ def register_bootstrapper(distro, klass, distro_version=None):
class Bootstrapper (object):
def __new__(klass, config, build_tools_only):
def __new__(klass, config, build_tools_only, offline):
bs = []
bs.append(BuildTools(config))
bs.append(BuildTools(config, offline))
if build_tools_only:
return bs
......@@ -66,7 +66,7 @@ class Bootstrapper (object):
m.warning(_("No bootstrapper for the distro version %s" % v))
v = None
bs.insert(0, bootstrappers[d][v](config))
bs.insert(0, bootstrappers[d][v](config, offline))
return bs
......
......@@ -36,8 +36,8 @@ class BuildTools (BootstrapperBase):
Platform.LINUX: ['intltool-m4'],
}
def __init__(self, config):
BootstrapperBase.__init__(self, config)
def __init__(self, config, offline):
BootstrapperBase.__init__(self, config, offline)
# if cross-compiling or not on linux, make sure we have gtk-doc
if self.config.target_platform != Platform.LINUX or\
......@@ -97,7 +97,7 @@ class BuildTools (BootstrapperBase):
os.makedirs(config.sources)
config.do_setup_env()
cookbook = CookBook(config)
cookbook = CookBook(config, offline=self.offline)
recipes = self.BUILD_TOOLS
recipes += self.PLAT_BUILD_TOOLS.get(self.config.platform, [])
oven = Oven(recipes, cookbook)
......
......@@ -70,8 +70,8 @@ class DebianBootstrapper (UnixBootstrapper):
DistroVersion.UBUNTU_PRECISE: ['libgdk-pixbuf2.0-dev'],
}
def __init__(self, config):
UnixBootstrapper.__init__(self, config)
def __init__(self, config, offline):
UnixBootstrapper.__init__(self, config, offline)
if self.config.target_platform == Platform.WINDOWS:
self.packages.append('mingw-w64-tools')
if self.config.arch == Architecture.X86_64:
......@@ -117,8 +117,8 @@ class RedHatBootstrapper (UnixBootstrapper):
'libXtst-devel', 'git', 'subversion', 'xorg-x11-util-macros',
'mesa-libEGL-devel']
def __init__(self, config):
UnixBootstrapper.__init__(self, config)
def __init__(self, config, offline):
UnixBootstrapper.__init__(self, config, offline)
if self.config.distro_version in [DistroVersion.FEDORA_23, DistroVersion.FEDORA_24, DistroVersion.FEDORA_25]:
self.tool = 'dnf install %s'
else:
......@@ -163,8 +163,8 @@ class ArchBootstrapper (UnixBootstrapper):
'libxv', 'mesa', 'python3', 'wget', 'glib-networking', 'git',
'subversion', 'xorg-util-macros']
def __init__(self, config):
UnixBootstrapper.__init__(self, config)
def __init__(self, config, offline):
UnixBootstrapper.__init__(self, config, offline)
has_multilib = True
try:
......
......@@ -49,11 +49,8 @@ class WindowsBootstrapper(BootstrapperBase):
Installs the mingw-w64 compiler toolchain and headers for Directx
'''
def start(self):
if not git.check_line_endings(self.config.platform):
raise ConfigurationError("git is configured to use automatic line "
"endings conversion. You can fix it running:\n"
"$git config core.autocrlf false")
def __init__(self, config, offline):
super().__init__(config, offline)
self.prefix = self.config.toolchain_prefix
self.perl_prefix = self.config.mingw_perl_prefix
self.platform = self.config.target_platform
......@@ -64,6 +61,11 @@ class WindowsBootstrapper(BootstrapperBase):
self.version = 'w64'
self.platform = self.config.platform
def start(self):
if not git.check_line_endings(self.config.platform):
raise ConfigurationError("git is configured to use automatic line "
"endings conversion. You can fix it running:\n"
"$git config core.autocrlf false")
self.check_dirs()
if self.platform == Platform.WINDOWS:
self.msys_mingw_bindir = Path(shutil.which('mingw-get')).parent
......
......@@ -29,11 +29,13 @@ class Bootstrap(Command):
def __init__(self):
args = [
ArgparseArgument('--build-tools-only', action='store_true',
default=False, help=_('only bootstrap the build tools'))]
default=False, help=_('only bootstrap the build tools')),
ArgparseArgument('--offline', action='store_true',
default=False, help=_('Use only the source cache, no network'))]
Command.__init__(self, args)
def run(self, config, args):
bootstrappers = Bootstrapper(config, args.build_tools_only)
bootstrappers = Bootstrapper(config, args.build_tools_only, args.offline)
for bootstrapper in bootstrappers:
bootstrapper.start()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment