All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Antonin Godard" <antonin.godard@bootlin.com>
To: "Quentin Schulz" <quentin.schulz@cherry.de>,
	<docs@lists.yoctoproject.org>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [docs] [PATCH 1/3] tools/gen-releases-svg: add script
Date: Wed, 18 Nov 2026 17:24:49 +0100	[thread overview]
Message-ID: <DMYH5TW61WRN.200Z8HFGKA2IL@bootlin.com> (raw)
In-Reply-To: <bef9eadf-6fa6-4ddf-8fac-508e6593e80d@cherry.de>

Hi,

On Mon Nov 9, 2026 at 2:20 PM CET, Quentin Schulz wrote:
> Hi Antonin,
>
> On 10/22/26 3:37 PM, Antonin Godard via lists.yoctoproject.org wrote:
>> Add a script that can be used to generate the releases.svg diagram by
>> parsing the releases.json file available at
>> https://dashboard.yoctoproject.org/releases.json.
>> 
>> This should be done periodically when new releases come out.
>> 
>> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
>> ---
>>   documentation/tools/gen-releases-svg | 95 ++++++++++++++++++++++++++++++++++++
>>   1 file changed, 95 insertions(+)
>> 
>> diff --git a/documentation/tools/gen-releases-svg b/documentation/tools/gen-releases-svg
>> new file mode 100755
>> index 000000000..e091c02de
>> --- /dev/null
>> +++ b/documentation/tools/gen-releases-svg
>> @@ -0,0 +1,95 @@
>> +#!/usr/bin/env python3
>> +#
>> +# Parse releases.json (from https://dashboard.yoctoproject.org/releases.json)
>> +# and output a Gantt diagram that shows the state of releases.
>> +#
>> +# Copyright (c) Antonin Godard
>> +#
>> +# SPDX-License-Identifier: MIT
>> +#
>> +
>> +import argparse
>> +import datetime
>> +import json
>> +import shutil
>> +import subprocess
>> +import sys
>> +import tempfile
>> +
>> +from pathlib import Path
>> +
>> +parser = argparse.ArgumentParser(
>> +    description="Parse releases.json and output a releases.svg file"
>> +)
>> +parser.add_argument("-i", help="Path to the releases.json file", dest="releases_json_path",
>> +                    default=Path(__file__).resolve().parent.parent / "releases.json")
>> +parser.add_argument("-o", help="Path to the output SVG", dest="output",
>> +                    default=Path(__file__).resolve().parent.parent / "ref-manual/svg/releases.svg")
>
> issue: missing required=True

Both options have a default value, the script can be called without passing
those, so I don't think we need 'required' here?

> Your script will happily be called without arguments and will fail later 
> on, c.f. https://docs.python.org/3/library/argparse.html#required. I 
> recommend to either replace -i/-o with RELEASES_JSON/OUTPUT to highlight 
> they aren't optional options, or add required=True to highlight the 
> flags aren't optional.
>
>> +args = parser.parse_args()
>> +
>> +if not shutil.which("mmdc"):
>> +    sys.exit("mermaid-cli is required for this script to run")
>> +
>> +MMD_HEADER = """---
>> +config:
>> +  fontFamily: '"Nimbus Sans", Helvetica, Arial, sans-serif'
>> +  gantt:
>> +    leftPadding: 5
>> +    useWidth: 1600
>> +    useMaxWidth: false
>> +  themeVariables:
>> +      activeTaskBkgColor: '#edf5f9'
>> +      activeTaskBorderColor: '#00557d'
>> +      sectionBkgColor: '#eff6f9'
>> +      sectionBkgColor2: '#eff6f9'
>> +---
>> +%% Generated with documentation/tools/gen-releases-mmd
>> +gantt
>> +    dateFormat YYYY-MM-DD
>> +    axisFormat %b %Y
>> +    tickInterval 6month
>> +    todayMarker off
>> +"""
>> +
>> +with open(args.releases_json_path, "r") as f:
>> +    releases_from_json = json.load(f)
>> +
>> +with tempfile.TemporaryDirectory() as tmpdir:
>> +    mmdpath = Path(tmpdir) / "diagram.mmd"
>> +    with open(mmdpath, "w", encoding="utf-8") as mmd:
>
> suggestion: replace the above three line with tempfile.NamedTemporaryFile?
>
> I don't think we care about the filename of file passed to mmdc? c.f. 
> https://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile

The thing is we need to have this file flushed/closed before we passed its path
to mmdc, which is why I think using a temp directory here makes sense

>> +        mmd.write(MMD_HEADER)
>> +
>> +        first_active_rel_found = False
>> +        for release in releases_from_json:
>> +            codename = release["release_codename"]
>> +            series_version = release["series_version"]
>> +            if release["status"] == "Active Development":
>> +                mmd.write(f"    {codename} {series_version} :done, after current_rel, 6M\n")
>> +                continue
>> +            if not release["original_release_date"]:
>> +                continue
>> +            original_release_date = datetime.datetime.strptime(release["original_release_date"], "%Y-%m-%dT%H:%M:%S%z")
>> +            if original_release_date < datetime.datetime(2022, 4, 1, tzinfo=datetime.timezone.utc):
>
> You don't explain why this date specifically. Looking at the diagram 
> currently on 
> https://docs.yoctoproject.org/ref-manual/release-process.html#long-term-support-releases 
> we have everything since kirkstone, do we want to keep all the older and 
> unmaintained releases forever in this graph or should we only keep the 
> oldest currently supported release and everything in between until 
> today? i.e. Scarthgap, Styhead, etc..., til Garburn?

I used this date to mimic the previous diagram which started from Kirkstone. But
it's true it might makes more sense to start from the oldest supported release,
hence Scarthgap as of writing.

> I also see in the graph Garburn in grey. I think it would make sense to 
> have either a different color for the current WIP branch or actively 
> mark it as in development.

I was limited to done/active as statuses with the Gantt mermaid diagram. This
is why I detailed the color meanings in the sentence above the diagram. Not sure
we can do much about it, not sure we should spend too much time on this detail
either though

>> +                continue
>> +            original_release_date = original_release_date.date().isoformat()
>> +            end_date = datetime.datetime.strptime(release["latest_release_date"], "%Y-%m-%dT%H:%M:%S%z")
>> +            end_date = end_date.date().isoformat()
>> +            lts = False
>> +            if "LTS until" in release["status"]:
>> +                lts = True
>
> nitpick: can be simplified
>
> lts = "LTS until" in release["status"]
>
>> +            status = "done"
>> +            if release["series"] == "current":
>> +                status = "active"
>> +                if not first_active_rel_found:
>> +                    status += ", current_rel"
>> +                    first_active_rel_found = True
>> +                end_date = "6M"
>> +                if lts:
>> +                    end_date = "4y"
>> +            mmd.write(f"    {codename} {series_version}{" (LTS)" if lts else ""}"
>> +                      f" :{status}, {original_release_date}, {end_date}\n")
>> +
>> +    result = subprocess.run(
>> +        ["mmdc", "--input", mmdpath, "--output", args.output],
>> +        check=True,
>> +    )
>
> You do nothing with result.
>
> suggestion: could be replaced by subprocess.check_call(["mmdc", 
> "--input", mmdpath, "--output", args.output]).

Indeed!

Will send follow-up patches, thanks

Antonin

  reply	other threads:[~2026-11-18 16:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-22 13:37 [PATCH 0/3] Convert releases.svg to an auto-generated diagram Antonin Godard
2026-10-22 13:37 ` [PATCH 1/3] tools/gen-releases-svg: add script Antonin Godard
2026-11-09 13:20   ` [docs] " Quentin Schulz
2026-11-18 16:24     ` Antonin Godard [this message]
2026-11-18 16:41       ` Quentin Schulz
2026-10-22 13:37 ` [PATCH 2/3] ref-manual/svg/releases.svg: update diagram Antonin Godard
2026-10-22 13:37 ` [PATCH 3/3] ref-manual/release-process.rst: add textual legend Antonin Godard
2026-11-09 13:24   ` [docs] " Quentin Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DMYH5TW61WRN.200Z8HFGKA2IL@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=docs@lists.yoctoproject.org \
    --cc=quentin.schulz@cherry.de \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.