From 8fcd8c165c1818fce854db44b7b796bb6d139d0f Mon Sep 17 00:00:00 2001
From: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
Date: Mon, 15 Mar 2021 10:36:20 +0100
Subject: [PATCH] flavours: Use OSTC download and sstate-cache by default

OSTC now publishes a complete sstate-cache and download cache for
a set of builds and configurations. Using those caches can dramatically
speed up setting up the development environment by avoiding huge source
downloads (about 12GB at the time of this writing) and virtually all of
the compilation (close to an hour on a 6 core 8th gen Intel mobile CPU)
at the cost of miniscule sstate cache download (on the order of one
gigabyte).

The setting is added at the bottom of local.conf, where it is easier to
spot and disable, if desired.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@huawei.com>
---
 flavours/freertos/local.conf.sample | 7 +++++++
 flavours/linux/local.conf.sample    | 7 +++++++
 flavours/zephyr/local.conf.sample   | 7 +++++++
 3 files changed, 21 insertions(+)

diff --git a/flavours/freertos/local.conf.sample b/flavours/freertos/local.conf.sample
index ec868437..66da7d80 100644
--- a/flavours/freertos/local.conf.sample
+++ b/flavours/freertos/local.conf.sample
@@ -69,3 +69,10 @@ EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
 # track the version of this file when it was generated. This can safely be ignored if
 # this doesn't mean anything to you.
 CONF_VERSION = "1"
+
+# Use OSTC download and sstate-cache by default. You can comment out or remove
+# those lines and use the defaults from Poky. Note that this cache is limited
+# to system configurations that are entirely re-distributable.
+INHERIT += "own-mirrors"
+SOURCE_MIRROR_URL = "https://cache.ostc-eu.org/bitbake/downloads"
+SSTATE_MIRRORS = "file://.* https://cache.ostc-eu.org/bitbake/sstate-cache/PATH;downloadfilename=PATH \n"
diff --git a/flavours/linux/local.conf.sample b/flavours/linux/local.conf.sample
index 1b79cbce..7ce5c173 100644
--- a/flavours/linux/local.conf.sample
+++ b/flavours/linux/local.conf.sample
@@ -246,3 +246,10 @@ PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
 # track the version of this file when it was generated. This can safely be ignored if
 # this doesn't mean anything to you.
 CONF_VERSION = "1"
+
+# Use OSTC download and sstate-cache by default. You can comment out or remove
+# those lines and use the defaults from Poky. Note that this cache is limited
+# to system configurations that are entirely re-distributable.
+INHERIT += "own-mirrors"
+SOURCE_MIRROR_URL = "https://cache.ostc-eu.org/bitbake/downloads"
+SSTATE_MIRRORS = "file://.* https://cache.ostc-eu.org/bitbake/sstate-cache/PATH;downloadfilename=PATH \n"
diff --git a/flavours/zephyr/local.conf.sample b/flavours/zephyr/local.conf.sample
index 81dbd652..43fd927b 100644
--- a/flavours/zephyr/local.conf.sample
+++ b/flavours/zephyr/local.conf.sample
@@ -247,3 +247,10 @@ PACKAGECONFIG_append_pn-qemu-system-native = " sdl"
 # track the version of this file when it was generated. This can safely be ignored if
 # this doesn't mean anything to you.
 CONF_VERSION = "1"
+
+# Use OSTC download and sstate-cache by default. You can comment out or remove
+# those lines and use the defaults from Poky. Note that this cache is limited
+# to system configurations that are entirely re-distributable.
+INHERIT += "own-mirrors"
+SOURCE_MIRROR_URL = "https://cache.ostc-eu.org/bitbake/downloads"
+SSTATE_MIRRORS = "file://.* https://cache.ostc-eu.org/bitbake/sstate-cache/PATH;downloadfilename=PATH \n"
-- 
GitLab