From 912490c0268815a32526fde9919e3af30013a69a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 15 Jun 2019 14:34:45 +0200 Subject: [PATCH] Add GLUON_DEPRECATED flag This new build flag is mandatory for now (it may default to 0 in a future Gluon version). It may be set to the following values: * 0 - Do not build any images for deprecated devices. * upgrade - Only build sysupgrade images for deprecated devices. * full - Build both sysupgrade and factory images for deprecated devices. "Other" images are handled like factory images, as they are also used for the initial installation of Gluon on a device. --- Makefile | 4 ++- docs/multidomain-site-example/site.mk | 3 ++ docs/site-example/site.mk | 3 ++ docs/user/getting_started.rst | 13 +++++++++ docs/user/site.rst | 13 +++++++++ scripts/common.inc.lua | 40 +++++++++++++++++++-------- 6 files changed, 63 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 13c62a71..6d95a398 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,8 @@ include $(GLUON_SITEDIR)/site.mk GLUON_RELEASE ?= $(error GLUON_RELEASE not set. GLUON_RELEASE can be set in site.mk or on the command line) +GLUON_DEPRECATED ?= $(error GLUON_DEPRECATED not set. Please consult the documentation) + # initialize (possibly already user set) directory variables GLUON_TMPDIR ?= tmp GLUON_OUTPUTDIR ?= output @@ -41,7 +43,7 @@ GLUON_MULTIDOMAIN ?= 0 GLUON_WLAN_MESH ?= 11s GLUON_DEBUG ?= 0 -export GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_WLAN_MESH GLUON_DEBUG GLUON_DEVICES \ +export GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_WLAN_MESH GLUON_DEBUG GLUON_DEPRECATED GLUON_DEVICES \ GLUON_TARGETSDIR GLUON_PATCHESDIR GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR show-release: diff --git a/docs/multidomain-site-example/site.mk b/docs/multidomain-site-example/site.mk index 7485ef17..a268fd48 100644 --- a/docs/multidomain-site-example/site.mk +++ b/docs/multidomain-site-example/site.mk @@ -59,3 +59,6 @@ GLUON_REGION ?= eu # Languages to include GLUON_LANGS ?= en de + +# Do not build images for deprecated devices +GLUON_DEPRECATED ?= 0 diff --git a/docs/site-example/site.mk b/docs/site-example/site.mk index c3967909..f8f84f97 100644 --- a/docs/site-example/site.mk +++ b/docs/site-example/site.mk @@ -53,3 +53,6 @@ GLUON_REGION ?= eu # Languages to include GLUON_LANGS ?= en de + +# Do not build images for deprecated devices +GLUON_DEPRECATED ?= 0 diff --git a/docs/user/getting_started.rst b/docs/user/getting_started.rst index 5e71f361..2b76bc81 100644 --- a/docs/user/getting_started.rst +++ b/docs/user/getting_started.rst @@ -161,6 +161,19 @@ GLUON_BRANCH by default. For the ``make manifest`` command, GLUON_BRANCH defines the branch to generate a manifest for. +GLUON_DEPRECATED + Controls whether images for deprecated devices should be built. The following + values are supported: + + - ``0``: Do not build any images for deprecated devices. + - ``upgrade``: Only build sysupgrade images for deprecated devices. + - ``full``: Build both sysupgrade and factory images for deprecated devices. + + Usually, devices are deprecated because their flash size is insufficient to + support future Gluon versions. The recommended setting is ``0`` for new sites, + and ``upgrade`` for existing configurations (where upgrades for existing + deployments of low-flash devices are required). + GLUON_LANGS Space-separated list of languages to include for the config mode/advanced settings. Defaults to ``en``. ``en`` should always be included, other supported languages are ``de`` and ``fr``. diff --git a/docs/user/site.rst b/docs/user/site.rst index b1549b23..13a78dbc 100644 --- a/docs/user/site.rst +++ b/docs/user/site.rst @@ -514,6 +514,19 @@ Build configuration The ``site.mk`` is a Makefile which defines various values involved in the build process of Gluon. +GLUON_DEPRECATED + Controls whether images for deprecated devices should be built. The following + values are supported: + + - ``0``: Do not build any images for deprecated devices. + - ``upgrade``: Only build sysupgrade images for deprecated devices. + - ``full``: Build both sysupgrade and factory images for deprecated devices. + + Usually, devices are deprecated because their flash size is insufficient to + support future Gluon versions. The recommended setting is ``0`` for new sites, + and ``upgrade`` for existing configurations (where upgrades for existing + deployments of low-flash devices are required). + GLUON_FEATURES Defines a list of features to include. The feature list is used to generate the default package set. diff --git a/scripts/common.inc.lua b/scripts/common.inc.lua index 0e365b36..0ec5a756 100644 --- a/scripts/common.inc.lua +++ b/scripts/common.inc.lua @@ -8,6 +8,7 @@ envtrue = setmetatable({}, { assert(env.GLUON_SITEDIR) assert(env.GLUON_TARGETSDIR) assert(env.GLUON_RELEASE) +assert(env.GLUON_DEPRECATED) site_code = assert(assert(dofile('scripts/site_config.lua')('site.conf')).site_code) @@ -25,6 +26,7 @@ local default_options = { aliases = {}, manifest_aliases = {}, packages = {}, + deprecated = false, broken = false, } @@ -39,6 +41,9 @@ local function want_device(dev, options) if options.broken and not envtrue.BROKEN then return false end + if options.deprecated and env.GLUON_DEPRECATED == '0' then + return false + end if (env.GLUON_DEVICES or '') == '' then return true @@ -48,6 +53,8 @@ local function want_device(dev, options) return gluon_devices[dev] end +local full_deprecated = env.GLUON_DEPRECATED == 'full' + local function merge(a, b) local ret = {} @@ -148,18 +155,6 @@ function device(image, name, options) options = options, }) - if options.factory then - add_image { - image = image, - name = name, - subdir = 'factory', - in_suffix = options.factory, - out_suffix = '', - extension = options.factory_ext, - aliases = options.aliases, - manifest_aliases = options.manifest_aliases, - } - end if options.sysupgrade then add_image { image = image, @@ -172,6 +167,23 @@ function device(image, name, options) manifest_aliases = options.manifest_aliases, } end + + if options.deprecated and not full_deprecated then + return + end + + if options.factory then + add_image { + image = image, + name = name, + subdir = 'factory', + in_suffix = options.factory, + out_suffix = '', + extension = options.factory_ext, + aliases = options.aliases, + manifest_aliases = options.manifest_aliases, + } + end for _, extra_image in ipairs(options.extra_images) do add_image { image = image, @@ -193,6 +205,10 @@ function factory_image(image, name, ext, options) return end + if options.deprecated and not full_deprecated then + return + end + add_image { image = image, name = name,