From patchwork Fri Mar 18 16:29:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 5475 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 1B139C433FE for ; Fri, 18 Mar 2022 16:29:50 +0000 (UTC) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.groups.io with SMTP id smtpd.web09.11940.1647620988795506299 for ; Fri, 18 Mar 2022 09:29:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=fHEGR68L; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.47, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f47.google.com with SMTP id p9so12386772wra.12 for ; Fri, 18 Mar 2022 09:29:48 -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=ArRqbk6U6aqonlXeCEco18TIAgXPMlMO0jj2hfKhMiU=; b=fHEGR68L+I5Am7IAFyUTBRlxfjuQMFhadGOknBAn0ZVO27SMkYZYbA6FnbV0f392B9 BkGjiXNIiEzAUzFI4Ttljh7x6kd/M0pNe0CVsynYb+U0NljwXjnBDuOB5S4TtnEwe5kn bSmPL/n+IS/2UzpuvtxbUBgj3LVg3b/2FXvyk= 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=ArRqbk6U6aqonlXeCEco18TIAgXPMlMO0jj2hfKhMiU=; b=KlNKvwdzy/vCok9H5sMUTX2JlMvkjKrk/qKnHZgA+uNM/LBk2aUViK9HMoFHwl5d39 Y/ZKg4qzXlNapaRTlX8v0P4poOgiwbF0VqyukZP5P0Pij/5plCN8Xm+EMXD71t3pDRNA mxEA3NCAXB0JJzaeKQnY8WWRfX/LbcRcW19Z27UVA3dAApCMlXiw/kiblUk07wwrniyC B4OAcmHczmHAscLVt0A+pu1TyISnIFRpSBO+Ej8AE39InMvDyEa2txzAONQX0Tjfyp9s Sgy3HZkG7dvkEaCcsc49iUpclvje1FWl5tQAMnz0KK4S4hhyNZIiIprYmaxNdbFEcQ10 uLjQ== X-Gm-Message-State: AOAM5321eD7t8RxCVck5wd6CIlW4gw8UfuQ6HoOvKMc+yVxQgCrRiLZT PO6McChW43JMj0Wuvzts0ho4cnHNOMCH7kK9 X-Google-Smtp-Source: ABdhPJzTsHf/eKH8207l0n/v0S8LlsVfCw/jfogeOdXmRzrStWpBALPX2GmclKbneBhDK5oA65Tckw== X-Received: by 2002:a05:6000:1083:b0:203:fbd3:937e with SMTP id y3-20020a056000108300b00203fbd3937emr1289119wrw.139.1647620986718; Fri, 18 Mar 2022 09:29:46 -0700 (PDT) Received: from hex.int.rpsys.net ([2001:8b0:aba:5f3c:ac92:797e:3dcd:ed37]) by smtp.gmail.com with ESMTPSA id v2-20020adf8b42000000b001edc38024c9sm7397469wra.65.2022.03.18.09.29.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Mar 2022 09:29:46 -0700 (PDT) From: Richard Purdie To: docs@lists.yoctoproject.org Subject: [PATCH 1/2] set_versions/switchers.js: Allow switchers.js version information to be autogenerated Date: Fri, 18 Mar 2022 16:29:44 +0000 Message-Id: <20220318162945.1072835-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:29:50 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/docs/message/2641 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 6452aeb14..d9f57112b 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 = {