Skip to content

Commit b245a96

Browse files
committed
install plrust from source
1 parent b728fce commit b245a96

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

ansible/tasks/postgres-extensions/30-plrust.yml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,48 @@
7070
args:
7171
executable: /bin/bash
7272

73-
- name: plrust - install plrust
74-
ansible.builtin.apt:
75-
deb: "https://github.com/tcdi/plrust/releases/download/v{{ plrust_release }}/plrust-trusted-{{ plrust_release }}_{{ plrust_language_version }}-debian-pg{{ postgresql_major }}-{{ platform }}.deb"
73+
- name: plrust - install cargo-pgrx and initialize
74+
shell: |
75+
source $HOME/.cargo/env
76+
cargo install cargo-pgrx --locked
77+
cargo pgrx init --pg{{ postgresql_major }} /usr/bin/pg_config
78+
args:
79+
executable: /bin/bash
80+
81+
- name: plrust - clone plrust
82+
git:
83+
repo: https://github.com/tcdi/plrust
84+
dest: /tmp/plrust
85+
version: v{{ plrust_release }}
86+
87+
88+
- name: plrust - move plrustc binary to .cargo/bin
89+
command:
90+
cmd: mv "/tmp/plrust/plrust/build/bin/plrustc" "$HOME/.cargo/bin/"
91+
warn: false
92+
93+
- name: plrust - build plrust
94+
shell: |
95+
source $HOME/.cargo/env
96+
export PG_VER="{{ postgresql_major }}"
97+
98+
if [[ "{{ platform }}" == "arm64" ]]; then
99+
STD_TARGETS="aarch64-postgres-linux-gnu"
100+
elif [[ "{{ platform }}" == "amd64" ]]; then
101+
STD_TARGETS="amd64-postgres-linux-gnu"
102+
else
103+
echo "Unsupported platform: $platform"
104+
exit 1
105+
fi
106+
107+
./build
108+
args:
109+
executable: /bin/bash
110+
chdir: "/tmp/plrust/plrust"
111+
112+
- name: plrust - install plrust
113+
shell: |
114+
source $HOME/.cargo/env
115+
cargo pgrx install --release --features trusted -c /usr/bin/pg_config
116+
args:
117+
executable: /bin/bash

0 commit comments

Comments
 (0)