mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-10 15:02:56 +00:00
We need some real extensions in S3 to accurately test the code for handling remote extensions. In this PR we just upload three extensions (anon, kq_imcx and postgis), which is enough for testing purposes for now. In addition to creating and uploading the extension archives, we must generate a file `ext_index.json` which specifies important metadata about the extensions. --------- Co-authored-by: Anastasia Lubennikova <anastasia@neon.tech> Co-authored-by: Alexander Bayandin <alexander@neon.tech>
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
#! /usr/bin/env python3
|
|
# Script to generate ext_index.json metadata file
|
|
# that stores content of the control files and location of extension archives
|
|
# for all extensions in extensions subdir.
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description="generate ext_index.json")
|
|
parser.add_argument("pg_version", type=str, choices=["v14", "v15"], help="pg_version")
|
|
parser.add_argument("BUILD_TAG", type=str, help="BUILD_TAG for this compute image")
|
|
args = parser.parse_args()
|
|
pg_version = args.pg_version
|
|
BUILD_TAG = args.BUILD_TAG
|
|
|
|
ext_index = {}
|
|
EXT_PATH = Path("extensions")
|
|
for extension in EXT_PATH.iterdir():
|
|
if extension.is_dir():
|
|
control_data = {}
|
|
for control_file in extension.glob("*.control"):
|
|
if control_file.suffix != ".control":
|
|
continue
|
|
with open(control_file, "r") as f:
|
|
control_data[control_file.name] = f.read()
|
|
ext_index[extension.name] = {
|
|
"control_data": control_data,
|
|
"archive_path": f"{BUILD_TAG}/{pg_version}/extensions/{extension.name}.tar.zst",
|
|
}
|
|
|
|
with open("ext_index.json", "w") as f:
|
|
json.dump(ext_index, f)
|