From e6f4046ea2782fa0d39390d183d95abdbddccee5 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Wed, 14 Aug 2024 13:40:30 +0300 Subject: [PATCH 1/3] chore: move nix prev version to a static list --- nix/ext/wrappers/default.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index 0411c003c..aa25c715c 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -19,6 +19,9 @@ in buildPgrxExtension_0_11_3 rec { pname = "supabase-wrappers"; version = "0.4.1"; + # update this when the wrappers version is updated + # required to ensure that extensions update scripts from previous versions are generated + 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"]; inherit postgresql; src = fetchFromGitHub { owner = "supabase"; @@ -62,7 +65,7 @@ buildPgrxExtension_0_11_3 rec { preBuild = '' echo "Processing git tags..." - echo '${builtins.toJSON gitTags}' | ${jq}/bin/jq -r '.[].name' | sort -rV > git_tags.txt + echo '${concatStringsSep "," previousVersions }' | sed 's/,/\n/g' > git_tags.txt ''; postInstall = '' @@ -71,10 +74,9 @@ buildPgrxExtension_0_11_3 rec { sql_file="$out/share/postgresql/extension/wrappers--$current_version.sql" if [ -f "$sql_file" ]; then - while read -r tag; do - tag_version=$(echo "$tag" | sed 's/^v//') - if [ "$(printf '%s\n' "$tag_version" "$current_version" | sort -V | head -n1)" = "$tag_version" ] && [ "$tag_version" != "$current_version" ]; then - new_file="$out/share/postgresql/extension/wrappers--$tag_version--$current_version.sql" + while read -r previous_version; do + if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then + new_file="$out/share/postgresql/extension/wrappers--$previous_version--$current_version.sql" echo "Creating $new_file" cp "$sql_file" "$new_file" fi From 8dd0234f180f935fa6c99c83b17e5528fc9ac2b4 Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Wed, 14 Aug 2024 13:42:10 +0300 Subject: [PATCH 2/3] chore: fix concatStringsSep usage --- nix/ext/wrappers/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index aa25c715c..58998017b 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -65,7 +65,7 @@ buildPgrxExtension_0_11_3 rec { preBuild = '' echo "Processing git tags..." - echo '${concatStringsSep "," previousVersions }' | sed 's/,/\n/g' > git_tags.txt + echo '${builtins.concatStringsSep "," previousVersions }' | sed 's/,/\n/g' > git_tags.txt ''; postInstall = '' From b548002b65dabd028da7fe45e93460e182af424b Mon Sep 17 00:00:00 2001 From: Paul Cioanca Date: Wed, 14 Aug 2024 13:46:21 +0300 Subject: [PATCH 3/3] chore: cleanup --- nix/ext/wrappers/default.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index 58998017b..db1e972f1 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -10,16 +10,10 @@ , jq }: -let - gitTags = builtins.fromJSON (builtins.readFile (builtins.fetchurl { - url = "https://api.github.com/repos/supabase/wrappers/tags"; - sha256 = "0pvavn0f8wnaszq4bmvjkadm6xbvf91rbhcmmgjasqajb69vskv9"; # Replace with actual hash - })); -in buildPgrxExtension_0_11_3 rec { pname = "supabase-wrappers"; version = "0.4.1"; - # update this when the wrappers version is updated + # update the following array when the wrappers version is updated # required to ensure that extensions update scripts from previous versions are generated 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"]; inherit postgresql; @@ -29,7 +23,7 @@ buildPgrxExtension_0_11_3 rec { rev = "v${version}"; hash = "sha256-AU9Y43qEMcIBVBThu+Aor1HCtfFIg+CdkzK9IxVdkzM="; }; - nativeBuildInputs = [ pkg-config cargo jq ]; + nativeBuildInputs = [ pkg-config cargo ]; buildInputs = [ openssl ] ++ lib.optionals (stdenv.isDarwin) [ darwin.apple_sdk.frameworks.CoreFoundation darwin.apple_sdk.frameworks.Security @@ -65,7 +59,7 @@ buildPgrxExtension_0_11_3 rec { preBuild = '' echo "Processing git tags..." - echo '${builtins.concatStringsSep "," previousVersions }' | sed 's/,/\n/g' > git_tags.txt + echo '${builtins.concatStringsSep "," previousVersions}' | sed 's/,/\n/g' > git_tags.txt ''; postInstall = ''