From 9b8e995e3b75a1b30775a572045e7f0ff9d71b5d Mon Sep 17 00:00:00 2001 From: Dave Page Date: Thu, 3 Dec 2026 16:19:32 +0000 Subject: [PATCH] Take the repository README's history from the live tree as well as the archive, so promoting a new platform's first release does not fail. --- pkg/linux/PLATFORMS.md | 14 +++------ pkg/publish/install-repo-readme.py | 50 +++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/pkg/linux/PLATFORMS.md b/pkg/linux/PLATFORMS.md index 4dba354eebb..acc0db3c4a3 100644 --- a/pkg/linux/PLATFORMS.md +++ b/pkg/linux/PLATFORMS.md @@ -89,16 +89,10 @@ the new matrix leg proves it. ### The first release that carries it -`rebuild-readme` builds the production README's history from the archive -bucket, and exits with ` is published but absent from the archive` -when a platform in the live tree has never been copied there. Promotion runs -`rebuild-readme` in "Publish the packages", before `sync-s3` copies the -release to the archive in "Update the website", so the first promotion after -adding a platform fails at that point, with the packages already live but the -website not updated. Until that ordering is changed, expect it: run -`pga-publish sync-s3` by hand on the download server, then rerun -`pga-publish rebuild-readme` for the affected kind and finish the website -steps. +Nothing extra is needed. `rebuild-readme` runs during promotion, before +`sync-s3` copies the release to the archive bucket, so it takes each +platform's history from the archive and the live tree together, and a new +platform is listed with the release that first carried it. ### Elsewhere diff --git a/pkg/publish/install-repo-readme.py b/pkg/publish/install-repo-readme.py index cd8dff29be2..158221306fd 100755 --- a/pkg/publish/install-repo-readme.py +++ b/pkg/publish/install-repo-readme.py @@ -142,7 +142,8 @@ def collect(keys, kind): def scan_tree(root, kind): - """{platform: set(arches)} for the repositories present in a tree.""" + """{platform: {"arches": set, "versions": set}} for the repositories + present in a tree, in the same form as collect().""" base = os.path.join(root, kind) if not os.path.isdir(base): sys.exit("No such repository tree: %s" % base) @@ -156,11 +157,11 @@ def scan_tree(root, kind): for entry in sorted(os.listdir(main)): if not entry.startswith("binary-"): continue - directory = os.path.join(main, entry) - if any(DEB.match(f) and DEB.match(f).group("package") - in VERSIONED_PACKAGES for f in os.listdir(directory)): - found.setdefault(codename, set()).add( - entry[len("binary-"):]) + versions = package_versions( + DEB, os.listdir(os.path.join(main, entry))) + if versions: + add_found(found, codename, entry[len("binary-"):], + versions) else: for family in sorted(os.listdir(base)): directory = os.path.join(base, family) @@ -173,12 +174,28 @@ def scan_tree(root, kind): if not os.path.isdir(full) or os.path.islink(full): continue platform, _, arch = tree.rpartition("-") - if any(RPM.match(f) and RPM.match(f).group("package") - in VERSIONED_PACKAGES for f in os.listdir(full)): - found.setdefault(platform, set()).add(arch) + versions = package_versions(RPM, os.listdir(full)) + if versions: + add_found(found, platform, arch, versions) return found +def package_versions(pattern, filenames): + """The pgAdmin versions of the versioned packages among filenames.""" + versions = set() + for filename in filenames: + match = pattern.match(filename) + if match and match.group("package") in VERSIONED_PACKAGES: + versions.add(upstream_version(match.group("version"))) + return versions + + +def add_found(found, platform, arch, versions): + entry = found.setdefault(platform, {"arches": set(), "versions": set()}) + entry["arches"].add(arch) + entry["versions"] |= versions + + def render_table(headings, rows): """An ASCII table in the style the hand-written READMEs used.""" if not rows: @@ -228,15 +245,18 @@ def main(): if args.no_archive: supported = render_table( ["Platform", "Architecture"], - [[p, " ".join(sorted(present[p]))] + [[p, " ".join(sorted(present[p]["arches"]))] for p in sorted(present, key=platform_key)]) else: + # The history is the archive plus the live tree. The archive alone is + # a release behind during a promotion, which runs this before + # sync-s3, so a platform that first appears in the release being + # promoted is not in it yet; the live tree has it, and never loses a + # package, so the union gives the same first release either way. history = collect(archive_keys(args.object_list), args.kind) - for platform in present: - if platform not in history: - sys.exit("%s is published but absent from the archive; the " - "archive sync has probably not run since it was " - "added" % platform) + for platform, entry in present.items(): + for arch in entry["arches"]: + add_found(history, platform, arch, entry["versions"]) supported_rows, archived_rows = [], [] for platform in sorted(history, key=platform_key):