Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdg-desktop-portal: 1.6.0 -> 1.7.2 #88598

Merged
merged 2 commits into from Jun 24, 2020
Merged

Conversation

betaboon
Copy link
Contributor

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@hedning
Copy link
Contributor

hedning commented May 22, 2020

Note 1.7.2 is a pre-release. Though it looks like both arch and fedora is already using it. So I'd guess we're okay.

@betaboon
Copy link
Contributor Author

I'm using this for quite a while now and it works fine

Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changelogs look okay:

Even the commits that stand out (fuse and test.portal for installed-tests):

flatpak/xdg-desktop-portal@1.6.0...1.7.0

But do we not need to update Flatpak and xdg-desktop-portal-gtk too?

@@ -61,10 +61,6 @@ stdenv.mkDerivation rec {
json-glib
];

# Seems to get stuck after "PASS: test-portals 39 /portal/inhibit/monitor"
# TODO: investigate!
doCheck = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test if the tests are still broken? There were some improvements in 1.7.0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some progress but the tests are still broken:

--- a/nixos/tests/installed-tests/xdg-desktop-portal.nix
+++ b/nixos/tests/installed-tests/xdg-desktop-portal.nix
@@ -3,7 +3,8 @@
 makeInstalledTest {
   tested = pkgs.xdg-desktop-portal;
 
-  # Ton of breakage.
-  # https://github.com/flatpak/xdg-desktop-portal/pull/428
-  meta.broken = true;
+  testConfig = {
+    services.geoclue2.enable = true;
+    services.pipewire.enable = true;
+  };
 }
diff --git a/pkgs/development/libraries/xdg-desktop-portal/default.nix b/pkgs/development/libraries/xdg-desktop-portal/default.nix
index b06edc63273..71b2c438fcb 100644
--- a/pkgs/development/libraries/xdg-desktop-portal/default.nix
+++ b/pkgs/development/libraries/xdg-desktop-portal/default.nix
@@ -6,6 +6,7 @@
 , pkgconfig
 , libxml2
 , glib
+, python3
 , pipewire
 , fontconfig
 , flatpak
@@ -59,6 +60,11 @@ stdenv.mkDerivation rec {
     libportal
     gsettings-desktop-schemas
     json-glib
+
+    # For installed tests
+    (python3.withPackages (pp: with pp; [
+      pygobject3
+    ]))
   ];
 
   configureFlags = [
@@ -70,6 +76,12 @@ stdenv.mkDerivation rec {
     "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/xdg-desktop-portal"
   ];
 
+  postFixup = ''
+    substituteInPlace $installedTests/libexec/installed-tests/xdg-desktop-portal/test-document-fuse.sh \
+      --subst-var-by libexecdir "$out/libexec"
+    wrapGApp $installedTests/libexec/installed-tests/xdg-desktop-portal/test-document-fuse.sh
+  '';
+
   passthru = {
     tests = {
       installedTests = nixosTests.installed-tests.xdg-desktop-portal;
diff --git a/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch b/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch
index 98e26e88b5c..4161ae975f0 100644
--- a/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch
+++ b/pkgs/development/libraries/xdg-desktop-portal/fix-paths.patch
@@ -2,7 +2,7 @@ diff --git a/src/notification.c b/src/notification.c
 index 5412609..4243e98 100644
 --- a/src/notification.c
 +++ b/src/notification.c
-@@ -366,7 +366,7 @@
+@@ -366,7 +366,7 @@ validate_icon_more (GVariant *v)
    int status;
    g_autofree char *err = NULL;
    g_autoptr(GError) error = NULL;
@@ -11,3 +11,52 @@ index 5412609..4243e98 100644
    const char *args[6];
  
    if (G_IS_THEMED_ICON (icon))
+diff --git a/tests/test-document-fuse.sh b/tests/test-document-fuse.sh
+index a571a16..4d15e45 100755
+--- a/tests/test-document-fuse.sh
++++ b/tests/test-document-fuse.sh
+@@ -49,37 +49,38 @@ export XDG_RUNTIME_DIR=${TEST_DATA_DIR}/runtime
+ cleanup () {
+     fusermount -u $XDG_RUNTIME_DIR/doc || :
+     sleep 0.1
+-    /bin/kill -9 $DBUS_SESSION_BUS_PID
++    kill -9 $DBUS_SESSION_BUS_PID
+     kill $(jobs -p) &> /dev/null || true
+     rm -rf $TEST_DATA_DIR
+ }
+ trap cleanup EXIT
+ 
+-sed s#@testdir@#${test_builddir}# ${test_srcdir}/session.conf.in > session.conf
++# for some reason it is installed to tests subdirectory
++sed s#@testdir@#${test_builddir}# ${test_srcdir}/tests/session.conf.in > session.conf
+ 
+ dbus-daemon --fork --config-file=session.conf --print-address=3 --print-pid=4 \
+             3> dbus-session-bus-address 4> dbus-session-bus-pid
+ 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 ! kill -0 "$DBUS_SESSION_BUS_PID"; then
+     assert_not_reached "Failed to start dbus-daemon"
+ fi
+ 
+ # Run portal manually so that we get any segfault our assert output
+ # Add -v here to get debug output from fuse
+-./xdg-document-portal -r &
++@libexecdir@/xdg-document-portal -r &
+ 
+ # First run a basic single-thread test
+ echo Testing single-threaded
+-python3 ${test_srcdir}/test-document-fuse.py --iterations 3 -v
++${test_srcdir}/test-document-fuse.py --iterations 3 -v
+ echo "ok single-threaded"
+ 
+ # Then a bunch of copies in parallel to stress-test
+ echo Testing in parallel
+ PIDS=()
+ for i in $(seq 20); do
+-    python3 ${test_srcdir}/test-document-fuse.py --iterations 10 --prefix $i &
++    ${test_srcdir}/test-document-fuse.py --iterations 10 --prefix $i &
+     PID="$!"
+     PIDS+=( "$PID" )
+ done

Upstream PR: flatpak/xdg-desktop-portal#503

@jtojnar
Copy link
Contributor

jtojnar commented Jun 14, 2020

@GrahamcOfBorg build xdg-desktop-portal.passthru.tests

@hedning
Copy link
Contributor

hedning commented Jun 14, 2020

Fedora-32 runs 1.7.1 xdg-desktop-portal-gtk, but still use the stable flatpak release (1.6.3). So it probably wouldn't hurt following tbh.

@flokli
Copy link
Contributor

flokli commented Jun 22, 2020

As @jsravn commented in #91218 (comment), this should be the missing component to get Chromium to screenshare on wayland.

@hedning, not sure if I understand what you're suggesting.

  • nixpkgs master uses flatpak 1.6.3 (their latest release is 1.7.3)
  • nixpkgs master uses xdg-desktop-portal-gtk 1.6.0 (their latest release is 1.7.1)
  • this PR bumps xdg-desktop-portal to 1.7.2 (their latest release)

I think it'd make sense to bump xdg-desktop-portal-gtk and flatpak to their latest 1.7.x releases, so xdg-desktop and xdg-desktop-portal[-gtk] all use 1.7.x versions.

@betaboon, do you want to add this to this PR, or should I create a followup commit?

@worldofpeace
Copy link
Contributor

@flokli I believe hedning means that they are likely API/ABI compatible and there's no reason to hold up this update to also update to latest flatpak at the same time. It's also rather tedious to update flatpak in nixpkgs, the previous one had lots of fallout.

@hedning
Copy link
Contributor

hedning commented Jun 22, 2020

@flokli, yep, it was in response to this:

But do we not need to update Flatpak and xdg-desktop-portal-gtk too?

So, we should probably just update xdg-desktop-portal-gtk too, but leave flatpak on a stable release.

@flokli
Copy link
Contributor

flokli commented Jun 22, 2020

So, we should probably just update xdg-desktop-portal-gtk too, but leave flatpak on a stable release.

SGTM. @betaboon, can you include this in this PR?

It's also rather tedious to update flatpak in nixpkgs, the previous one had lots of fallout.

We luckily already have Flatpak 1.6.3 in 20.03, so there's a chance we can backport all the needed fixes for wayland and screensharing to 20.03 :-)

@flokli
Copy link
Contributor

flokli commented Jun 24, 2020

Okay, seems ofborg got stuck here. I manually build xdg-desktop-portal, and added the bump of xdg-desktop-portal-gtk to this PR.

I tried another round of screensharing, there seem to be some few issues left - I'll document my findings in #91218, which seems to be better suited for the whole task than this individual PR.

@flokli flokli merged commit 5897105 into NixOS:master Jun 24, 2020
@betaboon
Copy link
Contributor Author

@flokli ah sorry i was too busy with work :/
thanks for getting this done :)

@jtojnar
Copy link
Contributor

jtojnar commented Jun 24, 2020

Changes look mostly okay but gsettings changes are always suspect:

Source code changes look reasonable, though, we already include gsettings-desktop-schemas for the animations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants