Skip to content

Commit 41f280b

Browse files
committed
Fix coffeejs & livescript extensions
1 parent 6b3cacb commit 41f280b

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

nix/ext/plv8/default.nix

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ let
131131

132132
installPhase = ''
133133
runHook preInstall
134+
set -eo pipefail
134135
135136
mkdir -p $out/{lib,share/postgresql/extension}
136137
@@ -162,23 +163,30 @@ let
162163
''}
163164
fi
164165
165-
166166
# plv8 3.2.x removed support for coffeejs and livescript
167-
if (builtins.compareVersions "3.1.10" version >= 0) then
168-
EXTENSIONS="plv8 plcoffee plls"
169-
else
170-
EXTENSIONS="plv8"
171-
fi
172-
173-
for ext in $EXTENSIONS; do
167+
EXTENSIONS=(${if (builtins.compareVersions "3.1.10" version >= 0) then "plv8 plcoffee plls" else "plv8"})
168+
for ext in "''${EXTENSIONS[@]}" ; do
174169
cp $ext--${version}.sql $out/share/postgresql/extension
175170
install -Dm644 $ext.control $out/share/postgresql/extension/$ext--${version}.control
176171
# Create versioned control file with modified module path
177172
sed -e "/^default_version =/d" \
178-
-e "s|^module_pathname = .*|module_pathname = '\$libdir/${pname}'|" \
179-
${pname}.control > $out/share/postgresql/extension/${pname}--${version}.control
173+
-e "s|^module_pathname = .*|module_pathname = '\$libdir/${pname}-${version}'|" \
174+
$ext.control > $out/share/postgresql/extension/$ext--${version}.control
180175
done
181176
177+
# For the latest 3.1.x version, also create the default control file
178+
# for coffeejs and livescript extensions
179+
if [[ ${version} == "3.1.10" ]]; then
180+
for ext in "''${EXTENSIONS[@]}" ; do
181+
if [[ "$ext" != "plv8" ]]; then
182+
{
183+
echo "default_version = '${version}'"
184+
cat $out/share/postgresql/extension/$ext--${version}.control
185+
} > $out/share/postgresql/extension/$ext.control
186+
fi
187+
done
188+
fi
189+
182190
# For the latest version, create default control file and symlink
183191
if [[ "${version}" == "${latestVersion}" ]]; then
184192
{

nix/tests/expected/z_15_ext_interface.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ added and you should `create extension ...` to enable it in ./nix/tests/prime
1313

1414
*/
1515
create extension if not exists adminpack;
16-
create extension if not exists plv8;
16+
create extension if not exists plv8 with version '3.1.10';
1717
create extension if not exists plcoffee;
1818
create extension if not exists plls;
1919
create extension if not exists old_snapshot;

nix/tests/sql/z_15_ext_interface.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ added and you should `create extension ...` to enable it in ./nix/tests/prime
1515
1616
*/
1717
create extension if not exists adminpack;
18-
create extension if not exists plv8;
18+
create extension if not exists plv8 with version '3.1.10';
1919
create extension if not exists plcoffee;
2020
create extension if not exists plls;
2121
create extension if not exists old_snapshot;

0 commit comments

Comments
 (0)