git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #93771 from jtojnar/flatpak-1.8
commita86f4110a769227c1c8bf7e88264c583bfdfd688 authorJan Tojnar <jtojnar@gmail.com> dateSun 26 Jul 2020, 13:56 (6 years ago) parent5d3f240379038b
5 files changed+71−30
nixos/modules/services/desktops/flatpak.nix+1 nixos/tests/installed-tests/default.nix+6 nixos/tests/installed-tests/flatpak.nix+3−6 pkgs/development/libraries/flatpak/default.nix+42−12 pkgs/development/libraries/flatpak/fix-test-paths.patch+19−12
nixos/modules/services/desktops/flatpak.nix+1
@@ -42,6 +42,7 @@ in {
4242 # It has been possible since https://github.com/flatpak/flatpak/releases/tag/1.3.2
4343 # to build a SELinux policy module.
4444
45+ # TODO: use sysusers.d
4546 users.users.flatpak = {
4647 description = "Flatpak system helper";
4748 group = "flatpak";
nixos/tests/installed-tests/default.nix+6
@@ -50,6 +50,12 @@ let
5050
5151 environment.systemPackages = with pkgs; [ gnome-desktop-testing ];
5252
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";
5359 };
5460
5561 testScript =
nixos/tests/installed-tests/flatpak.nix+3−6
@@ -5,14 +5,11 @@ makeInstalledTest {
55 withX11 = true;
66
77 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;
129 services.flatpak.enable = true;
13− environment.systemPackages = with pkgs; [ gnupg ostree python2 ];
10+ environment.systemPackages = with pkgs; [ gnupg ostree python3 ];
1411 virtualisation.memorySize = 2047;
15− virtualisation.diskSize = 1024;
12+ virtualisation.diskSize = 3072;
1613 };
1714
1815 testRunnerFlags = "--timeout 3600";
pkgs/development/libraries/flatpak/default.nix+42−12
@@ -1,21 +1,23 @@
11{ stdenv
22, fetchurl
3−, autoreconfHook
3+, fetchpatch
4+, autoconf
5+, automake
6+, libtool
47, docbook_xml_dtd_412
58, docbook_xml_dtd_42
69, docbook_xml_dtd_43
7−, docbook_xsl
10+, docbook-xsl-nons
811, which
912, libxml2
1013, gobject-introspection
1114, gtk-doc
1215, intltool
1316, libxslt
14−, pkgconfig
17+, pkg-config
1518, xmlto
1619, appstream-glib
1720, substituteAll
18−, glibcLocales
1921, yacc
2022, xdg-dbus-proxy
2123, p11-kit
@@ -39,6 +41,7 @@
3941, nixosTests
4042, libsoup
4143, lzma
44+, zstd
4245, ostree
4346, polkit
4447, python3
@@ -54,14 +57,14 @@
5457
5558stdenv.mkDerivation rec {
5659 pname = "flatpak";
57− version = "1.6.3";
60+ version = "1.8.1";
5861
5962 # 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" ];
6164
6265 src = fetchurl {
6366 url = "https://github.com/flatpak/flatpak/releases/download/${version}/${pname}-${version}.tar.xz";
64− sha256 = "17s8nqdxd4xdy7ag9bw06adxccha78jmlsa3zpqnl3qh92pg0hji";
67+ sha256 = "ZpFLZvmmQHk4bMCXpAoZ+oQZVo33+0VvLkB/D3asnq0=";
6568 };
6669
6770 patches = [
@@ -69,7 +72,7 @@ stdenv.mkDerivation rec {
6972 # https://github.com/flatpak/flatpak/issues/1460
7073 (substituteAll {
7174 src = ./fix-test-paths.patch;
72− inherit coreutils gettext glibcLocales socat gtk3;
75+ inherit coreutils gettext socat gtk3;
7376 smi = shared-mime-info;
7477 dfu = desktop-file-utils;
7578 hicolorIconTheme = hicolor-icon-theme;
@@ -101,21 +104,31 @@ stdenv.mkDerivation rec {
101104
102105 # But we want the GDK_PIXBUF_MODULE_FILE from the wrapper affect the icon validator.
103106 ./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+ })
104114 ];
105115
106116 nativeBuildInputs = [
107− autoreconfHook
117+ autoconf
118+ automake
119+ libtool
108120 libxml2
121+ # TODO: replace with docbook_xml_dtd_45 https://github.com/flatpak/flatpak/pull/3760
109122 docbook_xml_dtd_412
110123 docbook_xml_dtd_42
111124 docbook_xml_dtd_43
112− docbook_xsl
125+ docbook-xsl-nons
113126 which
114127 gobject-introspection
115128 gtk-doc
116129 intltool
117130 libxslt
118− pkgconfig
131+ pkg-config
119132 xmlto
120133 appstream-glib
121134 yacc
@@ -134,6 +147,7 @@ stdenv.mkDerivation rec {
134147 libseccomp
135148 libsoup
136149 lzma
150+ # zstd # TODO: broken paths in .pc file
137151 polkit
138152 python3
139153 systemd
@@ -166,6 +180,7 @@ stdenv.mkDerivation rec {
166180 "--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy"
167181 "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d"
168182 "--localstatedir=/var"
183+ "--enable-gtk-doc"
169184 "--enable-installed-tests"
170185 ];
171186
@@ -174,9 +189,24 @@ stdenv.mkDerivation rec {
174189 "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
175190 ];
176191
177− postPatch = ''
192+ postPatch = let
193+ vsc-py = python3.withPackages (pp: [
194+ pp.pyparsing
195+ ]);
196+ in ''
178197 patchShebangs buildutil
179198 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
180210 '';
181211
182212 passthru = {
pkgs/development/libraries/flatpak/fix-test-paths.patch+19−12
@@ -1,5 +1,5 @@
11diff --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
33--- a/app/flatpak-builtins-build-export.c
44+++ b/app/flatpak-builtins-build-export.c
55@@ -458,7 +458,7 @@ validate_desktop_file (GFile *desktop_file,
@@ -12,10 +12,10 @@ index 5de89d62..bf6bdb52 100644
1212 {
1313 if (!g_error_matches (local_error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
1414diff --git a/tests/libtest.sh b/tests/libtest.sh
15−index e64be49f..a9a53e12 100644
15+index acb2095b..b361da16 100644
1616--- a/tests/libtest.sh
1717+++ b/tests/libtest.sh
18−@@ -367,7 +367,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then
18+@@ -431,7 +431,7 @@ if [ -z "${FLATPAK_BWRAP:-}" ]; then
1919 # running installed-tests: assume we know what we're doing
2020 _flatpak_bwrap_works=true
2121 elif ! "$FLATPAK_BWRAP" --unshare-ipc --unshare-net --unshare-pid \
@@ -24,7 +24,7 @@ index e64be49f..a9a53e12 100644
2424 _flatpak_bwrap_works=false
2525 else
2626 _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 \
2828 export DBUS_SESSION_BUS_ADDRESS="$(cat dbus-session-bus-address)"
2929 DBUS_SESSION_BUS_PID="$(cat dbus-session-bus-pid)"
3030
@@ -33,7 +33,7 @@ index e64be49f..a9a53e12 100644
3333 assert_not_reached "Failed to start dbus-daemon"
3434 fi
3535
36−@@ -449,7 +449,7 @@ gdb_bt () {
36+@@ -519,7 +519,7 @@ commit_to_path () {
3737 }
3838
3939 cleanup () {
@@ -43,10 +43,10 @@ index e64be49f..a9a53e12 100644
4343 fusermount -u $XDG_RUNTIME_DIR/doc || :
4444 kill $(jobs -p) &> /dev/null || true
4545diff --git a/tests/make-test-app.sh b/tests/make-test-app.sh
46−index e51e21a6..7d39efb5 100755
46+index 612f914f..4b890da2 100755
4747--- a/tests/make-test-app.sh
4848+++ b/tests/make-test-app.sh
49−@@ -149,13 +149,13 @@ msgid "Hello world"
49+@@ -151,13 +151,13 @@ msgid "Hello world"
5050 msgstr "Hallo Welt"
5151 EOF
5252 mkdir -p ${DIR}/files/de/share/de/LC_MESSAGES
@@ -63,10 +63,10 @@ index e51e21a6..7d39efb5 100755
6363 flatpak build-finish ${DIR}
6464 mkdir -p repos
6565diff --git a/tests/make-test-runtime.sh b/tests/make-test-runtime.sh
66−index 5d2c309b..cf61a3cf 100755
66+index af289625..7db51c17 100755
6767--- a/tests/make-test-runtime.sh
6868+++ b/tests/make-test-runtime.sh
69−@@ -25,9 +25,10 @@ EOF
69+@@ -28,9 +28,10 @@ EOF
7070
7171 # On Debian derivatives, /usr/sbin and /sbin aren't in ordinary users'
7272 # PATHs, but ldconfig is kept in /sbin
@@ -78,7 +78,7 @@ index 5d2c309b..cf61a3cf 100755
7878 mkdir -p ${DIR}/usr/bin
7979 mkdir -p ${DIR}/usr/lib
8080 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
8282 else
8383 cp `which ldconfig` ${DIR}/usr/bin
8484 fi
@@ -129,11 +129,18 @@ index 5d2c309b..cf61a3cf 100755
129129 done
130130 ln -s bash ${DIR}/usr/bin/sh
131131
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+
132136-# We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but
133137-# the real en_US locale is often not available, because its in the
134138-# local archive.
135139-mkdir -p ${DIR}/usr/lib/locale/
136140-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++
137144+mv ${DIR}/nix/store ${DIR}/usr/store # files outside /usr are not permitted, we will have to replace /nix/store with /usr/store
138145+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
139146+find ${DIR} -type f -print0 | xargs -0 sed -i 's~/nix/store/~/usr/store/~g' # replace hardcoded paths
@@ -142,10 +149,10 @@ index 5d2c309b..cf61a3cf 100755
142149 if [ x$COLLECTION_ID != x ]; then
143150 collection_args=--collection-id=${COLLECTION_ID}
144151diff --git a/tests/testlibrary.c b/tests/testlibrary.c
145−index 44ae28e3..76bf619f 100644
152+index 509ce6cc..6a333c9c 100644
146153--- a/tests/testlibrary.c
147154+++ b/tests/testlibrary.c
148−@@ -1343,7 +1343,7 @@ check_bwrap_support (void)
155+@@ -1399,7 +1399,7 @@ check_bwrap_support (void)
149156 {
150157 gint exit_code = 0;
151158 char *argv[] = { (char *) bwrap, "--unshare-ipc", "--unshare-net",