@@ -63,41 +63,52 @@ buildPgrxExtension_0_11_3 rec {
63
63
echo '${ builtins . concatStringsSep "," previousVersions } ' | sed 's/,/\n/g' > git_tags.txt
64
64
'' ;
65
65
66
- postInstall = ''
67
- echo "Creating SQL files for previous versions..."
68
- current_version="${ version } "
69
- sql_file="$out/share/postgresql/extension/wrappers--$current_version.sql"
70
-
71
- if [ -f "$sql_file" ]; then
72
- while read -r previous_version; do
73
- if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
74
- new_file="$out/share/postgresql/extension/wrappers--$previous_version--$current_version.sql"
75
- echo "Creating $new_file"
76
- cp "$sql_file" "$new_file"
77
- fi
78
- done < git_tags.txt
79
- else
80
- echo "Warning: $sql_file not found"
81
- fi
82
- mv $out/lib/wrappers-${ version } .so $out/lib/wrappers.so
66
+ postInstall = ''
67
+ echo "Modifying main SQL file to use unversioned library name..."
68
+ current_version="${ version } "
69
+ main_sql_file="$out/share/postgresql/extension/wrappers--$current_version.sql"
70
+ if [ -f "$main_sql_file" ]; then
71
+ sed -i 's|$libdir/wrappers-[0-9.]*|$libdir/wrappers|g' "$main_sql_file"
72
+ echo "Modified $main_sql_file"
73
+ else
74
+ echo "Warning: $main_sql_file not found"
75
+ fi
76
+ echo "Creating and modifying SQL files for previous versions..."
77
+
78
+ if [ -f "$main_sql_file" ]; then
79
+ while read -r previous_version; do
80
+ if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
81
+ new_file="$out/share/postgresql/extension/wrappers--$previous_version--$current_version.sql"
82
+ echo "Creating $new_file"
83
+ cp "$main_sql_file" "$new_file"
84
+ sed -i 's|$libdir/wrappers-[0-9.]*|$libdir/wrappers|g' "$new_file"
85
+ echo "Modified $new_file"
86
+ fi
87
+ done < git_tags.txt
88
+ else
89
+ echo "Warning: $main_sql_file not found"
90
+ fi
91
+ mv $out/lib/wrappers-${ version } .so $out/lib/wrappers.so
92
+
93
+ echo "Creating wrappers.so symlinks to support pg_upgrade..."
94
+ if [ -f "$out/lib/wrappers.so" ]; then
95
+ while read -r previous_version; do
96
+ if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
97
+ new_file="$out/lib/wrappers-$previous_version.so"
98
+ echo "Creating $new_file"
99
+ ln -s "$out/lib/wrappers.so" "$new_file"
100
+ fi
101
+ done < git_tags.txt
102
+ else
103
+ echo "Warning: $out/lib/wrappers.so not found"
104
+ fi
83
105
84
- echo "Creating wrappers.so symlinks to support pg_upgrade..."
85
- if [ -f "$out/lib/wrappers.so" ]; then
86
- while read -r previous_version; do
87
- if [ "$(printf '%s\n' "$previous_version" "$current_version" | sort -V | head -n1)" = "$previous_version" ] && [ "$previous_version" != "$current_version" ]; then
88
- new_file="$out/lib/wrappers-$previous_version.so"
89
- echo "Creating $new_file"
90
- ln -s "$out/lib/wrappers.so" "$new_file"
91
- fi
92
- done < git_tags.txt
93
- else
94
- echo "Warning: $out/lib/wrappers.so not found"
95
- fi
96
-
97
- rm git_tags.txt
98
- echo "Uncommenting module_pathname in wrappers.control..."
99
- sed -i 's/^#module_pathname/module_pathname/' $out/share/postgresql/extension/wrappers.control
100
- '' ;
106
+ rm git_tags.txt
107
+ echo "Contents of updated wrappers.control:"
108
+ cat "$out/share/postgresql/extension/wrappers.control"
109
+ echo "List of generated SQL files:"
110
+ ls -l $out/share/postgresql/extension/wrappers--*.sql
111
+ '' ;
101
112
102
113
meta = with lib ; {
103
114
description = "Various Foreign Data Wrappers (FDWs) for PostreSQL" ;
0 commit comments