nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

205 lines
8.1 KiB
Diff
Raw Normal View History

diff --git a/app/flatpak-builtins-build-export.c b/app/flatpak-builtins-build-export.c
index 3f5d8a1f..79493e61 100644
--- a/app/flatpak-builtins-build-export.c
+++ b/app/flatpak-builtins-build-export.c
@@ -464,7 +464,7 @@ validate_desktop_file (GFile *desktop_file,
subprocess = g_subprocess_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE |
G_SUBPROCESS_FLAGS_STDERR_PIPE |
G_SUBPROCESS_FLAGS_STDERR_MERGE,
- &local_error, "desktop-file-validate", path, NULL);
+ &local_error, "@dfu@/bin/desktop-file-validate", path, NULL);
if (!subprocess)
{
if (!g_error_matches (local_error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 36d39ac4..3ad2c7a6 100644
2017-10-02 15:40:26 +02:00
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -511,7 +511,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then
2018-11-16 18:00:58 +01:00
# running installed-tests: assume we know what we're doing
_flatpak_bwrap_works=true
elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \
- --ro-bind / / /bin/true > bwrap-result 2>&1; then
+ --ro-bind / / @coreutils@/bin/true > bwrap-result 2>&1; then
_flatpak_bwrap_works=false
else
_flatpak_bwrap_works=true
@@ -591,7 +591,7 @@ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \
2017-10-02 15:40:26 +02:00
export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)"
DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)"
-if ! /bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
+if ! @coreutils@/bin/kill -0 "$DBUS_SESSION_BUS_PID"; then
assert_not_reached "Failed to start dbus-daemon"
fi
@@ -606,7 +606,7 @@ commit_to_path () {
}
2017-10-02 15:40:26 +02:00
cleanup () {
- /bin/kill -9 $DBUS_SESSION_BUS_PID
+ @coreutils@/bin/kill -9 $DBUS_SESSION_BUS_PID
gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye >&2 || true
fusermount -u $XDG_RUNTIME_DIR/doc >&2 || :
kill $(jobs -p) &> /dev/null || true
diff --git a/tests/make-test-app.sh b/tests/make-test-app.sh
index afa11a6b..5b12055f 100755
2018-11-16 18:00:58 +01:00
--- a/tests/make-test-app.sh
+++ b/tests/make-test-app.sh
@@ -190,13 +190,13 @@ msgid "Hello world"
2018-11-16 18:00:58 +01:00
msgstr "Hallo Welt"
EOF
mkdir -p ${DIR}/files/de/share/de/LC_MESSAGES
-msgfmt --output-file ${DIR}/files/de/share/de/LC_MESSAGES/helloworld.mo de.po
+@gettext@/bin/msgfmt --output-file ${DIR}/files/de/share/de/LC_MESSAGES/helloworld.mo de.po
cat > fr.po <<EOF
msgid "Hello world"
msgstr "Bonjour le monde"
EOF
mkdir -p ${DIR}/files/fr/share/fr/LC_MESSAGES
-msgfmt --output-file ${DIR}/files/fr/share/fr/LC_MESSAGES/helloworld.mo fr.po
+@gettext@/bin/msgfmt --output-file ${DIR}/files/fr/share/fr/LC_MESSAGES/helloworld.mo fr.po
flatpak build-finish ${DIR} >&2
2018-11-16 18:00:58 +01:00
mkdir -p repos
diff --git a/tests/make-test-runtime.sh b/tests/make-test-runtime.sh
index 4ba950df..fd50fab3 100755
2018-02-13 17:52:49 +01:00
--- a/tests/make-test-runtime.sh
+++ b/tests/make-test-runtime.sh
flatpak: 1.6.3 → 1.8.1 Changes: * https://github.com/flatpak/flatpak/releases/tag/1.7.1 * https://github.com/flatpak/flatpak/releases/tag/1.7.2 * https://github.com/flatpak/flatpak/releases/tag/1.7.3 * https://github.com/flatpak/flatpak/releases/tag/1.8.0 * https://github.com/flatpak/flatpak/releases/tag/1.8.1 Commits: https://github.com/flatpak/flatpak/compare/1.6.3...1.7.1 https://github.com/flatpak/flatpak/compare/1.7.1...1.8.1 Notable packaging changes: * Flatpak now ships a sysusers.d file for allowing systemd to create the required users. https://github.com/flatpak/flatpak/commit/4df019063b962d17a378fb92d073f8ceb6a6ca62 * Completion support for fish shell * If an app has filesystem access, the host /lib is accessible as /run/host/lib, etc. * New filesystem permission "host-etc" and "host-os" give access to system /usr and /etc. https://github.com/flatpak/flatpak/commit/fe2536b8441858e3b22f6780dca64a516ee4e48c * We now always expose the host timezone data, allowing us the expose the host /etc/localtime in a way that works better, fixing several apps that had timezone issues. https://github.com/flatpak/flatpak/commit/dc4e198766d91aa8871c276b9ed8d7f3ba003822 * We now ship a systemd unit (not installed by default) to automatically detect plugged in usb sticks with sideload repos. * By default we no longer install the gdm env.d file, as the systemd generators work better https://github.com/flatpak/flatpak/commit/7c3a85bf4337874719324a03cc5875708c84ee85 * Use variant-schema-compiler for some GVariant code https://github.com/flatpak/flatpak/pull/3366 * zstd compression for oci deltas: https://github.com/flatpak/flatpak/commit/bfa71e208a3672d965f560fd5250787d9b933493 Additionally: * Remove glibcLocales which is not used since 1.4 bump because glibc contains a locale archive with C.UTF-8 https://github.com/NixOS/nixpkgs/commit/1728bc8d22ffe5e340dfb7cf3a8627f3638f5616 * Stop using aliases for docbook-xsl-nons and pkg-config packages * Stop using autoreconfHook, the autogen.sh script contains some extra that are necessary when building from git. * Increase disk space for installed tests, they were running out. * Enable building developer documentation.
2020-07-24 09:04:16 +02:00
@@ -28,9 +28,10 @@ EOF
# On Debian derivatives, /usr/sbin and /sbin aren't in ordinary users'
# PATHs, but ldconfig is kept in /sbin
-PATH="$PATH:/usr/sbin:/sbin"
+PATH="$PATH:@socat@/bin:/usr/sbin:/sbin"
2018-02-13 17:52:49 +01:00
# Add bash and dependencies
+mkdir -p ${DIR}/nix/store
mkdir -p ${DIR}/usr/bin
mkdir -p ${DIR}/usr/lib
ln -s ../lib ${DIR}/usr/lib64
flatpak: 1.6.3 → 1.8.1 Changes: * https://github.com/flatpak/flatpak/releases/tag/1.7.1 * https://github.com/flatpak/flatpak/releases/tag/1.7.2 * https://github.com/flatpak/flatpak/releases/tag/1.7.3 * https://github.com/flatpak/flatpak/releases/tag/1.8.0 * https://github.com/flatpak/flatpak/releases/tag/1.8.1 Commits: https://github.com/flatpak/flatpak/compare/1.6.3...1.7.1 https://github.com/flatpak/flatpak/compare/1.7.1...1.8.1 Notable packaging changes: * Flatpak now ships a sysusers.d file for allowing systemd to create the required users. https://github.com/flatpak/flatpak/commit/4df019063b962d17a378fb92d073f8ceb6a6ca62 * Completion support for fish shell * If an app has filesystem access, the host /lib is accessible as /run/host/lib, etc. * New filesystem permission "host-etc" and "host-os" give access to system /usr and /etc. https://github.com/flatpak/flatpak/commit/fe2536b8441858e3b22f6780dca64a516ee4e48c * We now always expose the host timezone data, allowing us the expose the host /etc/localtime in a way that works better, fixing several apps that had timezone issues. https://github.com/flatpak/flatpak/commit/dc4e198766d91aa8871c276b9ed8d7f3ba003822 * We now ship a systemd unit (not installed by default) to automatically detect plugged in usb sticks with sideload repos. * By default we no longer install the gdm env.d file, as the systemd generators work better https://github.com/flatpak/flatpak/commit/7c3a85bf4337874719324a03cc5875708c84ee85 * Use variant-schema-compiler for some GVariant code https://github.com/flatpak/flatpak/pull/3366 * zstd compression for oci deltas: https://github.com/flatpak/flatpak/commit/bfa71e208a3672d965f560fd5250787d9b933493 Additionally: * Remove glibcLocales which is not used since 1.4 bump because glibc contains a locale archive with C.UTF-8 https://github.com/NixOS/nixpkgs/commit/1728bc8d22ffe5e340dfb7cf3a8627f3638f5616 * Stop using aliases for docbook-xsl-nons and pkg-config packages * Stop using autoreconfHook, the autogen.sh script contains some extra that are necessary when building from git. * Increase disk space for installed tests, they were running out. * Enable building developer documentation.
2020-07-24 09:04:16 +02:00
@@ -40,40 +41,17 @@ if test -f /sbin/ldconfig.real; then
2018-02-13 17:52:49 +01:00
else
cp "$(type -P ldconfig)" "${DIR}/usr/bin"
2018-02-13 17:52:49 +01:00
fi
2018-06-13 18:09:33 +02:00
-LIBS=`mktemp`
-BINS=`mktemp`
-
-add_bin() {
- local f=$1
- shift
-
- if grep -qFe "${f}" $BINS; then
- # Already handled
- return 0
- fi
-
- echo $f >> $BINS
-
- # Add library dependencies
- (ldd "${f}" | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | sort -u -o $LIBS $LIBS -) || true
-
- local shebang=$(sed -n '1s/^#!\([^ ]*\).*/\1/p' "${f}")
- if [ x$shebang != x ]; then
- add_bin "$shebang"
- fi
-}
-
for i in $@ bash ls cat echo readlink socat; do
- I=$(type -P "$i")
- add_bin "$I"
2018-02-13 17:52:49 +01:00
-done
2018-06-13 18:09:33 +02:00
-for i in `cat $BINS`; do
- #echo Adding binary $i 1>&2
2018-06-13 18:09:33 +02:00
- cp "$i" ${DIR}/usr/bin/
-done
-for i in `cat $LIBS`; do
- #echo Adding library $i 1>&2
2018-02-13 17:52:49 +01:00
- cp "$i" ${DIR}/usr/lib/
+ I=$(readlink -f "$(type -P "$i")")
+ [ -e "${DIR}/usr/bin/$i" ] && continue
2018-02-13 17:52:49 +01:00
+ requisites=$(nix-store --query --requisites "$I")
+ for r in $requisites; do
+ # a single store item can be needed by multiple paths, no need to copy it again
+ if [ ! -e "${DIR}/$r" ]; then
+ cp -r "$r" "${DIR}/$r"
2018-02-13 17:52:49 +01:00
+ fi
+ done
+ ln -s "$I" "${DIR}/usr/bin/$i"
2018-02-13 17:52:49 +01:00
done
2018-06-13 18:09:33 +02:00
ln -s bash ${DIR}/usr/bin/sh
2018-02-13 17:52:49 +01:00
flatpak: 1.6.3 → 1.8.1 Changes: * https://github.com/flatpak/flatpak/releases/tag/1.7.1 * https://github.com/flatpak/flatpak/releases/tag/1.7.2 * https://github.com/flatpak/flatpak/releases/tag/1.7.3 * https://github.com/flatpak/flatpak/releases/tag/1.8.0 * https://github.com/flatpak/flatpak/releases/tag/1.8.1 Commits: https://github.com/flatpak/flatpak/compare/1.6.3...1.7.1 https://github.com/flatpak/flatpak/compare/1.7.1...1.8.1 Notable packaging changes: * Flatpak now ships a sysusers.d file for allowing systemd to create the required users. https://github.com/flatpak/flatpak/commit/4df019063b962d17a378fb92d073f8ceb6a6ca62 * Completion support for fish shell * If an app has filesystem access, the host /lib is accessible as /run/host/lib, etc. * New filesystem permission "host-etc" and "host-os" give access to system /usr and /etc. https://github.com/flatpak/flatpak/commit/fe2536b8441858e3b22f6780dca64a516ee4e48c * We now always expose the host timezone data, allowing us the expose the host /etc/localtime in a way that works better, fixing several apps that had timezone issues. https://github.com/flatpak/flatpak/commit/dc4e198766d91aa8871c276b9ed8d7f3ba003822 * We now ship a systemd unit (not installed by default) to automatically detect plugged in usb sticks with sideload repos. * By default we no longer install the gdm env.d file, as the systemd generators work better https://github.com/flatpak/flatpak/commit/7c3a85bf4337874719324a03cc5875708c84ee85 * Use variant-schema-compiler for some GVariant code https://github.com/flatpak/flatpak/pull/3366 * zstd compression for oci deltas: https://github.com/flatpak/flatpak/commit/bfa71e208a3672d965f560fd5250787d9b933493 Additionally: * Remove glibcLocales which is not used since 1.4 bump because glibc contains a locale archive with C.UTF-8 https://github.com/NixOS/nixpkgs/commit/1728bc8d22ffe5e340dfb7cf3a8627f3638f5616 * Stop using aliases for docbook-xsl-nons and pkg-config packages * Stop using autoreconfHook, the autogen.sh script contains some extra that are necessary when building from git. * Increase disk space for installed tests, they were running out. * Enable building developer documentation.
2020-07-24 09:04:16 +02:00
@@ -84,11 +62,13 @@ echo "Hello world, from a runtime$EXTRA"
EOF
chmod a+x ${DIR}/usr/bin/runtime_hello.sh
2018-02-13 17:52:49 +01:00
-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but
-# the real en_US locale is often not available, because its in the
-# local archive.
-mkdir -p ${DIR}/usr/lib/locale/
-cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US
flatpak: 1.6.3 → 1.8.1 Changes: * https://github.com/flatpak/flatpak/releases/tag/1.7.1 * https://github.com/flatpak/flatpak/releases/tag/1.7.2 * https://github.com/flatpak/flatpak/releases/tag/1.7.3 * https://github.com/flatpak/flatpak/releases/tag/1.8.0 * https://github.com/flatpak/flatpak/releases/tag/1.8.1 Commits: https://github.com/flatpak/flatpak/compare/1.6.3...1.7.1 https://github.com/flatpak/flatpak/compare/1.7.1...1.8.1 Notable packaging changes: * Flatpak now ships a sysusers.d file for allowing systemd to create the required users. https://github.com/flatpak/flatpak/commit/4df019063b962d17a378fb92d073f8ceb6a6ca62 * Completion support for fish shell * If an app has filesystem access, the host /lib is accessible as /run/host/lib, etc. * New filesystem permission "host-etc" and "host-os" give access to system /usr and /etc. https://github.com/flatpak/flatpak/commit/fe2536b8441858e3b22f6780dca64a516ee4e48c * We now always expose the host timezone data, allowing us the expose the host /etc/localtime in a way that works better, fixing several apps that had timezone issues. https://github.com/flatpak/flatpak/commit/dc4e198766d91aa8871c276b9ed8d7f3ba003822 * We now ship a systemd unit (not installed by default) to automatically detect plugged in usb sticks with sideload repos. * By default we no longer install the gdm env.d file, as the systemd generators work better https://github.com/flatpak/flatpak/commit/7c3a85bf4337874719324a03cc5875708c84ee85 * Use variant-schema-compiler for some GVariant code https://github.com/flatpak/flatpak/pull/3366 * zstd compression for oci deltas: https://github.com/flatpak/flatpak/commit/bfa71e208a3672d965f560fd5250787d9b933493 Additionally: * Remove glibcLocales which is not used since 1.4 bump because glibc contains a locale archive with C.UTF-8 https://github.com/NixOS/nixpkgs/commit/1728bc8d22ffe5e340dfb7cf3a8627f3638f5616 * Stop using aliases for docbook-xsl-nons and pkg-config packages * Stop using autoreconfHook, the autogen.sh script contains some extra that are necessary when building from git. * Increase disk space for installed tests, they were running out. * Enable building developer documentation.
2020-07-24 09:04:16 +02:00
+# We do not copy C.UTF8 locale because it is in locale archive and
+# that is already copied with glibc.
+
+mv "${DIR}/nix/store" "${DIR}/usr/store" # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store
+chmod -R u+w "${DIR}" # nix store has read-only directories which would cause problems during clean-up, files need to be writable for sed
+find "${DIR}" -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths
+find "${DIR}" -type l | xargs -I '{}' sh -c 'tg="$(readlink "$1")"; newtg="${tg#/nix/store/}"; if [ "$tg" != "$newtg" ]; then ln -fs "/usr/store/$newtg" "$1"; fi' -- '{}' # replace symlink targets
2018-02-13 17:52:49 +01:00
if [ x$COLLECTION_ID != x ]; then
collection_args=--collection-id=${COLLECTION_ID}
diff --git a/tests/testlibrary.c b/tests/testlibrary.c
index 831d85c1..ae4f03d0 100644
2017-10-02 15:40:26 +02:00
--- a/tests/testlibrary.c
+++ b/tests/testlibrary.c
@@ -1601,7 +1601,7 @@ check_bwrap_support (void)
2017-10-02 15:40:26 +02:00
{
gint exit_code = 0;
2018-07-15 19:12:14 +02:00
char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net",
- "--unshare-pid", "--ro-bind", "/", "/", "/bin/true", NULL };
+ "--unshare-pid", "--ro-bind", "/", "/", "@coreutils@/bin/true", NULL };
2017-10-02 15:40:26 +02:00
g_autofree char *argv_str = g_strjoinv (" ", argv);
g_test_message ("Spawning %s", argv_str);
g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL, &exit_code, &error);
diff --git a/triggers/desktop-database.trigger b/triggers/desktop-database.trigger
index 1037466d..c4c7ed6d 100755
--- a/triggers/desktop-database.trigger
+++ b/triggers/desktop-database.trigger
@@ -1,5 +1,5 @@
#!/bin/sh
-if command -v update-desktop-database >/dev/null && test -d "$1/exports/share/applications"; then
- exec update-desktop-database -q "$1/exports/share/applications"
+if test -d "$1/exports/share/applications"; then
+ exec @dfu@/bin/update-desktop-database -q "$1/exports/share/applications"
fi
diff --git a/triggers/gtk-icon-cache.trigger b/triggers/gtk-icon-cache.trigger
index d9fc8251..d8ddb96e 100755
2018-02-13 17:52:49 +01:00
--- a/triggers/gtk-icon-cache.trigger
+++ b/triggers/gtk-icon-cache.trigger
@@ -1,10 +1,10 @@
2018-02-13 17:52:49 +01:00
#!/bin/sh
if command -v gtk-update-icon-cache >/dev/null && test -d "$1/exports/share/icons/hicolor"; then
- cp /usr/share/icons/hicolor/index.theme "$1/exports/share/icons/hicolor/"
+ cp @hicolorIconTheme@/share/icons/hicolor/index.theme "$1/exports/share/icons/hicolor/"
for dir in "$1"/exports/share/icons/*; do
if test -f "$dir/index.theme"; then
- if ! gtk-update-icon-cache --quiet "$dir"; then
+ if ! @gtk3@/bin/gtk-update-icon-cache --quiet "$dir"; then
echo "Failed to run gtk-update-icon-cache for $dir"
exit 1
fi
diff --git a/triggers/mime-database.trigger b/triggers/mime-database.trigger
index 10ddbbb3..c270998a 100755
--- a/triggers/mime-database.trigger
+++ b/triggers/mime-database.trigger
@@ -1,5 +1,5 @@
#!/bin/sh
-if command -v update-mime-database >/dev/null && test -d "$1/exports/share/mime/packages"; then
- exec update-mime-database "$1/exports/share/mime"
+if test -d "$1/exports/share/mime/packages"; then
+ exec @smi@/bin/update-mime-database "$1/exports/share/mime"
fi