radv: remove unnecessary LLVM includes
[mesa.git] / bin / gen_release_notes.py
index 3509879fa6fa02822600dc56472cf16956f56ab2..f104e996049041d415ae67551dd68b2c3216fa00 100755 (executable)
@@ -25,6 +25,7 @@ import asyncio
 import datetime
 import os
 import pathlib
+import sys
 import textwrap
 import typing
 import urllib.parse
@@ -35,9 +36,12 @@ from mako import exceptions
 
 
 CURRENT_GL_VERSION = '4.6'
-CURRENT_VK_VERSION = '1.1'
+CURRENT_VK_VERSION = '1.2'
 
 TEMPLATE = Template(textwrap.dedent("""\
+    <%!
+        import html
+    %>
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     <html lang="en">
     <head>
@@ -54,19 +58,19 @@ TEMPLATE = Template(textwrap.dedent("""\
     <iframe src="../contents.html"></iframe>
     <div class="content">
 
-    <h1>Mesa ${next_version} Release Notes / ${today}</h1>
+    <h1>Mesa ${this_version} Release Notes / ${today}</h1>
 
     <p>
-    %if bugfix:
-        Mesa ${next_version} is a new development release. People who are concerned
+    %if not bugfix:
+        Mesa ${this_version} is a new development release. People who are concerned
         with stability and reliability should stick with a previous release or
-        wait for Mesa ${version[:-1]}1.
+        wait for Mesa ${this_version[:-1]}1.
     %else:
-        Mesa ${next_version} is a bug fix release which fixes bugs found since the ${version} release.
+        Mesa ${this_version} is a bug fix release which fixes bugs found since the ${previous_version} release.
     %endif
     </p>
     <p>
-    Mesa ${next_version} implements the OpenGL ${gl_version} API, but the version reported by
+    Mesa ${this_version} implements the OpenGL ${gl_version} API, but the version reported by
     glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
     glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
     Some drivers don't support all the features required in OpenGL ${gl_version}. OpenGL
@@ -74,7 +78,7 @@ TEMPLATE = Template(textwrap.dedent("""\
     Compatibility contexts may report a lower version depending on each driver.
     </p>
     <p>
-    Mesa ${next_version} implements the Vulkan ${vk_version} API, but the version reported by
+    Mesa ${this_version} implements the Vulkan ${vk_version} API, but the version reported by
     the apiVersion property of the VkPhysicalDeviceProperties struct
     depends on the particular driver being used.
     </p>
@@ -89,7 +93,7 @@ TEMPLATE = Template(textwrap.dedent("""\
 
     <ul>
     %for f in features:
-        <li>${f}</li>
+        <li>${html.escape(f)}</li>
     %endfor
     </ul>
 
@@ -97,7 +101,7 @@ TEMPLATE = Template(textwrap.dedent("""\
 
     <ul>
     %for b in bugs:
-        <li>${b}</li>
+        <li>${html.escape(b)}</li>
     %endfor
     </ul>
 
@@ -106,9 +110,9 @@ TEMPLATE = Template(textwrap.dedent("""\
     <ul>
     %for c, author in changes:
       %if author:
-        <p>${c}</p>
+        <p>${html.escape(c)}</p>
       %else:
-        <li>${c}</li>
+        <li>${html.escape(c)}</li>
       %endif
     %endfor
     </ul>
@@ -121,7 +125,7 @@ TEMPLATE = Template(textwrap.dedent("""\
 
 async def gather_commits(version: str) -> str:
     p = await asyncio.create_subprocess_exec(
-        'git', 'log', f'mesa-{version}..', '--grep', r'Closes: \(https\|#\).*',
+        'git', 'log', '--oneline', f'mesa-{version}..', '--grep', r'Closes: \(https\|#\).*',
         stdout=asyncio.subprocess.PIPE)
     out, _ = await p.communicate()
     assert p.returncode == 0, f"git log didn't work: {version}"
@@ -149,7 +153,7 @@ async def gather_bugs(version: str) -> typing.List[str]:
             # This means we have a bug in the form "Closes: https://..."
             issues.append(os.path.basename(urllib.parse.urlparse(bug).path))
         else:
-            issues.append(bug)
+            issues.append(bug.lstrip('#'))
 
     loop = asyncio.get_event_loop()
     async with aiohttp.ClientSession(loop=loop) as session:
@@ -218,12 +222,16 @@ def calculate_previous_version(version: str, is_point: bool) -> str:
     return '.'.join(base)
 
 
-def get_features() -> typing.Generator[str, None, None]:
+def get_features(is_point_release: bool) -> typing.Generator[str, None, None]:
     p = pathlib.Path(__file__).parent.parent / 'docs' / 'relnotes' / 'new_features.txt'
     if p.exists():
+        if is_point_release:
+            print("WARNING: new features being introduced in a point release", file=sys.stderr)
         with p.open('rt') as f:
             for line in f:
                 yield line
+    else:
+        yield "None"
 
 
 async def main() -> None:
@@ -234,25 +242,25 @@ async def main() -> None:
     assert '-devel' not in raw_version, 'Do not run this script on -devel'
     version = raw_version.split('-')[0]
     previous_version = calculate_previous_version(version, is_point_release)
-    next_version = calculate_next_version(version, is_point_release)
+    this_version = calculate_next_version(version, is_point_release)
 
     shortlog, bugs = await asyncio.gather(
         get_shortlog(previous_version),
         gather_bugs(previous_version),
     )
 
-    final = pathlib.Path(__file__).parent.parent / 'docs' / 'relnotes' / f'{next_version}.html'
+    final = pathlib.Path(__file__).parent.parent / 'docs' / 'relnotes' / f'{this_version}.html'
     with final.open('wt') as f:
         try:
             f.write(TEMPLATE.render(
                 bugfix=is_point_release,
                 bugs=bugs,
                 changes=walk_shortlog(shortlog),
-                features=get_features(),
+                features=get_features(is_point_release),
                 gl_version=CURRENT_GL_VERSION,
-                next_version=next_version,
+                this_version=this_version,
                 today=datetime.date.today(),
-                version=previous_version,
+                previous_version=previous_version,
                 vk_version=CURRENT_VK_VERSION,
             ))
         except: