lol

Merge pull request #93771 from jtojnar/flatpak-1.8

authored by

Jan Tojnar and committed by
GitHub
a86f4110 5d3f240e

+71 -30
+1
nixos/modules/services/desktops/flatpak.nix
··· 42 42 # It has been possible since https://github.com/flatpak/flatpak/releases/tag/1.3.2 43 43 # to build a SELinux policy module. 44 44 45 + # TODO: use sysusers.d 45 46 users.users.flatpak = { 46 47 description = "Flatpak system helper"; 47 48 group = "flatpak";
+6
nixos/tests/installed-tests/default.nix
··· 50 50 51 51 environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; 52 52 53 + # The installed tests need to be added to the test VM’s closure. 54 + # Otherwise, their dependencies might not actually be registered 55 + # as valid paths in the VM’s Nix store database, 56 + # and `nix-store --query` commands run as part of the tests 57 + # (for example when building Flatpak runtimes) will fail. 58 + environment.variables.TESTED_PACKAGE_INSTALLED_TESTS = "${tested.installedTests}/share"; 53 59 }; 54 60 55 61 testScript =
+3 -6
nixos/tests/installed-tests/flatpak.nix
··· 5 5 withX11 = true; 6 6 7 7 testConfig = { 8 - services.xserver.desktopManager.gnome3.enable = true; # TODO: figure out minimal environment where the tests work 9 - # common/x11.nix enables the auto display manager (lightdm) 10 - services.xserver.displayManager.gdm.enable = false; 11 - services.gnome3.core-utilities.enable = false; 8 + xdg.portal.enable = true; 12 9 services.flatpak.enable = true; 13 - environment.systemPackages = with pkgs; [ gnupg ostree python2 ]; 10 + environment.systemPackages = with pkgs; [ gnupg ostree python3 ]; 14 11 virtualisation.memorySize = 2047; 15 - virtualisation.diskSize = 1024; 12 + virtualisation.diskSize = 3072; 16 13 }; 17 14 18 15 testRunnerFlags = "--timeout 3600";
+42 -12
pkgs/development/libraries/flatpak/default.nix
··· 1 1 { stdenv 2 2 , fetchurl 3 - , autoreconfHook 3 + , fetchpatch 4 + , autoconf 5 + , automake 6 + , libtool 4 7 , docbook_xml_dtd_412 5 8 , docbook_xml_dtd_42 6 9 , docbook_xml_dtd_43 7 - , docbook_xsl 10 + , docbook-xsl-nons 8 11 , which 9 12 , libxml2 10 13 , gobject-introspection 11 14 , gtk-doc 12 15 , intltool 13 16 , libxslt 14 - , pkgconfig 17 + , pkg-config 15 18 , xmlto 16 19 , appstream-glib 17 20 , substituteAll 18 - , glibcLocales 19 21 , yacc 20 22 , xdg-dbus-proxy 21 23 , p11-kit ··· 39 41 , nixosTests 40 42 , libsoup 41 43 , lzma 44 + , zstd 42 45 , ostree 43 46 , polkit 44 47 , python3 ··· 54 57 55 58 stdenv.mkDerivation rec { 56 59 pname = "flatpak"; 57 - version = "1.6.3"; 60 + version = "1.8.1"; 58 61 59 62 # TODO: split out lib once we figure out what to do with triggerdir 60 - outputs = [ "out" "dev" "man" "doc" "installedTests" ]; 63 + outputs = [ "out" "dev" "man" "doc" "devdoc" "installedTests" ]; 61 64 62 65 src = fetchurl { 63 66 url = "https://github.com/flatpak/flatpak/releases/download/${version}/${pname}-${version}.tar.xz"; 64 - sha256 = "17s8nqdxd4xdy7ag9bw06adxccha78jmlsa3zpqnl3qh92pg0hji"; 67 + sha256 = "ZpFLZvmmQHk4bMCXpAoZ+oQZVo33+0VvLkB/D3asnq0="; 65 68 }; 66 69 67 70 patches = [ ··· 69 72 # https://github.com/flatpak/flatpak/issues/1460 70 73 (substituteAll { 71 74 src = ./fix-test-paths.patch; 72 - inherit coreutils gettext glibcLocales socat gtk3; 75 + inherit coreutils gettext socat gtk3; 73 76 smi = shared-mime-info; 74 77 dfu = desktop-file-utils; 75 78 hicolorIconTheme = hicolor-icon-theme; ··· 101 104 102 105 # But we want the GDK_PIXBUF_MODULE_FILE from the wrapper affect the icon validator. 103 106 ./validate-icon-pixbuf.patch 107 + 108 + # Fix `flatpak/test-oci-registry@{user,system}.wrap.test` installed tests. 109 + # https://github.com/flatpak/flatpak/pull/3762 110 + (fetchpatch { 111 + url = "https://github.com/flatpak/flatpak/commit/c1447dadecd50f384b6d11dac18b014245267d00.patch"; 112 + sha256 = "UAA/wGr8/aMbx5MV+8Ilro2kgKkx2QOn88lDUjCgeDA="; 113 + }) 104 114 ]; 105 115 106 116 nativeBuildInputs = [ 107 - autoreconfHook 117 + autoconf 118 + automake 119 + libtool 108 120 libxml2 121 + # TODO: replace with docbook_xml_dtd_45 https://github.com/flatpak/flatpak/pull/3760 109 122 docbook_xml_dtd_412 110 123 docbook_xml_dtd_42 111 124 docbook_xml_dtd_43 112 - docbook_xsl 125 + docbook-xsl-nons 113 126 which 114 127 gobject-introspection 115 128 gtk-doc 116 129 intltool 117 130 libxslt 118 - pkgconfig 131 + pkg-config 119 132 xmlto 120 133 appstream-glib 121 134 yacc ··· 134 147 libseccomp 135 148 libsoup 136 149 lzma 150 + # zstd # TODO: broken paths in .pc file 137 151 polkit 138 152 python3 139 153 systemd ··· 166 180 "--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy" 167 181 "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d" 168 182 "--localstatedir=/var" 183 + "--enable-gtk-doc" 169 184 "--enable-installed-tests" 170 185 ]; 171 186 ··· 174 189 "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak" 175 190 ]; 176 191 177 - postPatch = '' 192 + postPatch = let 193 + vsc-py = python3.withPackages (pp: [ 194 + pp.pyparsing 195 + ]); 196 + in '' 178 197 patchShebangs buildutil 179 198 patchShebangs tests 199 + PATH=${stdenv.lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build variant-schema-compiler/variant-schema-compiler 200 + ''; 201 + 202 + preConfigure = '' 203 + # TODO: remove the condition once autogen.sh is shipped in the tarball 204 + # https://github.com/flatpak/flatpak/pull/3761 205 + if [[ -f autogen.sh ]]; then 206 + NOCONFIGURE=1 ./autogen.sh 207 + else 208 + autoreconf --install --force --verbose 209 + fi 180 210 ''; 181 211 182 212 passthru = {
+19 -12
pkgs/development/libraries/flatpak/fix-test-paths.patch
··· 1 1 diff --git a/app/flatpak-builtins-build-export.c b/app/flatpak-builtins-build-export.c 2 - index 5de89d62..bf6bdb52 100644 2 + index 43fd0563..4067bd36 100644 3 3 --- a/app/flatpak-builtins-build-export.c 4 4 +++ b/app/flatpak-builtins-build-export.c 5 5 @@ -458,7 +458,7 @@ validate_desktop_file (GFile *desktop_file, ··· 12 12 { 13 13 if (!g_error_matches (local_error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT)) 14 14 diff --git a/tests/libtest.sh b/tests/libtest.sh 15 - index e64be49f..a9a53e12 100644 15 + index acb2095b..b361da16 100644 16 16 --- a/tests/libtest.sh 17 17 +++ b/tests/libtest.sh 18 - @@ -367,7 +367,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then 18 + @@ -431,7 +431,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then 19 19 # running installed-tests: assume we know what we're doing 20 20 _flatpak_bwrap_works=true 21 21 elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \ ··· 24 24 _flatpak_bwrap_works=false 25 25 else 26 26 _flatpak_bwrap_works=true 27 - @@ -440,7 +440,7 @@ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \ 27 + @@ -504,7 +504,7 @@ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \ 28 28 export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)" 29 29 DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)" 30 30 ··· 33 33 assert_not_reached "Failed to start dbus-daemon" 34 34 fi 35 35 36 - @@ -449,7 +449,7 @@ gdb_bt () { 36 + @@ -519,7 +519,7 @@ commit_to_path () { 37 37 } 38 38 39 39 cleanup () { ··· 43 43 fusermount -u $XDG_RUNTIME_DIR/doc || : 44 44 kill $(jobs -p) &> /dev/null || true 45 45 diff --git a/tests/make-test-app.sh b/tests/make-test-app.sh 46 - index e51e21a6..7d39efb5 100755 46 + index 612f914f..4b890da2 100755 47 47 --- a/tests/make-test-app.sh 48 48 +++ b/tests/make-test-app.sh 49 - @@ -149,13 +149,13 @@ msgid "Hello world" 49 + @@ -151,13 +151,13 @@ msgid "Hello world" 50 50 msgstr "Hallo Welt" 51 51 EOF 52 52 mkdir -p ${DIR}/files/de/share/de/LC_MESSAGES ··· 63 63 flatpak build-finish ${DIR} 64 64 mkdir -p repos 65 65 diff --git a/tests/make-test-runtime.sh b/tests/make-test-runtime.sh 66 - index 5d2c309b..cf61a3cf 100755 66 + index af289625..7db51c17 100755 67 67 --- a/tests/make-test-runtime.sh 68 68 +++ b/tests/make-test-runtime.sh 69 - @@ -25,9 +25,10 @@ EOF 69 + @@ -28,9 +28,10 @@ EOF 70 70 71 71 # On Debian derivatives, /usr/sbin and /sbin aren't in ordinary users' 72 72 # PATHs, but ldconfig is kept in /sbin ··· 78 78 mkdir -p ${DIR}/usr/bin 79 79 mkdir -p ${DIR}/usr/lib 80 80 ln -s ../lib ${DIR}/usr/lib64 81 - @@ -37,48 +38,24 @@ if test -f /sbin/ldconfig.real; then 81 + @@ -40,40 +41,17 @@ if test -f /sbin/ldconfig.real; then 82 82 else 83 83 cp `which ldconfig` ${DIR}/usr/bin 84 84 fi ··· 129 129 done 130 130 ln -s bash ${DIR}/usr/bin/sh 131 131 132 + @@ -84,11 +62,13 @@ echo "Hello world, from a runtime$EXTRA" 133 + EOF 134 + chmod a+x ${DIR}/usr/bin/runtime_hello.sh 135 + 132 136 -# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but 133 137 -# the real en_US locale is often not available, because its in the 134 138 -# local archive. 135 139 -mkdir -p ${DIR}/usr/lib/locale/ 136 140 -cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US 141 + +# We do not copy C.UTF8 locale because it is in locale archive and 142 + +# that is already copied with glibc. 143 + + 137 144 +mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store 138 145 +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 139 146 +find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths ··· 142 149 if [ x$COLLECTION_ID != x ]; then 143 150 collection_args=--collection-id=${COLLECTION_ID} 144 151 diff --git a/tests/testlibrary.c b/tests/testlibrary.c 145 - index 44ae28e3..76bf619f 100644 152 + index 509ce6cc..6a333c9c 100644 146 153 --- a/tests/testlibrary.c 147 154 +++ b/tests/testlibrary.c 148 - @@ -1343,7 +1343,7 @@ check_bwrap_support (void) 155 + @@ -1399,7 +1399,7 @@ check_bwrap_support (void) 149 156 { 150 157 gint exit_code = 0; 151 158 char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net",