Skip to content

Commit bfe5f7b

Browse files
authored
fix(nix/wrappers): move previous versions to a static list (#1119)
1 parent 0721540 commit bfe5f7b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

nix/ext/wrappers/default.nix

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,20 @@
1010
, jq
1111
}:
1212

13-
let
14-
gitTags = builtins.fromJSON (builtins.readFile (builtins.fetchurl {
15-
url = "https://api.github.com/repos/supabase/wrappers/tags";
16-
sha256 = "0pvavn0f8wnaszq4bmvjkadm6xbvf91rbhcmmgjasqajb69vskv9"; # Replace with actual hash
17-
}));
18-
in
1913
buildPgrxExtension_0_11_3 rec {
2014
pname = "supabase-wrappers";
2115
version = "0.4.1";
16+
# update the following array when the wrappers version is updated
17+
# required to ensure that extensions update scripts from previous versions are generated
18+
previousVersions = ["0.4.0" "0.3.1" "0.3.0" "0.2.0" "0.1.19" "0.1.18" "0.1.17" "0.1.16" "0.1.15" "0.1.14" "0.1.12" "0.1.11" "0.1.10" "0.1.9" "0.1.8" "0.1.7" "0.1.6" "0.1.5" "0.1.4" "0.1.1" "0.1.0"];
2219
inherit postgresql;
2320
src = fetchFromGitHub {
2421
owner = "supabase";
2522
repo = "wrappers";
2623
rev = "v${version}";
2724
hash = "sha256-AU9Y43qEMcIBVBThu+Aor1HCtfFIg+CdkzK9IxVdkzM=";
2825
};
29-
nativeBuildInputs = [ pkg-config cargo jq ];
26+
nativeBuildInputs = [ pkg-config cargo ];
3027
buildInputs = [ openssl ] ++ lib.optionals (stdenv.isDarwin) [
3128
darwin.apple_sdk.frameworks.CoreFoundation
3229
darwin.apple_sdk.frameworks.Security
@@ -62,7 +59,7 @@ buildPgrxExtension_0_11_3 rec {
6259

6360
preBuild = ''
6461
echo "Processing git tags..."
65-
echo '${builtins.toJSON gitTags}' | ${jq}/bin/jq -r '.[].name' | sort -rV > git_tags.txt
62+
echo '${builtins.concatStringsSep "," previousVersions}' | sed 's/,/\n/g' > git_tags.txt
6663
'';
6764

6865
postInstall = ''
@@ -71,10 +68,9 @@ buildPgrxExtension_0_11_3 rec {
7168
sql_file="$out/share/postgresql/extension/wrappers--$current_version.sql"
7269
7370
if [ -f "$sql_file" ]; then
74-
while read -r tag; do
75-
tag_version=$(echo "$tag" | sed 's/^v//')
76-
if [ "$(printf '%s\n' "$tag_version" "$current_version" | sort -V | head -n1)" = "$tag_version" ] && [ "$tag_version" != "$current_version" ]; then
77-
new_file="$out/share/postgresql/extension/wrappers--$tag_version--$current_version.sql"
71+
while read -r previous_version; do
72+
if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
73+
new_file="$out/share/postgresql/extension/wrappers--$previous_version--$current_version.sql"
7874
echo "Creating $new_file"
7975
cp "$sql_file" "$new_file"
8076
fi

0 commit comments

Comments
 (0)