postgresql: rename patches

Trying to understand what each patch does made me come up with some more
descriptive names:

- Renaming the two disable-xxx patches to a common names makes it immediately
  clear that one replaces the other depending on version number.
- findstring was really not descriptive at all.
- hardcode-pgxs-path will be extended with more paths for split outputs in
  a later commit. Renaming here already to allow git to better track renames.

Finally replacing HARDCODED_PGXS_PATH with $out/lib in the last patch, makes
it easier to understand what the end result will look like when reading the
patch.
This commit is contained in:
Wolfgang Walther 2024-03-05 15:15:07 +01:00
parent 605618c2e8
commit 154215cfd8
No known key found for this signature in database
GPG Key ID: B39893FA5F65CAE1
6 changed files with 14 additions and 19 deletions

View File

@ -111,12 +111,11 @@ let
++ lib.optionals stdenv'.isLinux [ "--with-pam" ];
patches = [
(if atLeast "16" then ./patches/disable-normalize_exec_path.patch
else ./patches/disable-resolve_symlinks.patch)
(if atLeast "16" then ./patches/relative-to-symlinks-16+.patch else ./patches/relative-to-symlinks.patch)
./patches/less-is-more.patch
./patches/hardcode-pgxs-path.patch
./patches/paths-for-split-outputs.patch
./patches/specify_pkglibdir_at_runtime.patch
./patches/findstring.patch
./patches/paths-with-postgresql-suffix.patch
(substituteAll {
src = ./patches/locale-binary-path.patch;
@ -127,7 +126,7 @@ let
# Using fetchurl instead of fetchpatch on purpose: https://github.com/NixOS/nixpkgs/issues/240141
map fetchurl (lib.attrValues muslPatches)
) ++ lib.optionals stdenv'.isLinux [
(if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch)
(if atLeast "13" then ./patches/socketdir-in-run-13+.patch else ./patches/socketdir-in-run.patch)
];
installTargets = [ "install-world" ];
@ -136,7 +135,7 @@ let
postPatch = ''
# Hardcode the path to pgxs so pg_config returns the path in $out
substituteInPlace "src/common/config_info.c" --replace HARDCODED_PGXS_PATH "$out/lib"
substituteInPlace "src/common/config_info.c" --subst-var out
'' + lib.optionalString jitSupport ''
# Force lookup of jit stuff in $out instead of $lib
substituteInPlace src/backend/jit/jit.c --replace pkglib_path \"$out/lib\"

View File

@ -1,13 +1,11 @@
--- a/src/common/config_info.c
+++ b/src/common/config_info.c
@@ -118,7 +118,10 @@
@@ -118,7 +118,7 @@
i++;
configdata[i].name = pstrdup("PGXS");
+ strlcpy(path, "HARDCODED_PGXS_PATH", sizeof(path));
+/* commented out to be able to point to nix $out path
get_pkglib_path(my_exec_path, path);
+*/
+ strlcpy(path, "@out@/lib", sizeof(path));
- get_pkglib_path(my_exec_path, path);
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
cleanup_path(path);
configdata[i].setting = pstrdup(path);

View File

@ -1,7 +1,3 @@
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 29 May 2019 22:51:52 -0400
Subject: [PATCH] Add /postgresql suffix for Nix outputs
Nix outputs put the `name' in each store path like
/nix/store/...-<name>. This was confusing the Postgres make script
because it thought its data directory already had postgresql in its

View File

@ -1,10 +1,11 @@
On NixOS we *want* stuff relative to symlinks.
---
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -238,6 +238,9 @@
@@ -238,6 +238,8 @@
static int
normalize_exec_path(char *path)
{
+ // On NixOS we *want* stuff relative to symlinks.
+ return 0;
+
/*

View File

@ -1,10 +1,11 @@
On NixOS we *want* stuff relative to symlinks.
---
--- a/src/common/exec.c
+++ b/src/common/exec.c
@@ -218,6 +218,9 @@
@@ -218,6 +218,8 @@
static int
resolve_symlinks(char *path)
{
+ // On NixOS we *want* stuff relative to symlinks.
+ return 0;
+
#ifdef HAVE_READLINK