From 20eadb2c399c19cf47698b94550ec859ee85c059 Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 27 Feb 2019 13:05:29 +0200 Subject: [PATCH] relocatable-package: package and redirect gnutls configuration gnutls requires a configuration file, and the configuration file must match the one used by the library. Since we ship our own version of the library with the relocatable package, we must also ship the configuration file. Luckily, it is possible to override the location of the configuration file via an environment variable, so all we need to do is to copy the file to the archive and provide the environment variable in the thunk that adjusts the library path. Reviewed-by: Nadav Har'El Message-Id: <20190227110529.14146-1-avi@scylladb.com> --- scripts/create-relocatable-package.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/create-relocatable-package.py b/scripts/create-relocatable-package.py index 6417e0b8a1..36601e7539 100755 --- a/scripts/create-relocatable-package.py +++ b/scripts/create-relocatable-package.py @@ -70,6 +70,9 @@ for exe in executables: ld_so = libs['ld.so'] +have_gnutls = any([lib.startswith('libgnutls.so') + for lib in libs.keys()]) + # Although tarfile.open() can write directly to a compressed tar by using # the "w|gz" mode, it does so using a slow Python implementation. It is as # much as 3 times faster (!) to output to a pipe running the external gzip @@ -115,6 +118,7 @@ b="$(basename "$x")" d="$(dirname "$x")/.." ldso="$d/libexec/$b" realexe="$d/libexec/$b.bin" +export GNUTLS_SYSTEM_PRIORITY_FILE="${GNUTLS_SYSTEM_PRIORITY_FILE-$d/libreloc/gnutls.config}" LD_LIBRARY_PATH="$d/libreloc" exec -a "$0" "$ldso" "$realexe" "$@" ''' @@ -133,6 +137,9 @@ for exe in executables: ar.addfile(ti) for lib, libfile in libs.items(): ar.add(libfile, arcname='libreloc/' + lib) +if have_gnutls: + gnutls_config_nolink = os.path.realpath('/etc/crypto-policies/back-ends/gnutls.config') + ar.add(gnutls_config_nolink, arcname='libreloc/gnutls.config') ar.add('conf') ar.add('dist') ar.add('build/SCYLLA-RELEASE-FILE', arcname='SCYLLA-RELEASE-FILE')