Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions pkg/linux/PLATFORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<platform> 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

Expand Down
50 changes: 35 additions & 15 deletions pkg/publish/install-repo-readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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):
Expand Down