Skip to content

Commit 53bbeea

Browse files
Prepare v1.2.5, inc pgrx v0.10.0 and pg16RC1 (#378)
These are the updates for the v1.2.5 release, which includes updating to pgrx v0.10.0 and pg16rc1 support. --------- Co-authored-by: Brady Bonnette <b_bonnette@tcdi.com>
1 parent 9f0f459 commit 53bbeea

File tree

12 files changed

+70
-44
lines changed

12 files changed

+70
-44
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929

3030
strategy:
3131
matrix:
32-
version: ["pg13", "pg14", "pg15"]
32+
version: ["pg13", "pg14", "pg15", "pg16"]
3333
target: ["host", "postgrestd"]
3434
fail-fast: false
3535

@@ -212,7 +212,7 @@ jobs:
212212

213213
strategy:
214214
matrix:
215-
version: ["pg13", "pg14", "pg15"]
215+
version: ["pg13", "pg14", "pg15", "pg16"]
216216
os: ["ubuntu-latest"]
217217
# it would be nice to other contributors to return "macos-11" to the above array
218218
target: ["host", "postgrestd"]
@@ -222,7 +222,6 @@ jobs:
222222
- uses: actions/checkout@v3
223223

224224
- name: Set up (Linux) prerequisites and environment
225-
if: matrix.os == 'ubuntu-latest'
226225
run: |
227226
echo ""
228227
@@ -265,16 +264,10 @@ jobs:
265264
llvm-11 \
266265
make \
267266
pkg-config \
268-
postgresql-$PG_VER \
269-
postgresql-server-dev-$PG_VER \
270267
strace \
271268
zlib1g-dev
272269
echo ""
273270
274-
echo "----- Set up Postgres permissions -----"
275-
sudo chmod a+rwx `/usr/lib/postgresql/$PG_VER/bin/pg_config --pkglibdir` `/usr/lib/postgresql/$PG_VER/bin/pg_config --sharedir`/extension /var/run/postgresql/
276-
echo ""
277-
278271
echo "----- Print env -----"
279272
env
280273
echo ""
@@ -283,6 +276,39 @@ jobs:
283276
cargo --version
284277
echo ""
285278
279+
- name: Install release version of PostgreSQL
280+
if: matrix.version != 'pg16'
281+
run: |
282+
echo "----- Set up PostgreSQL Apt repository -----"
283+
sudo apt-get install -y wget gnupg
284+
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
285+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
286+
sudo apt-get update -y -qq --fix-missing
287+
echo ""
288+
289+
sudo apt-get install -y \
290+
postgresql-"$PG_VER" \
291+
postgresql-server-dev-"$PG_VER"
292+
293+
- name: Install development version of PostgreSQL
294+
if: matrix.version == 'pg16'
295+
run: |
296+
echo "----- Set up PostgreSQL Apt repository -----"
297+
sudo apt-get install -y wget gnupg
298+
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 7FCC7D46ACCC4CF8
299+
sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/ $(lsb_release -s -c)-pgdg-snapshot main 16"
300+
sudo add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt/ $(lsb_release -s -c)-pgdg main 16"
301+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
302+
sudo apt-get update -y -qq --fix-missing
303+
echo ""
304+
305+
sudo apt-get install -y \
306+
postgresql-"$PG_VER" \
307+
postgresql-server-dev-"$PG_VER"
308+
309+
- name: Set up Postgres permissions
310+
run: sudo chmod a+rwx "$(/usr/lib/postgresql/"$PG_VER"/bin/pg_config --pkglibdir)" "$(/usr/lib/postgresql/"$PG_VER"/bin/pg_config --sharedir)"/extension /var/run/postgresql/
311+
286312
- name: Cache cargo registry
287313
uses: actions/cache@v3
288314
continue-on-error: false

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plrust-tests/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plrust-tests"
3-
version = "1.2.4"
3+
version = "1.2.5"
44
edition = "2021"
55

66
[lib]
@@ -11,6 +11,7 @@ default = ["pg13"]
1111
pg13 = ["pgrx/pg13", "pgrx-tests/pg13" ]
1212
pg14 = ["pgrx/pg14", "pgrx-tests/pg14" ]
1313
pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ]
14+
pg16 = ["pgrx/pg16", "pgrx-tests/pg16" ]
1415
pg_test = []
1516
trusted = []
1617

plrust-trusted-pgrx/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plrust-trusted-pgrx"
3-
version = "1.2.4"
3+
version = "1.2.5"
44
authors = ["TCDI <opensource@tcdi.com>"]
55
edition = "2021"
66
license = "PostgreSQL"
@@ -15,6 +15,7 @@ crate-type = ["rlib"]
1515
pg13 = ["pgrx/pg13"]
1616
pg14 = ["pgrx/pg14"]
1717
pg15 = ["pgrx/pg15"]
18+
pg16 = ["pgrx/pg16"]
1819

1920
[dependencies]
2021
# changing the pgrx version will likely require at least a minor version bump to this create

plrust/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "plrust"
3-
version = "1.2.4"
3+
version = "1.2.5"
44
authors = ["TCDI <opensource@tcdi.com>"]
55
edition = "2021"
66
license = "PostgreSQL Open Source License"
@@ -17,6 +17,7 @@ default = ["pg14"]
1717
pg13 = ["pgrx/pg13", "pgrx-tests/pg13"]
1818
pg14 = ["pgrx/pg14", "pgrx-tests/pg14"]
1919
pg15 = ["pgrx/pg15", "pgrx-tests/pg15"]
20+
pg16 = ["pgrx/pg16", "pgrx-tests/pg16"]
2021
# is plrust to be compiled as a "trusted" language handler, meaning it requires postgrestd at runtime
2122
trusted = []
2223
pg_test = []

plrust/src/allow_list.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,8 @@ pub fn load_allowlist() -> eyre::Result<AllowList> {
486486
let path = PathBuf::from_str(
487487
&PLRUST_ALLOWED_DEPENDENCIES
488488
.get()
489-
.map(|cstr| {
490-
cstr.to_str()
491-
.expect("plrust.allowed_dependencies is not valid UTF8")
492-
})
493-
.ok_or(Error::NotConfigured)?,
489+
.ok_or(Error::NotConfigured)?
490+
.to_str()?,
494491
)
495492
.map_err(|_| Error::InvalidPath)?;
496493

plrust/src/gucs.rs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,20 @@ pub(crate) static PLRUST_COMPILE_LINTS: GucSetting<Option<&'static CStr>> =
3232
GucSetting::<Option<&'static CStr>>::new(Some(DEFAULT_LINTS));
3333
pub(crate) static PLRUST_REQUIRED_LINTS: GucSetting<Option<&'static CStr>> =
3434
GucSetting::<Option<&'static CStr>>::new(None);
35-
pub(crate) static PLRUST_TRUSTED_PGRX_VERSION: GucSetting<Option<&'static CStr>> =
36-
GucSetting::<Option<&'static CStr>>::new(None);
3735

38-
pub(crate) const COMPILED_PGRX_VERSION: &'static str = env!(
39-
"PLRUST_TRUSTED_PGRX_VERSION",
40-
"unknown `plrust-trusted-pgrx` version. `build.rs` must not have run successfully"
36+
const PGRX_VERSION_FROM_BUILD_RS: &'static str = concat!(
37+
env!(
38+
"PLRUST_TRUSTED_PGRX_VERSION",
39+
"unknown `plrust-trusted-pgrx` version. `build.rs` must not have run successfully"
40+
),
41+
"\0" // NULL-terminate the string
4142
);
4243

44+
pub(crate) static PLRUST_TRUSTED_PGRX_VERSION: GucSetting<Option<&'static CStr>> =
45+
GucSetting::<Option<&'static CStr>>::new(Some(unsafe {
46+
CStr::from_bytes_with_nul_unchecked(PGRX_VERSION_FROM_BUILD_RS.as_bytes())
47+
}));
48+
4349
pub(crate) fn init() {
4450
GucRegistry::define_string_guc(
4551
"plrust.work_dir",
@@ -118,8 +124,9 @@ pub(crate) fn work_dir() -> PathBuf {
118124
PathBuf::from_str(
119125
&PLRUST_WORK_DIR
120126
.get()
121-
.map(|cstr| cstr.to_str().expect("plrust.work_dir is not valid UTF8"))
122-
.expect("plrust.work_dir is not set in postgresql.conf"),
127+
.expect("plrust.work_dir is not set in postgresql.conf")
128+
.to_str()
129+
.expect("plrust.work_dir is not valid UTF8"),
123130
)
124131
.expect("plrust.work_dir is not a valid path")
125132
}
@@ -147,8 +154,7 @@ pub(crate) fn compilation_targets() -> eyre::Result<(
147154
let other_targets = match PLRUST_COMPILATION_TARGETS.get() {
148155
None => vec![],
149156
Some(targets) => targets
150-
.to_str()
151-
.expect("plrust.compilation_targets is not valid UTF8")
157+
.to_str()?
152158
.split(',')
153159
.map(str::trim)
154160
.filter(|s| s != &std::env::consts::ARCH) // make sure we don't include this architecture in the list of other targets
@@ -196,11 +202,9 @@ pub(crate) fn get_pgrx_bindings_for_target(target: &CrossCompilationTarget) -> O
196202
pub(crate) fn get_trusted_pgrx_version() -> String {
197203
let version = PLRUST_TRUSTED_PGRX_VERSION
198204
.get()
199-
.map(|cstr| {
200-
cstr.to_str()
201-
.expect("plrust.plrust_trusted_pgrx is not valid UTF8")
202-
})
203-
.unwrap_or(COMPILED_PGRX_VERSION);
205+
.expect("unable to determine `plrust-trusted-pgrx` version") // shouldn't happen since we set a known default
206+
.to_str()
207+
.expect("plrust.plrust_trusted_pgrx_version is not valid UTF8");
204208

205209
// we always want this specific version
206210
format!("={}", version)

plrust/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const DEFAULT_LINTS: &'static CStr = unsafe {
111111
suspicious_auto_trait_impls, \
112112
where_clauses_object_safety, \
113113
soft_unstable\
114-
\0", // NOTE: This is a null-terminated CString.
114+
\0", // NOTE: This is a null-terminated string as it's used statically as a &CStr
115115
)
116116
};
117117

plrust/src/user_crate/cargo.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ pub(crate) fn cargo(
4747
fn configure_path(command: &mut Command) -> eyre::Result<()> {
4848
if let Some(path) = PLRUST_PATH_OVERRIDE.get() {
4949
// we were configured with an explicit $PATH to use
50-
command.env(
51-
"PATH",
52-
path.to_str()
53-
.expect("plrust.plrust_path_override is not valid UTF8"),
54-
);
50+
command.env("PATH", path.to_str()?);
5551
} else {
5652
let is_empty = match std::env::var("PATH") {
5753
Ok(s) if s.trim().is_empty() => true,

plrust/src/user_crate/lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub(crate) fn compile_lints() -> LintSet {
9494
.get()
9595
.unwrap_or_default()
9696
.to_str()
97-
.expect("plrust.plrust_compile_lints is not valid UTF8")
97+
.expect("plrust.compile_lints is not valid UTF8")
9898
.split(',')
9999
.filter(|x| !x.is_empty())
100100
.map(|s| s.trim().into())
@@ -131,7 +131,7 @@ pub(crate) fn required_lints() -> LintSet {
131131
.get()
132132
.unwrap_or_default()
133133
.to_str()
134-
.expect("plrust.plrust_required_lints is not valid UTF8")
134+
.expect("plrust.required_lints is not valid UTF8")
135135
.split(',')
136136
.filter_map(filter_map)
137137
.collect::<LintSet>();

0 commit comments

Comments
 (0)