10
10
, jq
11
11
} :
12
12
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
19
13
buildPgrxExtension_0_11_3 rec {
20
14
pname = "supabase-wrappers" ;
21
15
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" ] ;
22
19
inherit postgresql ;
23
20
src = fetchFromGitHub {
24
21
owner = "supabase" ;
25
22
repo = "wrappers" ;
26
23
rev = "v${ version } " ;
27
24
hash = "sha256-AU9Y43qEMcIBVBThu+Aor1HCtfFIg+CdkzK9IxVdkzM=" ;
28
25
} ;
29
- nativeBuildInputs = [ pkg-config cargo jq ] ;
26
+ nativeBuildInputs = [ pkg-config cargo ] ;
30
27
buildInputs = [ openssl ] ++ lib . optionals ( stdenv . isDarwin ) [
31
28
darwin . apple_sdk . frameworks . CoreFoundation
32
29
darwin . apple_sdk . frameworks . Security
@@ -62,7 +59,7 @@ buildPgrxExtension_0_11_3 rec {
62
59
63
60
preBuild = ''
64
61
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
66
63
'' ;
67
64
68
65
postInstall = ''
@@ -71,10 +68,9 @@ buildPgrxExtension_0_11_3 rec {
71
68
sql_file="$out/share/postgresql/extension/wrappers--$current_version.sql"
72
69
73
70
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"
78
74
echo "Creating $new_file"
79
75
cp "$sql_file" "$new_file"
80
76
fi
0 commit comments