diffstat of debian/ for flatpak-xdg-utils_1.0.0-1 flatpak-xdg-utils_0.1 changelog | 6 compat | 1 control | 76 copyright | 74 flatpak-xdg-utils-tests.install | 2 flatpak-xdg-utils.install | 1 gbp.conf | 7 patches/Add-backports-of-g_autoptr-for-compatibility-with-older-G.patch | 283 -- patches/Add-test-and-installed-test-coverage-for-xdg-tools.patch | 1059 ---------- patches/series | 2 rules | 31 source/format | 2 tests/control | 4 tests/gnome-desktop-testing | 6 upstream/metadata | 8 watch | 2 16 files changed, 56 insertions(+), 1508 deletions(-) diff -Nru flatpak-xdg-utils-1.0.0/debian/changelog flatpak-xdg-utils-0.1/debian/changelog --- flatpak-xdg-utils-1.0.0/debian/changelog 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/changelog 2018-03-07 07:11:20.000000000 +0000 @@ -1,5 +1,5 @@ -flatpak-xdg-utils (1.0.0-1) unstable; urgency=medium +flatpak-xdg-utils (0.1) unstable; urgency=medium - * Initial release (Closes: #919299) + * Initial Release. - -- Simon McVittie Fri, 18 Jan 2019 10:29:06 +0000 + -- Deepin Packages Builder Wed, 07 Mar 2018 15:11:20 +0800 diff -Nru flatpak-xdg-utils-1.0.0/debian/compat flatpak-xdg-utils-0.1/debian/compat --- flatpak-xdg-utils-1.0.0/debian/compat 1970-01-01 00:00:00.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/compat 2018-03-07 07:11:20.000000000 +0000 @@ -0,0 +1 @@ +9 diff -Nru flatpak-xdg-utils-1.0.0/debian/control flatpak-xdg-utils-0.1/debian/control --- flatpak-xdg-utils-1.0.0/debian/control 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/control 2018-03-07 07:11:20.000000000 +0000 @@ -1,75 +1,13 @@ Source: flatpak-xdg-utils -Section: admin +Section: devel Priority: optional -Maintainer: Utopia Maintenance Team -Uploaders: - Simon McVittie , -Build-Depends: - dbus , - debhelper-compat (= 12), - libglib2.0-dev, - meson (>= 0.46.0), -Rules-Requires-Root: no -Standards-Version: 4.3.0 +Maintainer: Deepin Packages Builder +Build-Depends: debhelper (>= 9), gnome-common, libglib2.0-dev +Standards-Version: 3.9.8 Homepage: https://github.com/flatpak/flatpak-xdg-utils -Vcs-Git: https://salsa.debian.org/debian/flatpak-xdg-utils.git -Vcs-Browser: https://salsa.debian.org/debian/flatpak-xdg-utils Package: flatpak-xdg-utils Architecture: any -Multi-Arch: foreign -Depends: - ${misc:Depends}, - ${shlibs:Depends}, -Suggests: - default-dbus-session-bus | dbus-session-bus, - xdg-desktop-portal, -Description: xdg-open and xdg-email reimplementation for containerized apps - Applications running in a Flatpak sandbox cannot normally launch arbitrary - subprocesses outside the container to open files and URLs. This - package provides reimplementations of the standard xdg-open(1) and - xdg-email(1) command-line tools intended to be run inside the container. - They use the D-Bus session bus to communicate with the xdg-desktop-portal - service outside the container. - . - To avoid conflicting with the standard xdg-utils package, these tools - are installed in /usr/libexec/flatpak-xdg-utils. This directory can be - added to the PATH when preparing a container, or used as a target for - container-specific symbolic links in /usr/bin. - . - This package also contains flatpak-spawn, which can be used by Flatpak - applications to launch processes outside the container. Unprivileged - applications can use this mechanism to launch a helper tool such as a - thumbnailer in a version of their sandbox with more restrictive - permissions, and specially-privileged applications with the 'devel' flag - (such as GNOME Builder) can use this mechanism to bypass the sandbox and - run commands on the host system. - . - This package is normally only useful if you are using Debian packages to - construct a Flatpak runtime or a similar container, and should not be - installed on a normal Debian desktop system. On desktop systems please - install the reference implementation of the xdg-open and xdg-email tools, - which can be found in the xdg-utils package. - . - If this package is installed in a non-Flatpak environment for testing, - it will require the dbus-session-bus and xdg-desktop-portal packages - (which would not be useful to install in a container). - -Package: flatpak-xdg-utils-tests -Architecture: any -Multi-Arch: foreign -Depends: - dbus, - flatpak-xdg-utils, - ${misc:Depends}, - ${shlibs:Depends}, -Recommends: - gnome-desktop-testing, -Description: as-installed tests for flatpak-xdg-utils - flatpak-xdg-utils provides reimplementations of the standard xdg-open(1) - and xdg-email(1) command-line tools intended to be run inside a Flatpak - container. They use the D-Bus session bus to communicate with the - xdg-desktop-portal service outside the container - . - This package contains as-installed tests, for use with autopkgtest and - similar frameworks. They use a mock implementation of xdg-desktop-portal. +Breaks: xdg-utils +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: flatpak for xdg-utils diff -Nru flatpak-xdg-utils-1.0.0/debian/copyright flatpak-xdg-utils-0.1/debian/copyright --- flatpak-xdg-utils-1.0.0/debian/copyright 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/copyright 2018-03-07 07:11:20.000000000 +0000 @@ -1,58 +1,34 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: flatpak-xdg-utils -Source: https://github.com/flatpak/flatpak-xdg-utils/releases -License: LGPL-2.1+ +Source: -Files: - * -Copyright: - © 2017-2018 Red Hat, Inc -License: LGPL-2.1+ +Files: * +Copyright: + +License: GPL-3.0+ -Files: - src/xdg-email.c - src/xdg-open.c -Copyright: - © 2017 Red Hat, Inc. -License: LGPL-2+ +Files: debian/* +Copyright: 2018 Deepin Packages Builder +License: GPL-3.0+ -Files: - debian/* -Copyright: - © 2016-2018 Simon McVittie - © 2016-2019 Collabora Ltd. -License: LGPL-2+ - -License: LGPL-2+ - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. +License: GPL-3.0+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. . - This library is distributed in the hope that it will be useful, + This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. . - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -Comment: - On Debian systems, the full text of the GNU Lesser General Public License - version 2.1 can be found in the file '/usr/share/common-licenses/LGPL-2.1'. - -License: LGPL-2.1+ - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + You should have received a copy of the GNU General Public License + along with this program. If not, see . . - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - . - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -Comment: - On Debian systems, the full text of the GNU Lesser General Public License - version 2.1 can be found in the file '/usr/share/common-licenses/LGPL-2.1'. + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. diff -Nru flatpak-xdg-utils-1.0.0/debian/flatpak-xdg-utils-tests.install flatpak-xdg-utils-0.1/debian/flatpak-xdg-utils-tests.install --- flatpak-xdg-utils-1.0.0/debian/flatpak-xdg-utils-tests.install 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/flatpak-xdg-utils-tests.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -usr/libexec/installed-tests -usr/share/installed-tests diff -Nru flatpak-xdg-utils-1.0.0/debian/flatpak-xdg-utils.install flatpak-xdg-utils-0.1/debian/flatpak-xdg-utils.install --- flatpak-xdg-utils-1.0.0/debian/flatpak-xdg-utils.install 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/flatpak-xdg-utils.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/libexec/flatpak-xdg-utils diff -Nru flatpak-xdg-utils-1.0.0/debian/gbp.conf flatpak-xdg-utils-0.1/debian/gbp.conf --- flatpak-xdg-utils-1.0.0/debian/gbp.conf 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -[DEFAULT] -pristine-tar = True -compression = xz -debian-branch = debian/master -upstream-branch = upstream/latest -patch-numbers = False -upstream-vcs-tag = %(version)s diff -Nru flatpak-xdg-utils-1.0.0/debian/patches/Add-backports-of-g_autoptr-for-compatibility-with-older-G.patch flatpak-xdg-utils-0.1/debian/patches/Add-backports-of-g_autoptr-for-compatibility-with-older-G.patch --- flatpak-xdg-utils-1.0.0/debian/patches/Add-backports-of-g_autoptr-for-compatibility-with-older-G.patch 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/patches/Add-backports-of-g_autoptr-for-compatibility-with-older-G.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,283 +0,0 @@ -From: Simon McVittie -Date: Thu, 17 Jan 2019 16:49:13 +0000 -Subject: Add backports of g_autoptr for compatibility with older GLib - -I'm not sure how backwards-compatible these tools are meant to be, but -it seems to be straightforward to make them work on Ubuntu 14.04 LTS -(GLib 2.40). - -These backports resemble the ones in xdg-dbus-proxy, with the addition -of GUnixFDList and GDBusMessageInvocation, both of which I used when -adding some unit tests. - -Signed-off-by: Simon McVittie -Forwarded: https://github.com/flatpak/flatpak-xdg-utils/pull/21 -Applied-upstream: 1.0.1, commit:8914b518ebea67a560270a98d7e24f1bbc7c9026 ---- - src/backport-autoptr.h | 243 +++++++++++++++++++++++++++++++++++++++++++++++++ - src/flatpak-spawn.c | 2 + - 2 files changed, 245 insertions(+) - create mode 100644 src/backport-autoptr.h - -diff --git a/src/backport-autoptr.h b/src/backport-autoptr.h -new file mode 100644 -index 0000000..675c59f ---- /dev/null -+++ b/src/backport-autoptr.h -@@ -0,0 +1,243 @@ -+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- -+ * -+ * Copyright (C) 2015 Colin Walters -+ * -+ * GLIB - Library of useful routines for C programming -+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the -+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330, -+ * Boston, MA 02111-1307, USA. -+ */ -+ -+#pragma once -+ -+#include -+ -+G_BEGIN_DECLS -+ -+#ifdef G_OS_UNIX -+#include -+#endif -+ -+#if !GLIB_CHECK_VERSION(2, 43, 4) -+ -+#define _GLIB_AUTOPTR_FUNC_NAME(TypeName) glib_autoptr_cleanup_##TypeName -+#define _GLIB_AUTOPTR_TYPENAME(TypeName) TypeName##_autoptr -+#define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName -+#define _GLIB_CLEANUP(func) __attribute__((cleanup(func))) -+#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \ -+ typedef ModuleObjName *_GLIB_AUTOPTR_TYPENAME(ModuleObjName); \ -+ static inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) { \ -+ _GLIB_AUTOPTR_FUNC_NAME(ParentName) ((ParentName **) _ptr); } \ -+ -+ -+/* these macros are API */ -+#define G_DEFINE_AUTOPTR_CLEANUP_FUNC(TypeName, func) \ -+ typedef TypeName *_GLIB_AUTOPTR_TYPENAME(TypeName); \ -+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ -+ static inline void _GLIB_AUTOPTR_FUNC_NAME(TypeName) (TypeName **_ptr) { if (*_ptr) (func) (*_ptr); } \ -+ G_GNUC_END_IGNORE_DEPRECATIONS -+#define G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(TypeName, func) \ -+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ -+ static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { (func) (_ptr); } \ -+ G_GNUC_END_IGNORE_DEPRECATIONS -+#define G_DEFINE_AUTO_CLEANUP_FREE_FUNC(TypeName, func, none) \ -+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ -+ static inline void _GLIB_AUTO_FUNC_NAME(TypeName) (TypeName *_ptr) { if (*_ptr != none) (func) (*_ptr); } \ -+ G_GNUC_END_IGNORE_DEPRECATIONS -+#define g_autoptr(TypeName) _GLIB_CLEANUP(_GLIB_AUTOPTR_FUNC_NAME(TypeName)) _GLIB_AUTOPTR_TYPENAME(TypeName) -+#define g_auto(TypeName) _GLIB_CLEANUP(_GLIB_AUTO_FUNC_NAME(TypeName)) TypeName -+#define g_autofree _GLIB_CLEANUP(g_autoptr_cleanup_generic_gfree) -+ -+/** -+ * g_steal_pointer: -+ * @pp: a pointer to a pointer -+ * -+ * Sets @pp to %NULL, returning the value that was there before. -+ * -+ * Conceptually, this transfers the ownership of the pointer from the -+ * referenced variable to the "caller" of the macro (ie: "steals" the -+ * reference). -+ * -+ * The return value will be properly typed, according to the type of -+ * @pp. -+ * -+ * This can be very useful when combined with g_autoptr() to prevent the -+ * return value of a function from being automatically freed. Consider -+ * the following example (which only works on GCC and clang): -+ * -+ * |[ -+ * GObject * -+ * create_object (void) -+ * { -+ * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); -+ * -+ * if (early_error_case) -+ * return NULL; -+ * -+ * return g_steal_pointer (&obj); -+ * } -+ * ]| -+ * -+ * It can also be used in similar ways for 'out' parameters and is -+ * particularly useful for dealing with optional out parameters: -+ * -+ * |[ -+ * gboolean -+ * get_object (GObject **obj_out) -+ * { -+ * g_autoptr(GObject) obj = g_object_new (G_TYPE_OBJECT, NULL); -+ * -+ * if (early_error_case) -+ * return FALSE; -+ * -+ * if (obj_out) -+ * *obj_out = g_steal_pointer (&obj); -+ * -+ * return TRUE; -+ * } -+ * ]| -+ * -+ * In the above example, the object will be automatically freed in the -+ * early error case and also in the case that %NULL was given for -+ * @obj_out. -+ * -+ * Since: 2.44 -+ */ -+static inline gpointer -+(g_steal_pointer) (gpointer pp) -+{ -+ gpointer *ptr = (gpointer *) pp; -+ gpointer ref; -+ -+ ref = *ptr; -+ *ptr = NULL; -+ -+ return ref; -+} -+ -+/* type safety */ -+#define g_steal_pointer(pp) \ -+ (0 ? (*(pp)) : (g_steal_pointer) (pp)) -+ -+static inline void -+g_autoptr_cleanup_generic_gfree (void *p) -+{ -+ void **pp = (void**)p; -+ if (*pp) -+ g_free (*pp); -+} -+ -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncQueue, g_async_queue_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBookmarkFile, g_bookmark_file_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytes, g_bytes_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GChecksum, g_checksum_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDateTime, g_date_time_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDir, g_dir_close) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GError, g_error_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHashTable, g_hash_table_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GHmac, g_hmac_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOChannel, g_io_channel_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GKeyFile, g_key_file_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GList, g_list_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GArray, g_array_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPtrArray, g_ptr_array_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainContext, g_main_context_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMainLoop, g_main_loop_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSource, g_source_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMappedFile, g_mapped_file_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMarkupParseContext, g_markup_parse_context_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(gchar, g_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNode, g_node_destroy) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionContext, g_option_context_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOptionGroup, g_option_group_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPatternSpec, g_pattern_spec_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GQueue, g_queue_free) -+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRand, g_rand_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRegex, g_regex_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMatchInfo, g_match_info_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GScanner, g_scanner_destroy) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSequence, g_sequence_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSList, g_slist_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GStringChunk, g_string_chunk_free) -+G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThread, g_thread_unref) -+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GMutex, g_mutex_clear) -+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GCond, g_cond_clear) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimer, g_timer_destroy) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTimeZone, g_time_zone_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTree, g_tree_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariant, g_variant_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantBuilder, g_variant_builder_unref) -+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantBuilder, g_variant_builder_clear) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantIter, g_variant_iter_free) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantDict, g_variant_dict_unref) -+G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GVariantDict, g_variant_dict_clear) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVariantType, g_variant_type_free) -+ -+/* Add GObject-based types as needed. */ -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCancellable, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverter, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterOutputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataInputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFile, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileEnumerator, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIOStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInfo, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileMonitor, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileOutputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryInputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryOutputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusConnection, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMessage, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMethodInvocation, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolumeMonitor, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibCompressor, g_object_unref) -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibDecompressor, g_object_unref) -+ -+#ifdef G_OS_UNIX -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixFDList, g_object_unref) -+#endif -+ -+#endif /* !GLIB_CHECK_VERSION(2, 43, 3) */ -+ -+#if !GLIB_CHECK_VERSION(2, 45, 8) -+ -+static inline void -+g_autoptr_cleanup_gstring_free (GString *string) -+{ -+ if (string) -+ g_string_free (string, TRUE); -+} -+ -+G_DEFINE_AUTOPTR_CLEANUP_FUNC(GString, g_autoptr_cleanup_gstring_free) -+ -+#endif -+ -+G_END_DECLS -diff --git a/src/flatpak-spawn.c b/src/flatpak-spawn.c -index 282d9fb..139d5e9 100644 ---- a/src/flatpak-spawn.c -+++ b/src/flatpak-spawn.c -@@ -26,6 +26,8 @@ - #include - #include - -+#include "backport-autoptr.h" -+ - typedef enum { - FLATPAK_SPAWN_FLAGS_CLEAR_ENV = 1 << 0, - FLATPAK_SPAWN_FLAGS_LATEST_VERSION = 1 << 1, diff -Nru flatpak-xdg-utils-1.0.0/debian/patches/Add-test-and-installed-test-coverage-for-xdg-tools.patch flatpak-xdg-utils-0.1/debian/patches/Add-test-and-installed-test-coverage-for-xdg-tools.patch --- flatpak-xdg-utils-1.0.0/debian/patches/Add-test-and-installed-test-coverage-for-xdg-tools.patch 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/patches/Add-test-and-installed-test-coverage-for-xdg-tools.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,1059 +0,0 @@ -From: Simon McVittie -Date: Thu, 17 Jan 2019 16:49:20 +0000 -Subject: Add test and installed-test coverage for xdg-* tools - -This doesn't cover anything particularly fancy yet, and also doesn't yet -cover flatpak-spawn, but it's a good starting point for not regressing. - -Signed-off-by: Simon McVittie -Forwarded: https://github.com/flatpak/flatpak-xdg-utils/pull/21 -Applied-upstream: 1.0.1, commit:451d90e424e49d2b861b4111b4bf94ef34c73e0c ---- - meson.build | 15 ++ - meson_options.txt | 4 + - tests/common.c | 99 +++++++++++ - tests/common.h | 37 +++++ - tests/meson.build | 44 +++++ - tests/template-tap.test.in | 4 + - tests/test-email.c | 369 +++++++++++++++++++++++++++++++++++++++++ - tests/test-open.c | 400 +++++++++++++++++++++++++++++++++++++++++++++ - 8 files changed, 972 insertions(+) - create mode 100644 meson_options.txt - create mode 100644 tests/common.c - create mode 100644 tests/common.h - create mode 100644 tests/meson.build - create mode 100644 tests/template-tap.test.in - create mode 100644 tests/test-email.c - create mode 100644 tests/test-open.c - -diff --git a/meson.build b/meson.build -index 3689aa0..8d0525b 100644 ---- a/meson.build -+++ b/meson.build -@@ -9,12 +9,27 @@ project( - meson_version: '>= 0.46.0', - ) - -+bindir = join_paths(get_option('prefix'), get_option('bindir')) -+installed_tests_metadir = join_paths(get_option('prefix'), -+ get_option('datadir'), -+ 'installed-tests', -+ meson.project_name()) -+installed_tests_execdir = join_paths(get_option('prefix'), -+ get_option('libexecdir'), -+ 'installed-tests', -+ meson.project_name()) -+installed_tests_enabled = get_option('installed_tests') -+ - conf = configuration_data() - conf.set_quoted('GETTEXT_PACKAGE', meson.project_name()) - conf.set_quoted('PACKAGE_VERSION', meson.project_version()) -+conf.set_quoted('BINDIR', bindir) - conf.set('_GNU_SOURCE', 1) - config_h = configure_file(output: 'config.h', configuration: conf) - - gio_unix = dependency('gio-unix-2.0') - -+srcinc = include_directories('src') -+ - subdir('src') -+subdir('tests') -diff --git a/meson_options.txt b/meson_options.txt -new file mode 100644 -index 0000000..dfba31a ---- /dev/null -+++ b/meson_options.txt -@@ -0,0 +1,4 @@ -+option('installed_tests', -+ type : 'boolean', -+ value : false, -+ description : 'enable installed tests') -diff --git a/tests/common.c b/tests/common.c -new file mode 100644 -index 0000000..4d7566f ---- /dev/null -+++ b/tests/common.c -@@ -0,0 +1,99 @@ -+/* -+ * Copyright © 2018-2019 Collabora Ltd. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ */ -+ -+#include "common.h" -+ -+#include -+ -+#include -+ -+#include "backport-autoptr.h" -+ -+void -+setup_dbus_daemon (GSubprocess **dbus_daemon, -+ gchar **dbus_address) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autoptr(GError) error = NULL; -+ GInputStream *address_pipe; -+ gchar address_buffer[4096] = { 0 }; -+ g_autofree gchar *escaped = NULL; -+ char *newline; -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE); -+ *dbus_daemon = g_subprocess_launcher_spawn (launcher, &error, -+ "dbus-daemon", -+ "--session", -+ "--print-address=1", -+ "--nofork", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (*dbus_daemon); -+ -+ address_pipe = g_subprocess_get_stdout_pipe (*dbus_daemon); -+ -+ /* Crash if it takes too long to get the address */ -+ alarm (30); -+ -+ while (strchr (address_buffer, '\n') == NULL) -+ { -+ if (strlen (address_buffer) >= sizeof (address_buffer) - 1) -+ g_error ("Read %" G_GSIZE_FORMAT " bytes from dbus-daemon with " -+ "no newline", -+ sizeof (address_buffer) - 1); -+ -+ g_input_stream_read (address_pipe, -+ address_buffer + strlen (address_buffer), -+ sizeof (address_buffer) - strlen (address_buffer), -+ NULL, &error); -+ g_assert_no_error (error); -+ } -+ -+ /* Disable alarm */ -+ alarm (0); -+ -+ newline = strchr (address_buffer, '\n'); -+ g_assert_nonnull (newline); -+ *newline = '\0'; -+ *dbus_address = g_strdup (address_buffer); -+} -+ -+void -+own_name_sync (GDBusConnection *conn, -+ const char *name) -+{ -+ g_autoptr(GVariant) variant = NULL; -+ g_autoptr(GError) error = NULL; -+ guint32 result; -+ -+ /* We don't use g_bus_own_name() here because it's easier to be -+ * synchronous */ -+ variant = g_dbus_connection_call_sync (conn, -+ DBUS_SERVICE_DBUS, -+ DBUS_PATH_DBUS, -+ DBUS_IFACE_DBUS, -+ "RequestName", -+ g_variant_new ("(su)", -+ name, -+ DBUS_NAME_FLAG_DO_NOT_QUEUE), -+ G_VARIANT_TYPE ("(u)"), -+ G_DBUS_CALL_FLAGS_NONE, -1, -+ NULL, &error); -+ g_assert_no_error (error); -+ g_variant_get (variant, "(u)", &result); -+ g_assert_cmpuint (result, ==, DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER); -+} -diff --git a/tests/common.h b/tests/common.h -new file mode 100644 -index 0000000..cb9e19d ---- /dev/null -+++ b/tests/common.h -@@ -0,0 +1,37 @@ -+/* -+ * Copyright © 2018-2019 Collabora Ltd. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ */ -+ -+#pragma once -+ -+#include -+ -+/* GDBus interface info contains padding for future expansion, silence -+ * warnings about this */ -+#ifdef __GNUC__ -+#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -+#endif -+ -+#define DBUS_SERVICE_DBUS "org.freedesktop.DBus" -+#define DBUS_PATH_DBUS "/org/freedesktop/DBus" -+#define DBUS_IFACE_DBUS DBUS_SERVICE_DBUS -+#define DBUS_NAME_FLAG_DO_NOT_QUEUE 4 -+#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1 -+ -+void setup_dbus_daemon (GSubprocess **dbus_daemon, -+ gchar **dbus_address); -+void own_name_sync (GDBusConnection *conn, -+ const char *name); -diff --git a/tests/meson.build b/tests/meson.build -new file mode 100644 -index 0000000..6518546 ---- /dev/null -+++ b/tests/meson.build -@@ -0,0 +1,44 @@ -+test_env = environment() -+test_env.set('G_DEBUG', 'gc-friendly') -+test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) -+test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) -+test_env.set('GIO_USE_VFS', 'local') -+test_env.set('XDG_EMAIL', xdg_email.full_path()) -+test_env.set('XDG_OPEN', xdg_open.full_path()) -+test_env.set('MALLOC_CHECK_', '2') -+ -+tests = [ -+ 'test-email', -+ 'test-open', -+] -+ -+test_timeout = 60 -+ -+installed_tests_template_tap = files('template-tap.test.in') -+ -+foreach test_name : tests -+ template = installed_tests_template_tap -+ -+ if installed_tests_enabled -+ test_conf = configuration_data() -+ test_conf.set('installed_tests_dir', installed_tests_execdir) -+ test_conf.set('program', test_name) -+ configure_file( -+ input: template, -+ output: test_name + '.test', -+ install_dir: installed_tests_metadir, -+ configuration: test_conf -+ ) -+ endif -+ -+ exe = executable(test_name, [test_name + '.c', 'common.c', 'common.h'], -+ c_args: ['-include', '@0@'.format(config_h)], -+ dependencies: [gio_unix], -+ include_directories : [srcinc], -+ install_dir: installed_tests_execdir, -+ install: installed_tests_enabled, -+ ) -+ -+ test(test_name, exe, env : test_env, timeout : test_timeout, -+ suite : ['flatpak-xdg-utils'], args : ['--tap']) -+endforeach -diff --git a/tests/template-tap.test.in b/tests/template-tap.test.in -new file mode 100644 -index 0000000..6adf73f ---- /dev/null -+++ b/tests/template-tap.test.in -@@ -0,0 +1,4 @@ -+[Test] -+Type=session -+Exec=@installed_tests_dir@/@program@ --tap -+Output=TAP -diff --git a/tests/test-email.c b/tests/test-email.c -new file mode 100644 -index 0000000..82a4b69 ---- /dev/null -+++ b/tests/test-email.c -@@ -0,0 +1,369 @@ -+/* -+ * Copyright © 2018-2019 Collabora Ltd. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "backport-autoptr.h" -+#include "common.h" -+ -+#define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop" -+#define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop" -+#define PORTAL_IFACE_NAME "org.freedesktop.portal.Email" -+ -+typedef struct -+{ -+ GSubprocess *dbus_daemon; -+ gchar *dbus_address; -+ GSubprocess *xdg_email; -+ gchar *xdg_email_path; -+ GDBusConnection *mock_conn; -+ guint mock_object; -+ GQueue invocations; -+} Fixture; -+ -+typedef struct -+{ -+ int dummy; -+} Config; -+ -+static void -+mock_method_call (GDBusConnection *conn G_GNUC_UNUSED, -+ const gchar *sender G_GNUC_UNUSED, -+ const gchar *object_path G_GNUC_UNUSED, -+ const gchar *interface_name, -+ const gchar *method_name, -+ GVariant *parameters G_GNUC_UNUSED, -+ GDBusMethodInvocation *invocation, -+ gpointer user_data) -+{ -+ Fixture *f = user_data; -+ g_autofree gchar *params = NULL; -+ -+ params = g_variant_print (parameters, TRUE); -+ -+ g_test_message ("Method called: %s.%s%s", interface_name, method_name, -+ params); -+ -+ g_queue_push_tail (&f->invocations, g_object_ref (invocation)); -+ g_dbus_method_invocation_return_value (invocation, -+ g_variant_new ("(o)", "/foo")); -+} -+ -+static GDBusArgInfo arg_parent_window = -+{ -+ -1, -+ "parent_window", -+ "s", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo arg_options = -+{ -+ -1, -+ "options", -+ "a{sv}", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo arg_out_handle = -+{ -+ -1, -+ "handle", -+ "o", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo *in_args[] = -+{ -+ &arg_parent_window, -+ &arg_options, -+ NULL -+}; -+ -+static GDBusArgInfo *out_args[] = -+{ -+ &arg_out_handle, -+ NULL -+}; -+ -+static GDBusMethodInfo compose_email_info = -+{ -+ -1, -+ "ComposeEmail", -+ in_args, -+ out_args, -+ NULL /* annotations */ -+}; -+ -+static GDBusMethodInfo *method_info[] = -+{ -+ &compose_email_info, -+ NULL -+}; -+ -+static GDBusInterfaceInfo iface_info = -+{ -+ -1, -+ PORTAL_IFACE_NAME, -+ method_info, -+ NULL, /* signals */ -+ NULL, /* properties */ -+ NULL /* annotations */ -+}; -+ -+static const GDBusInterfaceVTable vtable = -+{ -+ mock_method_call, -+ NULL, /* get */ -+ NULL /* set */ -+}; -+ -+static void -+setup (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GError) error = NULL; -+ -+ g_queue_init (&f->invocations); -+ -+ setup_dbus_daemon (&f->dbus_daemon, &f->dbus_address); -+ -+ f->xdg_email_path = g_strdup (g_getenv ("XDG_EMAIL")); -+ -+ if (f->xdg_email_path == NULL) -+ f->xdg_email_path = g_strdup (BINDIR "/xdg-email"); -+ -+ f->mock_conn = g_dbus_connection_new_for_address_sync (f->dbus_address, -+ (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | -+ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION), -+ NULL, NULL, &error); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->mock_conn); -+ -+ f->mock_object = g_dbus_connection_register_object (f->mock_conn, -+ PORTAL_OBJECT_PATH, -+ &iface_info, -+ &vtable, -+ f, -+ NULL, -+ &error); -+ g_assert_no_error (error); -+ g_assert_cmpuint (f->mock_object, !=, 0); -+ -+ own_name_sync (f->mock_conn, PORTAL_BUS_NAME); -+} -+ -+static void -+test_help (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autofree gchar *stdout_buf; -+ g_autofree gchar *stderr_buf; -+ g_autoptr(GError) error = NULL; -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE | -+ G_SUBPROCESS_FLAGS_STDERR_PIPE); -+ g_subprocess_launcher_setenv (launcher, -+ "DBUS_SESSION_BUS_ADDRESS", -+ f->dbus_address, -+ TRUE); -+ -+ f->xdg_email = g_subprocess_launcher_spawn (launcher, &error, -+ f->xdg_email_path, -+ "--help", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->xdg_email); -+ -+ g_subprocess_communicate_utf8 (f->xdg_email, NULL, NULL, &stdout_buf, -+ &stderr_buf, &error); -+ g_assert_cmpstr (stderr_buf, ==, ""); -+ g_assert_nonnull (stdout_buf); -+ g_test_message ("xdg-open --help: %s", stdout_buf); -+ g_assert_true (strstr (stdout_buf, "--version") != NULL); -+ -+ g_subprocess_wait_check (f->xdg_email, NULL, &error); -+ g_assert_no_error (error); -+} -+ -+static void -+test_minimal (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autoptr(GError) error = NULL; -+ g_autoptr(GDBusMethodInvocation) invocation = NULL; -+ g_autoptr(GVariant) asv = NULL; -+ g_autoptr(GVariantDict) dict = NULL; -+ GVariant *parameters; -+ const gchar *window; -+ const gchar *address; -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE); -+ g_subprocess_launcher_setenv (launcher, -+ "DBUS_SESSION_BUS_ADDRESS", -+ f->dbus_address, -+ TRUE); -+ -+ f->xdg_email = g_subprocess_launcher_spawn (launcher, &error, -+ f->xdg_email_path, -+ "me@example.com", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->xdg_email); -+ -+ while (g_queue_get_length (&f->invocations) < 1) -+ g_main_context_iteration (NULL, TRUE); -+ -+ g_subprocess_wait_check (f->xdg_email, NULL, &error); -+ g_assert_no_error (error); -+ -+ g_assert_cmpuint (g_queue_get_length (&f->invocations), ==, 1); -+ invocation = g_queue_pop_head (&f->invocations); -+ -+ g_assert_cmpstr (g_dbus_method_invocation_get_interface_name (invocation), -+ ==, PORTAL_IFACE_NAME); -+ g_assert_cmpstr (g_dbus_method_invocation_get_method_name (invocation), -+ ==, "ComposeEmail"); -+ -+ parameters = g_dbus_method_invocation_get_parameters (invocation); -+ g_assert_cmpstr (g_variant_get_type_string (parameters), ==, "(sa{sv})"); -+ g_variant_get (parameters, "(&s@a{sv})", -+ &window, &asv); -+ g_assert_cmpstr (window, ==, ""); -+ -+ dict = g_variant_dict_new (asv); -+ g_assert_true (g_variant_dict_lookup (dict, "address", "&s", &address)); -+ g_assert_cmpstr (address, ==, "me@example.com"); -+ g_assert_false (g_variant_dict_contains (dict, "subject")); -+ g_assert_false (g_variant_dict_contains (dict, "body")); -+ g_assert_false (g_variant_dict_contains (dict, "attachments")); -+} -+ -+static void -+test_maximal (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autoptr(GError) error = NULL; -+ g_autoptr(GDBusMethodInvocation) invocation = NULL; -+ g_autoptr(GVariant) asv = NULL; -+ g_autoptr(GVariantDict) dict = NULL; -+ g_autoptr(GVariant) attachments = NULL; -+ GVariant *parameters; -+ const gchar *window; -+ const gchar *address; -+ const gchar *subject; -+ const gchar *body; -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE); -+ g_subprocess_launcher_setenv (launcher, -+ "DBUS_SESSION_BUS_ADDRESS", -+ f->dbus_address, -+ TRUE); -+ -+ f->xdg_email = g_subprocess_launcher_spawn (launcher, &error, -+ f->xdg_email_path, -+ "--subject", "Make Money Fast", -+ "--body", "Your spam here", -+ "--attach", "/dev/null", -+ "me@example.com", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->xdg_email); -+ -+ while (g_queue_get_length (&f->invocations) < 1) -+ g_main_context_iteration (NULL, TRUE); -+ -+ g_subprocess_wait_check (f->xdg_email, NULL, &error); -+ g_assert_no_error (error); -+ -+ g_assert_cmpuint (g_queue_get_length (&f->invocations), ==, 1); -+ invocation = g_queue_pop_head (&f->invocations); -+ -+ g_assert_cmpstr (g_dbus_method_invocation_get_interface_name (invocation), -+ ==, PORTAL_IFACE_NAME); -+ g_assert_cmpstr (g_dbus_method_invocation_get_method_name (invocation), -+ ==, "ComposeEmail"); -+ -+ parameters = g_dbus_method_invocation_get_parameters (invocation); -+ g_assert_cmpstr (g_variant_get_type_string (parameters), ==, "(sa{sv})"); -+ g_variant_get (parameters, "(&s@a{sv})", -+ &window, &asv); -+ g_assert_cmpstr (window, ==, ""); -+ -+ dict = g_variant_dict_new (asv); -+ g_assert_true (g_variant_dict_lookup (dict, "address", "&s", &address)); -+ g_assert_cmpstr (address, ==, "me@example.com"); -+ g_assert_true (g_variant_dict_lookup (dict, "subject", "&s", &subject)); -+ g_assert_cmpstr (subject, ==, "Make Money Fast"); -+ g_assert_true (g_variant_dict_lookup (dict, "body", "&s", &body)); -+ g_assert_cmpstr (body, ==, "Your spam here"); -+ /* TODO: Also test that the attachment went through correctly (this -+ * doesn't seem to work at the moment) */ -+} -+ -+static void -+teardown (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GError) error = NULL; -+ gpointer free_me; -+ -+ for (free_me = g_queue_pop_head (&f->invocations); -+ free_me != NULL; -+ free_me = g_queue_pop_head (&f->invocations)) -+ g_object_unref (free_me); -+ -+ if (f->mock_object != 0) -+ g_dbus_connection_unregister_object (f->mock_conn, f->mock_object); -+ -+ if (f->dbus_daemon != NULL) -+ { -+ g_subprocess_send_signal (f->dbus_daemon, SIGTERM); -+ g_subprocess_wait (f->dbus_daemon, NULL, &error); -+ g_assert_no_error (error); -+ } -+ -+ g_clear_object (&f->dbus_daemon); -+ g_clear_object (&f->xdg_email); -+ g_clear_object (&f->mock_conn); -+ g_free (f->dbus_address); -+ g_free (f->xdg_email_path); -+ alarm (0); -+} -+ -+int -+main (int argc, -+ char **argv) -+{ -+ g_test_init (&argc, &argv, NULL); -+ -+ g_test_add ("/help", Fixture, NULL, setup, test_help, teardown); -+ g_test_add ("/minimal", Fixture, NULL, setup, test_minimal, teardown); -+ g_test_add ("/maximal", Fixture, NULL, setup, test_maximal, teardown); -+ -+ return g_test_run (); -+} -diff --git a/tests/test-open.c b/tests/test-open.c -new file mode 100644 -index 0000000..6d891db ---- /dev/null -+++ b/tests/test-open.c -@@ -0,0 +1,400 @@ -+/* -+ * Copyright © 2018-2019 Collabora Ltd. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library. If not, see . -+ */ -+ -+#include -+#include -+#include -+#include -+ -+#include -+#include -+#include -+ -+#include "backport-autoptr.h" -+#include "common.h" -+ -+#define PORTAL_BUS_NAME "org.freedesktop.portal.Desktop" -+#define PORTAL_OBJECT_PATH "/org/freedesktop/portal/desktop" -+#define PORTAL_IFACE_NAME "org.freedesktop.portal.OpenURI" -+ -+typedef struct -+{ -+ GSubprocess *dbus_daemon; -+ gchar *dbus_address; -+ GSubprocess *xdg_open; -+ gchar *xdg_open_path; -+ GDBusConnection *mock_conn; -+ guint mock_object; -+ GQueue invocations; -+} Fixture; -+ -+typedef struct -+{ -+ int dummy; -+} Config; -+ -+static void -+mock_method_call (GDBusConnection *conn G_GNUC_UNUSED, -+ const gchar *sender G_GNUC_UNUSED, -+ const gchar *object_path G_GNUC_UNUSED, -+ const gchar *interface_name, -+ const gchar *method_name, -+ GVariant *parameters G_GNUC_UNUSED, -+ GDBusMethodInvocation *invocation, -+ gpointer user_data) -+{ -+ Fixture *f = user_data; -+ g_autofree gchar *params = NULL; -+ -+ params = g_variant_print (parameters, TRUE); -+ -+ g_test_message ("Method called: %s.%s%s", interface_name, method_name, -+ params); -+ -+ g_queue_push_tail (&f->invocations, g_object_ref (invocation)); -+ g_dbus_method_invocation_return_value (invocation, -+ g_variant_new ("(o)", "/foo")); -+} -+ -+static GDBusArgInfo arg_parent_window = -+{ -+ -1, -+ "parent_window", -+ "s", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo arg_uri = -+{ -+ -1, -+ "uri", -+ "s", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo arg_options = -+{ -+ -1, -+ "options", -+ "a{sv}", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo arg_fd = -+{ -+ -1, -+ "fd", -+ "h", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo arg_out_handle = -+{ -+ -1, -+ "handle", -+ "o", -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo *open_uri_in_args[] = -+{ -+ &arg_parent_window, -+ &arg_uri, -+ &arg_options, -+ NULL -+}; -+ -+static GDBusArgInfo *open_uri_out_args[] = -+{ -+ &arg_out_handle, -+ NULL -+}; -+ -+static GDBusMethodInfo open_uri_info = -+{ -+ -1, -+ "OpenURI", -+ open_uri_in_args, -+ open_uri_out_args, -+ NULL /* annotations */ -+}; -+ -+static GDBusArgInfo *open_file_in_args[] = -+{ -+ &arg_parent_window, -+ &arg_fd, -+ &arg_options, -+ NULL -+}; -+ -+static GDBusMethodInfo open_file_info = -+{ -+ -1, -+ "OpenFile", -+ open_file_in_args, -+ open_uri_out_args, /* the same */ -+ NULL /* annotations */ -+}; -+ -+static GDBusMethodInfo *method_info[] = -+{ -+ &open_uri_info, -+ &open_file_info, -+ NULL -+}; -+ -+static GDBusInterfaceInfo iface_info = -+{ -+ -1, -+ PORTAL_IFACE_NAME, -+ method_info, -+ NULL, /* signals */ -+ NULL, /* properties */ -+ NULL /* annotations */ -+}; -+ -+static const GDBusInterfaceVTable vtable = -+{ -+ mock_method_call, -+ NULL, /* get */ -+ NULL /* set */ -+}; -+ -+static void -+setup (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GError) error = NULL; -+ -+ g_queue_init (&f->invocations); -+ -+ setup_dbus_daemon (&f->dbus_daemon, &f->dbus_address); -+ -+ f->xdg_open_path = g_strdup (g_getenv ("XDG_OPEN")); -+ -+ if (f->xdg_open_path == NULL) -+ f->xdg_open_path = g_strdup (BINDIR "/xdg-open"); -+ -+ f->mock_conn = g_dbus_connection_new_for_address_sync (f->dbus_address, -+ (G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | -+ G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION), -+ NULL, NULL, &error); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->mock_conn); -+ -+ f->mock_object = g_dbus_connection_register_object (f->mock_conn, -+ PORTAL_OBJECT_PATH, -+ &iface_info, -+ &vtable, -+ f, -+ NULL, -+ &error); -+ g_assert_no_error (error); -+ g_assert_cmpuint (f->mock_object, !=, 0); -+ -+ own_name_sync (f->mock_conn, PORTAL_BUS_NAME); -+} -+ -+static void -+test_help (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autofree gchar *stdout_buf; -+ g_autofree gchar *stderr_buf; -+ g_autoptr(GError) error = NULL; -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE | -+ G_SUBPROCESS_FLAGS_STDERR_PIPE); -+ g_subprocess_launcher_setenv (launcher, -+ "DBUS_SESSION_BUS_ADDRESS", -+ f->dbus_address, -+ TRUE); -+ -+ f->xdg_open = g_subprocess_launcher_spawn (launcher, &error, -+ f->xdg_open_path, -+ "--help", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->xdg_open); -+ -+ g_subprocess_communicate_utf8 (f->xdg_open, NULL, NULL, &stdout_buf, -+ &stderr_buf, &error); -+ g_assert_cmpstr (stderr_buf, ==, ""); -+ g_assert_nonnull (stdout_buf); -+ g_test_message ("xdg-open --help: %s", stdout_buf); -+ g_assert_true (strstr (stdout_buf, "--version") != NULL); -+ -+ g_subprocess_wait_check (f->xdg_open, NULL, &error); -+ g_assert_no_error (error); -+} -+ -+static void -+test_uri (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autoptr(GError) error = NULL; -+ g_autoptr(GDBusMethodInvocation) invocation = NULL; -+ GVariant *parameters; -+ const gchar *window; -+ const gchar *uri; -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE); -+ g_subprocess_launcher_setenv (launcher, -+ "DBUS_SESSION_BUS_ADDRESS", -+ f->dbus_address, -+ TRUE); -+ -+ f->xdg_open = g_subprocess_launcher_spawn (launcher, &error, -+ f->xdg_open_path, -+ "http://example.com/", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->xdg_open); -+ -+ while (g_queue_get_length (&f->invocations) < 1) -+ g_main_context_iteration (NULL, TRUE); -+ -+ g_subprocess_wait_check (f->xdg_open, NULL, &error); -+ g_assert_no_error (error); -+ -+ g_assert_cmpuint (g_queue_get_length (&f->invocations), ==, 1); -+ invocation = g_queue_pop_head (&f->invocations); -+ -+ g_assert_cmpstr (g_dbus_method_invocation_get_interface_name (invocation), -+ ==, PORTAL_IFACE_NAME); -+ g_assert_cmpstr (g_dbus_method_invocation_get_method_name (invocation), -+ ==, "OpenURI"); -+ -+ parameters = g_dbus_method_invocation_get_parameters (invocation); -+ g_assert_cmpstr (g_variant_get_type_string (parameters), ==, "(ssa{sv})"); -+ g_variant_get (parameters, "(&s&sa{sv})", -+ &window, &uri, NULL); -+ g_assert_cmpstr (window, ==, ""); -+ g_assert_cmpstr (uri, ==, "http://example.com/"); -+} -+ -+static void -+test_file (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GSubprocessLauncher) launcher = NULL; -+ g_autoptr(GError) error = NULL; -+ g_autoptr(GDBusMethodInvocation) invocation = NULL; -+ GVariant *parameters; -+ const gchar *window; -+ gint32 handle; -+ GDBusMessage *message; -+ GUnixFDList *fd_list; -+ const int *fds; -+ struct stat ours, theirs; -+ -+ if (stat ("/dev/null", &ours) < 0) -+ g_error ("stat(/dev/null): %s", g_strerror (errno)); -+ -+ launcher = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE); -+ g_subprocess_launcher_setenv (launcher, -+ "DBUS_SESSION_BUS_ADDRESS", -+ f->dbus_address, -+ TRUE); -+ -+ f->xdg_open = g_subprocess_launcher_spawn (launcher, &error, -+ f->xdg_open_path, -+ "/dev/null", -+ NULL); -+ g_assert_no_error (error); -+ g_assert_nonnull (f->xdg_open); -+ -+ while (g_queue_get_length (&f->invocations) < 1) -+ g_main_context_iteration (NULL, TRUE); -+ -+ g_subprocess_wait_check (f->xdg_open, NULL, &error); -+ g_assert_no_error (error); -+ -+ g_assert_cmpuint (g_queue_get_length (&f->invocations), ==, 1); -+ invocation = g_queue_pop_head (&f->invocations); -+ -+ g_assert_cmpstr (g_dbus_method_invocation_get_interface_name (invocation), -+ ==, PORTAL_IFACE_NAME); -+ g_assert_cmpstr (g_dbus_method_invocation_get_method_name (invocation), -+ ==, "OpenFile"); -+ -+ parameters = g_dbus_method_invocation_get_parameters (invocation); -+ g_assert_cmpstr (g_variant_get_type_string (parameters), ==, "(sha{sv})"); -+ g_variant_get (parameters, "(&sha{sv})", -+ &window, &handle, NULL); -+ g_assert_cmpstr (window, ==, ""); -+ g_assert_cmpint (handle, ==, 0); -+ -+ message = g_dbus_method_invocation_get_message (invocation); -+ g_assert_cmpuint (g_dbus_message_get_num_unix_fds (message), ==, 1); -+ fd_list = g_dbus_message_get_unix_fd_list (message); -+ fds = g_unix_fd_list_peek_fds (fd_list, NULL); -+ g_assert_cmpint (fds[0], >=, 0); -+ g_assert_cmpint (fds[1], ==, -1); -+ -+ if (fstat (fds[0], &theirs) < 0) -+ g_error ("stat(their fd): %s", g_strerror (errno)); -+ -+ /* It's really /dev/null */ -+ g_assert_cmpuint (ours.st_dev, ==, theirs.st_dev); -+ g_assert_cmpuint (ours.st_ino, ==, theirs.st_ino); -+} -+ -+static void -+teardown (Fixture *f, -+ gconstpointer context G_GNUC_UNUSED) -+{ -+ g_autoptr(GError) error = NULL; -+ gpointer free_me; -+ -+ for (free_me = g_queue_pop_head (&f->invocations); -+ free_me != NULL; -+ free_me = g_queue_pop_head (&f->invocations)) -+ g_object_unref (free_me); -+ -+ if (f->mock_object != 0) -+ g_dbus_connection_unregister_object (f->mock_conn, f->mock_object); -+ -+ if (f->dbus_daemon != NULL) -+ { -+ g_subprocess_send_signal (f->dbus_daemon, SIGTERM); -+ g_subprocess_wait (f->dbus_daemon, NULL, &error); -+ g_assert_no_error (error); -+ } -+ -+ g_clear_object (&f->dbus_daemon); -+ g_clear_object (&f->xdg_open); -+ g_clear_object (&f->mock_conn); -+ g_free (f->dbus_address); -+ g_free (f->xdg_open_path); -+ alarm (0); -+} -+ -+int -+main (int argc, -+ char **argv) -+{ -+ g_test_init (&argc, &argv, NULL); -+ -+ g_test_add ("/help", Fixture, NULL, setup, test_help, teardown); -+ g_test_add ("/uri", Fixture, NULL, setup, test_uri, teardown); -+ g_test_add ("/file", Fixture, NULL, setup, test_file, teardown); -+ -+ return g_test_run (); -+} diff -Nru flatpak-xdg-utils-1.0.0/debian/patches/series flatpak-xdg-utils-0.1/debian/patches/series --- flatpak-xdg-utils-1.0.0/debian/patches/series 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -Add-backports-of-g_autoptr-for-compatibility-with-older-G.patch -Add-test-and-installed-test-coverage-for-xdg-tools.patch diff -Nru flatpak-xdg-utils-1.0.0/debian/rules flatpak-xdg-utils-0.1/debian/rules --- flatpak-xdg-utils-1.0.0/debian/rules 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/rules 2018-03-07 07:11:20.000000000 +0000 @@ -1,20 +1,27 @@ #!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 -export DEB_BUILD_MAINT_OPTIONS = hardening=+all -export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed -Wl,-O1 -export LC_ALL=C.UTF-8 -include /usr/share/dpkg/default.mk +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + %: dh $@ -override_dh_auto_configure: - dh_auto_configure -- \ - --bindir=/usr/libexec/flatpak-xdg-utils \ - --libexecdir=/usr/libexec \ - -Dinstalled_tests=true \ - $(NULL) -override_dh_missing: - dh_missing --fail-missing +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + +override_dh_auto_configure: + ./autogen.sh --prefix=/usr diff -Nru flatpak-xdg-utils-1.0.0/debian/source/format flatpak-xdg-utils-0.1/debian/source/format --- flatpak-xdg-utils-1.0.0/debian/source/format 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/source/format 2018-03-07 07:11:20.000000000 +0000 @@ -1 +1 @@ -3.0 (quilt) +3.0 (native) diff -Nru flatpak-xdg-utils-1.0.0/debian/tests/control flatpak-xdg-utils-0.1/debian/tests/control --- flatpak-xdg-utils-1.0.0/debian/tests/control 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/tests/control 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -Tests: gnome-desktop-testing -Depends: - flatpak-xdg-utils-tests, - gnome-desktop-testing, diff -Nru flatpak-xdg-utils-1.0.0/debian/tests/gnome-desktop-testing flatpak-xdg-utils-0.1/debian/tests/gnome-desktop-testing --- flatpak-xdg-utils-1.0.0/debian/tests/gnome-desktop-testing 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/tests/gnome-desktop-testing 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -#!/bin/sh - -set -e -exec 2>&1 - -exec gnome-desktop-testing-runner flatpak-xdg-utils diff -Nru flatpak-xdg-utils-1.0.0/debian/upstream/metadata flatpak-xdg-utils-0.1/debian/upstream/metadata --- flatpak-xdg-utils-1.0.0/debian/upstream/metadata 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/upstream/metadata 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ ---- -Name: flatpak-xdg-utils -Repository: https://github.com/flatpak/flatpak-xdg-utils -Repository-Browse: https://github.com/flatpak/flatpak-xdg-utils -Bug-Database: https://github.com/flatpak/flatpak-xdg-utils/issues -Bug-Submit: https://github.com/flatpak/flatpak-xdg-utils/issues/new -... -# vim:set ft=yaml: diff -Nru flatpak-xdg-utils-1.0.0/debian/watch flatpak-xdg-utils-0.1/debian/watch --- flatpak-xdg-utils-1.0.0/debian/watch 2019-01-18 10:29:06.000000000 +0000 +++ flatpak-xdg-utils-0.1/debian/watch 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -version=4 -https://github.com/flatpak/flatpak-xdg-utils/releases .*/flatpak-xdg-utils-(\d\S*)\.tar\.xz