From patchwork Wed Mar 23 10:19: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: 5740 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 A2285C433EF for ; Wed, 23 Mar 2022 10:20:01 +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.7449.1648030800636819219 for ; Wed, 23 Mar 2022 03:20:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=MAQB73Ih; 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 j13-20020a05600c1c0d00b0038c8f94aac2so4976519wms.3 for ; Wed, 23 Mar 2022 03:20: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:mime-version :content-transfer-encoding; bh=S0GFiPOOC0QPwfjVdx0apVoxxDvhS0pBVlBL74AnDAw=; b=MAQB73IhoULYdgdD6K/oUL+RpR83zSp00rFNnXQYWhd/od8B0c7RP/8J9wSAqImeqQ +7wP9UpsYi3IoR+7/pKG6JMR52UqaBW3vqJY8lBPAjmbihXv6PYa7jA/s5dkQnXWrSr8 5ql26lvLvc2RJdXLuR+DAm1uzKzY1xHNPwWAs= 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:mime-version :content-transfer-encoding; bh=S0GFiPOOC0QPwfjVdx0apVoxxDvhS0pBVlBL74AnDAw=; b=CEsQhGa0thgAkFv8j1xaJgWdcJ0DQYqzBJy9C1+DYaZy62Np1aK1R8nR0L9Zh7rIZY hhChVWCJlQbYKwdQZABU3LIjdB0tSGCSAUmzqsB6nXk77XV1yr8B4Hwe86zSh8XuE2EU bFFKtmZV/3Z0FNpYU4b7PTW22hbqrdjPpNE4wz+dXXqNM6cB8ZYcI2kvQUbQ5vR3avPZ UaSDpdrHQBTQggV7vFGhbzQlTppJwYO3q2L9Q5uriSPvrLMaVW2d7meVYsYN25qXLeL0 tUZzJbR8j8xAoO+4oxmPtKI2s6usRsOewT6y3JeBnhpdoa659Yx6vGjmX/rPhCpsYzKb KS+Q== X-Gm-Message-State: AOAM5311Fap/0OCgouThIddcgXuTZzmyGdOICAAw7nOlpXpAQTD+BKux md5Wpsl/enysiP9XYd+q4tevZL3xxChd9FC0 X-Google-Smtp-Source: ABdhPJxrxC66u+EXYlNFpisyeeKf+z476w0vE5VaEMvWyqpmW93Z1EzDf7klHKHfwKyMzJYflkr5GQ== X-Received: by 2002:a05:600c:600a:b0:38c:6c9e:f9c7 with SMTP id az10-20020a05600c600a00b0038c6c9ef9c7mr8287668wmb.26.1648030798401; Wed, 23 Mar 2022 03:19:58 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:aaba:716e:9c38:ad87]) by smtp.gmail.com with ESMTPSA id x3-20020a5d6b43000000b001e317fb86ecsm18171336wrw.57.2022.03.23.03.19.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 03:19: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: Wed, 23 Mar 2022 10:19:53 +0000 Message-Id: <20220323101957.1263785-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 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 ; Wed, 23 Mar 2022 10:20:01 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2696 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 | 120 ++++++++++++++++++++++ 4 files changed, 122 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..d48b8b74c --- /dev/null +++ b/documentation/set_versions.py @@ -0,0 +1,120 @@ +#!/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 + +ourversion = None +if len(sys.argv) == 2: + ourversion = sys.argv[1] + +activereleases = ["honister", "hardknott", "gatesgarth", "dunfell", "zeus", "warrior"] +#devbranch = "langdale" +devbranch = "kirkstone" +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 Wed Mar 23 10:19: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: 5741 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 764B8C433FE for ; Wed, 23 Mar 2022 10:20:02 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.web09.7428.1648030801172667754 for ; Wed, 23 Mar 2022 03:20:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=OddUmsZ/; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f44.google.com with SMTP id j18so1394723wrd.6 for ; Wed, 23 Mar 2022 03:20: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=I/5Z0zidLD0WptEDzr0/TF/xojB1lkY8HqTSxOeZvG8=; b=OddUmsZ/pnAybF///gJjA1zwuNVHcCpPX1OWB7w4cJQDeB40K4940qfrMDejKf1RdE 8KGqWq6ryLGFL6UMhNTObD68HbAwalVZrrQnZ5H6LBasM4gRgYmm3YYqXQkKg+eeYeV0 L6L8kbikq2222KRVgFKa0wUVryW9VvrG03bIE= 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=I/5Z0zidLD0WptEDzr0/TF/xojB1lkY8HqTSxOeZvG8=; b=6eIbxiT/p7lIaODcRBqJ8rHNqyHs1Ig5cw3LslYnby2gnYRRVC8ztri6btyv5mQNOe Z6EC6plOVSPMo2qWD0Zx/CQOo46XWbwfhXE9GY9PC/KzjqCnwMotgdQq1+1dRCAuCHt+ iMg4n8pQOzFT8QdZwosVVgdUJ5YlT7kVELjQySw/L8pgBdMvF0AOjRKL2ei+YMpMZLGa DMu5E+Z2nPcoZdb0tC0sU8g6lqpBXrSRzFaqJnPrmpV93qe5LLsHKQVcLO594wvYj+i6 aowdytjIgvMdmHnBsIsWcT3JFLgQO2vQ7+BMeBw9D84VQZB9ig5pjjA5KP6nFI9R3c49 v0ag== X-Gm-Message-State: AOAM532Rjd9gpSnGqNtCNR0g9yEamaoMiPDMb/oHvefxNSdEHUEvefaw 3kMatiC8hQG6RenvTcW42jKupO4PVQ+IDzvl X-Google-Smtp-Source: ABdhPJzAPEXAQD9I2iMlkx1d5BQ7c2NdoHyroOd1t/zkS/JrASJyFmU1rkl05LLeTSY4SIu8PPZUfQ== X-Received: by 2002:a05:6000:168e:b0:204:fe5:a55 with SMTP id y14-20020a056000168e00b002040fe50a55mr12405170wrd.453.1648030799192; Wed, 23 Mar 2022 03:19:59 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:aaba:716e:9c38:ad87]) by smtp.gmail.com with ESMTPSA id x3-20020a5d6b43000000b001e317fb86ecsm18171336wrw.57.2022.03.23.03.19.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 03:19: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: Wed, 23 Mar 2022 10:19:54 +0000 Message-Id: <20220323101957.1263785-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220323101957.1263785-1-richard.purdie@linuxfoundation.org> References: <20220323101957.1263785-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 ; Wed, 23 Mar 2022 10:20:02 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2697 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 d48b8b74c..4ee28d094 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -30,9 +30,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: @@ -50,10 +61,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() @@ -73,8 +86,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) @@ -88,6 +104,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:] @@ -104,6 +122,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 Wed Mar 23 10:19: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: 5742 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 8C084C43217 for ; Wed, 23 Mar 2022 10:20:03 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web12.7440.1648030802112944040 for ; Wed, 23 Mar 2022 03:20:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=eystV7Jp; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.43, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f43.google.com with SMTP id t11so1394658wrm.5 for ; Wed, 23 Mar 2022 03:20: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=ZPu5axCwTeH5uyflli+8O22q9jGct1VlJM5a1BWbLVg=; b=eystV7JpvWtDHKlYgV7QPu/4Dg9Nd/61iZgggEC4DOyNhrJZ7uVyVNZwCkIMRxco2O iRHsbudfFpYRoQmnFWVcJDM0kgAgQen5T/gQpo2nAbuGosQCX0e0P7IUYxgLZUW0I1Uz cXwW/z0W24qgAz5l7iiQNiaFpS1Hf4jAftg7I= 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=ZPu5axCwTeH5uyflli+8O22q9jGct1VlJM5a1BWbLVg=; b=ktHgm+YX2l81Vya9O6dDqiq5T4Motf27NtIW3t0aGQUGIyZMAl2hAfSN0/Ex8ImvUn kaDXCbM8rUge7MMqccFJqsaYDHXk8EcsHMrBoFNRyrpHXIYMGIHJMfuGC0T6ynEL1ls4 7E7WpmaGU6QOVVepRfEkFvIMkaVjSdcLLR5C0hoVDBTc4zn6G9kyZnqsijLqRmLnvqcP vP+aNCDaBz+iLwFUOpN+5JKD/503GwNWnuLpRTXwURBYN12dNCKB/B5K0WpN86nEnbOQ 1EzSiRkeusfSQkwCQ0PRHwkhvkFcprK5dDWdYVCW7CmIcyMqfsqz2FmfemCWDT1EY/lX anng== X-Gm-Message-State: AOAM533UXHufS6cQs9YP4jir7XF52T8vUQnAOU9mjRZOxg1veppUSrXK w0z4zvaPfkL07hpGppsGZN0RnG/heNi85Ghj X-Google-Smtp-Source: ABdhPJxlPx6uZ0clQwfrCLROX4B73i5Xv2jSnu0xuv9fxo55r6UzWhrmWIQTBfNocpu6S8h5ScBO+g== X-Received: by 2002:adf:90e2:0:b0:1e3:f5a:553c with SMTP id i89-20020adf90e2000000b001e30f5a553cmr25990796wri.476.1648030800311; Wed, 23 Mar 2022 03:20:00 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:aaba:716e:9c38:ad87]) by smtp.gmail.com with ESMTPSA id x3-20020a5d6b43000000b001e317fb86ecsm18171336wrw.57.2022.03.23.03.19.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 03:19: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: Wed, 23 Mar 2022 10:19:55 +0000 Message-Id: <20220323101957.1263785-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220323101957.1263785-1-richard.purdie@linuxfoundation.org> References: <20220323101957.1263785-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 ; Wed, 23 Mar 2022 10:20:03 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2698 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 4ee28d094..96e0d3469 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -39,6 +39,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 @@ -126,6 +133,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 Wed Mar 23 10:19:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5743 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 7CD53C433F5 for ; Wed, 23 Mar 2022 10:20:03 +0000 (UTC) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.groups.io with SMTP id smtpd.web08.7353.1648030802823751678 for ; Wed, 23 Mar 2022 03:20:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=JXOZBR61; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.41, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f41.google.com with SMTP id u3so1407959wrg.3 for ; Wed, 23 Mar 2022 03:20: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=onHRx1XuCnJWD0zTfVlR5nPELyoCIbekUManoVlK168=; b=JXOZBR61Yd7DjEUKJ0GG9uhYiU9MXTNTrTPVFzpWlj+RJkhlNfgpQVNyAQgy3iDHA0 q/hH9LpnDHi7/dzkqqBfhgAQ+x8j7/wIpDu5z8Tob7jfvCsa15o8Rorrqx3x43/lipwi sFfb0QbBL626dQvw92dd2w703HXUnDOwGd2OY= 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=onHRx1XuCnJWD0zTfVlR5nPELyoCIbekUManoVlK168=; b=AVsLRFpuge+V9VQUIW8E3OXCLsnh80Gf+C74SFOaXZGkAqaHiex3z7WJyYUKXayfzO 1YyWjI8U2kPjgUt10D+kvsq9wdes3isUqP5HnkTEjWmcpt7D0aRhYEA4i/L7f4v0bi02 w30tOe+xzp9Q6G+bNEP/XdAWREh7/3+9mSqRUTAlmX130eNtYCrQuL0WnEyRojLF8Tr4 6EIejLRA7YTVwrlgnQjtYlljOAtH0Hz8PG3EBjXD4Ukr8cM2HTNOA2eEejjTgRS7N6tb DMg+IEpfGzYtF1xvsvcvkYyMzws7q7dUH3CN5cB0N/ZIiSJbz9VO6xSpkTgyl3M3YpRp JDgw== X-Gm-Message-State: AOAM530ULD41BbFaKwbZ+Gt5/SHEiFhGprBSqyrfboYBoqLxKGjQbDcu NoUooK96drkwtUP5Glb/7syh25xyzpqxn17P X-Google-Smtp-Source: ABdhPJzYN5Exm+Ahk9IPfazr2xkPhtZNoTFHas2nquzo13HaXW56iieVw58n1yapg49wlSAIzgTv0w== X-Received: by 2002:a5d:4205:0:b0:205:7acf:d111 with SMTP id n5-20020a5d4205000000b002057acfd111mr6246548wrq.444.1648030801087; Wed, 23 Mar 2022 03:20:01 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:aaba:716e:9c38:ad87]) by smtp.gmail.com with ESMTPSA id x3-20020a5d6b43000000b001e317fb86ecsm18171336wrw.57.2022.03.23.03.20.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 03:20: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: Wed, 23 Mar 2022 10:19:56 +0000 Message-Id: <20220323101957.1263785-4-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220323101957.1263785-1-richard.purdie@linuxfoundation.org> References: <20220323101957.1263785-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 ; Wed, 23 Mar 2022 10:20:03 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2699 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 | 19 +++++++++++++++++++ .../{switchers.js => switchers.js.in} | 8 +------- 3 files changed, 21 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 96e0d3469..94e2704a5 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -149,3 +149,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 af7e33490..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.15': '3.1.15', - '3.0.4': '3.0.4', - '2.7.4': '2.7.4', + VERSIONS_PLACEHOLDER }; var all_doctypes = { From patchwork Wed Mar 23 10:19:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5744 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 7F1E9C433FE for ; Wed, 23 Mar 2022 10:20:04 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by mx.groups.io with SMTP id smtpd.web12.7441.1648030803895741408 for ; Wed, 23 Mar 2022 03:20:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=CqWCGGBL; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.53, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f53.google.com with SMTP id o7-20020a05600c4fc700b0038c87edc21eso3068442wmq.0 for ; Wed, 23 Mar 2022 03:20: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=u1Yf/oa69GSGg0G0IstLKfhtDcI3VL0Uh4L7AH+bw08=; b=CqWCGGBLLU3ArMLAdFtC9TzefMSmxgHRufNCD8UNHzrRRfNYjNRkWSN1T/kgwSEBo+ nioCkr3z6RypF3QAFA7AgxFmmTKb/umC99Gxc95XpJ+c6BZ8C6tcAJ73dcBMmzOpZwvU dK+ptktHXwDC+5EEsCDxfaNJc05yIBDFSse1w= 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=u1Yf/oa69GSGg0G0IstLKfhtDcI3VL0Uh4L7AH+bw08=; b=mIiHCw0zJLS0PG1YEKawoN/3aBNJcfZRaVuTY/qj9ozCvVdk5AfzOMFz/MCpP51qTs ZUBtDdN/ccfVCF9gtCodqiLPeS4iqA2vOOS3lM/RzhS0iMQ4fOTfc1t0PvAXwgpvApS+ g/6/SyhIzz/hOsn0gNanLvpdTnLVpZLhEey8GIldkD+KCpVKORst1/+bVSfujCYeaOkH oGV7Ri2VEb9Khim4MhV+pP2wxUMGawThC45AxvVXmZMFIL5qwRUYn0Yx7qvcYmQQr3X5 5/8lGw+G+le5pp+p69cbaLnAW9PTP4CzdSa1wxP0FS9w3NtaAtkXKeGeLr9R63ZsIpxG 5lOQ== X-Gm-Message-State: AOAM532L/Afh3M82FP2cTJFyhecaxQxk66IQ/Sz3dK+zJfh9bD433Qq2 S950LECrO6ID7ZEEue7ke/7L6SxO4fjbv+h8 X-Google-Smtp-Source: ABdhPJwjg8W/sr/2c8tIcRy8RSqjD6WUfl4qFIu2wdMwtewrXlHdBJqL5fwQ2FC9sgx/AIthyCdxiA== X-Received: by 2002:a7b:cc0d:0:b0:381:220e:a3a0 with SMTP id f13-20020a7bcc0d000000b00381220ea3a0mr8585393wmh.59.1648030801936; Wed, 23 Mar 2022 03:20:01 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:aaba:716e:9c38:ad87]) by smtp.gmail.com with ESMTPSA id x3-20020a5d6b43000000b001e317fb86ecsm18171336wrw.57.2022.03.23.03.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 03:20:01 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 5/5] set_versions: Various improvements Date: Wed, 23 Mar 2022 10:19:57 +0000 Message-Id: <20220323101957.1263785-5-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220323101957.1263785-1-richard.purdie@linuxfoundation.org> References: <20220323101957.1263785-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 ; Wed, 23 Mar 2022 10:20:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2700 - 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 | 117 +++++++++++++++++++++++++--------- 1 file changed, 88 insertions(+), 29 deletions(-) diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 94e2704a5..9f0d79429 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -12,6 +12,12 @@ import subprocess import collections import sys +import os +import itertools + +ourversion = None +if len(sys.argv) == 2: + ourversion = sys.argv[1] ourversion = None if len(sys.argv) == 2: @@ -29,6 +35,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 = { @@ -40,13 +67,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 @@ -73,31 +101,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) @@ -115,8 +150,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) @@ -134,21 +169,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: @@ -159,10 +213,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)