You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/10/22 11:10:04 UTC

(tooling-trusted-releases) 02/02: #1750 - update attic page and a couple of small fixes

This is an automated email from the ASF dual-hosted git repository.

alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git

commit 6d418771011d97727b0a050f9928151191063a1b
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Thu Oct 22 12:09:31 2026 +0100

    #1750 - update attic page and a couple of small fixes
---
 atr/catalog_site.py                   | 109 +++++++++++++++++++++++++++-------
 atr/datasources/apache.py             |   5 +-
 atr/templates/catalog_site/attic.html |  62 ++++++++++++++++++-
 3 files changed, 149 insertions(+), 27 deletions(-)

diff --git a/atr/catalog_site.py b/atr/catalog_site.py
index a3a3b793..aefd894a 100644
--- a/atr/catalog_site.py
+++ b/atr/catalog_site.py
@@ -182,6 +182,26 @@ class _ProjectLink:
     target: str
 
 
+@dataclasses.dataclass
+class _AtticProject:
+    # One retired project on the Attic page, opening at its archive
+    name: str
+    href: str
+    release_count: int
+    last_date: datetime.datetime | None
+
+
+@dataclasses.dataclass
+class _AtticEntry:
+    # A retired PMC (or one of the Attic's own projects), with the subprojects it kept
+    name: str
+    href: str
+    retired: datetime.datetime | None
+    release_count: int
+    last_date: datetime.datetime | None
+    subprojects: list[_AtticProject]
+
+
 @dataclasses.dataclass
 class _CommitteeSummary:
     release_count: int
@@ -194,6 +214,7 @@ class _SubprojectSummary:
     release_count: int
     latest_date: datetime.datetime | None
     has_archived: bool
+    archived_count: int
     # The most recent archived release's date, for a subproject with nothing current left
     last_archived_date: datetime.datetime | None
 
@@ -418,6 +439,61 @@ def _artifact_subpaths(version: api.CatalogVersion, pmc: str, project: str) -> I
     yield from _unique(derived)
 
 
+async def _attic_committee_entry(data: db.Session, committee: sql.Committee) -> _AtticEntry:
+    # The committee's own-named project is its TLP, the rest are its subprojects. With no TLP
+    # the entry opens at the committee page instead
+    members = sorted(committee.projects, key=lambda project: project.display_name.lower())
+    tlp = next((project for project in members if project.key == committee.key), None)
+    own = await _attic_project(data, tlp) if tlp is not None else None
+    subprojects = [await _attic_project(data, project) for project in members if project is not tlp]
+    counted = [own, *subprojects] if own is not None else subprojects
+    return _AtticEntry(
+        name=committee.display_name,
+        href=own.href if own is not None else f"../{committee.key}/index.html",
+        retired=committee.archived,
+        release_count=sum(project.release_count for project in counted),
+        last_date=max((project.last_date for project in counted if project.last_date is not None), default=None),
+        subprojects=subprojects,
+    )
+
+
+async def _attic_entries(
+    data: db.Session, projects: Sequence[sql.Project], committees: Sequence[sql.Committee]
+) -> list[_AtticEntry]:
+    # A retired PMC is filed either under the Attic itself or as a committee that kept its own
+    # key. The Attic's own projects have no committee date, so they're entries on their own
+    entries: list[_AtticEntry] = []
+    for project in projects:
+        own = await _attic_project(data, project)
+        entries.append(
+            _AtticEntry(
+                name=own.name,
+                href=own.href,
+                retired=None,
+                release_count=own.release_count,
+                last_date=own.last_date,
+                subprojects=[],
+            )
+        )
+    for committee in committees:
+        entries.append(await _attic_committee_entry(data, committee))
+    entries.sort(key=lambda entry: entry.name.lower())
+    return entries
+
+
+async def _attic_project(data: db.Session, project: sql.Project) -> _AtticProject:
+    # Current and archived releases both count - a retired project can still hold one that was
+    # never archived itself
+    summary = await _subproject_summary(data, project)
+    dates = [date for date in (summary.latest_date, summary.last_archived_date) if date is not None]
+    return _AtticProject(
+        name=project.display_name,
+        href=f"../{project.key}/archive.html",
+        release_count=summary.release_count + summary.archived_count,
+        last_date=max(dates, default=None),
+    )
+
+
 def _categories(commas: str | None) -> str | None:
     # ATR stores these comma-separated, sometimes with a space and sometimes without;
     # projects.json wants ", " between them. Placeholder tokens are dropped along the way.
@@ -496,10 +572,6 @@ async def _guarded_write(description: str, work: Awaitable[None]) -> None:
         log.exception(f"Failed to render catalog site {description}")
 
 
-def _has_live_project(committee: sql.Committee) -> bool:
-    return any(project.status in _LIVE_PROJECT_STATUSES for project in committee.projects)
-
-
 def _heatmap_url(url: str | None) -> str | None:
     if not url:
         return None
@@ -736,6 +808,7 @@ async def _subproject_summary(data: db.Session, project: sql.Project) -> _Subpro
         release_count=len(current),
         latest_date=_latest_release_date(current),
         has_archived=bool(archived),
+        archived_count=len(archived),
         last_archived_date=_latest_release_date(archived),
     )
 
@@ -792,19 +865,13 @@ async def _write_assets(site_dir: safe.StatePath) -> None:
 
 
 async def _write_attic_index(
+    data: db.Session,
     site_dir: safe.StatePath,
     attic: sql.Committee,
     projects: Sequence[sql.Project],
     committees: Sequence[sql.Committee],
 ) -> None:
-    # A retired PMC is filed either under the Attic itself or as a committee that kept its own
-    # key. Either way it's the projects a reader wants, so both are flattened into one list by
-    # their "Apache ..." name, each opening at its archive.
-    retired_projects = list(projects)
-    for committee in committees:
-        retired_projects.extend(committee.projects)
-    entries = [(project.display_name, f"../{project.key}/archive.html") for project in retired_projects]
-    entries.sort(key=lambda entry: entry[0].lower())
+    entries = await _attic_entries(data, projects, committees)
     html = _ENVIRONMENT.get_template("attic.html").render(committee=attic, entries=entries, root="../")
     await _write(site_dir / attic.key / "index.html", html)
 
@@ -833,7 +900,7 @@ async def _write_committee_index(
         subprojects=current,
         archived_subprojects=archived,
         subproject_summaries=await _subproject_summaries(data, (*current, *archived)),
-        retired=not current,
+        retired=committee.is_archived,
         keys_url=paths.committee_keys_url(committee),
         root="../",
     )
@@ -922,12 +989,12 @@ async def _write_index_pages(data: db.Session, site_dir: safe.StatePath, committ
         elif committee.key == _ATTIC_COMMITTEE_KEY:
             attic = committee
         elif committee.is_podling:
-            (current_podlings if _has_live_project(committee) else retired_podlings).append(committee)
-        elif _has_live_project(committee):
-            current.append(committee)
-        else:
-            # Nothing left to release, so it belongs with the rest of the Attic
+            (retired_podlings if committee.is_archived else current_podlings).append(committee)
+        elif committee.is_archived:
+            # Retirement is the committee's own flag - a new PMC with no project yet is still current
             retired_committees.append(committee)
+        else:
+            current.append(committee)
     # Each index is written on its own, so a failure rendering one doesn't starve the
     # others - above all the front page, which comes last and is the page most missed.
     # The committee is still listed even if its own index failed to render this pass;
@@ -938,11 +1005,11 @@ async def _write_index_pages(data: db.Session, site_dir: safe.StatePath, committ
         )
         current.append(incubator)
     if attic is not None:
-        attic_index = _write_attic_index(site_dir, attic, list(attic.projects), retired_committees)
+        attic_index = _write_attic_index(data, site_dir, attic, list(attic.projects), retired_committees)
         await _guarded_write("Attic index", attic_index)
         current.append(attic)
-    # A committee whose projects have all retired keeps its pages, but drops off the
-    # front page, so the index stays a list of where releases are still coming from.
+    # A retired committee keeps its pages, but drops off the front page, so the index
+    # stays a list of where releases are still coming from.
     await _guarded_write("front page", _write_front_page(data, site_dir, committees, current))
 
 
diff --git a/atr/datasources/apache.py b/atr/datasources/apache.py
index cc8ea81f..85a7c8e5 100644
--- a/atr/datasources/apache.py
+++ b/atr/datasources/apache.py
@@ -446,10 +446,9 @@ async def update_metadata(include_projects: bool = False) -> tuple[int, int]:
 
 
 def _coerce_https(url: str | None) -> str | None:
+    # Only the scheme changes - a host with "http" in it (httpcomponents, httpd) is left alone
     if type(url) is str:
-        if "http://" in url:
-            return url.replace("http", "https")
-        return url
+        return url.replace("http://", "https://", 1)
     return None
 
 
diff --git a/atr/templates/catalog_site/attic.html b/atr/templates/catalog_site/attic.html
index dbf8bdca..a280f195 100644
--- a/atr/templates/catalog_site/attic.html
+++ b/atr/templates/catalog_site/attic.html
@@ -4,16 +4,72 @@
 
 {%- block description -%}Apache projects that have retired to the Attic.{%- endblock description -%}
 
+{% macro history(release_count, last_date) -%}
+  {%- if release_count -%}
+    {{ release_count }} release{{ "s" if release_count != 1 else "" }}{% if last_date %} &middot; last {{ last_date.strftime("%Y-%m-%d") }}{% endif %}
+  {%- else -%}
+    No catalogued releases
+  {%- endif -%}
+{%- endmacro %}
+
 {% block content %}
   <p class="mb-1"><a href="{{ root }}index.html" class="atr-back-link">&larr; Release catalog</a></p>
   <h1 class="mb-3">{{ committee.display_name }}</h1>
+  <p class="text-muted">
+    Projects that have retired to the Attic: each link opens the project's archived releases.
+  </p>
   {% if entries %}
-    <div class="list-group">
-      {% for name, href in entries %}
-        <a class="list-group-item list-group-item-action" href="{{ href }}">{{ name }}</a>
+    <div class="mb-3">
+      <input type="text"
+             id="project-filter"
+             aria-label="Committee or project name filter"
+             class="form-control d-inline-block w-auto" />
+      <button type="button" class="btn btn-primary" id="filter-button">Filter</button>
+    </div>
+    <div class="mb-3">
+      <p>
+        Total count: <span id="committee-count">{{ entries|length }}</span>
+      </p>
+    </div>
+    <div class="d-flex flex-column gap-2">
+      {% for entry in entries %}
+        {# The filter hides a card through its parent, so each one gets a wrapper of its own #}
+        <div>
+          <div class="card page-committee-card">
+            <div class="card-body py-2">
+              <div class="d-flex justify-content-between align-items-baseline flex-wrap gap-2">
+                <a href="{{ entry.href }}" class="card-title fs-5 mb-0 text-decoration-none">{{ entry.name }}</a>
+                <span class="text-muted small">
+                  {%- if entry.retired %}Retired {{ entry.retired.strftime("%Y") }} &middot; {% endif -%}
+                  {{ history(entry.release_count, entry.last_date) }}
+                </span>
+              </div>
+              {% if entry.subprojects %}
+                {# The names ride along as data so a search for a subproject finds its committee #}
+                <ul class="list-unstyled ms-3 mt-2 mb-0 small">
+                  {% for subproject in entry.subprojects %}
+                    <li class="d-flex justify-content-between flex-wrap gap-2" data-project-name="{{ subproject.name }}">
+                      <a href="{{ subproject.href }}">{{ subproject.name }}</a>
+                      <span class="text-muted">{{ history(subproject.release_count, subproject.last_date) }}</span>
+                    </li>
+                  {% endfor %}
+                </ul>
+              {% endif %}
+            </div>
+          </div>
+        </div>
       {% endfor %}
     </div>
   {% else %}
     <p class="text-muted">No retired projects.</p>
   {% endif %}
 {% endblock content %}
+
+{% block scripts %}
+  <script src="{{ root }}assets/js/src/card-grid.js"></script>
+  <script>
+    document.addEventListener("DOMContentLoaded", () => {
+      initCardGrid({ cardSelector: ".page-committee-card", countId: "committee-count", noun: "committees" });
+    });
+  </script>
+{% endblock scripts %}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org