diff mbox series

layerindex: branchcompare: add rST format

Message ID 20251127-branch-compare-rst-v1-1-70c00ab5c149@bootlin.com
State New
Headers show
Series layerindex: branchcompare: add rST format | expand

Commit Message

Antonin Godard Nov. 27, 2025, 3:44 p.m. UTC
Add a new rST output format for the branch comparison tool. This can be
used to help write the Yocto Project release notes.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
An existing example (that I formatted manually at the time):
https://git.yoctoproject.org/yocto-docs/tree/documentation/migration-guides/release-notes-5.2.rst?id=79cd33b06e87c04e4f873a5afd9d53714bc5047f#n876

HTML output: https://docs.yoctoproject.org/5.2.4/migration-guides/release-notes-5.2.html#recipe-upgrades-in-yocto-ver
---
 layerindex/urls.py                         |  5 +++++
 templates/layerindex/branchcompare.html    |  1 +
 templates/layerindex/branchcompare_rst.txt | 35 ++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+)


---
base-commit: 459e8d6f1f18528a835513f12dffcc999c8f7fb5
change-id: 20251127-branch-compare-rst-e26338eefd53

Comments

Antonin Godard Nov. 27, 2025, 3:47 p.m. UTC | #1
Sorry, this is missing [layerindex-web] before the subject, I will resend it.

Antonin
diff mbox series

Patch

diff --git a/layerindex/urls.py b/layerindex/urls.py
index 80ceaa7..3b95a88 100644
--- a/layerindex/urls.py
+++ b/layerindex/urls.py
@@ -195,6 +195,11 @@  urlpatterns = [
             content_type='text/plain; charset=utf-8',
             template_name='layerindex/branchcompare_plain.txt'),
         name='branch_comparison_plain'),
+    re_path(r'^branch_comparison_rst/$',
+        BranchCompareView.as_view(
+            content_type='text/plain; charset=utf-8',
+            template_name='layerindex/branchcompare_rst.txt'),
+        name='branch_comparison_rst'),
     re_path(r'^recipe_deps/$',
         RecipeDependenciesView.as_view(
             template_name='layerindex/recipedeps.html'),
diff --git a/templates/layerindex/branchcompare.html b/templates/layerindex/branchcompare.html
index 56b2310..93ac801 100644
--- a/templates/layerindex/branchcompare.html
+++ b/templates/layerindex/branchcompare.html
@@ -151,6 +151,7 @@ 
 
     <span class="pull-right">
     <a class="btn btn-default" href="{% url 'branch_comparison_plain' %}?{{ request.GET.urlencode }}"><i class="glyphicon glyphicon-file"></i> Plain text</a>
+    <a class="btn btn-default" href="{% url 'branch_comparison_rst' %}?{{ request.GET.urlencode }}"><i class="glyphicon glyphicon-file"></i> rST</a>
     </span>
 
 
diff --git a/templates/layerindex/branchcompare_rst.txt b/templates/layerindex/branchcompare_rst.txt
new file mode 100644
index 0000000..1e61848
--- /dev/null
+++ b/templates/layerindex/branchcompare_rst.txt
@@ -0,0 +1,35 @@ 
+From {{ from_branch }} to {{ to_branch }} (layers: {{ showlayers_text }})
+
+Added
+-----
+
+.. list-table::
+   :widths: 30 70
+   :header-rows: 1
+
+   * - Recipe
+     - Version(s)
+{% for recipe in added %}   * - ``{{ recipe.pn }}``
+     - {% for rv in recipe.to_versions %}{{ rv.pv }}{% if not forloop.last %}, {% endif %}{% endfor %}
+{% endfor %}
+
+Changed
+-------
+
+.. list-table::
+   :widths: 20 40 40
+   :header-rows: 1
+
+   * - Recipe
+     - Previous version(s)
+     - New version(s)
+{% for recipe in changed %}{% with pv_changed=recipe.pv_changed %}   * - ``{{ recipe.pn }}``
+     - {% for rv in recipe.from_versions %}{{ rv.pv }}{% if rv.srcrev and not pv_changed %} ({{ rv.srcrev|truncatechars:13 }}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
+     - {% for rv in recipe.to_versions %}{{ rv.pv }}{% if rv.srcrev and not pv_changed %} ({{ rv.srcrev|truncatechars:13 }}){% endif %}{% if not forloop.last %}, {% endif %}{% endfor %}
+{% endwith %}{% endfor %}
+
+Removed
+-------
+
+{% for recipe in removed %}-  ``{{ recipe.pn }}``
+{% endfor %}