From b28e5f3c9a60ac2ae89390660671530221fbfd2a Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Mon, 4 Jan 2021 12:00:00 +0000 Subject: [PATCH 1/2] appimage-run: add regression test --- .../appimage-run/default.nix | 4 +++- .../package-management/appimage-run/test.nix | 24 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 7 +++++- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 pkgs/tools/package-management/appimage-run/test.nix diff --git a/pkgs/tools/package-management/appimage-run/default.nix b/pkgs/tools/package-management/appimage-run/default.nix index 3bc59f2ad148..98a04dff8f89 100644 --- a/pkgs/tools/package-management/appimage-run/default.nix +++ b/pkgs/tools/package-management/appimage-run/default.nix @@ -1,4 +1,4 @@ -{ appimageTools, buildFHSUserEnv, extraPkgs ? pkgs: [] }: +{ appimageTools, buildFHSUserEnv, extraPkgs ? pkgs: [], appimage-run-tests ? null }: let fhsArgs = appimageTools.defaultFhsEnvArgs; @@ -8,4 +8,6 @@ in buildFHSUserEnv (fhsArgs // { targetPkgs = pkgs: [ appimageTools.appimage-exec ] ++ fhsArgs.targetPkgs pkgs ++ extraPkgs pkgs; runScript = "appimage-exec.sh"; + + passthru.tests.appimage-run = appimage-run-tests; }) diff --git a/pkgs/tools/package-management/appimage-run/test.nix b/pkgs/tools/package-management/appimage-run/test.nix new file mode 100644 index 000000000000..c9bc63c08a8e --- /dev/null +++ b/pkgs/tools/package-management/appimage-run/test.nix @@ -0,0 +1,24 @@ +{ runCommand, fetchurl, appimage-run, glibcLocales, file }: +let + # any AppImage usable on cli, really + sample-appImage = fetchurl { + url = "https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage"; + sha256 = "04ws94q71bwskmhizhwmaf41ma4wabvfgjgkagr8wf3vakgv866r"; + }; +in + runCommand "appimage-run-tests" { + buildInputs = [ appimage-run glibcLocales file ]; + meta.platforms = [ "x86_64-linux" ]; + } + '' + export HOME=$(mktemp -d) + set -x + # regression test for #101137, must come first + LANG=fr_FR appimage-run ${sample-appImage} --list ${sample-appImage} + # regression test for #108426 + cp ${sample-appImage} foo.appImage + LANG=fr_FR appimage-run ${sample-appImage} --list foo.appImage + set +x + touch $out + '' + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 65ac1da50306..70b124a7b2ed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -852,7 +852,12 @@ in inherit (androidenv.androidPkgs_9_0) build-tools; }; - appimage-run = callPackage ../tools/package-management/appimage-run {}; + appimage-run = callPackage ../tools/package-management/appimage-run { }; + appimage-run-tests = callPackage ../tools/package-management/appimage-run/test.nix { + appimage-run = appimage-run.override { + appimage-run-tests = null; /* break boostrap cycle for passthru.tests */ + }; + }; appimagekit = callPackage ../tools/package-management/appimagekit {}; From f54f718871ed34cc8e6a71905349d34f00d6fd6d Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Mon, 4 Jan 2021 12:00:00 +0000 Subject: [PATCH 2/2] appimage-run: don't chdir to the appimage this allows to pass relative paths to appimages as argument fixes #108426 --- pkgs/build-support/appimage/appimage-exec.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/appimage/appimage-exec.sh b/pkgs/build-support/appimage/appimage-exec.sh index 7986c589667b..4ff6802e6453 100755 --- a/pkgs/build-support/appimage/appimage-exec.sh +++ b/pkgs/build-support/appimage/appimage-exec.sh @@ -75,15 +75,15 @@ apprun() { wrap() { - cd "$APPDIR" || exit # quite same in appimageTools export APPIMAGE_SILENT_INSTALL=1 if [ -n "$APPIMAGE_DEBUG_EXEC" ]; then + cd "$APPDIR" || true exec "$APPIMAGE_DEBUG_EXEC" fi - exec ./AppRun "$@" + exec "$APPDIR/AppRun" "$@" } usage() {