From patchwork Fri Mar 18 16:23:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5473 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 D7D49C433F5 for ; Fri, 18 Mar 2022 16:23:24 +0000 (UTC) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mx.groups.io with SMTP id smtpd.web12.11665.1647620603378596056 for ; Fri, 18 Mar 2022 09:23:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=fCy9jaJA; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.48, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f48.google.com with SMTP id r64so5112378wmr.4 for ; Fri, 18 Mar 2022 09:23:23 -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=geftKmjUuH5oJQ6X6rJL8AX48M/XRQM3ty2G54qlDsM=; b=fCy9jaJAIN8ykn+5ZOM2DKUdm4Rmq4gVprc4lEZRVOl3vHHOtzWxwlYfQqjpkZJmjx ndF4YmFf9h3RIMEkxzxUtTFmCTBzQhEbBLyMFq4uy6Lpy0XLHB70mjOkQVNcXtlHgc2B VDHprQN5+yJ2jQyPt2WNzKt/aqJ51lyPC4PG4= 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=geftKmjUuH5oJQ6X6rJL8AX48M/XRQM3ty2G54qlDsM=; b=PQ5dn03/f1ub42+q9JgVTSMeZdcJ3Cqtrk5oYNrt381pzI+0czGnBiFoW41LcK9B/D W1T9PiwxflwCY0ft45JwxbtqNwMOpBvjPBEhLikwNNLtnfoT9lXhqJIWtcjgMpBzBOJd uaSsQ6vbn9FWjj0IFfqkVrcYqN0pwwkSZXXalq6gZYIn23sToZzepQWwX3DkoRgiaNLn ZmTPJtehc5s/lwhhMsJDMLy6jjh7GzvQiZLemPD4cX+7rMCcTBbg2cJH0560gRSht38v aserQiXAxRgXP3pQdyGI9NUwsI5z48nmxSnlyBu9r7+vxLTD+NwY7MLI8arLCwk6hLoF z//A== X-Gm-Message-State: AOAM532+NtDkmNWoyQQ+zPkTGfYP7jgdzjXiTqB8uj5ad3a6+ocJ31MS vNbbHp7TSQGS6fZoYz5WAkhU0BZYpCZhDqbj X-Google-Smtp-Source: ABdhPJy/PDPUS5HOoWZkgk3OndTucitUO5F9ht3WmW3KXEzDk1nVRXrZqDNqUCzlk8J1i4Te37L3Tg== X-Received: by 2002:a05:600c:589:b0:389:a59e:a53d with SMTP id o9-20020a05600c058900b00389a59ea53dmr16496377wmd.28.1647620601363; Fri, 18 Mar 2022 09:23:21 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:ac92:797e:3dcd:ed37]) by smtp.gmail.com with ESMTPSA id o14-20020a5d47ce000000b00203e0a21c16sm8018567wrc.3.2022.03.18.09.23.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 09:23:20 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH] set_versions/switchers.js: Allow switchers.js version information to be autogenerated Date: Fri, 18 Mar 2022 16:23:20 +0000 Message-Id: <20220318162320.1072462-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 ; Fri, 18 Mar 2022 16:23:24 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2639 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 | 21 +++++++++++++++++++ .../{switchers.js => switchers.js.in} | 8 +------ 3 files changed, 23 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 6452aeb14..9cd0de46c 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,23 @@ 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] + print(str(versions)) + 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 = {