Commit 55cba131 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

cerbero: New command fetch-bootstrap

This fetches all network resources required for running bootstrap,
including build-tools recipe sources, toolchain binaries, etc.

https://bugzilla.gnome.org/show_bug.cgi?id=797316
parent 3996812e
......@@ -57,6 +57,10 @@ class BootstrapperBase (object):
self.sources[url] = source
source.fetch()
def fetch_recipes(self):
'Fetch build-tools recipes; only called by fetch-bootstrap'
pass
def extract(self):
for (url, unpack, unpack_dir) in self.extract_steps:
if unpack:
......
......@@ -22,11 +22,12 @@ from cerbero.config import Config, Platform, DistroVersion
from cerbero.bootstrap import BootstrapperBase
from cerbero.build.oven import Oven
from cerbero.build.cookbook import CookBook
from cerbero.commands.fetch import Fetch
from cerbero.utils import _
from cerbero.errors import FatalError, ConfigurationError
class BuildTools (BootstrapperBase):
class BuildTools (BootstrapperBase, Fetch):
BUILD_TOOLS = ['automake', 'autoconf', 'm4', 'gettext-tools', 'libtool',
'pkg-config', 'orc-tool', 'gettext-m4', 'meson']
......@@ -71,7 +72,6 @@ class BuildTools (BootstrapperBase):
self.BUILD_TOOLS.append('glib-tools')
self.BUILD_TOOLS += self.config.extra_build_tools
def start(self):
# Use a common prefix for the build tools for all the configurations
# so that it can be reused
config = Config()
......@@ -97,9 +97,14 @@ class BuildTools (BootstrapperBase):
os.makedirs(config.sources)
config.do_setup_env()
cookbook = CookBook(config, offline=self.offline)
recipes = self.BUILD_TOOLS
recipes += self.PLAT_BUILD_TOOLS.get(self.config.platform, [])
oven = Oven(recipes, cookbook)
self.cookbook = CookBook(config, offline=self.offline)
self.recipes = self.BUILD_TOOLS
self.recipes += self.PLAT_BUILD_TOOLS.get(self.config.platform, [])
def start(self):
oven = Oven(self.recipes, self.cookbook)
oven.start_cooking()
self.config.do_setup_env()
def fetch_recipes(self):
Fetch.fetch(self.cookbook, self.recipes, False, False, False, False)
......@@ -41,4 +41,22 @@ class Bootstrap(Command):
bootstrapper.extract()
bootstrapper.start()
class FetchBootstrap(Command):
doc = N_('Fetch the sources required for bootstrap')
name = 'fetch-bootstrap'
def __init__(self):
args = [
ArgparseArgument('--build-tools-only', action='store_true',
default=False, help=_('only fetch the build tools'))]
Command.__init__(self, args)
def run(self, config, args):
bootstrappers = Bootstrapper(config, args.build_tools_only, False)
for bootstrapper in bootstrappers:
bootstrapper.fetch_recipes()
bootstrapper.fetch()
register_command(Bootstrap)
register_command(FetchBootstrap)
......@@ -37,7 +37,8 @@ class Fetch(Command):
default=False, help=_('print all source URLs to stdout')))
Command.__init__(self, args)
def fetch(self, cookbook, recipes, no_deps, reset_rdeps, full_reset, print_only):
@staticmethod
def fetch(cookbook, recipes, no_deps, reset_rdeps, full_reset, print_only):
fetch_recipes = []
if not recipes:
fetch_recipes = cookbook.get_recipes_list()
......
Supports Markdown
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