diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-04-01 15:50:50 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-04-01 15:50:50 +0000 |
commit | 75eafe97f7df0d653bec67f3962214d7c357831f (patch) | |
tree | 09f2cc901e0e637876cbb78d192dfe2fcfef8156 /nixpkgs/pkgs/development/libraries/flatpak | |
parent | a53b121bf4331497da63df3b1b7f1a7897dad146 (diff) | |
parent | a2e06fc3423c4be53181b15c28dfbe0bcf67dd73 (diff) | |
download | nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.gz nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.bz2 nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.lz nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.xz nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.tar.zst nixlib-75eafe97f7df0d653bec67f3962214d7c357831f.zip |
Merge commit 'a2e06fc3423c4be53181b15c28dfbe0bcf67dd73'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/flatpak')
4 files changed, 205 insertions, 50 deletions
diff --git a/nixpkgs/pkgs/development/libraries/flatpak/default.nix b/nixpkgs/pkgs/development/libraries/flatpak/default.nix index c0a3d3718f34..3788974e1244 100644 --- a/nixpkgs/pkgs/development/libraries/flatpak/default.nix +++ b/nixpkgs/pkgs/development/libraries/flatpak/default.nix @@ -1,56 +1,161 @@ -{ stdenv, fetchurl, autoreconfHook, docbook_xml_dtd_412, docbook_xml_dtd_42, docbook_xml_dtd_43, docbook_xsl, which, libxml2 -, gobject-introspection, gtk-doc, intltool, libxslt, pkgconfig, xmlto, appstream-glib, substituteAll, glibcLocales, yacc, xdg-dbus-proxy, p11-kit -, bubblewrap, bzip2, dbus, glib, gpgme, json-glib, libarchive, libcap, libseccomp, coreutils, gettext, hicolor-icon-theme, fuse, nixosTests -, libsoup, lzma, ostree, polkit, python3, systemd, xorg, valgrind, glib-networking, wrapGAppsHook, dconf, gsettings-desktop-schemas, librsvg }: +{ stdenv +, fetchurl +, autoreconfHook +, docbook_xml_dtd_412 +, docbook_xml_dtd_42 +, docbook_xml_dtd_43 +, docbook_xsl +, which +, libxml2 +, gobject-introspection +, gtk-doc +, intltool +, libxslt +, pkgconfig +, xmlto +, appstream-glib +, substituteAll +, glibcLocales +, yacc +, xdg-dbus-proxy +, p11-kit +, bubblewrap +, bzip2 +, dbus +, glib +, gpgme +, json-glib +, libarchive +, libcap +, libseccomp +, coreutils +, socat +, gettext +, hicolor-icon-theme +, shared-mime-info +, desktop-file-utils +, gtk3 +, fuse +, nixosTests +, libsoup +, lzma +, ostree +, polkit +, python3 +, systemd +, xorg +, valgrind +, glib-networking +, wrapGAppsHook +, dconf +, gsettings-desktop-schemas +, librsvg +}: stdenv.mkDerivation rec { pname = "flatpak"; - version = "1.4.2"; + version = "1.6.2"; # TODO: split out lib once we figure out what to do with triggerdir - outputs = [ "out" "man" "doc" "installedTests" ]; + outputs = [ "out" "dev" "man" "doc" "installedTests" ]; src = fetchurl { url = "https://github.com/flatpak/flatpak/releases/download/${version}/${pname}-${version}.tar.xz"; - sha256 = "08nmpp26mgv0vp3mlwk97rnp0j7i108h4hr9nllja19sjxnrlygj"; + sha256 = "02k9p5n60gz2k85n805n9niic4miw0mfh0i7yk1vrc8vaa5h69wd"; }; patches = [ + # Hardcode paths used by tests and change test runtime generation to use files from Nix store. + # https://github.com/flatpak/flatpak/issues/1460 (substituteAll { src = ./fix-test-paths.patch; - inherit coreutils gettext glibcLocales; + inherit coreutils gettext glibcLocales socat gtk3; + smi = shared-mime-info; + dfu = desktop-file-utils; hicolorIconTheme = hicolor-icon-theme; }) + + # Hardcode paths used by Flatpak itself. (substituteAll { src = ./fix-paths.patch; - p11 = p11-kit; + p11kit = "${p11-kit.dev}/bin/p11-kit"; }) + + # Adapt paths exposed to sandbox for NixOS. (substituteAll { src = ./bubblewrap-paths.patch; inherit (builtins) storeDir; }) - # patch taken from gtk_doc + + # Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable. + # Patch taken from gtk-doc expression. ./respect-xml-catalog-files-var.patch + + # Don’t hardcode flatpak binary path in launchers stored under user’s profile otherwise they will break after Flatpak update. + # https://github.com/NixOS/nixpkgs/issues/43581 ./use-flatpak-from-path.patch + + # Nix environment hacks should not leak into the apps. + # https://github.com/NixOS/nixpkgs/issues/53441 ./unset-env-vars.patch + + # But we want the GDK_PIXBUF_MODULE_FILE from the wrapper affect the icon validator. ./validate-icon-pixbuf.patch ]; nativeBuildInputs = [ - autoreconfHook libxml2 docbook_xml_dtd_412 docbook_xml_dtd_42 docbook_xml_dtd_43 docbook_xsl which gobject-introspection - gtk-doc intltool libxslt pkgconfig xmlto appstream-glib yacc wrapGAppsHook + autoreconfHook + libxml2 + docbook_xml_dtd_412 + docbook_xml_dtd_42 + docbook_xml_dtd_43 + docbook_xsl + which + gobject-introspection + gtk-doc + intltool + libxslt + pkgconfig + xmlto + appstream-glib + yacc + wrapGAppsHook ]; buildInputs = [ - bubblewrap bzip2 dbus dconf glib gpgme json-glib libarchive libcap libseccomp - libsoup lzma ostree polkit python3 systemd xorg.libXau fuse - gsettings-desktop-schemas glib-networking + bubblewrap + bzip2 + dbus + dconf + gpgme + json-glib + libarchive + libcap + libseccomp + libsoup + lzma + polkit + python3 + systemd + xorg.libXau + fuse + gsettings-desktop-schemas + glib-networking librsvg # for flatpak-validate-icon ]; - checkInputs = [ valgrind ]; + # Required by flatpak.pc + propagatedBuildInputs = [ + glib + ostree + ]; + + checkInputs = [ + valgrind + ]; - doCheck = false; # TODO: some issues with temporary files + # TODO: some issues with temporary files + doCheck = false; NIX_LDFLAGS = "-lpthread"; @@ -65,8 +170,8 @@ stdenv.mkDerivation rec { ]; makeFlags = [ - "installed_testdir=$(installedTests)/libexec/installed-tests/flatpak" - "installed_test_metadir=$(installedTests)/share/installed-tests/flatpak" + "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak" + "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak" ]; postPatch = '' @@ -82,7 +187,7 @@ stdenv.mkDerivation rec { meta = with stdenv.lib; { description = "Linux application sandboxing and distribution framework"; - homepage = https://flatpak.org/; + homepage = "https://flatpak.org/"; license = licenses.lgpl21; maintainers = with maintainers; [ jtojnar ]; platforms = platforms.linux; diff --git a/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch index 746b4382864b..67f0d4eba71f 100644 --- a/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch +++ b/nixpkgs/pkgs/development/libraries/flatpak/fix-paths.patch @@ -7,7 +7,7 @@ index 5dd7629e..ddc71a4c 100644 int i; char *p11_argv[] = { - "p11-kit", "server", -+ "@p11@/bin/p11-kit", "server", ++ "@p11kit@", "server", /* We explicitly request --sh here, because we then fail on earlier versions that doesn't support * this flag. This is good, because those earlier versions did not properly daemonize and caused * the spawn_sync to hang forever, waiting for the pipe to close. diff --git a/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch b/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch index 85b222152d0a..8ea2f0159a31 100644 --- a/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch +++ b/nixpkgs/pkgs/development/libraries/flatpak/fix-test-paths.patch @@ -1,8 +1,21 @@ +diff --git a/app/flatpak-builtins-build-export.c b/app/flatpak-builtins-build-export.c +index 5de89d62..bf6bdb52 100644 +--- a/app/flatpak-builtins-build-export.c ++++ b/app/flatpak-builtins-build-export.c +@@ -458,7 +458,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 46bcefb3..0134425e 100644 +index e64be49f..a9a53e12 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh -@@ -352,7 +352,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then +@@ -367,7 +367,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then # running installed-tests: assume we know what we're doing _flatpak_bwrap_works=true elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \ @@ -11,7 +24,7 @@ index 46bcefb3..0134425e 100644 _flatpak_bwrap_works=false else _flatpak_bwrap_works=true -@@ -426,12 +426,12 @@ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \ +@@ -440,7 +440,7 @@ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \ export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)" DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)" @@ -20,17 +33,20 @@ index 46bcefb3..0134425e 100644 assert_not_reached "Failed to start dbus-daemon" fi +@@ -449,7 +449,7 @@ gdb_bt () { + } + cleanup () { -- /bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-} -+ @coreutils@/bin/kill -9 $DBUS_SESSION_BUS_PID ${FLATPAK_HTTP_PID:-} +- /bin/kill -9 $DBUS_SESSION_BUS_PID ++ @coreutils@/bin/kill -9 $DBUS_SESSION_BUS_PID gpg-connect-agent --homedir "${FL_GPG_HOMEDIR}" killagent /bye || true fusermount -u $XDG_RUNTIME_DIR/doc || : - if test -n "${TEST_SKIP_CLEANUP:-}"; then + kill $(jobs -p) &> /dev/null || true diff --git a/tests/make-test-app.sh b/tests/make-test-app.sh -index 0a0a28f1..16fd51fe 100755 +index e51e21a6..7d39efb5 100755 --- a/tests/make-test-app.sh +++ b/tests/make-test-app.sh -@@ -129,13 +129,13 @@ msgid "Hello world" +@@ -149,13 +149,13 @@ msgid "Hello world" msgstr "Hallo Welt" EOF mkdir -p ${DIR}/files/de/share/de/LC_MESSAGES @@ -47,18 +63,22 @@ index 0a0a28f1..16fd51fe 100755 flatpak build-finish ${DIR} mkdir -p repos diff --git a/tests/make-test-runtime.sh b/tests/make-test-runtime.sh -index 57899b75..9236996f 100755 +index 5d2c309b..cf61a3cf 100755 --- a/tests/make-test-runtime.sh +++ b/tests/make-test-runtime.sh -@@ -28,6 +28,7 @@ EOF - PATH="$PATH:/usr/sbin:/sbin" +@@ -25,9 +25,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" # 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 -@@ -37,48 +38,23 @@ if test -f /sbin/ldconfig.real; then +@@ -37,48 +38,24 @@ if test -f /sbin/ldconfig.real; then else cp `which ldconfig` ${DIR}/usr/bin fi @@ -85,18 +105,19 @@ index 57899b75..9236996f 100755 - fi -} - - for i in $@ bash ls cat echo readlink; do + for i in $@ bash ls cat echo readlink socat; do - I=`which $i` - add_bin $I -done -for i in `cat $BINS`; do -- echo Adding binary $i 1>&2 +- #echo Adding binary $i 1>&2 - cp "$i" ${DIR}/usr/bin/ -done -for i in `cat $LIBS`; do -- echo Adding library $i 1>&2 +- #echo Adding library $i 1>&2 - cp "$i" ${DIR}/usr/lib/ + I=$(readlink -f $(which $i)) ++ [ -e ${DIR}/usr/bin/$i ] && continue + 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 @@ -121,10 +142,10 @@ index 57899b75..9236996f 100755 if [ x$COLLECTION_ID != x ]; then collection_args=--collection-id=${COLLECTION_ID} diff --git a/tests/testlibrary.c b/tests/testlibrary.c -index f2773dc8..3af9026f 100644 +index 44ae28e3..76bf619f 100644 --- a/tests/testlibrary.c +++ b/tests/testlibrary.c -@@ -1053,7 +1053,7 @@ check_bwrap_support (void) +@@ -1343,7 +1343,7 @@ check_bwrap_support (void) { gint exit_code = 0; char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net", @@ -133,16 +154,45 @@ index f2773dc8..3af9026f 100644 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 2188f535..d8283061 100755 +--- a/triggers/desktop-database.trigger ++++ b/triggers/desktop-database.trigger +@@ -1,5 +1,5 @@ + #!/bin/sh + +-if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -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 711cfab2..10c220ec 100755 +index 711cfab2..07baa2ac 100755 --- a/triggers/gtk-icon-cache.trigger +++ b/triggers/gtk-icon-cache.trigger -@@ -1,7 +1,7 @@ +@@ -1,10 +1,10 @@ #!/bin/sh - if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then +-if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then - cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ ++if test \( -d $1/exports/share/icons/hicolor \); then + 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 ! 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 2067d8ec..a49a8777 100755 +--- a/triggers/mime-database.trigger ++++ b/triggers/mime-database.trigger +@@ -1,5 +1,5 @@ + #!/bin/sh + +-if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -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 diff --git a/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch b/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch index 01363ffb7b34..84534b7bc53a 100644 --- a/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch +++ b/nixpkgs/pkgs/development/libraries/flatpak/use-flatpak-from-path.patch @@ -1,8 +1,8 @@ diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c -index 8f9dc66c..d3ab6e5f 100644 +index 52b222ea..9489441f 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c -@@ -6701,7 +6701,7 @@ export_desktop_file (const char *app, +@@ -6956,7 +6956,7 @@ export_desktop_file (const char *app, new_exec = g_string_new (""); g_string_append_printf (new_exec, @@ -11,7 +11,7 @@ index 8f9dc66c..d3ab6e5f 100644 escaped_branch, escaped_arch); -@@ -7891,8 +7891,8 @@ flatpak_dir_deploy (FlatpakDir *self, +@@ -8290,8 +8290,8 @@ flatpak_dir_deploy (FlatpakDir *self, error)) return FALSE; @@ -23,10 +23,10 @@ index 8f9dc66c..d3ab6e5f 100644 G_FILE_CREATE_REPLACE_DESTINATION, NULL, cancellable, error)) return FALSE; diff --git a/tests/test-bundle.sh b/tests/test-bundle.sh -index dff17f33..a9857adc 100755 +index d1682344..5e2b9a97 100755 --- a/tests/test-bundle.sh +++ b/tests/test-bundle.sh -@@ -59,7 +59,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files +@@ -67,7 +67,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/files assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/master/active/export assert_has_file $FL_DIR/exports/share/applications/org.test.Hello.desktop # Ensure Exec key is rewritten @@ -36,7 +36,7 @@ index dff17f33..a9857adc 100755 assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png diff --git a/tests/test-run.sh b/tests/test-run.sh -index 233df9ad..76e0b23b 100644 +index fecb756e..64043281 100644 --- a/tests/test-run.sh +++ b/tests/test-run.sh @@ -45,7 +45,7 @@ assert_has_dir $FL_DIR/app/org.test.Hello/$ARCH/stable/active/files @@ -45,6 +45,6 @@ index 233df9ad..76e0b23b 100644 # Ensure Exec key is rewritten -assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=.*/flatpak run --branch=stable --arch=$ARCH --command=hello\.sh org\.test\.Hello$" +assert_file_has_content $FL_DIR/exports/share/applications/org.test.Hello.desktop "^Exec=flatpak run --branch=stable --arch=$ARCH --command=hello\.sh org\.test\.Hello$" + assert_has_file $FL_DIR/exports/share/gnome-shell/search-providers/org.test.Hello.search-provider.ini + assert_file_has_content $FL_DIR/exports/share/gnome-shell/search-providers/org.test.Hello.search-provider.ini "^DefaultDisabled=true$" assert_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/org.test.Hello.png - assert_not_has_file $FL_DIR/exports/share/icons/hicolor/64x64/apps/dont-export.png - assert_has_file $FL_DIR/exports/share/icons/HighContrast/64x64/apps/org.test.Hello.png |