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 = {