From patchwork Mon Mar 21 17:44:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5605 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F3D3C433F5 for ; Mon, 21 Mar 2022 17:45:00 +0000 (UTC) Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by mx.groups.io with SMTP id smtpd.web11.407.1647884699638747632 for ; Mon, 21 Mar 2022 10:45:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=SBrDughF; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.43, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f43.google.com with SMTP id v130-20020a1cac88000000b00389d0a5c511so10756931wme.5 for ; Mon, 21 Mar 2022 10:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CriO/sR6hzpM4byIuas8y8lOFmJUzCjrOgVBEi3RC4I=; b=SBrDughF5pNxJ4ZQMPVjGT01qjqmMxfgj12k8JYuBR6lGvZTFtovR6iUT+g9zuFOrz AndTRTD9qFhgt6VYThNDXZBL2Wo+JoJ2rXP86bgIKjgjlUc1K8IonBPINFLlFR8KLNe0 /msyuCj4bJOB0wl72lQdCA5PtI7d6Gqn2o5T8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CriO/sR6hzpM4byIuas8y8lOFmJUzCjrOgVBEi3RC4I=; b=aSw7Mrbgyrf69NI8GsDkHvfbYHaNC/AWU6iRkseVW3Qw6zUX6QZMP2y4g5TqLxQ4qz cNSYQjRxEcSboY+tZh3uz9fy02D57GcLvgMoIqIe5JiGXns5ZG93RHXr9FZmiqJcgToX CAa+wPujEX6eYOgsJTjyn06c3kDVwRZudGpDdSGqZJVKE1EWvB6wTddb4SrAveaEI56z Ddx0Xo+SzLvHFxZSSbFnDdMTDoIPqyvkDmXFN0qeoPYzX6Tti7uYpclyPRts5za3/q7a A8e3HVkqWxX0fWm5a+nKXAMp8OM6QWYXh4Ab49dOv/r+Ro32+S8oKxeZF2PgmU42UsmG XY9A== X-Gm-Message-State: AOAM530bnpIPtv6mdree6d/HHnTtz/69HQrsKThER21akQoMVkNn08If Oytya5uwT6IZoxHMWli3+HVdROmLnittoTmD X-Google-Smtp-Source: ABdhPJytYW/C08jG3w1bbySTGzCcuKhXm/RCSdBo+g8CGYoaoCH8BaerJsldvQkM4+UFKN8cx/SxHQ== X-Received: by 2002:a05:600c:3c9f:b0:38c:6dc6:6de2 with SMTP id bg31-20020a05600c3c9f00b0038c6dc66de2mr211373wmb.132.1647884697861; Mon, 21 Mar 2022 10:44:57 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:7422:13d5:6a39:d39]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c4f9600b0038c6ec42c38sm151849wmq.6.2022.03.21.10.44.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 10:44:57 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 1/5] Makefile/set_versions: Allow poky.yaml to be autogenerated Date: Mon, 21 Mar 2022 17:44:51 +0000 Message-Id: <20220321174455.1189669-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> References: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 21 Mar 2022 17:45:00 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2664 Use a script to generate the branch/tag information inside poky.yaml. If the branch isn't a known release branch, include git magic to find the closest matching release branch we know about. Signed-off-by: Richard Purdie --- documentation/.gitignore | 1 + documentation/Makefile | 1 + documentation/{poky.yaml => poky.yaml.in} | 0 documentation/set_versions.py | 115 ++++++++++++++++++++++ 4 files changed, 117 insertions(+) rename documentation/{poky.yaml => poky.yaml.in} (100%) create mode 100755 documentation/set_versions.py diff --git a/documentation/.gitignore b/documentation/.gitignore index 35ead8af6..e5e2c1708 100644 --- a/documentation/.gitignore +++ b/documentation/.gitignore @@ -1,5 +1,6 @@ _build/ Pipfile.lock +poky.yaml .vscode/ */svg/*.png */svg/*.pdf diff --git a/documentation/Makefile b/documentation/Makefile index f04f381bd..bec53399c 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -57,4 +57,5 @@ all: html epub latexpdf # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: + $(SOURCEDIR)/set_versions.py @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/documentation/poky.yaml b/documentation/poky.yaml.in similarity index 100% rename from documentation/poky.yaml rename to documentation/poky.yaml.in diff --git a/documentation/set_versions.py b/documentation/set_versions.py new file mode 100755 index 000000000..266ccf464 --- /dev/null +++ b/documentation/set_versions.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +# +# Add version information to poky.yaml based upon current git branch/tags +# +# Copyright Linux Foundation +# Author: Richard Purdie +# +# SPDX-License-Identifier: MIT +# + + +import subprocess +import collections +import sys + +devbranch = "kirkstone" +#devbranch = "langdale" +ltsseries = ["kirkstone", "dunfell"] + +release_series = collections.OrderedDict() +#release_series["langdale"] = "4.1" +release_series["kirkstone"] = "4.0" +release_series["honister"] = "3.4" +release_series["hardknott"] = "3.3" +release_series["gatesgarth"] = "3.2" +release_series["dunfell"] = "3.1" + +ourversion = None +ourseries = None +ourbranch = None + +# Test tags exist and inform the user to fetch if not +try: + subprocess.run(["git", "show", "yocto-3.4.2"], capture_output=True, check=True) +except subprocess.CalledProcessError: + sys.exit("Please run 'git fetch --tags' before building the documentation") + +# Try and figure out what we are +tags = subprocess.run(["git", "tag", "--points-at", "HEAD"], capture_output=True, text=True).stdout +for t in tags.split(): + if t.startswith("yocto-"): + ourversion = t[6:] + +if ourversion: + # We're a tagged release + components = ourversion.split(".") + baseversion = components[0] + "." + components[1] + for i in release_series: + if release_series[i] == baseversion: + ourseries = i + ourbranch = i +else: + # We're floating on a branch + branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip() + ourbranch = branch + if branch != "master" and branch not in release_series: + possible_branches = [] + for b in release_series.keys(): + result = subprocess.run(["git", "show-ref", "heads/" + b], capture_output=True, text=True) + if result.returncode == 0: + possible_branches.append(b) + continue + result = subprocess.run(["git", "show-ref", "origin/" + b], capture_output=True, text=True) + if result.returncode == 0: + possible_branches.append("origin/" + b) + nearestbranch = subprocess.run('git show-branch master ' + ' '.join(possible_branches) + ' | grep "*" | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1', shell=True, capture_output=True, text=True).stdout + branch = nearestbranch.split('[')[1].split('~')[0] + print("Nearest release branch esimtated to be %s" % branch) + if branch == "master": + ourseries = devbranch + elif branch in release_series: + ourseries = branch + else: + sys.exit("Unknown series for branch %s" % branch) + + previoustags = subprocess.run(["git", "tag", "--merged", "HEAD"], capture_output=True, text=True).stdout + previoustags = [t[6:] for t in previoustags.split() if t.startswith("yocto-" + release_series[ourseries])] + futuretags = subprocess.run(["git", "tag", "--merged", ourbranch], capture_output=True, text=True).stdout + futuretags = [t[6:] for t in futuretags.split() if t.startswith("yocto-" + release_series[ourseries])] + + # Append .999 against the last known version + if len(previoustags) != len(futuretags): + ourversion = previoustags[-1] + ".999" + else: + ourversion = release_series[ourseries] + ".999" + +series = [k for k in release_series] +previousseries = series[series.index(ourseries)+1:] +lastlts = [k for k in previousseries if k in ltsseries] + +print("Version calculated to be %s" % ourversion) +print("Release series calculated to be %s" % ourseries) + +replacements = { + "DISTRO" : ourversion, + "DISTRO_NAME_NO_CAP" : ourseries, + "DISTRO_NAME" : ourseries.capitalize(), + "DISTRO_NAME_NO_CAP_MINUS_ONE" : previousseries[0], + "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], + "YOCTO_DOC_VERSION" : ourversion, + "DISTRO_REL_TAG" : "yocto-" + ourversion, +} + +with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: + lines = r.readlines() + for line in lines: + data = line.split(":") + k = data[0].strip() + if k in replacements: + w.write("%s : \"%s\"\n" % (k, replacements[k])) + else: + w.write(line) + +print("poky.yaml generated from poky.yaml.in") + From patchwork Mon Mar 21 17:44:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76CBEC4332F for ; Mon, 21 Mar 2022 17:45:02 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web10.392.1647884700762098847 for ; Mon, 21 Mar 2022 10:45:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ijFHNMPY; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f44.google.com with SMTP id n35so7407352wms.5 for ; Mon, 21 Mar 2022 10:45:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=KRomAwlh6xdoIh3onIO8IVhFAVhcKPFuxZcPXW0CFT4=; b=ijFHNMPYi/DbckPrUULhTOZPzpomvgtymK3SI1UcFyKNRYrzqbM7xQCY1im8sAPD5g sHo2DXR7sMMwFi9wuIZICc4cnTxVTndoywyL7TxgbV+y2RiKo12pss0Vqgw4FC09QDx1 5CrFnQOWKOuLEEyTF99b7XxWGy1ygezY82oRo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KRomAwlh6xdoIh3onIO8IVhFAVhcKPFuxZcPXW0CFT4=; b=uXhpuj2vxMQxjzIUslzUzGb9VdyAs1c7rautTAPv6pVjLKpAG+bm8JrbVT90YaNTF5 kpnxRe1kG8iZgoajsjrRuc+2efG23Ti6aRNsYtvKdxGBvMyo1Z9wx8zS7U2NCVAOkevi tnWYs7A5LSUhihaa3yacHDgjIHXZC9Hn2F6oOvF8r20xD1AHG9Ku8x8SH/EaBnr6UWlt 6oYFgo6d8Ac+/X/Z4mKiC7ou4I/ucDPCuhzZD9x8Gp2kFyKxQxWvQMkfmiNpIg+kqXxa ONHKXGnBXZrEm3Q8dAsCmYAepzqYEuKQ/BBsgPk7InfCk1OQ5wRhp9CRLzUG/bV3FWCL 0VQg== X-Gm-Message-State: AOAM531ty32pnQmFeuX7tSS0dCkXeERnotOEYjYUPm7HCqkcoyw9rmJt 8oo8Qn2CPDbSRvHCHQuQyzp1kwAUMz3pW8xF X-Google-Smtp-Source: ABdhPJxKPW0H/Hi2AM3EUy7L5aiD5sp7trqBrXmf8tr3EnkFFCd2FXqLdFN1sl1oo5eTGTtzLvtVzg== X-Received: by 2002:a05:600c:1f17:b0:38b:b2b3:9faa with SMTP id bd23-20020a05600c1f1700b0038bb2b39faamr206158wmb.190.1647884698941; Mon, 21 Mar 2022 10:44:58 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:7422:13d5:6a39:d39]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c4f9600b0038c6ec42c38sm151849wmq.6.2022.03.21.10.44.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 10:44:58 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 2/5] conf.py/set_versions/poky.yaml: Set version in conf.py from poky.yaml Date: Mon, 21 Mar 2022 17:44:52 +0000 Message-Id: <20220321174455.1189669-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> References: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 21 Mar 2022 17:45:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2665 Allow conf.py to read the versions it needs from poky.yaml and have set_versions.py write this out. This means we don't have to change as many files when making new releases. Signed-off-by: Richard Purdie --- documentation/conf.py | 22 ++++++++++++++++++++-- documentation/poky.yaml.in | 2 ++ documentation/set_versions.py | 20 ++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/documentation/conf.py b/documentation/conf.py index 3015892d2..a5d7c0cd8 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -15,9 +15,27 @@ import os import sys import datetime +try: + import yaml +except ImportError: + sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\ + \nPlease make sure to install pyyaml python package.\n") + sys.exit(1) -current_version = "dev" -bitbake_version = "" # Leave empty for development branch +# current_version = "dev" +# bitbake_version = "" # Leave empty for development branch +# Obtain versions from poky.yaml instead +with open("poky.yaml") as data: + buff = data.read() + subst_vars = yaml.safe_load(buff) + if "DOCCONF_VERSION" not in subst_vars: + sys.stderr.write("Please set DOCCONF_VERSION in poky.yaml") + sys.exit(1) + current_version = subst_vars["DOCCONF_VERSION"] + if "BITBAKE_SERIES" not in subst_vars: + sys.stderr.write("Please set BITBAKE_SERIES in poky.yaml") + sys.exit(1) + bitbake_version = subst_vars["BITBAKE_SERIES"] # String used in sidebar version = 'Version: ' + current_version diff --git a/documentation/poky.yaml.in b/documentation/poky.yaml.in index 89a059ef1..a346b7623 100644 --- a/documentation/poky.yaml.in +++ b/documentation/poky.yaml.in @@ -5,6 +5,8 @@ DISTRO_NAME_NO_CAP_MINUS_ONE : "hardknott" DISTRO_NAME_NO_CAP_LTS : "dunfell" YOCTO_DOC_VERSION : "3.4.2" DISTRO_REL_TAG : "yocto-3.4.2" +DOCCONF_VERSION : "dev" +BITBAKE_SERIES : "" YOCTO_DL_URL : "https://downloads.yoctoproject.org" YOCTO_AB_URL : "https://autobuilder.yoctoproject.org" YOCTO_RELEASE_DL_URL : "&YOCTO_DL_URL;/releases/yocto/yocto-&DISTRO;" diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 266ccf464..a4bfaf1bf 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -25,9 +25,20 @@ release_series["hardknott"] = "3.3" release_series["gatesgarth"] = "3.2" release_series["dunfell"] = "3.1" +# "langdale" : "2.2", +bitbake_mapping = { + "kirkstone" : "2.0", + "honister" : "1.52", + "hardknott" : "1.50", + "gatesgarth" : "1.48", + "dunfell" : "1.46", +} + ourversion = None ourseries = None ourbranch = None +bitbakeversion = None +docconfver = None # Test tags exist and inform the user to fetch if not try: @@ -45,10 +56,12 @@ if ourversion: # We're a tagged release components = ourversion.split(".") baseversion = components[0] + "." + components[1] + docconfver = ourversion for i in release_series: if release_series[i] == baseversion: ourseries = i ourbranch = i + bitbakeversion = bitbake_mapping[i] else: # We're floating on a branch branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip() @@ -68,8 +81,11 @@ else: print("Nearest release branch esimtated to be %s" % branch) if branch == "master": ourseries = devbranch + docconfver = "dev" + bitbakeversion = "" elif branch in release_series: ourseries = branch + bitbakeversion = bitbake_mapping[branch] else: sys.exit("Unknown series for branch %s" % branch) @@ -83,6 +99,8 @@ else: ourversion = previoustags[-1] + ".999" else: ourversion = release_series[ourseries] + ".999" + if not docconfver: + docconfver = ourversion series = [k for k in release_series] previousseries = series[series.index(ourseries)+1:] @@ -99,6 +117,8 @@ replacements = { "DISTRO_NAME_NO_CAP_LTS" : lastlts[0], "YOCTO_DOC_VERSION" : ourversion, "DISTRO_REL_TAG" : "yocto-" + ourversion, + "DOCCONF_VERSION" : docconfver, + "BITBAKE_SERIES" : bitbakeversion, } with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: From patchwork Mon Mar 21 17:44:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5606 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 656DEC433EF for ; Mon, 21 Mar 2022 17:45:02 +0000 (UTC) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.groups.io with SMTP id smtpd.web12.380.1647884701622465917 for ; Mon, 21 Mar 2022 10:45:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=NRoc8jHC; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.51, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f51.google.com with SMTP id u16so20743690wru.4 for ; Mon, 21 Mar 2022 10:45:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=NIK7pVJbx7EHs5AvMOrkrTVWarZwUoZx7XL53qkcauQ=; b=NRoc8jHCm7AdEdX4xzftRx/lnwfRJZ3GmBMK1Hv8U1dbGa16D8a/w0Xq1dwVEYpSU1 VqtzxdYFHqu5PGvcc4qnVwAzSWmSmZkxbu6DtFMGJtpCt1idx2kfFi6sKZXe3fyaAsia 3cJ634eYRV7d63xCSyv3J3BXf0+x8f0cvZwTo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NIK7pVJbx7EHs5AvMOrkrTVWarZwUoZx7XL53qkcauQ=; b=Cop4sXj+XF72+zMpi8w2fWHdWJobIGcQ2jhalLmmbpPLDf0ZzPfLlW6VGWMepguvnI iuHhT1gDMtBHsgfkGsOA3VbZ0bpT0zSzMYWM4Uv1nh9dl8OV3jS5KNN3Ppv6/mHNHd2n 3i+L3pBX9/GM7bBLCXF01ZefLifdbOKArDGfKPz676pak6dnu4OaOcfuuXv7mavE+pOf G8CMpANJUjh9WkImngZBmc1PzHIXY7RvjCB+mpk2A4gE2zfkOH+zswlLxjg/U+T9R7Cm zy+VJzZZ9elFL3yVm2De2LhcNGY5kZMEOKT4hptBCcI4Q8LvvRTPzsZVQpHTNwFTtHqz 2hCA== X-Gm-Message-State: AOAM530xL+qB9cdRVrUF/PgE1LB9Qzw/8A5aSfi01g42ETioJijof7rP zBYELLR2211IpnD5883fxq2J3hsVPhHcOpHd X-Google-Smtp-Source: ABdhPJy4q8aUxA19r6EPZIVvGLby8wKJOu4l/UbCh7Hcae6GhcUfkSS1fwCrviwCkFGe4MTzbPFT/w== X-Received: by 2002:adf:eb86:0:b0:1e6:8c92:af6b with SMTP id t6-20020adfeb86000000b001e68c92af6bmr18790908wrn.116.1647884699757; Mon, 21 Mar 2022 10:44:59 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:7422:13d5:6a39:d39]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c4f9600b0038c6ec42c38sm151849wmq.6.2022.03.21.10.44.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 10:44:59 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 3/5] set_versions: Add support for setting POKYVERSION found in older releases Date: Mon, 21 Mar 2022 17:44:53 +0000 Message-Id: <20220321174455.1189669-4-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> References: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 21 Mar 2022 17:45:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2666 Signed-off-by: Richard Purdie --- documentation/set_versions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/documentation/set_versions.py b/documentation/set_versions.py index a4bfaf1bf..a121125ac 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -34,6 +34,13 @@ bitbake_mapping = { "dunfell" : "1.46", } +# 3.4 onwards doesn't have poky version +poky_mapping = { + "3.3" : "25.0", + "3.2" : "24.0", + "3.1" : "23.0", +} + ourversion = None ourseries = None ourbranch = None @@ -121,6 +128,10 @@ replacements = { "BITBAKE_SERIES" : bitbakeversion, } +if release_series[ourseries] in poky_mapping: + pokyversion = poky_mapping[release_series[ourseries]] + "." + ourversion.rsplit(".", 1)[1] + replacements["POKYVERSION"] = pokyversion + with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: lines = r.readlines() for line in lines: From patchwork Mon Mar 21 17:44:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5608 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A0A2C433F5 for ; Mon, 21 Mar 2022 17:45:03 +0000 (UTC) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mx.groups.io with SMTP id smtpd.web10.395.1647884702490773533 for ; Mon, 21 Mar 2022 10:45:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=FdOnu6bY; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.54, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f54.google.com with SMTP id u16so20743750wru.4 for ; Mon, 21 Mar 2022 10:45:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LK/IUj7fxvv1hYPFt01bMGWm2IC7by3uxUu0Z99kW+0=; b=FdOnu6bYgvutz8PyPWk8Aipj7RGtc6vSXG/bMztfv16F1DvGxEQVMmIhJyt5R8VvCb 8bZoo0CjX03hVfXWR/4kJ+4jFd5QQLhDBrmhDbIaLEzJZghvDYUiZfJmOEjsQcXaUD/q qDJK4XUYjFZMyRuKOWXWcJOmKPg2mRyMjc2o4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LK/IUj7fxvv1hYPFt01bMGWm2IC7by3uxUu0Z99kW+0=; b=yBQQ0T1doAVIt2V5lNevViZ18huhodIcL9ZVrgWTBOHW4EV4W25801J7105sOZ8iX7 gM8wCMXrdpcvyP2bQBRTlWCcaACBLcl0yO4CqKxah/JlMvjYx/OWDoTScVTYU0UAZyWO /mEzD0+2ciZEHP6Tqt9NH2a3KmhMI+KbojvpizogEL4DldfJhnI7WpiHAqW3wZ0HlwdJ C0JtD/Q/BtmaPmGBMSWZ+XtdRJsopPT3Qu8Ax29zdzSL/wQ/7bmQP4jtNsVqYHmn3rGW jygw0csmsWNsM+/N30TMA3TFckJMZKsyqawu79bbsoSYYuevg8WgOSVAE5AIkCTvr7Zi 0TSA== X-Gm-Message-State: AOAM530SUD3GFiSGufSoXM7sRVwPJ9JJhwDJPVg3jGY40IY3HSHmXmpd PN+pseTbFbEYBgIP6xIybI8hq19Q85Bc6eJY X-Google-Smtp-Source: ABdhPJwsuiJ3Ed48GxJWyEHVdvqFh/p6ZJ+qNw7FvLiUSZSTY5JeSmXPiPm7q3ydd9XfiFTosAeEsg== X-Received: by 2002:a5d:6da8:0:b0:1f1:fa31:e7f7 with SMTP id u8-20020a5d6da8000000b001f1fa31e7f7mr19450474wrs.389.1647884700626; Mon, 21 Mar 2022 10:45:00 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:7422:13d5:6a39:d39]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c4f9600b0038c6ec42c38sm151849wmq.6.2022.03.21.10.44.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 10:45:00 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 4/5] set_versions/switchers.js: Allow switchers.js version information to be autogenerated Date: Mon, 21 Mar 2022 17:44:54 +0000 Message-Id: <20220321174455.1189669-5-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> References: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 21 Mar 2022 17:45:03 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2667 A horrible blunt hammer approach to updating the version information in switchers.js based on the available tag information. To merge and work correctly, this will need a change to the autobuilder-helper docs generation code to pull the swicthers.js and script from master, then to run the script. That should hopefully remove the need for other patching even on old docs branches though. Signed-off-by: Richard Purdie --- documentation/.gitignore | 1 + documentation/set_versions.py | 20 +++++++++++++++++++ .../{switchers.js => switchers.js.in} | 8 +------- 3 files changed, 22 insertions(+), 7 deletions(-) rename documentation/sphinx-static/{switchers.js => switchers.js.in} (97%) diff --git a/documentation/.gitignore b/documentation/.gitignore index e5e2c1708..096b97ec2 100644 --- a/documentation/.gitignore +++ b/documentation/.gitignore @@ -1,6 +1,7 @@ _build/ Pipfile.lock poky.yaml +sphinx-static/switchers.js .vscode/ */svg/*.png */svg/*.pdf diff --git a/documentation/set_versions.py b/documentation/set_versions.py index a121125ac..668c42e30 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -13,6 +13,7 @@ import subprocess import collections import sys +activereleases = ["honister", "hardknott", "dunfell"] devbranch = "kirkstone" #devbranch = "langdale" ltsseries = ["kirkstone", "dunfell"] @@ -144,3 +145,22 @@ with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: print("poky.yaml generated from poky.yaml.in") +with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switchers.js", "w") as w: + lines = r.readlines() + for line in lines: + if "VERSIONS_PLACEHOLDER" in line: + w.write(" 'dev': 'dev (%s)',\n" % release_series[devbranch]) + for branch in activereleases: + if branch == devbranch: + continue + versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, capture_output=True, text=True).stdout.split() + versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in versions], key=int) + version = release_series[branch] + if versions[-1] != "0": + version = version + "." + versions[-1] + w.write(" '%s': '%s',\n" % (version, version)) + else: + w.write(line) + +print("switchers.js generated from switchers.js.in") + diff --git a/documentation/sphinx-static/switchers.js b/documentation/sphinx-static/switchers.js.in similarity index 97% rename from documentation/sphinx-static/switchers.js rename to documentation/sphinx-static/switchers.js.in index 3ea8927d7..5d3a4d793 100644 --- a/documentation/sphinx-static/switchers.js +++ b/documentation/sphinx-static/switchers.js.in @@ -10,13 +10,7 @@ by https://git.yoctoproject.org/yocto-autobuilder-helper/tree/scripts/run-docs-b 'use strict'; var all_versions = { - 'dev': 'dev (3.5)', - '3.4.2': '3.4.2', - '3.3.5': '3.3.5', - '3.2.4': '3.2.4', - '3.1.14': '3.1.14', - '3.0.4': '3.0.4', - '2.7.4': '2.7.4', + VERSIONS_PLACEHOLDER }; var all_doctypes = { From patchwork Mon Mar 21 17:44:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B4DCC4332F for ; Mon, 21 Mar 2022 17:45:04 +0000 (UTC) Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) by mx.groups.io with SMTP id smtpd.web11.409.1647884703463489606 for ; Mon, 21 Mar 2022 10:45:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ebO8sh9c; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f53.google.com with SMTP id h4so3782927wrc.13 for ; Mon, 21 Mar 2022 10:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=u++sACwT00z3SnqmIHWlTa0qBYMyKUl5jCR25wBZUus=; b=ebO8sh9czvCI1KxuzYMPVs2tgAq8h8Lp2H/cOhcMr4Pi4y/wsGEiYLCNRMoKFS62ye uqgVhN4vcIECwuhL2abnYcHpWj1Wq2ERLEd+Y3/g0x4sZY3qmASPZm4Fssfnf+K+aB+Z ksAoKJGCRr1oPxzeHm4VCoejD9AZHAnGBUUwA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u++sACwT00z3SnqmIHWlTa0qBYMyKUl5jCR25wBZUus=; b=bTfIW5rAWZ/Dqvs92LLaAsPDo1VeDOAZw04o+9Hn6PHG4737f5903Tre47ORS8LfLP ZvPIr5bIyphd/yDX+8liTLwCEzSSWbRz2bMKlpmSeaxm1qw/KDyvmSlpjklT1T7WicuH x6LckBCaGBnorooropWrQHaX/kG3eciJbr+U92gO4wyQP+rvjBcMhD8uEVgQcSuxSrJn JV50MJxjExunyjrXoEMUrzyO+mNy9U/Qg01I9fKEocxb1dsOpkTil59r/bmW2thCAJNR ZrccT57zS1jYZtANzZ+c0DyoE0kA10q4IvVTFZwbul7FpWtofoFmPQChA8xQoVd2VmeV wtEA== X-Gm-Message-State: AOAM530VuFauTkyuj///3pcl4NGmDEpgIt7K8x0+n2J85kPmoJXYIOvl XYWoeqI5/PAq7+NlI+03DBQAGmkiYVQkWT+j X-Google-Smtp-Source: ABdhPJzqZjQOvJoead3zXJCs3rSb48mVvflFiJNAZwDDqVIWw4ikATlbN684CQZY/pTaJaKWrIhsCw== X-Received: by 2002:a05:6000:1acf:b0:203:fe67:a8dc with SMTP id i15-20020a0560001acf00b00203fe67a8dcmr11119664wry.212.1647884701548; Mon, 21 Mar 2022 10:45:01 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:7422:13d5:6a39:d39]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c4f9600b0038c6ec42c38sm151849wmq.6.2022.03.21.10.45.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 10:45:01 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 5/5] set_versions: Various improvements Date: Mon, 21 Mar 2022 17:44:55 +0000 Message-Id: <20220321174455.1189669-6-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> References: <20220321174455.1189669-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 21 Mar 2022 17:45:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2668 - Allow specifying the version from the commandline - Add all previous release series/version mappings (to support transitions branch) - Add poky mapping for 3.4 as some releases erronously use it - Improve git branch 'guessing' code to work properly - Handle poky '.0' release mappings correctly - Only write poky.yaml if poky.yaml.in exists - Ensure older non-active releases are shown in the switchers.js release list. - Ensure current version and current release series are shown in switcher. Signed-off-by: Richard Purdie --- documentation/set_versions.py | 119 +++++++++++++++++++++++++--------- 1 file changed, 89 insertions(+), 30 deletions(-) diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 668c42e30..354776c16 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -12,10 +12,16 @@ import subprocess import collections import sys +import os +import itertools + +ourversion = None +if len(sys.argv) == 2: + ourversion = sys.argv[1] activereleases = ["honister", "hardknott", "dunfell"] -devbranch = "kirkstone" #devbranch = "langdale" +devbranch = "kirkstone" ltsseries = ["kirkstone", "dunfell"] release_series = collections.OrderedDict() @@ -25,6 +31,27 @@ release_series["honister"] = "3.4" release_series["hardknott"] = "3.3" release_series["gatesgarth"] = "3.2" release_series["dunfell"] = "3.1" +release_series["zeus"] = "3.0" +release_series["warrior"] = "2.7" +release_series["thud"] = "2.6" +release_series["sumo"] = "2.5" +release_series["rocko"] = "2.4" +release_series["pyro"] = "2.3" +release_series["morty"] = "2.2" +release_series["krogoth"] = "2.1" +release_series["jethro"] = "2.0" +release_series["jethro-pre"] = "1.9" +release_series["fido"] = "1.8" +release_series["dizzy"] = "1.7" +release_series["daisy"] = "1.6" +release_series["dora"] = "1.5" +release_series["dylan"] = "1.4" +release_series["danny"] = "1.3" +release_series["denzil"] = "1.2" +release_series["edison"] = "1.1" +release_series["bernard"] = "1.0" +release_series["laverne"] = "0.9" + # "langdale" : "2.2", bitbake_mapping = { @@ -36,13 +63,14 @@ bitbake_mapping = { } # 3.4 onwards doesn't have poky version +# Early 3.4 release docs do reference it though poky_mapping = { + "3.4" : "26.0", "3.3" : "25.0", "3.2" : "24.0", "3.1" : "23.0", } -ourversion = None ourseries = None ourbranch = None bitbakeversion = None @@ -69,31 +97,38 @@ if ourversion: if release_series[i] == baseversion: ourseries = i ourbranch = i - bitbakeversion = bitbake_mapping[i] + if i in bitbake_mapping: + bitbakeversion = bitbake_mapping[i] else: # We're floating on a branch branch = subprocess.run(["git", "branch", "--show-current"], capture_output=True, text=True).stdout.strip() ourbranch = branch if branch != "master" and branch not in release_series: - possible_branches = [] - for b in release_series.keys(): - result = subprocess.run(["git", "show-ref", "heads/" + b], capture_output=True, text=True) + # We're not on a known release branch so we have to guess. Compare the numbers of commits + # from each release branch and assume the smallest number of commits is the one we're based off + possible_branch = None + branch_count = 0 + for b in itertools.chain(release_series.keys(), ["master"]): + result = subprocess.run(["git", "log", "--format=oneline", "HEAD..origin/" + b], capture_output=True, text=True) if result.returncode == 0: - possible_branches.append(b) - continue - result = subprocess.run(["git", "show-ref", "origin/" + b], capture_output=True, text=True) - if result.returncode == 0: - possible_branches.append("origin/" + b) - nearestbranch = subprocess.run('git show-branch master ' + ' '.join(possible_branches) + ' | grep "*" | grep -v "$(git rev-parse --abbrev-ref HEAD)" | head -n1', shell=True, capture_output=True, text=True).stdout - branch = nearestbranch.split('[')[1].split('~')[0] - print("Nearest release branch esimtated to be %s" % branch) + count = result.stdout.count('\n') + if not possible_branch or count < branch_count: + print("Branch %s has count %s" % (b, count)) + possible_branch = b + branch_count = count + if possible_branch: + branch = possible_branch + else: + branch = "master" + print("Nearest release branch estimated to be %s" % branch) if branch == "master": ourseries = devbranch docconfver = "dev" bitbakeversion = "" elif branch in release_series: ourseries = branch - bitbakeversion = bitbake_mapping[branch] + if branch in bitbake_mapping: + bitbakeversion = bitbake_mapping[branch] else: sys.exit("Unknown series for branch %s" % branch) @@ -111,8 +146,8 @@ else: docconfver = ourversion series = [k for k in release_series] -previousseries = series[series.index(ourseries)+1:] -lastlts = [k for k in previousseries if k in ltsseries] +previousseries = series[series.index(ourseries)+1:] or [""] +lastlts = [k for k in previousseries if k in ltsseries] or "dunfell" print("Version calculated to be %s" % ourversion) print("Release series calculated to be %s" % ourseries) @@ -130,21 +165,40 @@ replacements = { } if release_series[ourseries] in poky_mapping: - pokyversion = poky_mapping[release_series[ourseries]] + "." + ourversion.rsplit(".", 1)[1] + pokyversion = poky_mapping[release_series[ourseries]] + if ourversion != release_series[ourseries]: + pokyversion = pokyversion + "." + ourversion.rsplit(".", 1)[1] + else: + pokyversion = pokyversion + ".0" replacements["POKYVERSION"] = pokyversion -with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: - lines = r.readlines() - for line in lines: - data = line.split(":") - k = data[0].strip() - if k in replacements: - w.write("%s : \"%s\"\n" % (k, replacements[k])) - else: - w.write(line) - -print("poky.yaml generated from poky.yaml.in") - +if os.path.exists("poky.yaml.in"): + with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: + lines = r.readlines() + for line in lines: + data = line.split(":") + k = data[0].strip() + if k in replacements: + w.write("%s : \"%s\"\n" % (k, replacements[k])) + else: + w.write(line) + + print("poky.yaml generated from poky.yaml.in") + + +# In the switcher list of versions we display: +# - latest dev +# - latest stable release +# - latest LTS +# - latest for each releases listed as active +# - latest doc version in current series +# - current doc version +# (with duplicates removed) + +if ourseries not in activereleases: + activereleases.append(ourseries) + +versions = [] with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switchers.js", "w") as w: lines = r.readlines() for line in lines: @@ -155,10 +209,15 @@ with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switch continue versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, capture_output=True, text=True).stdout.split() versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in versions], key=int) + if not versions: + continue version = release_series[branch] if versions[-1] != "0": version = version + "." + versions[-1] + versions.append(version) w.write(" '%s': '%s',\n" % (version, version)) + if ourversion not in versions: + w.write(" '%s': '%s',\n" % (ourversion, ourversion)) else: w.write(line)