diff --git a/docs/scripts/new-interim.py b/docs/scripts/new-version.py similarity index 52% rename from docs/scripts/new-interim.py rename to docs/scripts/new-version.py index 418b821..8657dcb 100755 --- a/docs/scripts/new-interim.py +++ b/docs/scripts/new-version.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 -"""Create a new interim release directory in docs/ from docs/template/interim. +"""Create a new release directory in docs/ from docs/template/{interim,lts}. -Example: - ./new-interim.py 26.10 "Stonking Stingray" --release-date 2026-10-15 +Examples: + ./new-version.py 26.10 "Stonking Stingray" --release-date 2026-10-15 + ./new-version.py 28.04 "Example Codename" --lts --release-date 2028-04-20 """ import argparse +import logging import re import sys from datetime import date @@ -13,9 +15,13 @@ from jinja2 import Environment, FileSystemLoader, StrictUndefined +logger = logging.getLogger(Path(__file__).stem) + DOCS_DIR = Path(__file__).resolve().parent.parent -TEMPLATE_DIR = DOCS_DIR / "template" / "interim" +TEMPLATE_ROOT = DOCS_DIR / "template" INTERIM_SUPPORT_MONTHS = 9 +LTS_SUPPORT_MONTHS = 5 * 12 +PLACEHOLDER_CODENAME = "codename" TEMPLATE_SUFFIX = ".jinja2" INDEX_FILE = DOCS_DIR / "index.md" DEV_CAPTION = "Currently in development" @@ -27,9 +33,23 @@ def format_month(year: int, month: int) -> str: return date(year, month, 1).strftime("%B %Y") +def previous_version(version: str, steps: int) -> str: + """Return the release `steps` half-year cycles (04/10) before version.""" + year, month = (int(part) for part in version.split(".")) + total = year * 2 + (month == 10) - steps + return f"{total // 2:02d}.{'10' if total % 2 else '04'}" + + +def find_codename(index_text: str, version: str) -> str | None: + match = re.search( + rf"^{re.escape(version)}(?: LTS)? \((.+?)\) <", index_text, re.MULTILINE + ) + return match[1] if match else None + + def parse_args() -> argparse.Namespace: parser = argparse.ArgumentParser( - description="Create a new interim release directory from the template." + description="Create a new release directory from the interim or LTS template." ) parser.add_argument("version", help="version number, e.g. 26.10") parser.add_argument("codename", help='release code name, e.g. "Stonking Stingray"') @@ -38,6 +58,18 @@ def parse_args() -> argparse.Namespace: metavar="YYYY-MM-DD", help="release date; also used to compute the end of support", ) + parser.add_argument( + "-l", + "--lts", + action="store_true", + help="use the LTS templates instead of the interim ones", + ) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + help="print debug messages", + ) parser.add_argument( "-f", "--force", @@ -45,6 +77,10 @@ def parse_args() -> argparse.Namespace: help="overwrite template files in an existing release directory", ) args = parser.parse_args() + logging.basicConfig( + format="%(levelname)s: %(message)s", + level=logging.DEBUG if args.verbose else logging.INFO, + ) if not re.fullmatch(r"\d{2}\.(04|10)", args.version): parser.error("version must look like YY.04 or YY.10") @@ -55,10 +91,49 @@ def parse_args() -> argparse.Namespace: date.fromisoformat(args.release_date) except ValueError: parser.error("--release-date is not a valid date") + + year = int(args.version[:2]) + is_lts_version = args.version.endswith(".04") and year % 2 == 0 + if is_lts_version and not args.lts: + logger.warning( + "%s is an LTS release, but --lts was not set. " + "Proceeding with the interim templates. Re-run with --lts --force " + "to overwrite the generated release notes.", + args.version, + ) + elif args.lts and not is_lts_version: + logger.warning( + "%s is not an LTS version (LTS releases are YY.04 in even years). " + "Proceeding with the LTS templates.", + args.version, + ) return args -def build_context(args: argparse.Namespace) -> dict: +def lts_context(version: str, index_text: str) -> dict: + old_interim = previous_version(version, 1) + old_lts = previous_version(version, 4) + context = { + "old_interim_version": old_interim, + "old_old_interim_version": previous_version(version, 2), + "old_old_old_interim_version": previous_version(version, 3), + "old_lts_version": old_lts, + "old_old_lts_version": previous_version(version, 8), + } + for key, old_version in (("interim", old_interim), ("lts", old_lts)): + codename = find_codename(index_text, old_version) + if codename is None: + logger.warning( + 'no codename for %s found in %s; using the placeholder "%s".', + old_version, + INDEX_FILE.name, + PLACEHOLDER_CODENAME, + ) + context[f"old_{key}_codename"] = codename or PLACEHOLDER_CODENAME + return context + + +def build_context(args: argparse.Namespace, index_text: str) -> dict: release_date = PLACEHOLDER_DATE release_month = end_of_support = PLACEHOLDER_MONTH if args.release_date: @@ -66,9 +141,10 @@ def build_context(args: argparse.Namespace) -> dict: year, month = released.year, released.month release_date = f"{released.day} {format_month(year, month)}" release_month = format_month(year, month) - total = year * 12 + (month - 1) + INTERIM_SUPPORT_MONTHS + support = LTS_SUPPORT_MONTHS if args.lts else INTERIM_SUPPORT_MONTHS + total = year * 12 + (month - 1) + support end_of_support = format_month(total // 12, total % 12 + 1) - return { + context = { "codename": args.codename, "codename_slug": "-".join(args.codename.lower().split()), "version": args.version, @@ -76,6 +152,9 @@ def build_context(args: argparse.Namespace) -> dict: "release_month": release_month, "end_of_support": end_of_support, } + if args.lts: + context.update(lts_context(args.version, index_text)) + return context def add_to_index(text: str, entry: str) -> tuple[str, list[str]]: @@ -114,51 +193,54 @@ def main() -> int: args = parse_args() target = DOCS_DIR / args.version if target.exists() and not args.force: - print( - f"Error: {target} already exists. Use -f/--force to overwrite it.", - file=sys.stderr, - ) + logger.error("%s already exists. Use -f/--force to overwrite it.", target) return 1 - context = build_context(args) index_text = INDEX_FILE.read_text(encoding="utf-8") + context = build_context(args, index_text) + template_dir = TEMPLATE_ROOT / ("lts" if args.lts else "interim") + logger.debug("Using templates from %s", template_dir) + logger.debug("Template context: %s", context) try: new_index_text, listed = add_to_index( index_text, f"{args.version} ({args.codename}) <{args.version}/index>" ) except ValueError as error: - print(f"Error: {error}", file=sys.stderr) + logger.error("%s", error) return 1 env = Environment( - loader=FileSystemLoader(TEMPLATE_DIR), + loader=FileSystemLoader([template_dir, TEMPLATE_ROOT]), undefined=StrictUndefined, keep_trailing_newline=True, ) target.mkdir(exist_ok=True) - for source in sorted(TEMPLATE_DIR.rglob("*")): + for source in sorted(template_dir.rglob("*")): if not source.is_file(): continue - relative = source.relative_to(TEMPLATE_DIR) + relative = source.relative_to(template_dir) if source.suffix == TEMPLATE_SUFFIX: relative = relative.with_suffix("") destination = target / relative destination.parent.mkdir(parents=True, exist_ok=True) + logger.debug("Writing %s", destination) if source.suffix == TEMPLATE_SUFFIX: - template = env.get_template(source.relative_to(TEMPLATE_DIR).as_posix()) + template = env.get_template(source.relative_to(template_dir).as_posix()) rendered = template.render(**context) destination.write_text(rendered, encoding="utf-8") else: destination.write_bytes(source.read_bytes()) if listed: - print( - f"Warning: {INDEX_FILE.name} already lists a release under " - f'"{DEV_CAPTION}": {", ".join(listed)}', - file=sys.stderr, + logger.warning( + '%s already lists a release under "%s": %s', + INDEX_FILE.name, + DEV_CAPTION, + ", ".join(listed), ) if new_index_text != index_text: INDEX_FILE.write_text(new_index_text, encoding="utf-8") + logger.debug("Added the release to %s", INDEX_FILE) print(f"Created {target}") return 0 diff --git a/docs/template/interim/index.md.jinja2 b/docs/template/interim/index.md.jinja2 index 9e4897b..5077df0 100644 --- a/docs/template/interim/index.md.jinja2 +++ b/docs/template/interim/index.md.jinja2 @@ -26,105 +26,11 @@ Ubuntu {{ version }} will be supported for 9 months, from {{ release_month }} un For details, see [Ubuntu release cycle](https://ubuntu.com/about/release-cycle). - ## Upgrades To upgrade from a previous Ubuntu release, refer to the [Ubuntu Desktop](https://ubuntu.com/desktop/docs/en/latest/how-to/upgrade-ubuntu-desktop/) or [Ubuntu Server](https://ubuntu.com/server/docs/how-to/software/upgrade-your-release/) guide. -## New features and improvements - -### Desktop features - -### Server features - -### Development features - -### Enterprise features - -### Cloud features - -### Security features - -### Hardware support features - -### System features - - -## Backwards-incompatible changes - -### Desktop changes - -### Server changes - -### Development changes - -### Enterprise changes - -### Cloud changes - -### Security changes - -### Hardware support changes - -### System changes - - -## Deprecated features - -### Desktop deprecations - -### Server deprecations - -### Development deprecations - -### Enterprise deprecations - -### Cloud deprecations - -### Security deprecations - -### Hardware support deprecations - -### System deprecations - - -## Bug fixes - -### Desktop fixes - -### Server fixes - -### Development fixes - -### Enterprise fixes - -### Cloud fixes - -### Security fixes - -### Hardware support fixes - -### System fixes - - -## Known issues - -### Desktop issues - -### Server issues - -### Development issues - -### Enterprise issues - -### Cloud issues - -### Security issues - -### Hardware support issues - -### System issues - +{% include "partial/release-notes.md.jinja2" %} ## Official flavors diff --git a/docs/template/lts/changes-since-previous-interim.md.jinja2 b/docs/template/lts/changes-since-previous-interim.md.jinja2 new file mode 100644 index 0000000..88293c7 --- /dev/null +++ b/docs/template/lts/changes-since-previous-interim.md.jinja2 @@ -0,0 +1,10 @@ +--- +tocdepth: 3 +--- + +(ubuntu-{{ version }}-lts-changes-since-{{ old_interim_version }})= +# Ubuntu {{ version }} LTS changes since {{ old_interim_version }} + +If you're upgrading to Ubuntu {{ version }} LTS from the previous interim release, Ubuntu {{ old_interim_version }} ({{ old_interim_codename }}), the following changes apply to you. + +{% include "partial/release-notes.md.jinja2" %} diff --git a/docs/template/lts/index.md.jinja2 b/docs/template/lts/index.md.jinja2 new file mode 100644 index 0000000..d74ebf4 --- /dev/null +++ b/docs/template/lts/index.md.jinja2 @@ -0,0 +1,119 @@ +--- +tocdepth: 3 +--- + +(ubuntu-{{ version }}-lts-release-notes)= +# Ubuntu {{ version }} LTS release notes + +:::{rubric} {{ release_date }} +::: + +These release notes cover new features and changes in Ubuntu {{ version }} LTS ({{ codename }}). + +:::{important} +Ubuntu {{ version }} LTS ({{ codename }}) is currently in development, scheduled to be released on {{ release_date }}. +::: + +For the release schedule of Ubuntu {{ version }} LTS, refer to the {ref}`release schedule <{{ codename_slug }}-schedule>`. + + +## Changes since your version of Ubuntu + +The majority of Ubuntu users upgrade every two years, following LTS releases. Other users prefer the more frequent interim releases that come out every six months. + +:::{toctree} +:hidden: +:maxdepth: 1 + +Summary for LTS users +Changes since {{ old_interim_version }} +::: + +Find the news relevant to your system: + +::::{grid} 1 1 2 2 + +:::{grid-item-card} +:link: summary-for-lts-users +:link-type: doc + +### {ref}`For Ubuntu LTS users ` + +If you're upgrading **from Ubuntu {{ old_lts_version }} LTS ({{ old_lts_codename }})**, read an overview of the major changes between the two LTS releases. +::: + +:::{grid-item-card} +:link: changes-since-previous-interim +:link-type: doc + +### {ref}`For Ubuntu interim users ` + +If you're upgrading **from Ubuntu {{ old_interim_version }} ({{ old_interim_codename }})**, read a detailed list of changes since the previous interim release. +::: +:::: + + + +## Support lifespan + +Ubuntu {{ version }} LTS is designated as a long-term support release. This means it will continue to receive security updates and critical bug fixes for five years. Ubuntu {{ version }} LTS will be supported until {{ end_of_support }}. + +With an Ubuntu Pro subscription, access to ESM (Expanded Security Maintenance) updates will be available for ten years. + +See our {ref}`release-policy-and-schedule`. + +## Upgrades + +To upgrade from a previous Ubuntu release, refer to the [Ubuntu Desktop](https://ubuntu.com/desktop/docs/en/latest/how-to/upgrade-ubuntu-desktop/) or [Ubuntu Server](https://ubuntu.com/server/docs/how-to/software/upgrade-your-release/) guide. + +:::{admonition} Upgrading from older releases +:class: note + +If you're currently using an older Ubuntu LTS or interim release, such as Ubuntu {{ old_old_lts_version }} LTS or {{ old_old_interim_version }}, you must first upgrade to either Ubuntu {{ old_lts_version }} LTS or {{ old_interim_version }} before you can proceed to {{ version }} LTS. +::: + +## Requirements and compatibility + +Ubuntu Desktop {{ version }} LTS requires a 2 GHz dual-core processor or better, a minimum of 6 GB RAM and 25 GB of free storage space for a comfortable experience. + +Although it's possible to install Ubuntu Desktop on systems with lower specifications, we recommend using an [Ubuntu flavor](https://ubuntu.com/desktop/flavors) instead in that case. For example, you can install [Xubuntu](https://xubuntu.org/) or [Lubuntu](https://lubuntu.me/) on systems with 2 GB RAM or more. + +Requirements for Ubuntu Server {{ version }} LTS [scale with your specific use case](https://ubuntu.com/server/docs/reference/installation/system-requirements/), starting as low as 1.5 GB RAM and 4 GB of storage space. + +For ISO-based installs, you will need a USB port or DVD drive for the installation media. +Alternatively, Ubuntu Server is also available as pre-built images for cloud, virtualized, +and bare-metal environments, which utilize their own deployment mechanisms. + +While an internet connection is recommended for updates and additional software, it is not required for the initial installation. + + +## Official flavors + +Find the release notes for the official flavors at the following links: + +* [Edubuntu Release Notes](https://discourse.ubuntu.com/t/...) +* [Kubuntu Release Notes](https://kubuntu.org/news/...) +* [Lubuntu Release Notes](https://lubuntu.me/...) +* [Ubuntu Budgie Release Notes](https://ubuntubudgie.org/blog/...) +* [Ubuntu Studio Release Notes](https://discourse.ubuntu.com/t/...) +* [Xubuntu Release Notes](https://xubuntu.org/releasedocs/...) +* [Ubuntu Unity Release Notes](https://ubuntuunity.org/posts/...) +* [Ubuntu Kylin Release Notes](https://ubuntukylin.com/news/...) +* [Ubuntu Cinnamon Release Notes](https://ubuntucinnamon.org/...) + +:::{toctree} +:hidden: +:maxdepth: 1 + +Release schedule +::: diff --git a/docs/template/lts/summary-for-lts-users.md.jinja2 b/docs/template/lts/summary-for-lts-users.md.jinja2 new file mode 100644 index 0000000..699c160 --- /dev/null +++ b/docs/template/lts/summary-for-lts-users.md.jinja2 @@ -0,0 +1,25 @@ +--- +tocdepth: 3 +--- + +(ubuntu-{{ version }}-lts-summary)= +# Ubuntu {{ version }} LTS summary + +If you’re upgrading **from Ubuntu {{ old_lts_version }} LTS ({{ old_lts_codename }})**, you receive the changes that happened in all the interim releases between Ubuntu {{ old_lts_version }} LTS and {{ version }} LTS, as well as the most recent changes since Ubuntu {{ old_interim_version }}. + +For details, see the complete interim release notes: {ref}`{{ old_old_old_interim_version }} `, {ref}`{{ old_old_interim_version }} ` and {ref}`{{ old_interim_version }} `. Finally, review the latest {ref}`ubuntu-{{ version }}-lts-changes-since-{{ old_interim_version }}`. + +The following is an overview of the major changes. + +{% include "partial/release-notes.md.jinja2" %} + +## More details + +You can find the {ref}`{{ codename_slug }}-known-issues` in this release on a separate page. + +For a complete list of changes in Ubuntu {{ version }} LTS, refer to the following documents, depending on the Ubuntu release that you're upgrading from: + +- {ref}`ubuntu-{{ old_old_old_interim_version }}-release-notes` +- {ref}`ubuntu-{{ old_old_interim_version }}-release-notes` +- {ref}`ubuntu-{{ old_interim_version }}-release-notes` +- {ref}`ubuntu-{{ version }}-lts-changes-since-{{ old_interim_version }}` diff --git a/docs/template/partial/release-notes.md.jinja2 b/docs/template/partial/release-notes.md.jinja2 new file mode 100644 index 0000000..b89f35d --- /dev/null +++ b/docs/template/partial/release-notes.md.jinja2 @@ -0,0 +1,89 @@ +## New features and improvements + +### Desktop features + +### Server features + +### Development features + +### Enterprise features + +### Cloud features + +### Security features + +### Hardware support features + +### System features + +## Backwards-incompatible changes + +### Desktop changes + +### Server changes + +### Development changes + +### Enterprise changes + +### Cloud changes + +### Security changes + +### Hardware support changes + +### System changes + +## Deprecated features + +### Desktop deprecations + +### Server deprecations + +### Development deprecations + +### Enterprise deprecations + +### Cloud deprecations + +### Security deprecations + +### Hardware support deprecations + +### System deprecations + +## Bug fixes + +### Desktop fixes + +### Server fixes + +### Development fixes + +### Enterprise fixes + +### Cloud fixes + +### Security fixes + +### Hardware support fixes + +### System fixes + +## Known issues + +### Desktop issues + +### Server issues + +### Development issues + +### Enterprise issues + +### Cloud issues + +### Security issues + +### Hardware support issues + +### System issues