├── .gitignore ├── .gitmodules ├── COPYING ├── Makefile.am ├── NEWS ├── README.md ├── acinclude.m4 ├── app ├── Makefile.am.inc ├── flatpak-builtins-add-remote.c ├── flatpak-builtins-build-bundle.c ├── flatpak-builtins-build-export.c ├── flatpak-builtins-build-finish.c ├── flatpak-builtins-build-import-bundle.c ├── flatpak-builtins-build-init.c ├── flatpak-builtins-build-sign.c ├── flatpak-builtins-build.c ├── flatpak-builtins-delete-remote.c ├── flatpak-builtins-document.c ├── flatpak-builtins-enter.c ├── flatpak-builtins-info.c ├── flatpak-builtins-install.c ├── flatpak-builtins-list-remotes.c ├── flatpak-builtins-list.c ├── flatpak-builtins-ls-remote.c ├── flatpak-builtins-make-current.c ├── flatpak-builtins-override.c ├── flatpak-builtins-repo-update.c ├── flatpak-builtins-run.c ├── flatpak-builtins-uninstall.c ├── flatpak-builtins-update.c ├── flatpak-builtins.h └── flatpak-main.c ├── autogen.sh ├── builder ├── Makefile.am.inc ├── builder-cache.c ├── builder-cache.h ├── builder-context.c ├── builder-context.h ├── builder-main.c ├── builder-manifest.c ├── builder-manifest.h ├── builder-module.c ├── builder-module.h ├── builder-options.c ├── builder-options.h ├── builder-source-archive.c ├── builder-source-archive.h ├── builder-source-bzr.c ├── builder-source-bzr.h ├── builder-source-file.c ├── builder-source-file.h ├── builder-source-git.c ├── builder-source-git.h ├── builder-source-patch.c ├── builder-source-patch.h ├── builder-source-script.c ├── builder-source-script.h ├── builder-source-shell.c ├── builder-source-shell.h ├── builder-source.c ├── builder-source.h ├── builder-utils.c └── builder-utils.h ├── buildutil ├── glib-tap.mk ├── tap-driver.sh └── tap-test ├── common ├── Makefile.am.inc ├── flatpak-chain-input-stream.c ├── flatpak-chain-input-stream.h ├── flatpak-common-types.h ├── flatpak-db.c ├── flatpak-db.h ├── flatpak-dir.c ├── flatpak-dir.h ├── flatpak-portal-error.c ├── flatpak-portal-error.h ├── flatpak-run.c ├── flatpak-run.h ├── flatpak-utils.c ├── flatpak-utils.h └── gvdb │ ├── .gitignore │ ├── README │ ├── gvdb-builder.c │ ├── gvdb-builder.h │ ├── gvdb-format.h │ ├── gvdb-reader.c │ ├── gvdb-reader.h │ └── gvdb.doap ├── completion └── flatpak ├── configure.ac ├── data ├── Makefile.am.inc ├── org.freedesktop.Flatpak.xml ├── org.freedesktop.impl.portal.PermissionStore.xml ├── org.freedesktop.portal.Documents.xml └── org.freedesktop.systemd1.xml ├── dbus-proxy ├── Makefile.am.inc ├── dbus-proxy.c ├── flatpak-proxy.c └── flatpak-proxy.h ├── doc ├── Makefile.am ├── flatpak-build-bundle.xml ├── flatpak-build-export.xml ├── flatpak-build-finish.xml ├── flatpak-build-import-bundle.xml ├── flatpak-build-init.xml ├── flatpak-build-sign.xml ├── flatpak-build-update-repo.xml ├── flatpak-build.xml ├── flatpak-builder.xml ├── flatpak-enter.xml ├── flatpak-export-file.xml ├── flatpak-info.xml ├── flatpak-install.xml ├── flatpak-list.xml ├── flatpak-make-current.xml ├── flatpak-override.xml ├── flatpak-remote-add.xml ├── flatpak-remote-delete.xml ├── flatpak-remote-list.xml ├── flatpak-remote-ls.xml ├── flatpak-remote-modify.xml ├── flatpak-run.xml ├── flatpak-uninstall.xml ├── flatpak-update.xml ├── flatpak.xml └── reference │ ├── .gitignore │ ├── Makefile.am │ ├── flatpak-docs.xml │ ├── flatpak-sections.txt │ └── version.xml.in ├── document-portal ├── Makefile.am.inc ├── org.freedesktop.portal.Documents.service.in ├── xdg-document-portal.service.in ├── xdp-enums.h ├── xdp-fuse.c ├── xdp-fuse.h ├── xdp-main.c ├── xdp-util.c └── xdp-util.h ├── env.d └── flatpak.env.in ├── flatpak.pc.in ├── lib ├── Makefile.am.inc ├── flatpak-bundle-ref.c ├── flatpak-bundle-ref.h ├── flatpak-enum-types.c.template ├── flatpak-enum-types.h.template ├── flatpak-error.c ├── flatpak-error.h ├── flatpak-installation.c ├── flatpak-installation.h ├── flatpak-installed-ref-private.h ├── flatpak-installed-ref.c ├── flatpak-installed-ref.h ├── flatpak-ref.c ├── flatpak-ref.h ├── flatpak-remote-private.h ├── flatpak-remote-ref-private.h ├── flatpak-remote-ref.c ├── flatpak-remote-ref.h ├── flatpak-remote.c ├── flatpak-remote.h ├── flatpak-version-macros.h.in ├── flatpak.c ├── flatpak.h └── test-lib.c ├── m4 └── glibtests.m4 ├── permission-store ├── Makefile.am.inc ├── org.freedesktop.impl.portal.PermissionStore.service.in ├── permission-store.c ├── xdg-permission-store.c ├── xdg-permission-store.h └── xdg-permission-store.service.in ├── po ├── POTFILES.in └── POTFILES.skip ├── profile └── flatpak.sh.in ├── session-helper ├── Makefile.am.inc ├── flatpak-session-helper.c ├── flatpak-session-helper.service.in └── org.freedesktop.Flatpak.service.in ├── system-helper ├── Makefile.am.inc ├── flatpak-system-helper.c ├── flatpak-system-helper.service.in ├── org.freedesktop.Flatpak.SystemHelper.conf ├── org.freedesktop.Flatpak.SystemHelper.service.in ├── org.freedesktop.Flatpak.policy.in └── org.freedesktop.Flatpak.rules ├── tests ├── Makefile.am.inc ├── dbs │ └── no_tables ├── flatpak-valgrind.supp ├── libtest.sh ├── make-test-app.sh ├── make-test-bundles.sh ├── make-test-runtime.sh ├── org.test.Hello.png ├── session.conf.in ├── test-basic.sh ├── test-builder.sh ├── test-configure ├── test-doc-portal.c ├── test-keyring │ ├── README │ ├── pubring.gpg │ └── secring.gpg ├── test-run-system.sh ├── test-run.sh ├── test.json └── testdb.c ├── triggers ├── desktop-database.trigger ├── gtk-icon-cache.trigger └── mime-database.trigger ├── uncrustify.cfg └── uncrustify.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.la 2 | *.o 3 | *.lo 4 | .deps 5 | .libs 6 | INSTALL 7 | Makefile 8 | Makefile.in 9 | aclocal.m4 10 | autom4te.cache/ 11 | test-driver 12 | compile 13 | config.guess 14 | config.h 15 | config.log 16 | config.status 17 | config.sub 18 | configure 19 | depcomp 20 | install-sh 21 | libtool 22 | ltmain.sh 23 | m4/*.m4 24 | !m4/glibtests.m4 25 | missing 26 | stamp-h1 27 | config.h.in 28 | stamp-* 29 | gtk-doc.make 30 | flatpak 31 | flatpak-session-helper 32 | xdg-document-portal 33 | xdg-permission-store 34 | flatpak-builder 35 | testdb 36 | doc/*.1 37 | *~ 38 | profile/flatpak.sh 39 | flatpak-dbus.[ch] 40 | flatpak-systemd-dbus.[ch] 41 | flatpak-resources.[ch] 42 | flatpak-dbus-proxy 43 | permission-store-dbus.[ch] 44 | flatpak-system-helper 45 | xdg-desktop-portal 46 | *.service 47 | flatpak.env 48 | flatpak.sh 49 | document-portal/xdp-dbus.[ch] 50 | document-portal/xdp-resources.[ch] 51 | .dirstamp 52 | test-suite*.log 53 | lib/flatpak-version-macros.h 54 | flatpak.pc 55 | lib/flatpak-enum-types.c 56 | lib/flatpak-enum-types.h 57 | test-libflatpak 58 | Flatpak-1.0.* 59 | /doc/reference/gtkdoc-check.log 60 | /doc/reference/gtkdoc-check.test 61 | /doc/reference/gtkdoc-check.trs 62 | /doc/reference/version.xml 63 | /test-doc-portal 64 | /test-doc-portal.log 65 | /test-doc-portal.trs 66 | /testdb.log 67 | /testdb.trs 68 | /tests/test-keyring/.gpg-v21-migrated 69 | /tests/test-keyring/private-keys-v1.d/ 70 | /tests/test-keyring/trustdb.gpg 71 | /tests/hello*.flatpak 72 | /tests/platform*.flatpak 73 | /tests/repo 74 | /tests/package_version.txt 75 | *.test 76 | /tests/*.sh.log 77 | /tests/*.sh.test 78 | /tests/*.sh.trs 79 | po/.intltool-merge-cache 80 | po/Makefile.in.in 81 | po/POTFILES 82 | po/Flatpak.pot 83 | system-helper/org.freedesktop.Flatpak.policy 84 | bwrap 85 | py-compile 86 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "libglnx"] 2 | path = libglnx 3 | url = https://git.gnome.org/browse/libglnx 4 | [submodule "bubblewrap"] 5 | path = bubblewrap 6 | url = https://github.com/projectatomic/bubblewrap.git 7 | ignore = dirty 8 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | NULL = 2 | 3 | bin_PROGRAMS = $(NULL) 4 | noinst_PROGRAMS = $(NULL) 5 | noinst_LTLIBRARIES = $(NULL) 6 | libexec_PROGRAMS = $(NULL) 7 | CLEANFILES = $(NULL) 8 | DISTCLEANFILES= $(NULL) 9 | BUILT_SOURCES = $(NULL) 10 | EXTRA_DIST = 11 | 12 | include $(top_srcdir)/buildutil/glib-tap.mk 13 | 14 | SUBDIRS = 15 | 16 | 17 | if BUILD_DOCUMENTATION 18 | SUBDIRS += . doc 19 | endif 20 | 21 | SUBDIRS += po 22 | 23 | %.service: %.service.in config.log 24 | $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" -e "s|\@extraargs\@||" $< > $@ 25 | 26 | dbus_servicedir = $(DBUS_SERVICE_DIR) 27 | service_in_files = $(NULL) 28 | dbus_service_DATA = $(NULL) 29 | systemduserunit_DATA = $(NULL) 30 | CLEANFILES += $(dbus_service_DATA) 31 | CLEANFILES += $(systemduserunit_DATA) 32 | EXTRA_DIST += $(service_in_files) 33 | 34 | FLATPAK_BINDIR=$(bindir) 35 | 36 | AM_CPPFLAGS = \ 37 | -DFLATPAK_BINDIR=\"$(FLATPAK_BINDIR)\" \ 38 | -DFLATPAK_SYSTEMDIR=\"$(SYSTEM_INSTALL_DIR)\" \ 39 | -DFLATPAK_CONFIGDIR=\"$(sysconfdir)/flatpak\" \ 40 | -DFLATPAK_BASEDIR=\"$(pkgdatadir)\" \ 41 | -DFLATPAK_TRIGGERDIR=\"$(pkgdatadir)/triggers\" \ 42 | -DSYSTEM_FONTS_DIR=\"$(SYSTEM_FONTS_DIR)\" \ 43 | -DHELPER=\"$(libdir)/flatpak/bwrap\" \ 44 | -DDBUSPROXY=\"$(libexecdir)/flatpak-dbus-proxy\" \ 45 | -DG_LOG_DOMAIN=\"flatpak\" \ 46 | -I$(srcdir)/libglnx \ 47 | -I$(srcdir)/common \ 48 | -I$(builddir)/common \ 49 | $(NULL) 50 | 51 | triggersdir = $(pkgdatadir)/triggers 52 | dist_triggers_SCRIPTS = \ 53 | triggers/gtk-icon-cache.trigger \ 54 | triggers/mime-database.trigger \ 55 | triggers/desktop-database.trigger \ 56 | $(NULL) 57 | 58 | lib_LTLIBRARIES = 59 | noinst_LTLIBRARIES += libglnx.la 60 | libglnx_srcpath := $(srcdir)/libglnx 61 | libglnx_cflags := \ 62 | $(BASE_CFLAGS) \ 63 | "-I$(libglnx_srcpath)" \ 64 | $(HIDDEN_VISIBILITY_CFLAGS) \ 65 | $(NULL) 66 | libglnx_libs := $(BASE_LIBS) 67 | include libglnx/Makefile-libglnx.am.inc 68 | 69 | include common/Makefile.am.inc 70 | include data/Makefile.am.inc 71 | include app/Makefile.am.inc 72 | include lib/Makefile.am.inc 73 | include builder/Makefile.am.inc 74 | include session-helper/Makefile.am.inc 75 | include system-helper/Makefile.am.inc 76 | include dbus-proxy/Makefile.am.inc 77 | include permission-store/Makefile.am.inc 78 | include document-portal/Makefile.am.inc 79 | include tests/Makefile.am.inc 80 | 81 | bwrap_PROGRAMS = bwrap 82 | bwrapdir = $(libdir)/flatpak 83 | include bubblewrap/Makefile-bwrap.am.inc 84 | 85 | # NOTE: bwrap is install-bwrapPROGS which is run from install-data, not install-exec, this data-hook is used 86 | install-data-hook: 87 | $(MAKE) $(AM_MAKEFLAGS) install-test-data-hook 88 | if PRIV_MODE_SETUID 89 | $(SUDO_BIN) chown root $(DESTDIR)$(libdir)/flatpak/bwrap 90 | $(SUDO_BIN) chmod u+s $(DESTDIR)$(libdir)/flatpak/bwrap 91 | else 92 | if PRIV_MODE_FILECAPS 93 | $(SUDO_BIN) setcap cap_sys_admin,cap_net_admin,cap_sys_chroot+ep $(DESTDIR)$(libdir)/flatpak/bwrap 94 | endif 95 | endif 96 | 97 | completiondir = $(datadir)/bash-completion/completions 98 | completion_DATA = completion/flatpak 99 | EXTRA_DIST += $(completion_DATA) 100 | 101 | profiledir = $(sysconfdir)/profile.d 102 | profile_DATA = flatpak.sh 103 | EXTRA_DIST += \ 104 | profile/flatpak.sh.in \ 105 | $(NULL) 106 | DISTCLEANFILES += flatpak.sh 107 | 108 | flatpak.sh: profile/flatpak.sh.in 109 | $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \ 110 | -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@ 111 | 112 | envdir = $(datadir)/gdm/env.d 113 | env_DATA = flatpak.env 114 | EXTRA_DIST += env.d/flatpak.env.in 115 | DISTCLEANFILES += flatpak.env 116 | 117 | flatpak.env: env.d/flatpak.env.in 118 | $(AM_V_GEN) $(SED) -e "s|\@localstatedir\@|$(localstatedir)|" \ 119 | -e "s|\@sysconfdir\@|$(sysconfdir)|" $< > $@ 120 | 121 | pkgconfigdir = $(libdir)/pkgconfig 122 | pkgconfig_DATA = flatpak.pc 123 | EXTRA_DIST += flatpak.pc.in 124 | 125 | DISTCHECK_CONFIGURE_FLAGS = \ 126 | --enable-documentation \ 127 | --disable-maintainer-mode \ 128 | --enable-introspection 129 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flatpak 2 | 3 | flatpak is a system for building, distributing and running sandboxed 4 | desktop applications on Linux. 5 | 6 | See https://wiki.gnome.org/Projects/SandboxedApps for more information. 7 | -------------------------------------------------------------------------------- /app/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS += \ 2 | flatpak \ 3 | $(NULL) 4 | 5 | flatpak_SOURCES = \ 6 | app/flatpak-main.c \ 7 | app/flatpak-builtins.h \ 8 | app/flatpak-builtins-add-remote.c \ 9 | app/flatpak-builtins-delete-remote.c \ 10 | app/flatpak-builtins-list-remotes.c \ 11 | app/flatpak-builtins-ls-remote.c \ 12 | app/flatpak-builtins-install.c \ 13 | app/flatpak-builtins-override.c \ 14 | app/flatpak-builtins-make-current.c \ 15 | app/flatpak-builtins-update.c \ 16 | app/flatpak-builtins-uninstall.c \ 17 | app/flatpak-builtins-list.c \ 18 | app/flatpak-builtins-info.c \ 19 | app/flatpak-builtins-run.c \ 20 | app/flatpak-builtins-enter.c \ 21 | app/flatpak-builtins-build-init.c \ 22 | app/flatpak-builtins-build.c \ 23 | app/flatpak-builtins-build-finish.c \ 24 | app/flatpak-builtins-build-export.c \ 25 | app/flatpak-builtins-build-bundle.c \ 26 | app/flatpak-builtins-build-import-bundle.c \ 27 | app/flatpak-builtins-build-sign.c \ 28 | app/flatpak-builtins-repo-update.c \ 29 | app/flatpak-builtins-document.c \ 30 | $(xdp_dbus_built_sources) \ 31 | $(NULL) 32 | 33 | flatpak_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(LIBARCHIVE_LIBS) libglnx.la libflatpak-common.la 34 | flatpak_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(LIBARCHIVE_CFLAGS) 35 | -------------------------------------------------------------------------------- /app/flatpak-builtins-build-sign.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "libgsystem.h" 29 | #include "libglnx/libglnx.h" 30 | 31 | #include "flatpak-builtins.h" 32 | #include "flatpak-utils.h" 33 | 34 | static char *opt_arch; 35 | static gboolean opt_runtime; 36 | static char **opt_gpg_key_ids; 37 | static char *opt_gpg_homedir; 38 | 39 | static GOptionEntry options[] = { 40 | { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to install for", "ARCH" }, 41 | { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Look for runtime with the specified name", }, 42 | { "gpg-sign", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_gpg_key_ids, "GPG Key ID to sign the commit with", "KEY-ID"}, 43 | { "gpg-homedir", 0, 0, G_OPTION_ARG_STRING, &opt_gpg_homedir, "GPG Homedir to use when looking for keyrings", "HOMEDIR"}, 44 | { NULL } 45 | }; 46 | 47 | 48 | gboolean 49 | flatpak_builtin_build_sign (int argc, char **argv, GCancellable *cancellable, GError **error) 50 | { 51 | g_autoptr(GOptionContext) context = NULL; 52 | g_autoptr(GFile) repofile = NULL; 53 | g_autoptr(OstreeRepo) repo = NULL; 54 | const char *location; 55 | const char *branch; 56 | const char *id; 57 | g_autofree char *commit_checksum = NULL; 58 | g_autofree char *ref = NULL; 59 | char **iter; 60 | 61 | context = g_option_context_new ("LOCATION ID [BRANCH] - Create a repository from a build directory"); 62 | 63 | if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error)) 64 | return FALSE; 65 | 66 | if (argc < 3) 67 | { 68 | usage_error (context, "LOCATION and DIRECTORY must be specified", error); 69 | return FALSE; 70 | } 71 | 72 | location = argv[1]; 73 | id = argv[2]; 74 | 75 | if (argc >= 4) 76 | branch = argv[3]; 77 | else 78 | branch = "master"; 79 | 80 | if (!flatpak_is_valid_name (id)) 81 | return flatpak_fail (error, "'%s' is not a valid name", id); 82 | 83 | if (!flatpak_is_valid_branch (branch)) 84 | return flatpak_fail (error, "'%s' is not a valid branch name", branch); 85 | 86 | if (opt_gpg_key_ids == NULL) 87 | return flatpak_fail (error, "No gpg key ids specified"); 88 | 89 | if (opt_runtime) 90 | ref = flatpak_build_runtime_ref (id, branch, opt_arch); 91 | else 92 | ref = flatpak_build_app_ref (id, branch, opt_arch); 93 | 94 | repofile = g_file_new_for_commandline_arg (location); 95 | repo = ostree_repo_new (repofile); 96 | 97 | if (!ostree_repo_open (repo, cancellable, error)) 98 | return FALSE; 99 | 100 | if (!ostree_repo_resolve_rev (repo, ref, TRUE, &commit_checksum, error)) 101 | return FALSE; 102 | 103 | for (iter = opt_gpg_key_ids; iter && *iter; iter++) 104 | { 105 | const char *keyid = *iter; 106 | 107 | if (!ostree_repo_sign_commit (repo, 108 | commit_checksum, 109 | keyid, 110 | opt_gpg_homedir, 111 | cancellable, 112 | error)) 113 | return FALSE; 114 | } 115 | 116 | return TRUE; 117 | } 118 | -------------------------------------------------------------------------------- /app/flatpak-builtins-delete-remote.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "libgsystem.h" 29 | #include "libglnx/libglnx.h" 30 | 31 | #include "flatpak-builtins.h" 32 | 33 | static gboolean opt_force; 34 | 35 | static GOptionEntry delete_options[] = { 36 | { "force", 0, 0, G_OPTION_ARG_NONE, &opt_force, "Remove remote even if in use", }, 37 | { NULL } 38 | }; 39 | 40 | 41 | gboolean 42 | flatpak_builtin_delete_remote (int argc, char **argv, GCancellable *cancellable, GError **error) 43 | { 44 | g_autoptr(GOptionContext) context = NULL; 45 | g_autoptr(FlatpakDir) dir = NULL; 46 | const char *remote_name; 47 | 48 | context = g_option_context_new ("NAME - Delete a remote repository"); 49 | 50 | g_option_context_add_main_entries (context, delete_options, NULL); 51 | 52 | if (!flatpak_option_context_parse (context, NULL, &argc, &argv, 0, &dir, cancellable, error)) 53 | return FALSE; 54 | 55 | if (argc < 2) 56 | return usage_error (context, "NAME must be specified", error); 57 | 58 | remote_name = argv[1]; 59 | 60 | if (!flatpak_dir_remove_remote (dir, opt_force, remote_name, 61 | cancellable, error)) 62 | return FALSE; 63 | 64 | return TRUE; 65 | } 66 | -------------------------------------------------------------------------------- /app/flatpak-builtins-ls-remote.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "libgsystem.h" 29 | #include "libglnx/libglnx.h" 30 | 31 | #include "flatpak-builtins.h" 32 | #include "flatpak-utils.h" 33 | 34 | static gboolean opt_show_details; 35 | static gboolean opt_runtime; 36 | static gboolean opt_app; 37 | static gboolean opt_only_updates; 38 | 39 | static GOptionEntry options[] = { 40 | { "show-details", 'd', 0, G_OPTION_ARG_NONE, &opt_show_details, "Show arches and branches", NULL }, 41 | { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Show only runtimes", NULL }, 42 | { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, "Show only apps", NULL }, 43 | { "updates", 0, 0, G_OPTION_ARG_NONE, &opt_only_updates, "Show only those where updates are available", NULL }, 44 | { NULL } 45 | }; 46 | 47 | gboolean 48 | flatpak_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GError **error) 49 | { 50 | g_autoptr(GOptionContext) context = NULL; 51 | g_autoptr(FlatpakDir) dir = NULL; 52 | g_autoptr(GHashTable) refs = NULL; 53 | GHashTableIter iter; 54 | gpointer key; 55 | gpointer value; 56 | g_autoptr(GHashTable) names = NULL; 57 | guint n_keys; 58 | g_autofree const char **keys = NULL; 59 | int i; 60 | const char *repository; 61 | const char *arch; 62 | 63 | context = g_option_context_new (" REMOTE - Show available runtimes and applications"); 64 | 65 | if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error)) 66 | return FALSE; 67 | 68 | if (!opt_app && !opt_runtime) 69 | opt_app = opt_runtime = TRUE; 70 | 71 | if (argc < 2) 72 | return usage_error (context, "REMOTE must be specified", error); 73 | 74 | repository = argv[1]; 75 | 76 | 77 | if (!flatpak_dir_list_remote_refs (dir, 78 | repository, 79 | &refs, 80 | cancellable, error)) 81 | return FALSE; 82 | 83 | names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); 84 | 85 | arch = flatpak_get_arch (); 86 | 87 | g_hash_table_iter_init (&iter, refs); 88 | while (g_hash_table_iter_next (&iter, &key, &value)) 89 | { 90 | const char *ref = key; 91 | const char *checksum = value; 92 | const char *name = NULL; 93 | g_auto(GStrv) parts = NULL; 94 | 95 | parts = flatpak_decompose_ref (ref, NULL); 96 | if (parts == NULL) 97 | { 98 | g_debug ("Invalid remote ref %s\n", ref); 99 | continue; 100 | } 101 | 102 | if (opt_only_updates) 103 | { 104 | g_autofree char *deployed = NULL; 105 | 106 | deployed = flatpak_dir_read_active (dir, ref, cancellable); 107 | if (deployed == NULL) 108 | continue; 109 | 110 | if (g_strcmp0 (deployed, checksum) == 0) 111 | continue; 112 | } 113 | 114 | if (!opt_show_details) 115 | { 116 | if (strcmp (arch, parts[2]) != 0) 117 | continue; 118 | } 119 | 120 | if (strcmp (parts[0], "runtime") == 0 && !opt_runtime) 121 | continue; 122 | 123 | if (strcmp (parts[0], "app") == 0 && !opt_app) 124 | continue; 125 | 126 | if (!opt_show_details) 127 | name = parts[1]; 128 | else 129 | name = ref; 130 | 131 | if (g_hash_table_lookup (names, name) == NULL) 132 | g_hash_table_insert (names, g_strdup (name), g_strdup (checksum)); 133 | } 134 | 135 | keys = (const char **) g_hash_table_get_keys_as_array (names, &n_keys); 136 | g_qsort_with_data (keys, n_keys, sizeof (char *), (GCompareDataFunc) flatpak_strcmp0_ptr, NULL); 137 | 138 | for (i = 0; i < n_keys; i++) 139 | { 140 | if (opt_show_details) 141 | g_print ("%s %.12s\n", keys[i], (char *) g_hash_table_lookup (names, keys[i])); 142 | else 143 | g_print ("%s\n", keys[i]); 144 | } 145 | 146 | return TRUE; 147 | } 148 | -------------------------------------------------------------------------------- /app/flatpak-builtins-make-current.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "libgsystem.h" 29 | #include "libglnx/libglnx.h" 30 | 31 | #include "flatpak-builtins.h" 32 | #include "flatpak-utils.h" 33 | 34 | static char *opt_arch; 35 | 36 | static GOptionEntry options[] = { 37 | { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to make current for", "ARCH" }, 38 | { NULL } 39 | }; 40 | 41 | gboolean 42 | flatpak_builtin_make_current_app (int argc, char **argv, GCancellable *cancellable, GError **error) 43 | { 44 | g_autoptr(GOptionContext) context = NULL; 45 | g_autoptr(FlatpakDir) dir = NULL; 46 | g_autoptr(GFile) deploy_base = NULL; 47 | const char *app; 48 | const char *branch = "master"; 49 | g_autofree char *ref = NULL; 50 | g_auto(GLnxLockFile) lock = GLNX_LOCK_FILE_INIT; 51 | 52 | context = g_option_context_new ("APP BRANCH - Make branch of application current"); 53 | 54 | if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error)) 55 | return FALSE; 56 | 57 | if (argc < 3) 58 | return usage_error (context, "APP and BRANCH must be specified", error); 59 | 60 | app = argv[1]; 61 | branch = argv[2]; 62 | 63 | ref = flatpak_compose_ref (TRUE, app, branch, opt_arch, error); 64 | if (ref == NULL) 65 | return FALSE; 66 | 67 | if (!flatpak_dir_lock (dir, &lock, 68 | cancellable, error)) 69 | return FALSE; 70 | 71 | deploy_base = flatpak_dir_get_deploy_dir (dir, ref); 72 | if (!g_file_query_exists (deploy_base, cancellable)) 73 | return flatpak_fail (error, "App %s branch %s is not installed", app, branch); 74 | 75 | if (!flatpak_dir_make_current_ref (dir, ref, cancellable, error)) 76 | return FALSE; 77 | 78 | if (!flatpak_dir_update_exports (dir, app, cancellable, error)) 79 | return FALSE; 80 | 81 | glnx_release_lock_file (&lock); 82 | 83 | if (!flatpak_dir_mark_changed (dir, error)) 84 | return FALSE; 85 | 86 | return TRUE; 87 | } 88 | -------------------------------------------------------------------------------- /app/flatpak-builtins-override.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "libgsystem.h" 31 | #include "libglnx/libglnx.h" 32 | 33 | #include "flatpak-builtins.h" 34 | #include "flatpak-utils.h" 35 | #include "flatpak-run.h" 36 | 37 | static GOptionEntry options[] = { 38 | { NULL } 39 | }; 40 | 41 | gboolean 42 | flatpak_builtin_override (int argc, char **argv, GCancellable *cancellable, GError **error) 43 | { 44 | g_autoptr(GOptionContext) context = NULL; 45 | const char *app; 46 | g_autoptr(FlatpakContext) arg_context = NULL; 47 | g_autoptr(FlatpakDir) dir = NULL; 48 | g_autoptr(GKeyFile) metakey = NULL; 49 | g_autoptr(FlatpakContext) overrides = NULL; 50 | g_autoptr(GError) my_error = NULL; 51 | 52 | context = g_option_context_new ("APP - Override settings for application"); 53 | 54 | arg_context = flatpak_context_new (); 55 | g_option_context_add_group (context, flatpak_context_get_options (arg_context)); 56 | 57 | if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error)) 58 | return FALSE; 59 | 60 | if (argc < 2) 61 | { 62 | usage_error (context, "APP must be specified", error); 63 | return FALSE; 64 | } 65 | 66 | app = argv[1]; 67 | 68 | if (!flatpak_is_valid_name (app)) 69 | return flatpak_fail (error, "'%s' is not a valid application name", app); 70 | 71 | metakey = flatpak_load_override_keyfile (app, flatpak_dir_is_user (dir), &my_error); 72 | if (metakey == NULL) 73 | { 74 | if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) 75 | { 76 | g_propagate_error (error, g_steal_pointer (&my_error)); 77 | return FALSE; 78 | } 79 | metakey = g_key_file_new (); 80 | } 81 | 82 | overrides = flatpak_context_new (); 83 | if (!flatpak_context_load_metadata (overrides, metakey, error)) 84 | return FALSE; 85 | 86 | flatpak_context_merge (overrides, arg_context); 87 | 88 | flatpak_context_save_metadata (overrides, metakey); 89 | 90 | if (!flatpak_save_override_keyfile (metakey, app, flatpak_dir_is_user (dir), error)) 91 | return FALSE; 92 | 93 | return TRUE; 94 | } 95 | -------------------------------------------------------------------------------- /app/flatpak-builtins-uninstall.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "libgsystem.h" 29 | #include "libglnx/libglnx.h" 30 | 31 | #include "flatpak-builtins.h" 32 | #include "flatpak-utils.h" 33 | 34 | static char *opt_arch; 35 | static gboolean opt_keep_ref; 36 | static gboolean opt_force_remove; 37 | static gboolean opt_runtime; 38 | static gboolean opt_app; 39 | 40 | static GOptionEntry options[] = { 41 | { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Arch to uninstall", "ARCH" }, 42 | { "keep-ref", 0, 0, G_OPTION_ARG_NONE, &opt_keep_ref, "Keep ref in local repository", NULL }, 43 | { "force-remove", 0, 0, G_OPTION_ARG_NONE, &opt_force_remove, "Remove files even if running", NULL }, 44 | { "runtime", 0, 0, G_OPTION_ARG_NONE, &opt_runtime, "Look for runtime with the specified name", }, 45 | { "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, "Look for app with the specified name", }, 46 | { NULL } 47 | }; 48 | 49 | gboolean 50 | flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GError **error) 51 | { 52 | g_autoptr(GOptionContext) context = NULL; 53 | g_autoptr(FlatpakDir) dir = NULL; 54 | const char *name = NULL; 55 | const char *branch = NULL; 56 | g_autofree char *ref = NULL; 57 | gboolean is_app; 58 | FlatpakHelperUninstallFlags flags = 0; 59 | 60 | context = g_option_context_new ("APP [BRANCH] - Uninstall an application"); 61 | 62 | if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error)) 63 | return FALSE; 64 | 65 | if (argc < 2) 66 | return usage_error (context, "APP must be specified", error); 67 | 68 | name = argv[1]; 69 | if (argc > 2) 70 | branch = argv[2]; 71 | 72 | if (!opt_app && !opt_runtime) 73 | opt_app = opt_runtime = TRUE; 74 | 75 | ref = flatpak_dir_find_installed_ref (dir, 76 | name, 77 | branch, 78 | opt_arch, 79 | opt_app, opt_runtime, &is_app, 80 | error); 81 | if (ref == NULL) 82 | return FALSE; 83 | 84 | /* TODO: when removing runtimes, look for apps that use it, require --force */ 85 | 86 | if (opt_keep_ref) 87 | flags |= FLATPAK_HELPER_UNINSTALL_FLAGS_KEEP_REF; 88 | if (opt_force_remove) 89 | flags |= FLATPAK_HELPER_UNINSTALL_FLAGS_FORCE_REMOVE; 90 | 91 | if (!flatpak_dir_uninstall (dir, ref, flags, 92 | cancellable, error)) 93 | return FALSE; 94 | 95 | return TRUE; 96 | } 97 | -------------------------------------------------------------------------------- /app/flatpak-builtins.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __FLATPAK_BUILTINS_H__ 22 | #define __FLATPAK_BUILTINS_H__ 23 | 24 | #include 25 | #include 26 | 27 | #include "flatpak-dir.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef enum { 32 | FLATPAK_BUILTIN_FLAG_NO_DIR = 1 << 0, 33 | FLATPAK_BUILTIN_FLAG_NO_REPO = 1 << 1, 34 | } FlatpakBuiltinFlags; 35 | 36 | gboolean flatpak_option_context_parse (GOptionContext *context, 37 | const GOptionEntry *main_entries, 38 | int *argc, 39 | char ***argv, 40 | FlatpakBuiltinFlags flags, 41 | FlatpakDir **out_dir, 42 | GCancellable *cancellable, 43 | GError **error); 44 | 45 | gboolean usage_error (GOptionContext *context, 46 | const char *message, 47 | GError **error); 48 | 49 | #define BUILTINPROTO(name) gboolean flatpak_builtin_ ## name (int argc, char **argv, GCancellable * cancellable, GError * *error) 50 | 51 | BUILTINPROTO (add_remote); 52 | BUILTINPROTO (modify_remote); 53 | BUILTINPROTO (delete_remote); 54 | BUILTINPROTO (ls_remote); 55 | BUILTINPROTO (list_remotes); 56 | BUILTINPROTO (install); 57 | BUILTINPROTO (update); 58 | BUILTINPROTO (make_current_app); 59 | BUILTINPROTO (uninstall); 60 | BUILTINPROTO (install_bundle); 61 | BUILTINPROTO (list); 62 | BUILTINPROTO (info); 63 | BUILTINPROTO (run); 64 | BUILTINPROTO (enter); 65 | BUILTINPROTO (build_init); 66 | BUILTINPROTO (build); 67 | BUILTINPROTO (build_finish); 68 | BUILTINPROTO (build_sign); 69 | BUILTINPROTO (build_export); 70 | BUILTINPROTO (build_bundle); 71 | BUILTINPROTO (build_import); 72 | BUILTINPROTO (build_update_repo); 73 | BUILTINPROTO (export_file); 74 | BUILTINPROTO (override); 75 | 76 | #undef BUILTINPROTO 77 | 78 | G_END_DECLS 79 | 80 | #endif /* __FLATPAK_BUILTINS_H__ */ 81 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | test -n "$srcdir" || srcdir=`dirname "$0"` 5 | test -n "$srcdir" || srcdir=. 6 | 7 | olddir=`pwd` 8 | cd "$srcdir" 9 | 10 | AUTORECONF=`which autoreconf` 11 | if test -z $AUTORECONF; then 12 | echo "*** No autoreconf found, please install it ***" 13 | exit 1 14 | fi 15 | 16 | # INSTALL are required by automake, but may be deleted by clean 17 | # up rules. to get automake to work, simply touch these here, they will be 18 | # regenerated from their corresponding *.in files by ./configure anyway. 19 | touch INSTALL 20 | 21 | if ! test -f libglnx/README.md -a -f bubblewrap/README.md; then 22 | git submodule update --init 23 | fi 24 | # Workaround automake bug with subdir-objects and computed paths 25 | sed -e 's,$(libglnx_srcpath),'${srcdir}/libglnx,g < libglnx/Makefile-libglnx.am >libglnx/Makefile-libglnx.am.inc 26 | sed -e 's,$(bwrap_srcpath),'${srcdir}/bubblewrap,g < bubblewrap/Makefile-bwrap.am >bubblewrap/Makefile-bwrap.am.inc 27 | 28 | GTKDOCIZE=$(which gtkdocize 2>/dev/null) 29 | if test -z $GTKDOCIZE; then 30 | echo "*** You don't have gtk-doc installed, and thus won't be able to generate the documentation. ***" 31 | rm -f gtk-doc.make 32 | cat > gtk-doc.make <. 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_CACHE_H__ 22 | #define __BUILDER_CACHE_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct BuilderCache BuilderCache; 30 | 31 | #define BUILDER_TYPE_CACHE (builder_cache_get_type ()) 32 | #define BUILDER_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_CACHE, BuilderCache)) 33 | #define BUILDER_IS_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_CACHE)) 34 | 35 | GType builder_cache_get_type (void); 36 | 37 | BuilderCache *builder_cache_new (GFile *cache_dir, 38 | GFile *app_dir, 39 | const char *branch); 40 | void builder_cache_disable_lookups (BuilderCache *self); 41 | gboolean builder_cache_open (BuilderCache *self, 42 | GError **error); 43 | GChecksum * builder_cache_get_checksum (BuilderCache *self); 44 | gboolean builder_cache_lookup (BuilderCache *self, 45 | const char *stage); 46 | void builder_cache_ensure_checkout (BuilderCache *self); 47 | gboolean builder_cache_has_checkout (BuilderCache *self); 48 | gboolean builder_cache_commit (BuilderCache *self, 49 | const char *body, 50 | GError **error); 51 | gboolean builder_cache_get_outstanding_changes (BuilderCache *self, 52 | GPtrArray **added_out, 53 | GPtrArray **modified_out, 54 | GPtrArray **removed_out, 55 | GError **error); 56 | GPtrArray *builder_cache_get_changes (BuilderCache *self, 57 | GError **error); 58 | GPtrArray *builder_cache_get_all_changes (BuilderCache *self, 59 | GError **error); 60 | gboolean builder_gc (BuilderCache *self, 61 | GError **error); 62 | 63 | void builder_cache_checksum_str (BuilderCache *self, 64 | const char *str); 65 | void builder_cache_checksum_strv (BuilderCache *self, 66 | char **strv); 67 | void builder_cache_checksum_boolean (BuilderCache *self, 68 | gboolean val); 69 | void builder_cache_checksum_uint32 (BuilderCache *self, 70 | guint32 val); 71 | void builder_cache_checksum_data (BuilderCache *self, 72 | guint8 *data, 73 | gsize len); 74 | 75 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderCache, g_object_unref) 76 | 77 | G_END_DECLS 78 | 79 | #endif /* __BUILDER_CACHE_H__ */ 80 | -------------------------------------------------------------------------------- /builder/builder-context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_CONTEXT_H__ 22 | #define __BUILDER_CONTEXT_H__ 23 | 24 | #include 25 | #include 26 | #include "builder-options.h" 27 | 28 | G_BEGIN_DECLS 29 | 30 | /* BuilderContext defined in builder-options.h to fix include loop */ 31 | 32 | #define BUILDER_TYPE_CONTEXT (builder_context_get_type ()) 33 | #define BUILDER_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_CONTEXT, BuilderContext)) 34 | #define BUILDER_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_CONTEXT)) 35 | 36 | GType builder_context_get_type (void); 37 | 38 | GFile * builder_context_get_app_dir (BuilderContext *self); 39 | GFile * builder_context_get_base_dir (BuilderContext *self); 40 | GFile * builder_context_get_state_dir (BuilderContext *self); 41 | GFile * builder_context_get_cache_dir (BuilderContext *self); 42 | GFile * builder_context_get_build_dir (BuilderContext *self); 43 | GFile * builder_context_get_ccache_dir (BuilderContext *self); 44 | GFile * builder_context_get_download_dir (BuilderContext *self); 45 | SoupSession * builder_context_get_soup_session (BuilderContext *self); 46 | const char * builder_context_get_arch (BuilderContext *self); 47 | void builder_context_set_arch (BuilderContext *self, 48 | const char *arch); 49 | int builder_context_get_n_cpu (BuilderContext *self); 50 | void builder_context_set_keep_build_dirs (BuilderContext *self, 51 | gboolean keep_build_dirs); 52 | gboolean builder_context_get_keep_build_dirs (BuilderContext *self); 53 | void builder_context_set_global_cleanup (BuilderContext *self, 54 | const char **cleanup); 55 | const char ** builder_context_get_global_cleanup (BuilderContext *self); 56 | void builder_context_set_global_cleanup_platform (BuilderContext *self, 57 | const char **cleanup); 58 | const char ** builder_context_get_global_cleanup_platform (BuilderContext *self); 59 | BuilderOptions *builder_context_get_options (BuilderContext *self); 60 | void builder_context_set_options (BuilderContext *self, 61 | BuilderOptions *option); 62 | gboolean builder_context_get_build_runtime (BuilderContext *self); 63 | void builder_context_set_build_runtime (BuilderContext *self, 64 | gboolean build_runtime); 65 | gboolean builder_context_get_separate_locales (BuilderContext *self); 66 | void builder_context_set_separate_locales (BuilderContext *self, 67 | gboolean separate_locales); 68 | 69 | BuilderContext *builder_context_new (GFile *base_dir, 70 | GFile *app_dir); 71 | gboolean builder_context_enable_ccache (BuilderContext *self, 72 | GError **error); 73 | char ** builder_context_extend_env (BuilderContext *self, 74 | char **envp); 75 | 76 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderContext, g_object_unref) 77 | 78 | G_END_DECLS 79 | 80 | #endif /* __BUILDER_CONTEXT_H__ */ 81 | -------------------------------------------------------------------------------- /builder/builder-manifest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_MANIFEST_H__ 22 | #define __BUILDER_MANIFEST_H__ 23 | 24 | #include 25 | 26 | #include "builder-options.h" 27 | #include "builder-module.h" 28 | #include "builder-cache.h" 29 | 30 | G_BEGIN_DECLS 31 | 32 | typedef struct BuilderManifest BuilderManifest; 33 | 34 | #define BUILDER_TYPE_MANIFEST (builder_manifest_get_type ()) 35 | #define BUILDER_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_MANIFEST, BuilderManifest)) 36 | #define BUILDER_IS_MANIFEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_MANIFEST)) 37 | 38 | /* Bump this if format changes in incompatible ways to force rebuild */ 39 | #define BUILDER_MANIFEST_CHECKSUM_VERSION "1" 40 | #define BUILDER_MANIFEST_CHECKSUM_CLEANUP_VERSION "1" 41 | #define BUILDER_MANIFEST_CHECKSUM_FINISH_VERSION "2" 42 | #define BUILDER_MANIFEST_CHECKSUM_PLATFORM_VERSION "1" 43 | 44 | GType builder_manifest_get_type (void); 45 | 46 | const char * builder_manifest_get_id (BuilderManifest *self); 47 | const char * builder_manifest_get_id_platform (BuilderManifest *self); 48 | BuilderOptions *builder_manifest_get_build_options (BuilderManifest *self); 49 | GList * builder_manifest_get_modules (BuilderManifest *self); 50 | const char * builder_manifest_get_branch (BuilderManifest *self); 51 | 52 | gboolean builder_manifest_start (BuilderManifest *self, 53 | BuilderContext *context, 54 | GError **error); 55 | gboolean builder_manifest_init_app_dir (BuilderManifest *self, 56 | BuilderContext *context, 57 | GError **error); 58 | gboolean builder_manifest_download (BuilderManifest *self, 59 | gboolean update_vcs, 60 | BuilderContext *context, 61 | GError **error); 62 | gboolean builder_manifest_build (BuilderManifest *self, 63 | BuilderCache *cache, 64 | BuilderContext *context, 65 | GError **error); 66 | gboolean builder_manifest_run (BuilderManifest *self, 67 | BuilderContext *context, 68 | char **argv, 69 | int argc, 70 | GError **error); 71 | void builder_manifest_checksum (BuilderManifest *self, 72 | BuilderCache *cache, 73 | BuilderContext *context); 74 | gboolean builder_manifest_cleanup (BuilderManifest *self, 75 | BuilderCache *cache, 76 | BuilderContext *context, 77 | GError **error); 78 | gboolean builder_manifest_finish (BuilderManifest *self, 79 | BuilderCache *cache, 80 | BuilderContext *context, 81 | GError **error); 82 | gboolean builder_manifest_create_platform (BuilderManifest *self, 83 | BuilderCache *cache, 84 | BuilderContext *context, 85 | GError **error); 86 | 87 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderManifest, g_object_unref) 88 | 89 | G_END_DECLS 90 | 91 | #endif /* __BUILDER_MANIFEST_H__ */ 92 | -------------------------------------------------------------------------------- /builder/builder-module.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_MODULE_H__ 22 | #define __BUILDER_MODULE_H__ 23 | 24 | #include 25 | 26 | #include "builder-source.h" 27 | #include "builder-options.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct BuilderModule BuilderModule; 32 | 33 | #define BUILDER_TYPE_MODULE (builder_module_get_type ()) 34 | #define BUILDER_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_MODULE, BuilderModule)) 35 | #define BUILDER_IS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_MODULE)) 36 | 37 | /* Bump this if format changes in incompatible ways to force rebuild */ 38 | #define BUILDER_MODULE_CHECKSUM_VERSION "1" 39 | 40 | GType builder_module_get_type (void); 41 | 42 | const char * builder_module_get_name (BuilderModule *self); 43 | gboolean builder_module_get_disabled (BuilderModule *self); 44 | GList * builder_module_get_sources (BuilderModule *self); 45 | GPtrArray * builder_module_get_changes (BuilderModule *self); 46 | void builder_module_set_changes (BuilderModule *self, 47 | GPtrArray *changes); 48 | 49 | gboolean builder_module_download_sources (BuilderModule *self, 50 | gboolean update_vcs, 51 | BuilderContext *context, 52 | GError **error); 53 | gboolean builder_module_extract_sources (BuilderModule *self, 54 | GFile *dest, 55 | BuilderContext *context, 56 | GError **error); 57 | gboolean builder_module_build (BuilderModule *self, 58 | BuilderCache *cache, 59 | BuilderContext *context, 60 | GError **error); 61 | gboolean builder_module_update (BuilderModule *self, 62 | BuilderContext *context, 63 | GError **error); 64 | void builder_module_checksum (BuilderModule *self, 65 | BuilderCache *cache, 66 | BuilderContext *context); 67 | void builder_module_checksum_for_cleanup (BuilderModule *self, 68 | BuilderCache *cache, 69 | BuilderContext *context); 70 | void builder_module_cleanup_collect (BuilderModule *self, 71 | gboolean platform, 72 | BuilderContext *context, 73 | GHashTable *to_remove_ht); 74 | 75 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderModule, g_object_unref) 76 | 77 | G_END_DECLS 78 | 79 | #endif /* __BUILDER_MODULE_H__ */ 80 | -------------------------------------------------------------------------------- /builder/builder-options.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_OPTIONS_H__ 22 | #define __BUILDER_OPTIONS_H__ 23 | 24 | #include 25 | #include "builder-cache.h" 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct BuilderContext BuilderContext; 30 | typedef struct BuilderOptions BuilderOptions; 31 | 32 | #define BUILDER_TYPE_OPTIONS (builder_options_get_type ()) 33 | #define BUILDER_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_OPTIONS, BuilderOptions)) 34 | #define BUILDER_IS_OPTIONS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_OPTIONS)) 35 | 36 | /* Bump this if format changes in incompatible ways to force rebuild */ 37 | #define BUILDER_OPTION_CHECKSUM_VERSION "1" 38 | 39 | GType builder_options_get_type (void); 40 | 41 | const char *builder_options_get_cflags (BuilderOptions *self, 42 | BuilderContext *context); 43 | const char *builder_options_get_cxxflags (BuilderOptions *self, 44 | BuilderContext *context); 45 | const char *builder_options_get_prefix (BuilderOptions *self, 46 | BuilderContext *context); 47 | char ** builder_options_get_env (BuilderOptions *self, 48 | BuilderContext *context); 49 | char ** builder_options_get_build_args (BuilderOptions *self, 50 | BuilderContext *context); 51 | char ** builder_options_get_config_opts (BuilderOptions *self, 52 | BuilderContext *context, 53 | char **base_opts); 54 | void builder_options_checksum (BuilderOptions *self, 55 | BuilderCache *cache, 56 | BuilderContext *context); 57 | gboolean builder_options_get_no_debuginfo (BuilderOptions *self, 58 | BuilderContext *context); 59 | gboolean builder_options_get_strip (BuilderOptions *self, 60 | BuilderContext *context); 61 | 62 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderOptions, g_object_unref) 63 | 64 | G_END_DECLS 65 | 66 | #endif /* __BUILDER_OPTIONS_H__ */ 67 | -------------------------------------------------------------------------------- /builder/builder-source-archive.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_ARCHIVE_H__ 22 | #define __BUILDER_SOURCE_ARCHIVE_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceArchive BuilderSourceArchive; 29 | 30 | #define BUILDER_TYPE_SOURCE_ARCHIVE (builder_source_archive_get_type ()) 31 | #define BUILDER_SOURCE_ARCHIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_ARCHIVE, BuilderSourceArchive)) 32 | #define BUILDER_IS_SOURCE_ARCHIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_ARCHIVE)) 33 | 34 | GType builder_source_archive_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceArchive, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_ARCHIVE_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source-bzr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_BZR_H__ 22 | #define __BUILDER_SOURCE_BZR_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceBzr BuilderSourceBzr; 29 | 30 | #define BUILDER_TYPE_SOURCE_BZR (builder_source_bzr_get_type ()) 31 | #define BUILDER_SOURCE_BZR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_BZR, BuilderSourceBzr)) 32 | #define BUILDER_IS_SOURCE_BZR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_BZR)) 33 | 34 | GType builder_source_bzr_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceBzr, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_BZR_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source-file.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_FILE_H__ 22 | #define __BUILDER_SOURCE_FILE_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceFile BuilderSourceFile; 29 | 30 | #define BUILDER_TYPE_SOURCE_FILE (builder_source_file_get_type ()) 31 | #define BUILDER_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_FILE, BuilderSourceFile)) 32 | #define BUILDER_IS_SOURCE_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_FILE)) 33 | 34 | GType builder_source_file_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceFile, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_FILE_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source-git.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_GIT_H__ 22 | #define __BUILDER_SOURCE_GIT_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceGit BuilderSourceGit; 29 | 30 | #define BUILDER_TYPE_SOURCE_GIT (builder_source_git_get_type ()) 31 | #define BUILDER_SOURCE_GIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_GIT, BuilderSourceGit)) 32 | #define BUILDER_IS_SOURCE_GIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_GIT)) 33 | 34 | GType builder_source_git_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceGit, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_GIT_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source-patch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_PATCH_H__ 22 | #define __BUILDER_SOURCE_PATCH_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourcePatch BuilderSourcePatch; 29 | 30 | #define BUILDER_TYPE_SOURCE_PATCH (builder_source_patch_get_type ()) 31 | #define BUILDER_SOURCE_PATCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_PATCH, BuilderSourcePatch)) 32 | #define BUILDER_IS_SOURCE_PATCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_PATCH)) 33 | 34 | GType builder_source_patch_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourcePatch, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_PATCH_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source-script.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_SCRIPT_H__ 22 | #define __BUILDER_SOURCE_SCRIPT_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceScript BuilderSourceScript; 29 | 30 | #define BUILDER_TYPE_SOURCE_SCRIPT (builder_source_script_get_type ()) 31 | #define BUILDER_SOURCE_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SCRIPT, BuilderSourceScript)) 32 | #define BUILDER_IS_SOURCE_SCRIPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SCRIPT)) 33 | 34 | GType builder_source_script_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceScript, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_SCRIPT_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source-shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_SHELL_H__ 22 | #define __BUILDER_SOURCE_SHELL_H__ 23 | 24 | #include "builder-source.h" 25 | 26 | G_BEGIN_DECLS 27 | 28 | typedef struct BuilderSourceShell BuilderSourceShell; 29 | 30 | #define BUILDER_TYPE_SOURCE_SHELL (builder_source_shell_get_type ()) 31 | #define BUILDER_SOURCE_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE_SHELL, BuilderSourceShell)) 32 | #define BUILDER_IS_SOURCE_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE_SHELL)) 33 | 34 | GType builder_source_shell_get_type (void); 35 | 36 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSourceShell, g_object_unref) 37 | 38 | G_END_DECLS 39 | 40 | #endif /* __BUILDER_SOURCE_SHELL_H__ */ 41 | -------------------------------------------------------------------------------- /builder/builder-source.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_SOURCE_H__ 22 | #define __BUILDER_SOURCE_H__ 23 | 24 | #include 25 | 26 | #include "builder-context.h" 27 | #include "builder-cache.h" 28 | 29 | G_BEGIN_DECLS 30 | 31 | typedef struct BuilderSource BuilderSource; 32 | 33 | #define BUILDER_TYPE_SOURCE (builder_source_get_type ()) 34 | #define BUILDER_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), BUILDER_TYPE_SOURCE, BuilderSource)) 35 | #define BUILDER_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), BUILDER_TYPE_SOURCE, BuilderSourceClass)) 36 | #define BUILDER_IS_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BUILDER_TYPE_SOURCE)) 37 | #define BUILDER_IS_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), BUILDER_TYPE_SOURCE)) 38 | #define BUILDER_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), BUILDER_TYPE_SOURCE, BuilderSourceClass)) 39 | 40 | struct BuilderSource 41 | { 42 | GObject parent; 43 | 44 | char *dest; 45 | }; 46 | 47 | typedef struct 48 | { 49 | GObjectClass parent_class; 50 | 51 | gboolean (* download)(BuilderSource *self, 52 | gboolean update_vcs, 53 | BuilderContext *context, 54 | GError **error); 55 | gboolean (* extract)(BuilderSource *self, 56 | GFile *dest, 57 | BuilderContext *context, 58 | GError **error); 59 | gboolean (* update)(BuilderSource *self, 60 | BuilderContext *context, 61 | GError **error); 62 | void (* checksum)(BuilderSource *self, 63 | BuilderCache *cache, 64 | BuilderContext *context); 65 | } BuilderSourceClass; 66 | 67 | GType builder_source_get_type (void); 68 | 69 | BuilderSource * builder_source_from_json (JsonNode *node); 70 | JsonNode * builder_source_to_json (BuilderSource *self); 71 | 72 | gboolean builder_source_download (BuilderSource *self, 73 | gboolean update_vcs, 74 | BuilderContext *context, 75 | GError **error); 76 | gboolean builder_source_extract (BuilderSource *self, 77 | GFile *dest, 78 | BuilderContext *context, 79 | GError **error); 80 | gboolean builder_source_update (BuilderSource *self, 81 | BuilderContext *context, 82 | GError **error); 83 | 84 | void builder_source_checksum (BuilderSource *self, 85 | BuilderCache *cache, 86 | BuilderContext *context); 87 | 88 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (BuilderSource, g_object_unref) 89 | 90 | G_END_DECLS 91 | 92 | #endif /* __BUILDER_SOURCE_H__ */ 93 | -------------------------------------------------------------------------------- /builder/builder-utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __BUILDER_UTILS_H__ 22 | #define __BUILDER_UTILS_H__ 23 | 24 | #include 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | typedef struct BuilderUtils BuilderUtils; 30 | 31 | char *builder_uri_to_filename (const char *uri); 32 | 33 | gboolean strip (GError **error, 34 | ...); 35 | gboolean eu_strip (GError **error, 36 | ...); 37 | 38 | gboolean is_elf_file (const char *path, 39 | gboolean *is_shared, 40 | gboolean *is_stripped); 41 | 42 | char ** builder_get_debuginfo_file_references (const char *filename, 43 | GError **error); 44 | 45 | gboolean directory_is_empty (const char *path); 46 | 47 | gboolean flatpak_matches_path_pattern (const char *path, 48 | const char *pattern); 49 | void flatpak_collect_matches_for_path_pattern (const char *path, 50 | const char *pattern, 51 | const char *add_prefix, 52 | GHashTable *to_remove_ht); 53 | gboolean builder_migrate_locale_dirs (GFile *root_dir, 54 | GError **error); 55 | 56 | G_END_DECLS 57 | 58 | #endif /* __BUILDER_UTILS_H__ */ 59 | -------------------------------------------------------------------------------- /buildutil/tap-test: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | # 3 | # Run a test in tap mode, ensuring we have a temporary directory. We 4 | # always use /var/tmp becuase we might want to use user xattrs, which 5 | # aren't available on tmpfs. 6 | # 7 | # The test binary is passed as $1 8 | 9 | srcd=$(cd $(dirname $1) && pwd) 10 | bn=$(basename $1) 11 | tempdir=$(mktemp -d /var/tmp/tap-test.XXXXXX) 12 | touch ${tempdir}/.testtmp 13 | function cleanup () { 14 | if test -n "${TEST_SKIP_CLEANUP:-}"; then 15 | echo "Skipping cleanup of ${tempdir}" 16 | else if test -f ${tempdir}/.testtmp; then 17 | rm "${tempdir}" -rf 18 | fi 19 | fi 20 | } 21 | trap cleanup EXIT 22 | cd ${tempdir} 23 | ${srcd}/${bn} -k --tap 24 | -------------------------------------------------------------------------------- /common/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES += libflatpak-common.la 2 | 3 | dbus_built_sources = common/flatpak-dbus.c common/flatpak-dbus.h 4 | systemd_dbus_built_sources = common/flatpak-systemd-dbus.c common/flatpak-systemd-dbus.h 5 | BUILT_SOURCES += $(dbus_built_sources) $(systemd_dbus_built_sources) 6 | 7 | $(dbus_built_sources) : data/org.freedesktop.Flatpak.xml 8 | $(AM_V_GEN) $(GDBUS_CODEGEN) \ 9 | --interface-prefix org.freedesktop.Flatpak. \ 10 | --c-namespace Flatpak \ 11 | --generate-c-code $(builddir)/common/flatpak-dbus \ 12 | $(srcdir)/data/org.freedesktop.Flatpak.xml \ 13 | $(NULL) 14 | 15 | $(systemd_dbus_built_sources) : data/org.freedesktop.systemd1.xml 16 | $(AM_V_GEN) $(GDBUS_CODEGEN) \ 17 | --interface-prefix org.freedesktop.systemd1. \ 18 | --c-namespace Systemd \ 19 | --generate-c-code $(builddir)/common/flatpak-systemd-dbus \ 20 | $(srcdir)/data/org.freedesktop.systemd1.xml \ 21 | $(NULL) 22 | 23 | libflatpak_common_la_SOURCES = \ 24 | common/flatpak-common-types.h \ 25 | common/flatpak-dir.c \ 26 | common/flatpak-dir.h \ 27 | common/flatpak-run.c \ 28 | common/flatpak-run.h \ 29 | common/flatpak-portal-error.c \ 30 | common/flatpak-portal-error.h \ 31 | common/flatpak-utils.c \ 32 | common/flatpak-utils.h \ 33 | common/flatpak-chain-input-stream.c \ 34 | common/flatpak-chain-input-stream.h \ 35 | common/gvdb/gvdb-reader.h \ 36 | common/gvdb/gvdb-format.h \ 37 | common/gvdb/gvdb-reader.c \ 38 | common/gvdb/gvdb-builder.h \ 39 | common/gvdb/gvdb-builder.c \ 40 | common/flatpak-db.c \ 41 | common/flatpak-db.h \ 42 | $(dbus_built_sources) \ 43 | $(systemd_dbus_built_sources) \ 44 | $(NULL) 45 | 46 | libflatpak_common_la_CFLAGS = \ 47 | $(AM_CFLAGS) \ 48 | $(BASE_CFLAGS) \ 49 | $(HIDDEN_VISIBILITY_CFLAGS) \ 50 | $(OSTREE_CFLAGS) \ 51 | $(SOUP_CFLAGS) \ 52 | $(XAUTH_CFLAGS) \ 53 | $(LIBSECCOMP_CFLAGS) \ 54 | -I$(srcdir)/dbus-proxy \ 55 | $(NULL) 56 | libflatpak_common_la_LIBADD = libglnx.la $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(XAUTH_LIBS) $(LIBSECCOMP_LIBS) 57 | -------------------------------------------------------------------------------- /common/flatpak-chain-input-stream.h: -------------------------------------------------------------------------------- 1 | /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- 2 | * 3 | * Copyright (C) 2011 Colin Walters 4 | * 5 | * This library is free software; you can redistribute it and/or 6 | * modify it under the terms of the GNU Lesser General Public 7 | * License as published by the Free Software Foundation; either 8 | * version 2 of the License, or (at your option) any later version. 9 | * 10 | * This library is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General 16 | * Public License along with this library; if not, write to the 17 | * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 18 | * Boston, MA 02111-1307, USA. 19 | * 20 | */ 21 | 22 | #pragma once 23 | 24 | #ifndef __GI_SCANNER__ 25 | 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | 30 | #define FLATPAK_TYPE_CHAIN_INPUT_STREAM (flatpak_chain_input_stream_get_type ()) 31 | #define FLATPAK_CHAIN_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStream)) 32 | #define FLATPAK_CHAIN_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStreamClass)) 33 | #define FLATPAK_IS_CHAIN_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM)) 34 | #define FLATPAK_IS_CHAIN_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), FLATPAK_TYPE_CHAIN_INPUT_STREAM)) 35 | #define FLATPAK_CHAIN_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStreamClass)) 36 | 37 | typedef struct _FlatpakChainInputStream FlatpakChainInputStream; 38 | typedef struct _FlatpakChainInputStreamClass FlatpakChainInputStreamClass; 39 | typedef struct _FlatpakChainInputStreamPrivate FlatpakChainInputStreamPrivate; 40 | 41 | struct _FlatpakChainInputStream 42 | { 43 | GInputStream parent_instance; 44 | 45 | /*< private >*/ 46 | FlatpakChainInputStreamPrivate *priv; 47 | }; 48 | 49 | struct _FlatpakChainInputStreamClass 50 | { 51 | GInputStreamClass parent_class; 52 | 53 | /*< private >*/ 54 | /* Padding for future expansion */ 55 | void (*_g_reserved1) (void); 56 | void (*_g_reserved2) (void); 57 | void (*_g_reserved3) (void); 58 | void (*_g_reserved4) (void); 59 | void (*_g_reserved5) (void); 60 | }; 61 | 62 | GType flatpak_chain_input_stream_get_type (void) G_GNUC_CONST; 63 | 64 | FlatpakChainInputStream * flatpak_chain_input_stream_new (GPtrArray *streams); 65 | 66 | G_END_DECLS 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /common/flatpak-common-types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __FLATPAK_COMMON_TYPES_H__ 22 | #define __FLATPAK_COMMON_TYPES_H__ 23 | 24 | typedef struct FlatpakDir FlatpakDir; 25 | typedef struct FlatpakDeploy FlatpakDeploy; 26 | typedef struct FlatpakContext FlatpakContext; 27 | 28 | #endif /* __FLATPAK_COMMON_TYPES_H__ */ 29 | -------------------------------------------------------------------------------- /common/flatpak-portal-error.c: -------------------------------------------------------------------------------- 1 | /* flatpak-error.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This file is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This file is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #include "config.h" 23 | 24 | #include "flatpak-portal-error.h" 25 | 26 | #include 27 | 28 | static const GDBusErrorEntry flatpak_error_entries[] = { 29 | {FLATPAK_PORTAL_ERROR_FAILED, "org.freedesktop.portal.Error.Failed"}, 30 | {FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT, "org.freedesktop.portal.Error.InvalidArgument"}, 31 | {FLATPAK_PORTAL_ERROR_NOT_FOUND, "org.freedesktop.portal.Error.NotFound"}, 32 | {FLATPAK_PORTAL_ERROR_EXISTS, "org.freedesktop.portal.Error.Exists"}, 33 | {FLATPAK_PORTAL_ERROR_NOT_ALLOWED, "org.freedesktop.portal.Error.NotAllowed"}, 34 | {FLATPAK_PORTAL_ERROR_CANCELLED, "org.freedesktop.portal.Error.Cancelled"}, 35 | {FLATPAK_PORTAL_ERROR_WINDOW_DESTROYED, "org.freedesktop.portal.Error.WindowDestroyed"}, 36 | }; 37 | 38 | GQuark 39 | flatpak_portal_error_quark (void) 40 | { 41 | static volatile gsize quark_volatile = 0; 42 | 43 | g_dbus_error_register_error_domain ("flatpak-portal-error-quark", 44 | &quark_volatile, 45 | flatpak_error_entries, 46 | G_N_ELEMENTS (flatpak_error_entries)); 47 | return (GQuark) quark_volatile; 48 | } 49 | -------------------------------------------------------------------------------- /common/flatpak-portal-error.h: -------------------------------------------------------------------------------- 1 | /* flatpak-portal-error.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This file is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This file is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #ifndef FLATPAK_PORTAL_ERROR_H 23 | #define FLATPAK_PORTAL_ERROR_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | /** 30 | * XdpErrorEnum: 31 | */ 32 | typedef enum { 33 | FLATPAK_PORTAL_ERROR_FAILED = 0, 34 | FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT, 35 | FLATPAK_PORTAL_ERROR_NOT_FOUND, 36 | FLATPAK_PORTAL_ERROR_EXISTS, 37 | FLATPAK_PORTAL_ERROR_NOT_ALLOWED, 38 | FLATPAK_PORTAL_ERROR_CANCELLED, 39 | FLATPAK_PORTAL_ERROR_WINDOW_DESTROYED, 40 | } FlatpakErrorEnum; 41 | 42 | 43 | #define FLATPAK_PORTAL_ERROR flatpak_portal_error_quark () 44 | 45 | FLATPAK_EXTERN GQuark flatpak_portal_error_quark (void); 46 | 47 | G_END_DECLS 48 | 49 | #endif /* FLATPAK_PORTAL_ERROR_H */ 50 | -------------------------------------------------------------------------------- /common/gvdb/.gitignore: -------------------------------------------------------------------------------- 1 | libgvdb.a 2 | libgvdb-shared.a 3 | -------------------------------------------------------------------------------- /common/gvdb/README: -------------------------------------------------------------------------------- 1 | DO NOT MODIFY ANY FILE IN THIS DIRECTORY 2 | 3 | (except maybe the Makefile.am) 4 | 5 | This directory is the result of a git subtree merge with the 'gvdb' 6 | module on git.gnome.org. Please apply fixes to the 'gvdb' module and 7 | perform a git merge. 8 | -------------------------------------------------------------------------------- /common/gvdb/gvdb-builder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2010 Codethink Limited 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the licence, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, see . 16 | * 17 | * Author: Ryan Lortie 18 | */ 19 | 20 | #ifndef __gvdb_builder_h__ 21 | #define __gvdb_builder_h__ 22 | 23 | #include 24 | 25 | typedef struct _GvdbItem GvdbItem; 26 | 27 | G_GNUC_INTERNAL 28 | GHashTable * gvdb_hash_table_new (GHashTable *parent, 29 | const gchar *key); 30 | 31 | G_GNUC_INTERNAL 32 | GvdbItem * gvdb_hash_table_insert (GHashTable *table, 33 | const gchar *key); 34 | G_GNUC_INTERNAL 35 | void gvdb_hash_table_insert_string (GHashTable *table, 36 | const gchar *key, 37 | const gchar *value); 38 | 39 | G_GNUC_INTERNAL 40 | void gvdb_item_set_value (GvdbItem *item, 41 | GVariant *value); 42 | G_GNUC_INTERNAL 43 | void gvdb_item_set_hash_table (GvdbItem *item, 44 | GHashTable *table); 45 | G_GNUC_INTERNAL 46 | void gvdb_item_set_parent (GvdbItem *item, 47 | GvdbItem *parent); 48 | 49 | G_GNUC_INTERNAL 50 | gboolean gvdb_table_write_contents (GHashTable *table, 51 | const gchar *filename, 52 | gboolean byteswap, 53 | GError **error); 54 | 55 | G_GNUC_INTERNAL 56 | GBytes * gvdb_table_get_content (GHashTable *table, 57 | gboolean byteswap); 58 | 59 | 60 | #endif /* __gvdb_builder_h__ */ 61 | -------------------------------------------------------------------------------- /common/gvdb/gvdb-format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2010 Codethink Limited 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the licence, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, see . 16 | * 17 | * Author: Ryan Lortie 18 | */ 19 | 20 | #ifndef __gvdb_format_h__ 21 | #define __gvdb_format_h__ 22 | 23 | #include 24 | 25 | typedef struct { guint16 value; } guint16_le; 26 | typedef struct { guint32 value; } guint32_le; 27 | 28 | struct gvdb_pointer { 29 | guint32_le start; 30 | guint32_le end; 31 | }; 32 | 33 | struct gvdb_hash_header { 34 | guint32_le n_bloom_words; 35 | guint32_le n_buckets; 36 | }; 37 | 38 | struct gvdb_hash_item { 39 | guint32_le hash_value; 40 | guint32_le parent; 41 | 42 | guint32_le key_start; 43 | guint16_le key_size; 44 | gchar type; 45 | gchar unused; 46 | 47 | union 48 | { 49 | struct gvdb_pointer pointer; 50 | gchar direct[8]; 51 | } value; 52 | }; 53 | 54 | struct gvdb_header { 55 | guint32 signature[2]; 56 | guint32_le version; 57 | guint32_le options; 58 | 59 | struct gvdb_pointer root; 60 | }; 61 | 62 | static inline guint32_le guint32_to_le (guint32 value) { 63 | guint32_le result = { GUINT32_TO_LE (value) }; 64 | return result; 65 | } 66 | 67 | static inline guint32 guint32_from_le (guint32_le value) { 68 | return GUINT32_FROM_LE (value.value); 69 | } 70 | 71 | static inline guint16_le guint16_to_le (guint16 value) { 72 | guint16_le result = { GUINT16_TO_LE (value) }; 73 | return result; 74 | } 75 | 76 | static inline guint16 guint16_from_le (guint16_le value) { 77 | return GUINT16_FROM_LE (value.value); 78 | } 79 | 80 | #define GVDB_SIGNATURE0 1918981703 81 | #define GVDB_SIGNATURE1 1953390953 82 | #define GVDB_SWAPPED_SIGNATURE0 GUINT32_SWAP_LE_BE (GVDB_SIGNATURE0) 83 | #define GVDB_SWAPPED_SIGNATURE1 GUINT32_SWAP_LE_BE (GVDB_SIGNATURE1) 84 | 85 | #endif /* __gvdb_format_h__ */ 86 | -------------------------------------------------------------------------------- /common/gvdb/gvdb-reader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2010 Codethink Limited 3 | * 4 | * This library is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the licence, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library; if not, see . 16 | * 17 | * Author: Ryan Lortie 18 | */ 19 | 20 | #ifndef __gvdb_reader_h__ 21 | #define __gvdb_reader_h__ 22 | 23 | #include 24 | 25 | typedef struct _GvdbTable GvdbTable; 26 | 27 | G_BEGIN_DECLS 28 | 29 | G_GNUC_INTERNAL 30 | GvdbTable * gvdb_table_new_from_bytes (GBytes *bytes, 31 | gboolean trusted, 32 | GError **error); 33 | G_GNUC_INTERNAL 34 | GvdbTable * gvdb_table_new (const gchar *filename, 35 | gboolean trusted, 36 | GError **error); 37 | G_GNUC_INTERNAL 38 | void gvdb_table_free (GvdbTable *table); 39 | G_GNUC_INTERNAL 40 | gchar ** gvdb_table_get_names (GvdbTable *table, 41 | gint *length); 42 | G_GNUC_INTERNAL 43 | gchar ** gvdb_table_list (GvdbTable *table, 44 | const gchar *key); 45 | G_GNUC_INTERNAL 46 | GvdbTable * gvdb_table_get_table (GvdbTable *table, 47 | const gchar *key); 48 | G_GNUC_INTERNAL 49 | GVariant * gvdb_table_get_raw_value (GvdbTable *table, 50 | const gchar *key); 51 | G_GNUC_INTERNAL 52 | GVariant * gvdb_table_get_value (GvdbTable *table, 53 | const gchar *key); 54 | 55 | G_GNUC_INTERNAL 56 | gboolean gvdb_table_has_value (GvdbTable *table, 57 | const gchar *key); 58 | G_GNUC_INTERNAL 59 | gboolean gvdb_table_is_valid (GvdbTable *table); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __gvdb_reader_h__ */ 64 | -------------------------------------------------------------------------------- /common/gvdb/gvdb.doap: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | gvdb 9 | GVariant Database file 10 | 11 | A simple database file format that stores a mapping from strings to 12 | GVariant values in a way that is extremely efficient for lookups. 13 | 14 | The database is written once and can not be modified. 15 | 16 | Included here is reader code and a first-pass implementation of a 17 | writer (that does not currently produce particularly optimised 18 | output). 19 | 20 | It is intended that this code be used by copy-pasting into your 21 | project or by making use of git-merge(1). 22 | 23 | 24 | 25 | 26 | Ryan Lortie 27 | 28 | ryanl 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /data/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | introspectiondir = $(datadir)/dbus-1/interfaces 2 | introspection_DATA = \ 3 | data/org.freedesktop.impl.portal.PermissionStore.xml \ 4 | data/org.freedesktop.portal.Documents.xml \ 5 | data/org.freedesktop.Flatpak.xml \ 6 | $(NULL) 7 | 8 | EXTRA_DIST += \ 9 | data/org.freedesktop.portal.Documents.xml \ 10 | data/org.freedesktop.impl.portal.PermissionStore.xml \ 11 | data/org.freedesktop.systemd1.xml \ 12 | data/org.freedesktop.Flatpak.xml \ 13 | $(NULL) 14 | -------------------------------------------------------------------------------- /data/org.freedesktop.Flatpak.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /data/org.freedesktop.impl.portal.PermissionStore.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /data/org.freedesktop.portal.Documents.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /data/org.freedesktop.systemd1.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /dbus-proxy/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | libexec_PROGRAMS += \ 2 | flatpak-dbus-proxy \ 3 | $(NULL) 4 | 5 | flatpak_dbus_proxy_SOURCES = \ 6 | dbus-proxy/flatpak-proxy.c \ 7 | dbus-proxy/flatpak-proxy.h \ 8 | dbus-proxy/dbus-proxy.c \ 9 | $(NULL) 10 | 11 | flatpak_dbus_proxy_LDADD = $(BASE_LIBS) libglnx.la 12 | flatpak_dbus_proxy_CFLAGS = $(BASE_CFLAGS) -I$(srcdir)/dbus-proxy 13 | -------------------------------------------------------------------------------- /dbus-proxy/flatpak-proxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __FLATPAK_PROXY_H__ 22 | #define __FLATPAK_PROXY_H__ 23 | 24 | #include 25 | #include "libglnx/libglnx.h" 26 | 27 | typedef enum { 28 | FLATPAK_POLICY_NONE, 29 | FLATPAK_POLICY_SEE, 30 | FLATPAK_POLICY_TALK, 31 | FLATPAK_POLICY_OWN 32 | } FlatpakPolicy; 33 | 34 | typedef struct FlatpakProxy FlatpakProxy; 35 | 36 | #define FLATPAK_TYPE_PROXY flatpak_proxy_get_type () 37 | #define FLATPAK_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY, FlatpakProxy)) 38 | #define FLATPAK_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY)) 39 | 40 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakProxy, g_object_unref) 41 | 42 | GType flatpak_proxy_get_type (void); 43 | 44 | FlatpakProxy *flatpak_proxy_new (const char *dbus_address, 45 | const char *socket_path); 46 | void flatpak_proxy_set_log_messages (FlatpakProxy *proxy, 47 | gboolean log); 48 | void flatpak_proxy_set_filter (FlatpakProxy *proxy, 49 | gboolean filter); 50 | void flatpak_proxy_add_policy (FlatpakProxy *proxy, 51 | const char *name, 52 | FlatpakPolicy policy); 53 | void flatpak_proxy_add_wildcarded_policy (FlatpakProxy *proxy, 54 | const char *name, 55 | FlatpakPolicy policy); 56 | gboolean flatpak_proxy_start (FlatpakProxy *proxy, 57 | GError **error); 58 | void flatpak_proxy_stop (FlatpakProxy *proxy); 59 | 60 | #endif /* __FLATPAK_PROXY_H__ */ 61 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | NULL = 2 | 3 | SUBDIRS = reference 4 | 5 | XSLTPROC_FLAGS = \ 6 | --nonet \ 7 | --stringparam man.output.quietly 1 \ 8 | --stringparam funcsynopsis.style ansi \ 9 | --stringparam man.th.extra1.suppress 1 \ 10 | --stringparam man.authors.section.enabled 0 \ 11 | --stringparam man.copyright.section.enabled 0 \ 12 | $(NULL) 13 | 14 | .xml.1: 15 | $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< 16 | 17 | man_MANS = \ 18 | flatpak.1 \ 19 | flatpak-remote-add.1 \ 20 | flatpak-remote-delete.1 \ 21 | flatpak-remote-list.1 \ 22 | flatpak-remote-modify.1 \ 23 | flatpak-remote-ls.1 \ 24 | flatpak-install.1 \ 25 | flatpak-update.1 \ 26 | flatpak-uninstall.1 \ 27 | flatpak-list.1 \ 28 | flatpak-info.1 \ 29 | flatpak-make-current.1 \ 30 | flatpak-run.1 \ 31 | flatpak-override.1 \ 32 | flatpak-enter.1 \ 33 | flatpak-export-file.1 \ 34 | flatpak-build-init.1 \ 35 | flatpak-build.1 \ 36 | flatpak-build-bundle.1 \ 37 | flatpak-build-import-bundle.1 \ 38 | flatpak-build-finish.1 \ 39 | flatpak-build-export.1 \ 40 | flatpak-build-update-repo.1 \ 41 | flatpak-build-sign.1 \ 42 | flatpak-builder.1 \ 43 | $(NULL) 44 | 45 | xml_files = $(man_MANS:.1=.xml) 46 | 47 | EXTRA_DIST = $(xml_files) 48 | 49 | DISTCLEANFILES = $(man_MANS) 50 | -------------------------------------------------------------------------------- /doc/flatpak-build-import-bundle.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | flatpak build-import-bundle 9 | flatpak 10 | 11 | 12 | 13 | Developer 14 | Alexander 15 | Larsson 16 | alexl@redhat.com 17 | 18 | 19 | 20 | 21 | 22 | flatpak build-import-bundle 23 | 1 24 | 25 | 26 | 27 | flatpak-build-import-bundle 28 | Import a file bundle into a local repository 29 | 30 | 31 | 32 | 33 | flatpak build-import-bundle 34 | OPTION 35 | LOCATION 36 | FILENAME 37 | 38 | 39 | 40 | 41 | Description 42 | 43 | 44 | Imports a bundle from a file named FILENAME 45 | into the repository at LOCATION. 46 | 47 | 48 | The format of the bundle file is that generated by build-bundle. 49 | 50 | 51 | 52 | 53 | Options 54 | 55 | The following options are understood: 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Show help options and exit. 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | Print debug information during command processing. 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Override the ref specified in the bundle. 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Print version information and exit. 89 | 90 | 91 | 92 | 93 | 94 | 95 | See also 96 | 97 | 98 | ostree1, 99 | flatpak1, 100 | flatpak-build-bundle1, 101 | flatpak-repo-update1 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /doc/flatpak-enter.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | flatpak enter 9 | flatpak 10 | 11 | 12 | 13 | Developer 14 | Alexander 15 | Larsson 16 | alexl@redhat.com 17 | 18 | 19 | 20 | 21 | 22 | flatpak enter 23 | 1 24 | 25 | 26 | 27 | flatpak-enter 28 | Enter an application 29 | 30 | 31 | 32 | 33 | flatpak enter 34 | OPTION 35 | MONITORPID 36 | COMMAND 37 | ARG 38 | 39 | 40 | 41 | 42 | Description 43 | 44 | 45 | Enter a running sandbox. 46 | MONITORPID must be the pid of the monitor process for a running sandbox. 47 | COMMAND is the command to run in the sandbox. 48 | Extra arguments are passed on to the command. 49 | 50 | 51 | This creates a new process within the running sandbox, with the same environment. This is useful 52 | when you want to debug a problem with a running application. 53 | 54 | 55 | 56 | 57 | 58 | Options 59 | 60 | The following options are understood: 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Show help options and exit. 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | Print debug information during command processing. 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Print version information and exit. 86 | 87 | 88 | 89 | 90 | 91 | 92 | Examples 93 | 94 | 95 | $ flatpak enter 15345 sh 96 | 97 | 98 | 99 | 100 | 101 | See also 102 | 103 | 104 | flatpak1 105 | flatpak-run1 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /doc/flatpak-make-current.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | flatpak make-current 9 | flatpak 10 | 11 | 12 | 13 | Developer 14 | Alexander 15 | Larsson 16 | alexl@redhat.com 17 | 18 | 19 | 20 | 21 | 22 | flatpak make-current 23 | 1 24 | 25 | 26 | 27 | flatpak-make-current 28 | Make a specific version of an app current 29 | 30 | 31 | 32 | 33 | flatpak make-current 34 | OPTION 35 | APP 36 | BRANCH 37 | 38 | 39 | 40 | 41 | Description 42 | 43 | 44 | Makes a particular branch of an application current. Only the current branch 45 | of an app has its exported files (such as desktop files and icons) made visible 46 | to the host. 47 | 48 | 49 | When a new branch is installed it will automatically be made current, so this 50 | command is often not needed. 51 | 52 | 53 | Unless overridden with the --user option, this command creates a 54 | system-wide installation. 55 | 56 | 57 | 58 | 59 | 60 | Options 61 | 62 | The following options are understood: 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | Show help options and exit. 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Create a per-user installation. 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | Create a system-wide installation. 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | The architecture to install for. 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | Print debug information during command processing. 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | Print version information and exit. 112 | 113 | 114 | 115 | 116 | 117 | 118 | Examples 119 | 120 | 121 | $ flatpak --user make-current org.gnome.GEdit 3.14 122 | 123 | 124 | 125 | 126 | 127 | See also 128 | 129 | 130 | flatpak1, 131 | flatpak-install-app1, 132 | flatpak-list-apps1 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /doc/flatpak-remote-delete.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | flatpak remote-delete 9 | flatpak 10 | 11 | 12 | 13 | Developer 14 | Alexander 15 | Larsson 16 | alexl@redhat.com 17 | 18 | 19 | 20 | 21 | 22 | flatpak remote-delete 23 | 1 24 | 25 | 26 | 27 | flatpak-remote-delete 28 | Delete a remote repository 29 | 30 | 31 | 32 | 33 | flatpak remote-delete 34 | OPTION 35 | NAME 36 | 37 | 38 | 39 | 40 | Description 41 | 42 | 43 | Removes a remote repository from the flatpak repository configuration. 44 | NAME is the name of an existing remote. 45 | 46 | 47 | Unless overridden with the --user option, this command changes 48 | the system-wide configuration. 49 | 50 | 51 | 52 | 53 | 54 | Options 55 | 56 | The following options are understood: 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | Show help options and exit. 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | Modify the per-user configuration. 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Modify the system-wide configuration. 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Remove remote even if its in use by installed apps or runtimes. 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Print debug information during command processing. 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | Print version information and exit. 106 | 107 | 108 | 109 | 110 | 111 | 112 | Examples 113 | 114 | 115 | $ flatpak --user remote-delete dried-raisins 116 | 117 | 118 | 119 | 120 | See also 121 | 122 | 123 | flatpak1, 124 | flatpak-add-remote1, 125 | flatpak-modify-remote1, 126 | flatpak-list-remotes1 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /doc/flatpak-remote-list.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | flatpak remote-list 9 | flatpak 10 | 11 | 12 | 13 | Developer 14 | Alexander 15 | Larsson 16 | alexl@redhat.com 17 | 18 | 19 | 20 | 21 | 22 | flatpak remote-list 23 | 1 24 | 25 | 26 | 27 | flatpak-remote-list 28 | List remote repositories 29 | 30 | 31 | 32 | 33 | flatpak remote-list 34 | OPTION 35 | 36 | 37 | 38 | 39 | Description 40 | 41 | 42 | Lists the known remote repositories, in priority order. 43 | 44 | 45 | By default, both per-user and system-wide installations 46 | are shown. Use the --user or --system options to change 47 | this. 48 | 49 | 50 | 51 | 52 | 53 | Options 54 | 55 | The following options are understood: 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | Show help options and exit. 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | Show the per-user configuration. 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Show the system-wide configuration. 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | Show more information each repository in addition to the name. 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | Show disabled repos. 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | Print debug information during command processing. 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | Print version information and exit. 113 | 114 | 115 | 116 | 117 | 118 | 119 | Examples 120 | 121 | 122 | $ flatpak remote-list --user --show-details 123 | 124 | 125 | testrepo Test Repository http://209.132.179.91/repo/ no-gpg-verify 126 | 127 | 128 | 129 | 130 | See also 131 | 132 | 133 | flatpak1, 134 | flatpak-add-remote1, 135 | flatpak-delete-remote1 136 | 137 | 138 | 139 | 140 | -------------------------------------------------------------------------------- /doc/flatpak-remote-ls.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | flatpak remote-ls 9 | flatpak 10 | 11 | 12 | 13 | Developer 14 | Alexander 15 | Larsson 16 | alexl@redhat.com 17 | 18 | 19 | 20 | 21 | 22 | flatpak remote-ls 23 | 1 24 | 25 | 26 | 27 | flatpak-remote-ls 28 | Show available runtimes and applications 29 | 30 | 31 | 32 | 33 | flatpak remote-ls 34 | OPTION 35 | REMOTE 36 | 37 | 38 | 39 | 40 | Description 41 | 42 | 43 | Shows runtimes and applications that are available in the 44 | remote repository with the name REMOTE. 45 | You can find all configured remote repositories with flatpak list-repos. 46 | 47 | 48 | Unless overridden with the --user option, this command uses 49 | the system-wide configuration. 50 | 51 | 52 | 53 | 54 | 55 | Options 56 | 57 | The following options are understood: 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | Show help options and exit. 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Use the per-user configuration. 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Use the system-wide configuration. 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | Show arches, branches and commit ids, in addition to the names. 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | Show only runtimes, omit applications. 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | Show only applications, omit runtimes. 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | Show only those which have updates available. 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | Print debug information during command processing. 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | Print version information and exit. 132 | 133 | 134 | 135 | 136 | 137 | 138 | Examples 139 | 140 | 141 | $ flatpak --user remote-ls --only-apps testrepo 142 | 143 | 144 | org.gnome.Builder 145 | org.freedesktop.glxgears 146 | 147 | 148 | 149 | 150 | 151 | -------------------------------------------------------------------------------- /doc/reference/.gitignore: -------------------------------------------------------------------------------- 1 | html/ 2 | xml/ 3 | *.stamp 4 | *.bak 5 | flatpak-decl-list.txt 6 | flatpak-decl.txt 7 | flatpak-overrides.txt 8 | flatpak-undeclared.txt 9 | flatpak-undocumented.txt 10 | flatpak-unused.txt 11 | flatpak.args 12 | flatpak.hierarchy 13 | flatpak.interfaces 14 | flatpak.prerequisites 15 | flatpak.signals 16 | flatpak.types 17 | -------------------------------------------------------------------------------- /doc/reference/Makefile.am: -------------------------------------------------------------------------------- 1 | DOC_MODULE = flatpak 2 | DOC_MAIN_SGML_FILE = flatpak-docs.xml 3 | DOC_SOURCE_DIR = $(top_srcdir)/lib $(top_builddir)/lib 4 | 5 | SCAN_OPTIONS = --rebuild-types \ 6 | --ignore-decorators='FLATPAK_EXTERN' 7 | SCANGOBJ_OPTIONS = 8 | MKDB_OPTIONS = --output-format=xml --name-space=flatpak 9 | FIXXREF_OPTIONS = 10 | 11 | HFILE_GLOB = $(top_srcdir)/lib/*.h $(top_builddir)/lib/*.h 12 | CFILE_GLOB = $(top_srcdir)/lib/*.c 13 | 14 | IGNORE_HFILES = \ 15 | flatpak-enum-types.h \ 16 | flatpak-installed-ref-private.h \ 17 | flatpak-remote-ref-private.h \ 18 | flatpak-remote-private.h 19 | 20 | EXTRA_HFILES = 21 | 22 | HTML_IMAGES = 23 | 24 | content_files = 25 | expand_content_files = 26 | 27 | AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_builddir)/lib $(BASE_CFLAGS) 28 | GTKDOC_LIBS = $(top_builddir)/libflatpak.la $(BASE_LIBS) 29 | 30 | include $(top_srcdir)/gtk-doc.make 31 | 32 | EXTRA_DIST += version.xml.in 33 | 34 | if ENABLE_GTK_DOC_CHECK 35 | TESTS_ENVIRONMENT = \ 36 | DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \ 37 | SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir) 38 | TESTS = $(GTKDOC_CHECK) 39 | endif 40 | -------------------------------------------------------------------------------- /doc/reference/flatpak-docs.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | ]> 8 | 9 | 10 | Flatpak Library Reference Manual 11 | 12 | For flatpak &version; 13 | 14 | 15 | 16 | 17 | Flatpak 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Object Hierarchy 30 | 31 | 32 | 33 | 34 | API Index 35 | 36 | 37 | 38 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /doc/reference/flatpak-sections.txt: -------------------------------------------------------------------------------- 1 |
2 | flatpak-installation 3 | FlatpakInstallation 4 | FlatpakInstallation 5 | flatpak_installation_new_system 6 | flatpak_installation_new_user 7 | flatpak_installation_new_for_path 8 | flatpak_installation_get_is_user 9 | flatpak_installation_get_path 10 | flatpak_installation_create_monitor 11 | flatpak_installation_install 12 | flatpak_installation_update 13 | flatpak_installation_uninstall 14 | flatpak_installation_launch 15 | flatpak_installation_get_current_installed_app 16 | flatpak_installation_get_installed_ref 17 | flatpak_installation_list_installed_refs 18 | flatpak_installation_list_installed_refs_by_kind 19 | flatpak_installation_list_installed_refs_for_update 20 | flatpak_installation_list_remote_refs_sync 21 | flatpak_installation_list_remotes 22 | flatpak_installation_get_remote_by_name 23 | flatpak_installation_fetch_remote_metadata_sync 24 | flatpak_installation_fetch_remote_ref_sync 25 | flatpak_installation_fetch_remote_size_sync 26 | flatpak_installation_load_app_overrides 27 | flatpak_installation_update_appstream_sync 28 | flatpak_installation_install_bundle 29 | flatpak_installation_drop_caches 30 | flatpak_installation_modify_remote 31 | flatpak_installation_remove_remote 32 | flatpak_get_default_arch 33 | FlatpakProgressCallback 34 | FlatpakUpdateFlags 35 | 36 | FLATPAK_INSTALLATION 37 | FLATPAK_IS_INSTALLATION 38 | FLATPAK_TYPE_INSTALLATION 39 | FlatpakInstallationClass 40 | flatpak_installation_get_type 41 |
42 | 43 |
44 | flatpak-installed-ref 45 | FlatpakInstalledRef 46 | FlatpakInstalledRef 47 | flatpak_installed_ref_get_deploy_dir 48 | flatpak_installed_ref_get_installed_size 49 | flatpak_installed_ref_get_is_current 50 | flatpak_installed_ref_get_latest_commit 51 | flatpak_installed_ref_get_origin 52 | flatpak_installed_ref_load_metadata 53 | flatpak_installed_ref_get_subpaths 54 | 55 | FlatpakInstalledRefClass 56 | FLATPAK_INSTALLED_REF 57 | FLATPAK_IS_INSTALLED_REF 58 | FLATPAK_TYPE_INSTALLED_REF 59 | flatpak_installed_ref_get_type 60 |
61 | 62 |
63 | flatpak-remote-ref 64 | FlatpakRemoteRef 65 | FlatpakRemoteRef 66 | flatpak_remote_ref_get_remote_name 67 | 68 | FLATPAK_IS_REMOTE_REF 69 | FLATPAK_REMOTE_REF 70 | FLATPAK_TYPE_REMOTE_REF 71 | FlatpakRemoteRefClass 72 | flatpak_remote_ref_get_type 73 |
74 | 75 |
76 | flatpak-ref 77 | FlatpakRef 78 | FlatpakRef 79 | FlatpakRefKind 80 | flatpak_ref_format_ref 81 | flatpak_ref_get_arch 82 | flatpak_ref_get_branch 83 | flatpak_ref_get_commit 84 | flatpak_ref_get_kind 85 | flatpak_ref_get_name 86 | flatpak_ref_parse 87 | 88 | FlatpakRefClass 89 | FLATPAK_IS_REF 90 | FLATPAK_REF 91 | FLATPAK_TYPE_REF 92 | flatpak_ref_get_type 93 |
94 | 95 |
96 | flatpak-remote 97 | FlatpakRemote 98 | FlatpakRemote 99 | flatpak_remote_new 100 | flatpak_remote_get_name 101 | flatpak_remote_get_appstream_dir 102 | flatpak_remote_get_appstream_timestamp 103 | flatpak_remote_get_gpg_verify 104 | flatpak_remote_set_gpg_verify 105 | flatpak_remote_set_gpg_key 106 | flatpak_remote_get_noenumerate 107 | flatpak_remote_set_noenumerate 108 | flatpak_remote_get_prio 109 | flatpak_remote_set_prio 110 | flatpak_remote_get_title 111 | flatpak_remote_set_title 112 | flatpak_remote_get_url 113 | flatpak_remote_set_url 114 | flatpak_remote_get_disabled 115 | flatpak_remote_set_disabled 116 | 117 | FlatpakRemoteClass 118 | FLATPAK_IS_REMOTE 119 | FLATPAK_REMOTE 120 | FLATPAK_TYPE_REMOTE 121 | flatpak_remote_get_type 122 |
123 | 124 |
125 | flatpak-version-macros 126 | FLATPAK_MAJOR_VERSION 127 | FLATPAK_MINOR_VERSION 128 | FLATPAK_MICRO_VERSION 129 | FLATPAK_EXTERN 130 |
131 | 132 |
133 | flatpak-error 134 | FLATPAK_ERROR 135 | FlatpakError 136 | flatpak_error_quark 137 |
138 | 139 |
140 | flatpak-bundle-ref 141 | FlatpakBundleRef 142 | flatpak_bundle_ref_new 143 | flatpak_bundle_ref_get_file 144 | flatpak_bundle_ref_get_metadata 145 | flatpak_bundle_ref_get_appstream 146 | flatpak_bundle_ref_get_icon 147 | flatpak_bundle_ref_get_origin 148 | flatpak_bundle_ref_get_installed_size 149 | 150 | FlatpakBundleRefClass 151 | FLATPAK_TYPE_BUNDLE_REF 152 | FLATPAK_BUNDLE_REF 153 | FLATPAK_IS_BUNDLE_REF 154 | flatpak_bundle_ref_get_type 155 |
156 | -------------------------------------------------------------------------------- /doc/reference/version.xml.in: -------------------------------------------------------------------------------- 1 | @FLATPAK_MAJOR_VERSION@.@FLATPAK_MINOR_VERSION@.@FLATPAK_MICRO_VERSION@ 2 | -------------------------------------------------------------------------------- /document-portal/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | libexec_PROGRAMS += \ 2 | xdg-document-portal \ 3 | $(NULL) 4 | 5 | xdp_dbus_built_sources = document-portal/xdp-dbus.c document-portal/xdp-dbus.h 6 | BUILT_SOURCES += $(xdp_dbus_built_sources) 7 | 8 | $(xdp_dbus_built_sources) : data/org.freedesktop.portal.Documents.xml 9 | $(AM_V_GEN) $(GDBUS_CODEGEN) \ 10 | --interface-prefix org.freedesktop.portal. \ 11 | --c-namespace XdpDbus \ 12 | --generate-c-code $(builddir)/document-portal/xdp-dbus \ 13 | $(srcdir)/data/org.freedesktop.portal.Documents.xml \ 14 | $(NULL) 15 | 16 | service_in_files += document-portal/xdg-document-portal.service.in 17 | systemduserunit_DATA += document-portal/xdg-document-portal.service 18 | 19 | service_in_files += document-portal/org.freedesktop.portal.Documents.service.in 20 | dbus_service_DATA += document-portal/org.freedesktop.portal.Documents.service 21 | 22 | xdg_document_portal_SOURCES = \ 23 | document-portal/xdp-main.c \ 24 | document-portal/xdp-enums.h \ 25 | $(xdp_dbus_built_sources) \ 26 | $(ps_dbus_built_sources) \ 27 | document-portal/xdp-util.h \ 28 | document-portal/xdp-util.c \ 29 | document-portal/xdp-fuse.h \ 30 | document-portal/xdp-fuse.c \ 31 | $(NULL) 32 | 33 | xdg_document_portal_LDADD = $(BASE_LIBS) $(FUSE_LIBS) libflatpak-common.la 34 | xdg_document_portal_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(SOUP_CFLAGS) $(FUSE_CFLAGS) -I$(srcdir)/document-portal -I$(builddir)/document-portal -I$(srcdir)/permission-store -I$(builddir)/permission-store 35 | -------------------------------------------------------------------------------- /document-portal/org.freedesktop.portal.Documents.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.freedesktop.portal.Documents 3 | Exec=@libexecdir@/xdg-document-portal 4 | SystemdService=xdg-document-portal.service 5 | -------------------------------------------------------------------------------- /document-portal/xdg-document-portal.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=flatpak document portal service 3 | 4 | [Service] 5 | BusName=org.freedesktop.portal.Documents 6 | ExecStart=@libexecdir@/xdg-document-portal 7 | Type=dbus 8 | -------------------------------------------------------------------------------- /document-portal/xdp-enums.h: -------------------------------------------------------------------------------- 1 | #ifndef XDP_ENUMS_H 2 | #define XDP_ENUMS_H 3 | 4 | G_BEGIN_DECLS 5 | 6 | typedef enum { 7 | XDP_PERMISSION_FLAGS_READ = (1 << 0), 8 | XDP_PERMISSION_FLAGS_WRITE = (1 << 1), 9 | XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS = (1 << 2), 10 | XDP_PERMISSION_FLAGS_DELETE = (1 << 3), 11 | 12 | XDP_PERMISSION_FLAGS_ALL = ((1 << 4) - 1) 13 | } XdpPermissionFlags; 14 | 15 | G_END_DECLS 16 | 17 | #endif /* XDP_ENUMS_H */ 18 | -------------------------------------------------------------------------------- /document-portal/xdp-fuse.h: -------------------------------------------------------------------------------- 1 | #ifndef XDP_FUSE_H 2 | #define XDP_FUSE_H 3 | 4 | #include 5 | #include "flatpak-db.h" 6 | 7 | G_BEGIN_DECLS 8 | 9 | char ** xdp_list_apps (void); 10 | char ** xdp_list_docs (void); 11 | FlatpakDbEntry *xdp_lookup_doc (const char *doc_id); 12 | 13 | gboolean xdp_fuse_init (GError **error); 14 | void xdp_fuse_exit (void); 15 | const char *xdp_fuse_get_mountpoint (void); 16 | void xdp_fuse_invalidate_doc_app (const char *doc_id, 17 | const char *opt_app_id); 18 | char *xdp_fuse_lookup_id_for_inode (ino_t inode); 19 | 20 | 21 | G_END_DECLS 22 | 23 | #endif /* XDP_FUSE_H */ 24 | -------------------------------------------------------------------------------- /document-portal/xdp-util.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | #include 3 | #include 4 | #include 5 | #include "flatpak-portal-error.h" 6 | #include "xdp-util.h" 7 | 8 | const char ** 9 | xdg_unparse_permissions (XdpPermissionFlags permissions) 10 | { 11 | GPtrArray *array; 12 | 13 | array = g_ptr_array_new (); 14 | 15 | if (permissions & XDP_PERMISSION_FLAGS_READ) 16 | g_ptr_array_add (array, "read"); 17 | if (permissions & XDP_PERMISSION_FLAGS_WRITE) 18 | g_ptr_array_add (array, "write"); 19 | if (permissions & XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS) 20 | g_ptr_array_add (array, "grant-permissions"); 21 | if (permissions & XDP_PERMISSION_FLAGS_DELETE) 22 | g_ptr_array_add (array, "delete"); 23 | 24 | g_ptr_array_add (array, NULL); 25 | return (const char **) g_ptr_array_free (array, FALSE); 26 | } 27 | 28 | XdpPermissionFlags 29 | xdp_parse_permissions (const char **permissions) 30 | { 31 | XdpPermissionFlags perms; 32 | int i; 33 | 34 | perms = 0; 35 | for (i = 0; permissions[i]; i++) 36 | { 37 | if (strcmp (permissions[i], "read") == 0) 38 | perms |= XDP_PERMISSION_FLAGS_READ; 39 | else if (strcmp (permissions[i], "write") == 0) 40 | perms |= XDP_PERMISSION_FLAGS_WRITE; 41 | else if (strcmp (permissions[i], "grant-permissions") == 0) 42 | perms |= XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS; 43 | else if (strcmp (permissions[i], "delete") == 0) 44 | perms |= XDP_PERMISSION_FLAGS_DELETE; 45 | else 46 | g_warning ("No such permission: %s", permissions[i]); 47 | } 48 | 49 | return perms; 50 | } 51 | 52 | XdpPermissionFlags 53 | xdp_entry_get_permissions (FlatpakDbEntry *entry, 54 | const char *app_id) 55 | { 56 | g_autofree const char **permissions = NULL; 57 | 58 | if (strcmp (app_id, "") == 0) 59 | return XDP_PERMISSION_FLAGS_ALL; 60 | 61 | permissions = flatpak_db_entry_list_permissions (entry, app_id); 62 | return xdp_parse_permissions (permissions); 63 | } 64 | 65 | gboolean 66 | xdp_entry_has_permissions (FlatpakDbEntry *entry, 67 | const char *app_id, 68 | XdpPermissionFlags perms) 69 | { 70 | XdpPermissionFlags current_perms; 71 | 72 | current_perms = xdp_entry_get_permissions (entry, app_id); 73 | 74 | return (current_perms & perms) == perms; 75 | } 76 | 77 | char * 78 | xdp_name_from_id (guint32 doc_id) 79 | { 80 | return g_strdup_printf ("%x", doc_id); 81 | } 82 | 83 | const char * 84 | xdp_entry_get_path (FlatpakDbEntry *entry) 85 | { 86 | g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry); 87 | g_autoptr(GVariant) c = g_variant_get_child_value (v, 0); 88 | return g_variant_get_bytestring (c); 89 | } 90 | 91 | char * 92 | xdp_entry_dup_basename (FlatpakDbEntry *entry) 93 | { 94 | const char *path = xdp_entry_get_path (entry); 95 | 96 | return g_path_get_basename (path); 97 | } 98 | 99 | char * 100 | xdp_entry_dup_dirname (FlatpakDbEntry *entry) 101 | { 102 | const char *path = xdp_entry_get_path (entry); 103 | 104 | return g_path_get_dirname (path); 105 | } 106 | 107 | guint64 108 | xdp_entry_get_device (FlatpakDbEntry *entry) 109 | { 110 | g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry); 111 | g_autoptr(GVariant) c = g_variant_get_child_value (v, 1); 112 | return g_variant_get_uint64 (c); 113 | } 114 | 115 | guint64 116 | xdp_entry_get_inode (FlatpakDbEntry *entry) 117 | { 118 | g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry); 119 | g_autoptr(GVariant) c = g_variant_get_child_value (v, 2); 120 | return g_variant_get_uint64 (c); 121 | } 122 | 123 | guint32 124 | xdp_entry_get_flags (FlatpakDbEntry *entry) 125 | { 126 | g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry); 127 | g_autoptr(GVariant) c = g_variant_get_child_value (v, 3); 128 | return g_variant_get_uint32 (c); 129 | } 130 | -------------------------------------------------------------------------------- /document-portal/xdp-util.h: -------------------------------------------------------------------------------- 1 | #ifndef XDP_UTIL_H 2 | #define XDP_UTIL_H 3 | 4 | #include 5 | #include "flatpak-db.h" 6 | #include "xdp-enums.h" 7 | 8 | G_BEGIN_DECLS 9 | 10 | #define XDP_ENTRY_FLAG_UNIQUE (1 << 0) 11 | #define XDP_ENTRY_FLAG_TRANSIENT (1 << 1) 12 | 13 | const char ** xdg_unparse_permissions (XdpPermissionFlags permissions); 14 | XdpPermissionFlags xdp_parse_permissions (const char **permissions); 15 | 16 | XdpPermissionFlags xdp_entry_get_permissions (FlatpakDbEntry *entry, 17 | const char *app_id); 18 | gboolean xdp_entry_has_permissions (FlatpakDbEntry *entry, 19 | const char *app_id, 20 | XdpPermissionFlags perms); 21 | const char * xdp_entry_get_path (FlatpakDbEntry *entry); 22 | char * xdp_entry_dup_basename (FlatpakDbEntry *entry); 23 | char * xdp_entry_dup_dirname (FlatpakDbEntry *entry); 24 | guint64 xdp_entry_get_device (FlatpakDbEntry *entry); 25 | guint64 xdp_entry_get_inode (FlatpakDbEntry *entry); 26 | guint32 xdp_entry_get_flags (FlatpakDbEntry *entry); 27 | 28 | char * xdp_name_from_id (guint32 doc_id); 29 | 30 | 31 | G_END_DECLS 32 | 33 | #endif /* XDP_UTIL_H */ 34 | -------------------------------------------------------------------------------- /env.d/flatpak.env.in: -------------------------------------------------------------------------------- 1 | XDG_DATA_DIRS=$HOME/.local/share/flatpak/exports/share/:@localstatedir@/flatpak/exports/share/:/usr/local/share/:/usr/share/ 2 | -------------------------------------------------------------------------------- /flatpak.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | datarootdir=@datarootdir@ 5 | includedir=@includedir@ 6 | datadir=@datadir@ 7 | 8 | interfaces_dir=${datadir}/dbus-1/interfaces/ 9 | 10 | Name: flatpak 11 | Description: Application sandboxing framework 12 | Version: @VERSION@ 13 | Requires: glib-2.0 gio-2.0 14 | Requires.private: gio-unix-2.0 ostree-1 libgsystem 15 | Libs: -L${libdir} -lflatpak 16 | Cflags: -I${includedir}/flatpak 17 | -------------------------------------------------------------------------------- /lib/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | lib_LTLIBRARIES += libflatpak.la 2 | noinst_PROGRAMS += test-libflatpak 3 | 4 | public_headers = \ 5 | lib/flatpak.h \ 6 | lib/flatpak-ref.h \ 7 | lib/flatpak-error.h \ 8 | lib/flatpak-installed-ref.h \ 9 | lib/flatpak-remote-ref.h \ 10 | lib/flatpak-bundle-ref.h \ 11 | lib/flatpak-installation.h \ 12 | lib/flatpak-remote.h \ 13 | lib/flatpak-version-macros.h \ 14 | $(NULL) 15 | 16 | generated_public_headers = \ 17 | lib/flatpak-enum-types.h \ 18 | $(NULL) 19 | 20 | BUILT_SOURCES += \ 21 | lib/flatpak-enum-types.c \ 22 | lib/flatpak-enum-types.h \ 23 | $(NULL) 24 | 25 | DISTCLEANFILES += \ 26 | lib/flatpak-enum-types.c \ 27 | lib/flatpak-enum-types.h \ 28 | $(NULL) 29 | 30 | 31 | lib/flatpak-enum-types.h: $(public_headers) lib/flatpak-enum-types.h.template 32 | $(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \ 33 | lib/flatpak-enum-types.h.tmp && mv lib/flatpak-enum-types.h.tmp lib/flatpak-enum-types.h 34 | 35 | lib/flatpak-enum-types.c: $(public_headers) lib/flatpak-enum-types.c.template 36 | $(AM_V_GEN) $(GLIB_MKENUMS) --template $(filter %.template,$^) $(filter-out %.template,$^) > \ 37 | lib/flatpak-enum-types.c.tmp && mv lib/flatpak-enum-types.c.tmp lib/flatpak-enum-types.c 38 | 39 | EXTRA_DIST += lib/flatpak-enum-types.c.template lib/flatpak-enum-types.h.template 40 | 41 | flatpakincludedir = $(includedir)/flatpak 42 | flatpakinclude_HEADERS = $(public_headers) $(generated_public_headers) 43 | 44 | sources = \ 45 | lib/flatpak.c \ 46 | lib/flatpak-enum-types.c \ 47 | lib/flatpak-ref.c \ 48 | lib/flatpak-installed-ref.c \ 49 | lib/flatpak-installed-ref-private.h \ 50 | lib/flatpak-remote-ref.c \ 51 | lib/flatpak-bundle-ref.c \ 52 | lib/flatpak-remote-ref-private.h \ 53 | lib/flatpak-remote-private.h \ 54 | lib/flatpak-remote.c \ 55 | lib/flatpak-error.c \ 56 | lib/flatpak-installation.c \ 57 | $(NULL) 58 | 59 | libflatpak_la_SOURCES = \ 60 | $(public_headers) \ 61 | $(generated_public_headers) \ 62 | $(sources) \ 63 | $(NULL) 64 | 65 | libflatpak_la_CFLAGS = \ 66 | $(HIDDEN_VISIBILITY_CFLAGS) \ 67 | -DFLATPAK_COMPILATION \ 68 | -I$(top_srcdir)/lib \ 69 | -I$(top_builddir)/lib \ 70 | $(AM_CFLAGS) \ 71 | $(BASE_CFLAGS) \ 72 | $(OSTREE_CFLAGS) \ 73 | $(SOUP_CFLAGS) \ 74 | $(NULL) 75 | 76 | libflatpak_la_LDFLAGS = \ 77 | -version-info $(LT_VERSION_INFO) \ 78 | -export-dynamic \ 79 | -rpath $(libdir) \ 80 | $(NULL) 81 | 82 | libflatpak_la_LIBADD = \ 83 | libflatpak-common.la \ 84 | $(BASE_LIBS) \ 85 | $(OSTREE_LIBS) \ 86 | $(SOUP_LIBS) \ 87 | $(NULL) 88 | 89 | test_libflatpak_SOURCES = \ 90 | lib/test-lib.c \ 91 | $(NULL) 92 | 93 | test_libflatpak_CFLAGS = \ 94 | $(BASE_CFLAGS) \ 95 | -I$(top_srcdir)/lib \ 96 | -I$(top_builddir)/lib \ 97 | $(NULL) 98 | 99 | test_libflatpak_LDADD = \ 100 | $(BASE_LIBS) \ 101 | libflatpak.la \ 102 | $(NULL) 103 | 104 | # gobject-introspection rules 105 | -include $(INTROSPECTION_MAKEFILE) 106 | 107 | INTROSPECTION_GIRS = 108 | 109 | if HAVE_INTROSPECTION 110 | Flatpak-1.0.gir: libflatpak.la Makefile 111 | 112 | introspected_headers = $(public_headers) 113 | introspected_sources = $(filter-out %-private.h,$(sources)) 114 | 115 | Flatpak_1_0_gir_NAMESPACE = Flatpak 116 | Flatpak_1_0_gir_VERSION = 1.0 117 | Flatpak_1_0_gir_LIBS = libflatpak.la 118 | Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources) 119 | Flatpak_1_0_gir_CFLAGS = $(libflatpak_la_CFLAGS) 120 | Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 121 | Flatpak_1_0_gir_SCANNERFLAGS = \ 122 | --warn-all \ 123 | --c-include='flatpak.h' \ 124 | --pkg-export=flatpak 125 | 126 | INTROSPECTION_GIRS += Flatpak-1.0.gir 127 | 128 | girdir = $(datadir)/gir-1.0 129 | nodist_gir_DATA = $(INTROSPECTION_GIRS) 130 | CLEANFILES += $(nodist_gir_DATA) 131 | 132 | typelibdir = $(libdir)/girepository-1.0 133 | nodist_typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) 134 | CLEANFILES += $(nodist_typelib_DATA) 135 | 136 | endif # HAVE_INTROSPECTION 137 | -------------------------------------------------------------------------------- /lib/flatpak-bundle-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_BUNDLE_REF_H__ 26 | #define __FLATPAK_BUNDLE_REF_H__ 27 | 28 | typedef struct _FlatpakBundleRef FlatpakBundleRef; 29 | 30 | #include 31 | #include 32 | 33 | #define FLATPAK_TYPE_BUNDLE_REF flatpak_bundle_ref_get_type () 34 | #define FLATPAK_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_BUNDLE_REF, FlatpakBundleRef)) 35 | #define FLATPAK_IS_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_BUNDLE_REF)) 36 | 37 | FLATPAK_EXTERN GType flatpak_bundle_ref_get_type (void); 38 | 39 | struct _FlatpakBundleRef 40 | { 41 | FlatpakRef parent; 42 | }; 43 | 44 | typedef struct 45 | { 46 | FlatpakRefClass parent_class; 47 | } FlatpakBundleRefClass; 48 | 49 | FLATPAK_EXTERN FlatpakBundleRef *flatpak_bundle_ref_new (GFile *file, 50 | GError **error); 51 | FLATPAK_EXTERN GFile *flatpak_bundle_ref_get_file (FlatpakBundleRef *self); 52 | FLATPAK_EXTERN GBytes *flatpak_bundle_ref_get_metadata (FlatpakBundleRef *self); 53 | FLATPAK_EXTERN GBytes *flatpak_bundle_ref_get_appstream (FlatpakBundleRef *self); 54 | FLATPAK_EXTERN GBytes *flatpak_bundle_ref_get_icon (FlatpakBundleRef *self, 55 | int size); 56 | FLATPAK_EXTERN char *flatpak_bundle_ref_get_origin (FlatpakBundleRef *self); 57 | FLATPAK_EXTERN guint64 flatpak_bundle_ref_get_installed_size (FlatpakBundleRef *self); 58 | 59 | 60 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC 61 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakBundleRef, g_object_unref) 62 | #endif 63 | 64 | #endif /* __FLATPAK_BUNDLE_REF_H__ */ 65 | -------------------------------------------------------------------------------- /lib/flatpak-enum-types.c.template: -------------------------------------------------------------------------------- 1 | /*** BEGIN file-header ***/ 2 | #include "config.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | /*** END file-header ***/ 9 | 10 | /*** BEGIN file-production ***/ 11 | /* enumerations from "@filename@" */ 12 | /*** END file-production ***/ 13 | 14 | /*** BEGIN value-header ***/ 15 | GType 16 | @enum_name@_get_type (void) 17 | { 18 | static volatile gsize g_define_type_id__volatile = 0; 19 | 20 | if (g_once_init_enter (&g_define_type_id__volatile)) 21 | { 22 | static const G@Type@Value values[] = { 23 | /*** END value-header ***/ 24 | 25 | /*** BEGIN value-production ***/ 26 | { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, 27 | /*** END value-production ***/ 28 | 29 | /*** BEGIN value-tail ***/ 30 | { 0, NULL, NULL } 31 | }; 32 | GType g_define_type_id = 33 | g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); 34 | g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); 35 | } 36 | 37 | return g_define_type_id__volatile; 38 | } 39 | 40 | /*** END value-tail ***/ 41 | -------------------------------------------------------------------------------- /lib/flatpak-enum-types.h.template: -------------------------------------------------------------------------------- 1 | /*** BEGIN file-header ***/ 2 | #ifndef __FLATPAK_ENUM_TYPES_H__ 3 | #define __FLATPAK_ENUM_TYPES_H__ 4 | 5 | #include 6 | 7 | G_BEGIN_DECLS 8 | /*** END file-header ***/ 9 | 10 | /*** BEGIN file-production ***/ 11 | 12 | /* enumerations from "@filename@" */ 13 | /*** END file-production ***/ 14 | 15 | /*** BEGIN value-header ***/ 16 | FLATPAK_EXTERN GType @enum_name@_get_type (void) G_GNUC_CONST; 17 | #define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) 18 | /*** END value-header ***/ 19 | 20 | /*** BEGIN file-tail ***/ 21 | G_END_DECLS 22 | 23 | #endif /* __GIO_ENUM_TYPES_H__ */ 24 | /*** END file-tail ***/ 25 | -------------------------------------------------------------------------------- /lib/flatpak-error.c: -------------------------------------------------------------------------------- 1 | /* flatpak-error.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This file is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This file is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #include "config.h" 23 | 24 | #include "flatpak-error.h" 25 | 26 | #include 27 | 28 | /** 29 | * SECTION:flatpak-error 30 | * @Title: Error codes 31 | * 32 | */ 33 | 34 | /* This is actually defined in common/flatpak-utils.c so the common code can report errors */ 35 | -------------------------------------------------------------------------------- /lib/flatpak-error.h: -------------------------------------------------------------------------------- 1 | /* flatpak-error.c 2 | * 3 | * Copyright (C) 2015 Red Hat, Inc 4 | * 5 | * This file is free software; you can redistribute it and/or modify it 6 | * under the terms of the GNU Lesser General Public License as 7 | * published by the Free Software Foundation; either version 2 of the 8 | * License, or (at your option) any later version. 9 | * 10 | * This file is distributed in the hope that it will be useful, but 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | * Lesser General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Lesser General Public License 16 | * along with this program. If not, see . 17 | * 18 | * Authors: 19 | * Alexander Larsson 20 | */ 21 | 22 | #ifndef FLATPAK_ERROR_H 23 | #define FLATPAK_ERROR_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | 29 | /** 30 | * FlatpakError: 31 | * @FLATPAK_ERROR_ALREADY_INSTALLED: App/runtime is already installed 32 | * @FLATPAK_ERROR_NOT_INSTALLED: App/runtime is not installed 33 | * 34 | * Error codes for library functions. 35 | */ 36 | typedef enum { 37 | FLATPAK_ERROR_ALREADY_INSTALLED, 38 | FLATPAK_ERROR_NOT_INSTALLED, 39 | } FlatpakError; 40 | 41 | #define FLATPAK_ERROR flatpak_error_quark () 42 | 43 | FLATPAK_EXTERN GQuark flatpak_error_quark (void); 44 | 45 | G_END_DECLS 46 | 47 | #endif /* FLATPAK_ERROR_H */ 48 | -------------------------------------------------------------------------------- /lib/flatpak-installed-ref-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_INSTALLED_REF_PRIVATE_H__ 26 | #define __FLATPAK_INSTALLED_REF_PRIVATE_H__ 27 | 28 | #include 29 | #include 30 | 31 | FlatpakInstalledRef *flatpak_installed_ref_new (const char *full_ref, 32 | const char *commit, 33 | const char *latest_commit, 34 | const char *origin, 35 | const char **subpaths, 36 | const char *deploy_dir, 37 | guint64 installed_size, 38 | gboolean current); 39 | 40 | #endif /* __FLATPAK_INSTALLED_REF_PRIVATE_H__ */ 41 | -------------------------------------------------------------------------------- /lib/flatpak-installed-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_INSTALLED_REF_H__ 26 | #define __FLATPAK_INSTALLED_REF_H__ 27 | 28 | typedef struct _FlatpakInstalledRef FlatpakInstalledRef; 29 | 30 | #include 31 | #include 32 | 33 | #define FLATPAK_TYPE_INSTALLED_REF flatpak_installed_ref_get_type () 34 | #define FLATPAK_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLED_REF, FlatpakInstalledRef)) 35 | #define FLATPAK_IS_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLED_REF)) 36 | 37 | FLATPAK_EXTERN GType flatpak_installed_ref_get_type (void); 38 | 39 | struct _FlatpakInstalledRef 40 | { 41 | FlatpakRef parent; 42 | }; 43 | 44 | typedef struct 45 | { 46 | FlatpakRefClass parent_class; 47 | } FlatpakInstalledRefClass; 48 | 49 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC 50 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstalledRef, g_object_unref) 51 | #endif 52 | 53 | FLATPAK_EXTERN const char *flatpak_installed_ref_get_origin (FlatpakInstalledRef * self); 54 | FLATPAK_EXTERN const char * const *flatpak_installed_ref_get_subpaths (FlatpakInstalledRef *self); 55 | FLATPAK_EXTERN guint64 flatpak_installed_ref_get_installed_size (FlatpakInstalledRef *self); 56 | FLATPAK_EXTERN const char *flatpak_installed_ref_get_deploy_dir (FlatpakInstalledRef *self); 57 | FLATPAK_EXTERN const char *flatpak_installed_ref_get_latest_commit (FlatpakInstalledRef *self); 58 | FLATPAK_EXTERN gboolean flatpak_installed_ref_get_is_current (FlatpakInstalledRef *self); 59 | FLATPAK_EXTERN GBytes *flatpak_installed_ref_load_metadata (FlatpakInstalledRef *self, 60 | GCancellable *cancellable, 61 | GError **error); 62 | 63 | #endif /* __FLATPAK_INSTALLED_REF_H__ */ 64 | -------------------------------------------------------------------------------- /lib/flatpak-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_REF_H__ 26 | #define __FLATPAK_REF_H__ 27 | 28 | typedef struct _FlatpakRef FlatpakRef; 29 | 30 | #include 31 | 32 | #define FLATPAK_TYPE_REF flatpak_ref_get_type () 33 | #define FLATPAK_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REF, FlatpakRef)) 34 | #define FLATPAK_IS_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REF)) 35 | 36 | FLATPAK_EXTERN GType flatpak_ref_get_type (void); 37 | 38 | struct _FlatpakRef 39 | { 40 | GObject parent; 41 | }; 42 | 43 | typedef struct 44 | { 45 | GObjectClass parent_class; 46 | } FlatpakRefClass; 47 | 48 | 49 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC 50 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRef, g_object_unref) 51 | #endif 52 | 53 | /** 54 | * FlatpakRefKind: 55 | * @FLATPAK_REF_KIND_APP: An application 56 | * @FLATPAK_REF_KIND_RUNTIME: A runtime that applications can use. 57 | * 58 | * The kind of artifact that a FlatpakRef refers to. 59 | */ 60 | typedef enum { 61 | FLATPAK_REF_KIND_APP, 62 | FLATPAK_REF_KIND_RUNTIME, 63 | } FlatpakRefKind; 64 | 65 | FLATPAK_EXTERN const char * flatpak_ref_get_name (FlatpakRef *self); 66 | FLATPAK_EXTERN const char * flatpak_ref_get_arch (FlatpakRef *self); 67 | FLATPAK_EXTERN const char * flatpak_ref_get_branch (FlatpakRef *self); 68 | FLATPAK_EXTERN const char * flatpak_ref_get_commit (FlatpakRef *self); 69 | FLATPAK_EXTERN FlatpakRefKind flatpak_ref_get_kind (FlatpakRef *self); 70 | FLATPAK_EXTERN char * flatpak_ref_format_ref (FlatpakRef *self); 71 | FLATPAK_EXTERN FlatpakRef * flatpak_ref_parse (const char *ref, 72 | GError **error); 73 | 74 | #endif /* __FLATPAK_REF_H__ */ 75 | -------------------------------------------------------------------------------- /lib/flatpak-remote-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_REMOTE_PRIVATE_H__ 26 | #define __FLATPAK_REMOTE_PRIVATE_H__ 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | FlatpakRemote *flatpak_remote_new_with_dir (const char *name, 33 | FlatpakDir *dir); 34 | 35 | gboolean flatpak_remote_commit (FlatpakRemote *self, 36 | FlatpakDir *dir, 37 | GCancellable *cancellable, 38 | GError **error); 39 | 40 | #endif /* __FLATPAK_REMOTE_PRIVATE_H__ */ 41 | -------------------------------------------------------------------------------- /lib/flatpak-remote-ref-private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_REMOTE_REF_PRIVATE_H__ 26 | #define __FLATPAK_REMOTE_REF_PRIVATE_H__ 27 | 28 | #include 29 | #include 30 | 31 | FlatpakRemoteRef *flatpak_remote_ref_new (const char *full_ref, 32 | const char *commit, 33 | const char *remote_name); 34 | 35 | #endif /* __FLATPAK_REMOTE_REF_PRIVATE_H__ */ 36 | -------------------------------------------------------------------------------- /lib/flatpak-remote-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_REMOTE_REF_H__ 26 | #define __FLATPAK_REMOTE_REF_H__ 27 | 28 | typedef struct _FlatpakRemoteRef FlatpakRemoteRef; 29 | 30 | #include 31 | #include 32 | 33 | #define FLATPAK_TYPE_REMOTE_REF flatpak_remote_ref_get_type () 34 | #define FLATPAK_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE_REF, FlatpakRemoteRef)) 35 | #define FLATPAK_IS_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE_REF)) 36 | 37 | FLATPAK_EXTERN GType flatpak_remote_ref_get_type (void); 38 | 39 | struct _FlatpakRemoteRef 40 | { 41 | FlatpakRef parent; 42 | }; 43 | 44 | typedef struct 45 | { 46 | FlatpakRefClass parent_class; 47 | } FlatpakRemoteRefClass; 48 | 49 | FLATPAK_EXTERN const char * flatpak_remote_ref_get_remote_name (FlatpakRemoteRef *self); 50 | 51 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC 52 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemoteRef, g_object_unref) 53 | #endif 54 | 55 | #endif /* __FLATPAK_REMOTE_REF_H__ */ 56 | -------------------------------------------------------------------------------- /lib/flatpak-remote.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_REMOTE_H__ 26 | #define __FLATPAK_REMOTE_H__ 27 | 28 | typedef struct _FlatpakRemote FlatpakRemote; 29 | 30 | #include 31 | #include 32 | 33 | #define FLATPAK_TYPE_REMOTE flatpak_remote_get_type () 34 | #define FLATPAK_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE, FlatpakRemote)) 35 | #define FLATPAK_IS_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE)) 36 | 37 | FLATPAK_EXTERN GType flatpak_remote_get_type (void); 38 | 39 | struct _FlatpakRemote 40 | { 41 | GObject parent; 42 | }; 43 | 44 | typedef struct 45 | { 46 | GObjectClass parent_class; 47 | } FlatpakRemoteClass; 48 | 49 | #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC 50 | G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemote, g_object_unref) 51 | #endif 52 | 53 | FLATPAK_EXTERN FlatpakRemote * flatpak_remote_new (const char *name); 54 | 55 | FLATPAK_EXTERN const char * flatpak_remote_get_name (FlatpakRemote *self); 56 | FLATPAK_EXTERN GFile * flatpak_remote_get_appstream_dir (FlatpakRemote *self, 57 | const char *arch); 58 | FLATPAK_EXTERN GFile * flatpak_remote_get_appstream_timestamp (FlatpakRemote *self, 59 | const char *arch); 60 | FLATPAK_EXTERN char * flatpak_remote_get_url (FlatpakRemote *self); 61 | FLATPAK_EXTERN void flatpak_remote_set_url (FlatpakRemote *self, 62 | const char *url); 63 | FLATPAK_EXTERN char * flatpak_remote_get_title (FlatpakRemote *self); 64 | FLATPAK_EXTERN void flatpak_remote_set_title (FlatpakRemote *self, 65 | const char *title); 66 | FLATPAK_EXTERN gboolean flatpak_remote_get_gpg_verify (FlatpakRemote *self); 67 | FLATPAK_EXTERN void flatpak_remote_set_gpg_verify (FlatpakRemote *self, 68 | gboolean gpg_verify); 69 | FLATPAK_EXTERN void flatpak_remote_set_gpg_key (FlatpakRemote *self, 70 | GBytes *gpg_key); 71 | FLATPAK_EXTERN gboolean flatpak_remote_get_noenumerate (FlatpakRemote *self); 72 | FLATPAK_EXTERN void flatpak_remote_set_noenumerate (FlatpakRemote *self, 73 | gboolean noenumerate); 74 | FLATPAK_EXTERN gboolean flatpak_remote_get_disabled (FlatpakRemote *self); 75 | FLATPAK_EXTERN void flatpak_remote_set_disabled (FlatpakRemote *self, 76 | gboolean disabled); 77 | FLATPAK_EXTERN int flatpak_remote_get_prio (FlatpakRemote *self); 78 | FLATPAK_EXTERN void flatpak_remote_set_prio (FlatpakRemote *self, 79 | int prio); 80 | 81 | 82 | 83 | #endif /* __FLATPAK_REMOTE_H__ */ 84 | -------------------------------------------------------------------------------- /lib/flatpak-version-macros.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #if !defined (__FLATPAK_H_INSIDE__) && !defined (FLATPAK_COMPILATION) 22 | #error "Only can be included directly." 23 | #endif 24 | 25 | #ifndef __FLATPAK_VERSION_MACROS_H__ 26 | #define __FLATPAK_VERSION_MACROS_H__ 27 | 28 | #define FLATPAK_MAJOR_VERSION (@FLATPAK_MAJOR_VERSION@) 29 | #define FLATPAK_MINOR_VERSION (@FLATPAK_MINOR_VERSION@) 30 | #define FLATPAK_MICRO_VERSION (@FLATPAK_MICRO_VERSION@) 31 | 32 | #ifndef FLATPAK_EXTERN 33 | #define FLATPAK_EXTERN extern 34 | #endif 35 | 36 | /** 37 | * SECTION:flatpak-version-macros 38 | * @Title: Version information 39 | */ 40 | 41 | #endif /* __FLATPAK_VERSION_MACROS_H__ */ 42 | -------------------------------------------------------------------------------- /lib/flatpak.c: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | #include "flatpak-version-macros.h" 4 | -------------------------------------------------------------------------------- /lib/flatpak.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __FLATPAK_H__ 22 | #define __FLATPAK_H__ 23 | 24 | #define __FLATPAK_H_INSIDE__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #undef __FLATPAK_H_INSIDE__ 39 | 40 | #endif /* __FLATPAK_H__ */ 41 | -------------------------------------------------------------------------------- /m4/glibtests.m4: -------------------------------------------------------------------------------- 1 | dnl GLIB_TESTS 2 | dnl 3 | 4 | AC_DEFUN([GLIB_TESTS], 5 | [ 6 | AC_ARG_ENABLE(installed-tests, 7 | AS_HELP_STRING([--enable-installed-tests], 8 | [Enable installation of some test cases]), 9 | [case ${enableval} in 10 | yes) ENABLE_INSTALLED_TESTS="1" ;; 11 | no) ENABLE_INSTALLED_TESTS="" ;; 12 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;; 13 | esac]) 14 | AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1") 15 | AC_ARG_ENABLE(always-build-tests, 16 | AS_HELP_STRING([--enable-always-build-tests], 17 | [Enable always building tests during 'make all']), 18 | [case ${enableval} in 19 | yes) ENABLE_ALWAYS_BUILD_TESTS="1" ;; 20 | no) ENABLE_ALWAYS_BUILD_TESTS="" ;; 21 | *) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;; 22 | esac]) 23 | AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test "$ENABLE_ALWAYS_BUILD_TESTS" = "1") 24 | if test "$ENABLE_INSTALLED_TESTS" = "1"; then 25 | AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME) 26 | AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME) 27 | fi 28 | ]) 29 | -------------------------------------------------------------------------------- /permission-store/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | libexec_PROGRAMS += \ 2 | xdg-permission-store \ 3 | $(NULL) 4 | 5 | service_in_files += permission-store/xdg-permission-store.service.in 6 | systemduserunit_DATA += permission-store/xdg-permission-store.service 7 | 8 | service_in_files += permission-store/org.freedesktop.impl.portal.PermissionStore.service.in 9 | dbus_service_DATA += permission-store/org.freedesktop.impl.portal.PermissionStore.service 10 | 11 | ps_dbus_built_sources = permission-store/permission-store-dbus.c permission-store/permission-store-dbus.h 12 | BUILT_SOURCES += $(ps_dbus_built_sources) 13 | 14 | $(ps_dbus_built_sources) : data/org.freedesktop.impl.portal.PermissionStore.xml 15 | $(AM_V_GEN) $(GDBUS_CODEGEN) \ 16 | --interface-prefix org.freedesktop.impl.portal. \ 17 | --c-namespace Xdg \ 18 | --generate-c-code $(builddir)/permission-store/permission-store-dbus \ 19 | $(srcdir)/data/org.freedesktop.impl.portal.PermissionStore.xml \ 20 | $(NULL) 21 | 22 | xdg_permission_store_SOURCES = \ 23 | $(ps_dbus_built_sources) \ 24 | permission-store/permission-store.c \ 25 | permission-store/xdg-permission-store.c \ 26 | permission-store/xdg-permission-store.h \ 27 | $(NULL) 28 | 29 | xdg_permission_store_LDADD = $(BASE_LIBS) libflatpak-common.la 30 | xdg_permission_store_CFLAGS = $(BASE_CFLAGS) $(SOUP_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) -I$(srcdir)/permission-store -I$(builddir)/permission-store 31 | -------------------------------------------------------------------------------- /permission-store/org.freedesktop.impl.portal.PermissionStore.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.freedesktop.impl.portal.PermissionStore 3 | Exec=@libexecdir@/xdg-permission-store 4 | SystemdService=xdg-permission-store.service 5 | -------------------------------------------------------------------------------- /permission-store/permission-store.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2014 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #include "config.h" 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "permission-store-dbus.h" 28 | #include "xdg-permission-store.h" 29 | #include "flatpak-utils.h" 30 | 31 | static void 32 | on_bus_acquired (GDBusConnection *connection, 33 | const gchar *name, 34 | gpointer user_data) 35 | { 36 | xdg_permission_store_start (connection); 37 | } 38 | 39 | static void 40 | on_name_acquired (GDBusConnection *connection, 41 | const gchar *name, 42 | gpointer user_data) 43 | { 44 | } 45 | 46 | static void 47 | on_name_lost (GDBusConnection *connection, 48 | const gchar *name, 49 | gpointer user_data) 50 | { 51 | exit (1); 52 | } 53 | 54 | int 55 | main (int argc, 56 | char **argv) 57 | { 58 | guint owner_id; 59 | GMainLoop *loop; 60 | 61 | setlocale (LC_ALL, ""); 62 | 63 | g_setenv ("GIO_USE_VFS", "local", TRUE); 64 | 65 | g_set_prgname (argv[0]); 66 | 67 | flatpak_migrate_from_xdg_app (); 68 | 69 | owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, 70 | "org.freedesktop.impl.portal.PermissionStore", 71 | G_BUS_NAME_OWNER_FLAGS_NONE, 72 | on_bus_acquired, 73 | on_name_acquired, 74 | on_name_lost, 75 | NULL, 76 | NULL); 77 | 78 | loop = g_main_loop_new (NULL, FALSE); 79 | g_main_loop_run (loop); 80 | 81 | g_bus_unown_name (owner_id); 82 | 83 | return 0; 84 | } 85 | -------------------------------------------------------------------------------- /permission-store/xdg-permission-store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2015 Red Hat, Inc 3 | * 4 | * This program is free software; you can redistribute it and/or 5 | * modify it under the terms of the GNU Lesser General Public 6 | * License as published by the Free Software Foundation; either 7 | * version 2 of the License, or (at your option) any later version. 8 | * 9 | * This library is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | * Lesser General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU Lesser General Public 15 | * License along with this library. If not, see . 16 | * 17 | * Authors: 18 | * Alexander Larsson 19 | */ 20 | 21 | #ifndef __FLATPAK_PERMISSION_STORE_H__ 22 | #define __FLATPAK_PERMISSION_STORE_H__ 23 | 24 | #include "flatpak-dbus.h" 25 | 26 | void xdg_permission_store_start (GDBusConnection *connection); 27 | 28 | #endif /* __FLATPAK_PERMISSION_STORE_H__ */ 29 | -------------------------------------------------------------------------------- /permission-store/xdg-permission-store.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=sandboxed app permission store 3 | 4 | [Service] 5 | BusName=org.freedesktop.impl.portal.PermissionStore 6 | ExecStart=@libexecdir@/xdg-permission-store 7 | Type=dbus 8 | -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | system-helper/org.freedesktop.Flatpak.policy.in 2 | -------------------------------------------------------------------------------- /po/POTFILES.skip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexlarsson/xdg-app/501802270ed1b8860987c104681b1066e57b1f1c/po/POTFILES.skip -------------------------------------------------------------------------------- /profile/flatpak.sh.in: -------------------------------------------------------------------------------- 1 | # @sysconfdir@/profile.d/flatpak.sh - set XDG_DATA_DIRS 2 | 3 | XDG_DATA_DIRS="${XDG_DATA_DIRS:-$HOME/.local/share/flatpak/exports/share:@localstatedir@/flatpak/exports/share/:/usr/local/share/:/usr/share/}" 4 | export XDG_DATA_DIRS 5 | -------------------------------------------------------------------------------- /session-helper/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | libexec_PROGRAMS += \ 2 | flatpak-session-helper \ 3 | $(NULL) 4 | 5 | service_in_files += session-helper/flatpak-session-helper.service.in 6 | systemduserunit_DATA += session-helper/flatpak-session-helper.service 7 | 8 | service_in_files += session-helper/org.freedesktop.Flatpak.service.in 9 | dbus_service_DATA += session-helper/org.freedesktop.Flatpak.service 10 | 11 | flatpak_session_helper_SOURCES = \ 12 | session-helper/flatpak-session-helper.c \ 13 | $(NULL) 14 | 15 | flatpak_session_helper_LDADD = $(BASE_LIBS) libflatpak-common.la 16 | flatpak_session_helper_CFLAGS = $(BASE_CFLAGS) $(SOUP_CFLAGS) $(OSTREE_CFLAGS) $(GSYSTEM_CFLAGS) 17 | -------------------------------------------------------------------------------- /session-helper/flatpak-session-helper.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=flatpak session helper 3 | 4 | [Service] 5 | BusName=org.freedesktop.Flatpak 6 | ExecStart=@libexecdir@/flatpak-session-helper 7 | Type=dbus 8 | -------------------------------------------------------------------------------- /session-helper/org.freedesktop.Flatpak.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.freedesktop.Flatpak 3 | Exec=@libexecdir@/flatpak-session-helper 4 | SystemdService=flatpak-session-helper.service 5 | -------------------------------------------------------------------------------- /system-helper/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | libexec_PROGRAMS += \ 2 | flatpak-system-helper \ 3 | $(NULL) 4 | 5 | dbussystemservicedir = $(datadir)/dbus-1/system-services 6 | service_in_files += system-helper/org.freedesktop.Flatpak.SystemHelper.service.in 7 | dbussystemservice_DATA = system-helper/org.freedesktop.Flatpak.SystemHelper.service 8 | 9 | dbusconfdir = ${sysconfdir}/dbus-1/system.d 10 | dbusconf_DATA = system-helper/org.freedesktop.Flatpak.SystemHelper.conf 11 | 12 | service_in_files += system-helper/flatpak-system-helper.service.in 13 | systemdsystemunit_DATA = system-helper/flatpak-system-helper.service 14 | 15 | flatpak_system_helper_SOURCES = \ 16 | system-helper/flatpak-system-helper.c \ 17 | lib/flatpak-error.c \ 18 | $(NULL) 19 | 20 | flatpak_system_helper_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(POLKIT_LIBS) libflatpak-common.la 21 | flatpak_system_helper_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(POLKIT_CFLAGS) 22 | 23 | polkit_rulesdir = $(datadir)/polkit-1/rules.d 24 | dist_polkit_rules_DATA = \ 25 | system-helper/org.freedesktop.Flatpak.rules 26 | 27 | polkit_policydir = $(datadir)/polkit-1/actions 28 | dist_polkit_policy_DATA = \ 29 | system-helper/org.freedesktop.Flatpak.policy 30 | 31 | @INTLTOOL_POLICY_RULE@ 32 | 33 | EXTRA_DIST += system-helper/org.freedesktop.Flatpak.policy.in system-helper/org.freedesktop.Flatpak.SystemHelper.conf 34 | DISTCLEANFILES += system-helper/org.freedesktop.Flatpak.policy system-helper/flatpak-system-helper.service system-helper/org.freedesktop.Flatpak.SystemHelper.service 35 | -------------------------------------------------------------------------------- /system-helper/flatpak-system-helper.service.in: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=flatpak system helper 3 | 4 | [Service] 5 | BusName=org.freedesktop.Flatpak.SystemHelper 6 | ExecStart=@libexecdir@/flatpak-system-helper 7 | Type=dbus 8 | -------------------------------------------------------------------------------- /system-helper/org.freedesktop.Flatpak.SystemHelper.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /system-helper/org.freedesktop.Flatpak.SystemHelper.service.in: -------------------------------------------------------------------------------- 1 | [D-BUS Service] 2 | Name=org.freedesktop.Flatpak.SystemHelper 3 | Exec=@libexecdir@/flatpak-system-helper@extraargs@ 4 | SystemdService=flatpak-system-helper.service 5 | -------------------------------------------------------------------------------- /system-helper/org.freedesktop.Flatpak.rules: -------------------------------------------------------------------------------- 1 | polkit.addRule(function(action, subject) { 2 | if ((action.id == "org.freedesktop.Flatpak.app-install" || 3 | action.id == "org.freedesktop.Flatpak.runtime-install") && 4 | subject.active == true && subject.local == true && 5 | subject.isInGroup("wheel")) { 6 | return polkit.Result.YES; 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /tests/Makefile.am.inc: -------------------------------------------------------------------------------- 1 | TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \ 2 | FLATPAK_TRIGGERSDIR=$$(cd $(top_srcdir) && pwd)/triggers \ 3 | FLATPAK_BWRAP=$$(cd $(top_builddir) && pwd)/bwrap \ 4 | FLATPAK_DBUSPROXY=$$(cd $(top_builddir) && pwd)/flatpak-dbus-proxy \ 5 | GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd) \ 6 | LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd) \ 7 | PATH=$$(cd $(top_builddir) && pwd):$${PATH} \ 8 | $(NULL) 9 | 10 | testdb_CFLAGS = $(BASE_CFLAGS) 11 | testdb_LDADD = \ 12 | $(BASE_LIBS) \ 13 | $(OSTREE_LIBS) \ 14 | libglnx.la \ 15 | libflatpak-common.la \ 16 | $(NULL) 17 | testdb_SOURCES = tests/testdb.c 18 | 19 | test_doc_portal_CFLAGS = $(BASE_CFLAGS) 20 | test_doc_portal_LDADD = \ 21 | $(BASE_LIBS) \ 22 | $(OSTREE_LIBS) \ 23 | libglnx.la \ 24 | libflatpak-common.la \ 25 | $(NULL) 26 | test_doc_portal_SOURCES = tests/test-doc-portal.c $(xdp_dbus_built_sources) 27 | 28 | EXTRA_test_doc_portal_DEPENDENCIES = tests/services/org.freedesktop.impl.portal.PermissionStore.service tests/services/org.freedesktop.portal.Documents.service tests/services/org.freedesktop.Flatpak.service tests/services/org.freedesktop.Flatpak.SystemHelper.service 29 | 30 | tests/services/org.freedesktop.portal.Documents.service: document-portal/org.freedesktop.portal.Documents.service.in 31 | mkdir -p tests/services 32 | $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@ 33 | 34 | tests/services/org.freedesktop.impl.portal.PermissionStore.service: permission-store/org.freedesktop.impl.portal.PermissionStore.service.in 35 | mkdir -p tests/services 36 | $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@ 37 | 38 | tests/services/org.freedesktop.Flatpak.service: session-helper/org.freedesktop.Flatpak.service.in 39 | mkdir -p tests/services 40 | $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" $< > $@ 41 | 42 | tests/services/org.freedesktop.Flatpak.SystemHelper.service: system-helper/org.freedesktop.Flatpak.SystemHelper.service.in 43 | mkdir -p tests/services 44 | $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(abs_top_builddir)|" -e "s|\@extraargs\@| --session --no-idle-exit|" $< > $@ 45 | 46 | tests/libtest.sh: tests/services/org.freedesktop.impl.portal.PermissionStore.service tests/services/org.freedesktop.portal.Documents.service tests/services/org.freedesktop.Flatpak.service 47 | 48 | install-test-data-hook: 49 | if ENABLE_INSTALLED_TESTS 50 | mkdir -p $(DESTDIR)$(installed_testdir)/services 51 | ln -sf $(dbus_servicedir)/org.freedesktop.Flatpak.service $(DESTDIR)$(installed_testdir)/services/ 52 | ln -sf $(dbus_servicedir)/org.freedesktop.portal.Documents.service $(DESTDIR)$(installed_testdir)/services/ 53 | ln -sf $(dbus_servicedir)/org.freedesktop.impl.portal.PermissionStore.service $(DESTDIR)$(installed_testdir)/services/ 54 | $(AM_V_GEN) $(SED) -e "s|\@libexecdir\@|$(libexecdir)|" -e "s|\@extraargs\@| --session --no-idle-exit|" $(top_srcdir)/system-helper/org.freedesktop.Flatpak.SystemHelper.service.in > $(DESTDIR)$(installed_testdir)/services/org.freedesktop.Flatpak.SystemHelper.service 55 | endif 56 | 57 | tests/package_version.txt: Makefile 58 | echo $(PACKAGE_VERSION) > tests/package_version.txt 59 | 60 | tests/test-basic.sh: tests/package_version.txt 61 | 62 | installed_test_SCRIPTS += \ 63 | buildutil/tap-driver.sh \ 64 | tests/test-configure \ 65 | tests/make-test-app.sh \ 66 | tests/make-test-runtime.sh \ 67 | tests/make-test-bundles.sh \ 68 | $(NULL) 69 | 70 | installed_test_data = \ 71 | tests/libtest.sh \ 72 | tests/org.test.Hello.png \ 73 | tests/package_version.txt \ 74 | tests/test.json \ 75 | tests/session.conf.in \ 76 | $(NULL) 77 | 78 | installed_test_keyringdir = $(installed_testdir)/test-keyring 79 | installed_test_dbsdir = $(installed_testdir)/dbs 80 | 81 | if ENABLE_INSTALLED_TESTS 82 | installed_test_keyring_DATA = \ 83 | tests/test-keyring/pubring.gpg \ 84 | tests/test-keyring/secring.gpg \ 85 | $(NULL) 86 | installed_test_dbs_DATA = tests/dbs/no_tables 87 | endif 88 | 89 | EXTRA_DIST += $(installed_test_SCRIPTS) $(installed_test_data) $(installed_test_keyring_DATA) $(installed_test_dbs_DATA) 90 | 91 | test_scripts = \ 92 | tests/test-basic.sh \ 93 | tests/test-run.sh \ 94 | tests/test-run-system.sh \ 95 | tests/test-builder.sh \ 96 | $(NULL) 97 | 98 | test_programs = testdb test-doc-portal 99 | 100 | @VALGRIND_CHECK_RULES@ 101 | VALGRIND_SUPPRESSIONS_FILES=tests/flatpak-valgrind.supp 102 | EXTRA_DIST += tests/flatpak-valgrind.supp 103 | DISTCLEANFILES += \ 104 | tests/services/org.freedesktop.Flatpak.service \ 105 | tests/services/org.freedesktop.portal.Documents.service \ 106 | tests/services/org.freedesktop.impl.portal.PermissionStore.service \ 107 | tests/services/org.freedesktop.Flatpak.SystemHelper.service \ 108 | tests/package_version.txt \ 109 | $(NULL) 110 | -------------------------------------------------------------------------------- /tests/dbs/no_tables: -------------------------------------------------------------------------------- 1 | GVariant ( -------------------------------------------------------------------------------- /tests/flatpak-valgrind.supp: -------------------------------------------------------------------------------- 1 | { 2 | g_type_init_with_debug_flags calloc 3 | Memcheck:Leak 4 | fun:calloc 5 | ... 6 | fun:g_type_init_with_debug_flags 7 | ... 8 | } 9 | 10 | { 11 | g_type_add_interface_static malloc 12 | Memcheck:Leak 13 | fun:malloc 14 | ... 15 | fun:g_type_add_interface_static 16 | ... 17 | } 18 | 19 | { 20 | g_type_add_interface_dynamic malloc 21 | Memcheck:Leak 22 | fun:malloc 23 | ... 24 | fun:g_type_add_interface_dynamic 25 | ... 26 | } 27 | 28 | { 29 | g_type_class_ref malloc 30 | Memcheck:Leak 31 | fun:malloc 32 | ... 33 | fun:g_type_class_ref 34 | ... 35 | } 36 | 37 | { 38 | g_type_register_dynamic malloc 39 | Memcheck:Leak 40 | fun:malloc 41 | ... 42 | fun:g_type_register_dynamic 43 | ... 44 | } 45 | 46 | { 47 | g_type_init_with_debug_flags malloc 48 | Memcheck:Leak 49 | fun:malloc 50 | ... 51 | fun:g_type_init_with_debug_flags 52 | ... 53 | } 54 | 55 | { 56 | g_type_init_with_debug_flags realloc 57 | Memcheck:Leak 58 | fun:realloc 59 | ... 60 | fun:g_type_init_with_debug_flags 61 | ... 62 | } 63 | 64 | { 65 | g_test_add_vtable malloc 66 | Memcheck:Leak 67 | fun:malloc 68 | ... 69 | fun:g_test_add_vtable 70 | ... 71 | } 72 | 73 | { 74 | g_test_init 75 | Memcheck:Leak 76 | fun:malloc 77 | ... 78 | fun:g_test_init 79 | ... 80 | } 81 | 82 | { 83 | g_type_register_static malloc 84 | Memcheck:Leak 85 | fun:malloc 86 | ... 87 | fun:g_type_register_static 88 | ... 89 | } 90 | 91 | { 92 | g_type_register_static realloc 93 | Memcheck:Leak 94 | fun:realloc 95 | ... 96 | fun:g_type_register_static 97 | ... 98 | } 99 | 100 | { 101 | g_type_register_fundamental never freed 102 | Memcheck:Leak 103 | fun:malloc 104 | ... 105 | fun:g_type_register_fundamental 106 | ... 107 | } 108 | 109 | { 110 | g_type_class_ref never finalized 111 | Memcheck:Leak 112 | fun:calloc 113 | ... 114 | fun:g_type_class_ref 115 | ... 116 | } 117 | 118 | { 119 | DBusGValue qdata 120 | Memcheck:Leak 121 | fun:realloc 122 | fun:g_realloc 123 | fun:g_type_set_qdata 124 | fun:_dbus_g_value_types_init 125 | ... 126 | } 127 | 128 | { 129 | gettext conditional jump 130 | Memcheck:Cond 131 | fun:__GI___strcasecmp_l 132 | fun:__gconv_open 133 | fun:_nl_find_msg 134 | fun:__dcigettext 135 | ... 136 | } 137 | 138 | { 139 | gettext uninitialized value 140 | Memcheck:Value8 141 | fun:__GI___strcasecmp_l 142 | fun:__gconv_open 143 | fun:_nl_find_msg 144 | fun:__dcigettext 145 | ... 146 | } 147 | 148 | { 149 | font config invalid reads 150 | Memcheck:Addr4 151 | ... 152 | fun:FcConfigParseAndLoad 153 | ... 154 | } 155 | 156 | { 157 | dynamic loader conditional jump 158 | Memcheck:Cond 159 | fun:index 160 | fun:expand_dynamic_string_token 161 | fun:_dl_map_object 162 | fun:map_doit 163 | fun:_dl_catch_error 164 | fun:do_preload 165 | fun:dl_main 166 | ... 167 | } 168 | 169 | { 170 | g_vfs_get_local 171 | Memcheck:Leak 172 | ... 173 | fun:g_vfs_get_local 174 | ... 175 | } 176 | 177 | { 178 | _g_io_modules_ensure_loaded 179 | Memcheck:Leak 180 | ... 181 | fun:_g_io_modules_ensure_loaded 182 | ... 183 | } 184 | 185 | { 186 | _g_io_module_get_default 187 | Memcheck:Leak 188 | ... 189 | fun:_g_io_module_get_default 190 | ... 191 | } 192 | 193 | { 194 | _dl_allocate_tls 195 | Memcheck:Leak 196 | ... 197 | fun:_dl_allocate_tls 198 | ... 199 | } 200 | -------------------------------------------------------------------------------- /tests/make-test-app.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | DIR=`mktemp -d` 6 | 7 | EXTRA="${1-}" 8 | 9 | # Init dir 10 | flatpak build-init ${DIR} org.test.Hello org.test.Platform org.test.Platform 11 | 12 | mkdir -p ${DIR}/files/bin 13 | cat > ${DIR}/files/bin/hello.sh < ${DIR}/files/share/applications/org.test.Hello.desktop < ${DIR}/files/share/app-info/xmls/org.test.Hello.xml.gz < 37 | 38 | 39 | org.test.Hello.desktop 40 | Hello world test app 41 | Print a greeting 42 |

This is a test app.

43 | 44 | Utility 45 | 46 | 64x64/org.gnome.gedit.png 47 |
48 |
49 | EOF 50 | cp $(dirname $0)/org.test.Hello.png ${DIR}/files/share/app-info/icons/flatpak/64x64/ 51 | 52 | flatpak build-finish --command=hello.sh ${DIR} 53 | flatpak build-export ${GPGARGS-} repo ${DIR} 54 | rm -rf ${DIR} 55 | -------------------------------------------------------------------------------- /tests/make-test-bundles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -x 5 | 6 | ./make-test-runtime.sh org.test.Platform bash ls cat echo readlink 7 | ./make-test-app.sh 8 | 9 | URL=file://`pwd`/repo 10 | 11 | REF=`(cd repo/refs/heads; echo app/org.test.Hello/*/master)` 12 | 13 | flatpak build-bundle repo hello.flatpak org.test.Hello 14 | flatpak build-bundle repo hello-key.flatpak --gpg-keys=test-keyring/pubring.gpg org.test.Hello 15 | flatpak build-bundle repo --repo-url=${URL} hello-origin.flatpak org.test.Hello 16 | flatpak build-bundle repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg hello-key-origin.flatpak org.test.Hello 17 | 18 | ostree gpg-sign --repo=repo --gpg-homedir=test-keyring ${REF} 7B0961FD 19 | 20 | flatpak build-bundle repo hello-signed.flatpak org.test.Hello 21 | flatpak build-bundle repo hello-key-signed.flatpak --gpg-keys=test-keyring/pubring.gpg org.test.Hello 22 | flatpak build-bundle repo --repo-url=${URL} hello-origin-signed.flatpak org.test.Hello 23 | flatpak build-bundle repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg hello-key-origin-signed.flatpak org.test.Hello 24 | 25 | REF=`(cd repo/refs/heads; echo runtime/org.test.Platform/*/master)` 26 | ostree gpg-sign --repo=repo --gpg-homedir=test-keyring ${REF} 7B0961FD 27 | flatpak build-bundle --runtime repo --repo-url=${URL} --gpg-keys=test-keyring/pubring.gpg platform.flatpak org.test.Platform 28 | -------------------------------------------------------------------------------- /tests/make-test-runtime.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | DIR=`mktemp -d` 6 | 7 | ID=$1 8 | shift 9 | 10 | flatpak build-init ${DIR} ${ID} ${ID} ${ID} 11 | sed -i s/Application/Runtime/ ${DIR}/metadata 12 | 13 | # Add bash and dependencies 14 | mkdir -p ${DIR}/usr/bin 15 | mkdir -p ${DIR}/usr/lib 16 | ln -s ../lib ${DIR}/usr/lib64 17 | ln -s ../lib ${DIR}/usr/lib32 18 | T=`mktemp` 19 | for i in $@; do 20 | I=`which $i` 21 | cp $I ${DIR}/usr/bin 22 | ldd $I | sed "s/.* => //" | awk '{ print $1}' | grep ^/ | grep ^/ >> $T 23 | done 24 | ln -s bash ${DIR}/usr/bin/sh 25 | for i in `sort -u $T`; do 26 | cp "$i" ${DIR}/usr/lib/ 27 | done 28 | 29 | # We copy the C.UTF8 locale and call it en_US. Its a bit of a lie, but 30 | # the real en_US locale is often not available, because its in the 31 | # local archive. 32 | mkdir -p ${DIR}/usr/lib/locale/ 33 | cp -r /usr/lib/locale/C.* ${DIR}/usr/lib/locale/en_US 34 | 35 | flatpak build-export --runtime ${GPGARGS-} repo ${DIR} 36 | rm -rf ${DIR} 37 | -------------------------------------------------------------------------------- /tests/org.test.Hello.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexlarsson/xdg-app/501802270ed1b8860987c104681b1066e57b1f1c/tests/org.test.Hello.png -------------------------------------------------------------------------------- /tests/session.conf.in: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | session 6 | 7 | 9 | 10 | 11 | unix:tmpdir=/tmp 12 | 13 | @testdir@/services 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | contexts/dbus_contexts 30 | 31 | 38 | 39 | 40 | 1000000000 41 | 250000000 42 | 1000000000 43 | 250000000 44 | 1000000000 45 | 4096 46 | 120000 47 | 240000 48 | 100000 49 | 10000 50 | 100000 51 | 10000 52 | 50000 53 | 50000 54 | 50000 55 | 56 | 57 | -------------------------------------------------------------------------------- /tests/test-basic.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2011 Colin Walters 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the 17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | # Boston, MA 02111-1307, USA. 19 | 20 | set -euo pipefail 21 | 22 | . $(dirname $0)/libtest.sh 23 | 24 | echo "1..3" 25 | 26 | ${FLATPAK} --version > version_out 27 | 28 | VERSION=`cat "$test_builddir/package_version.txt"` 29 | assert_file_has_content version_out "^flatpak $VERSION$" 30 | 31 | echo "ok version" 32 | 33 | ${FLATPAK} --help > help_out 34 | 35 | assert_file_has_content help_out "^Usage:$" 36 | 37 | echo "ok help" 38 | 39 | ${FLATPAK} --default-arch > /dev/null 40 | 41 | echo "ok default arch" 42 | -------------------------------------------------------------------------------- /tests/test-builder.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2011 Colin Walters 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the 17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | # Boston, MA 02111-1307, USA. 19 | 20 | set -euo pipefail 21 | 22 | . $(dirname $0)/libtest.sh 23 | 24 | skip_without_bwrap 25 | 26 | echo "1..3" 27 | 28 | setup_repo 29 | install_repo 30 | setup_sdk_repo 31 | install_sdk_repo 32 | 33 | # Need /var/tmp cwd for xattrs 34 | REPO=`pwd`/repo 35 | cd $TEST_DATA_DIR/ 36 | 37 | cp -a $(dirname $0)/test-configure . 38 | echo "version1" > app-data 39 | cp $(dirname $0)/test.json . 40 | flatpak-builder --repo=$REPO $FL_GPGARGS --force-clean appdir test.json > /dev/null 41 | 42 | assert_file_has_content appdir/files/share/app-data version1 43 | assert_file_has_content appdir/metadata shared=network; 44 | assert_file_has_content appdir/metadata tags=test; 45 | 46 | assert_not_has_file appdir/files/cleanup/a_filee 47 | assert_not_has_file appdir/files/bin/file.cleanup 48 | 49 | assert_has_file appdir/files/cleaned_up > out 50 | 51 | ${FLATPAK} build appdir /app/bin/hello2.sh > hello_out2 52 | assert_file_has_content hello_out2 '^Hello world2, from a sandbox$' 53 | 54 | echo "ok build" 55 | 56 | ${FLATPAK} ${U} install test-repo org.test.Hello2 master 57 | run org.test.Hello2 > hello_out3 58 | assert_file_has_content hello_out3 '^Hello world2, from a sandbox$' 59 | 60 | run --command=cat org.test.Hello2 /app/share/app-data > app_data_1 61 | assert_file_has_content app_data_1 version1 62 | 63 | echo "ok install+run" 64 | 65 | echo "version2" > app-data 66 | flatpak-builder $FL_GPGARGS --repo=$REPO --force-clean appdir test.json > /dev/null 67 | assert_file_has_content appdir/files/share/app-data version2 68 | 69 | ${FLATPAK} ${U} update org.test.Hello2 master 70 | 71 | run --command=cat org.test.Hello2 /app/share/app-data > app_data_2 72 | assert_file_has_content app_data_2 version2 73 | 74 | echo "ok update" 75 | -------------------------------------------------------------------------------- /tests/test-configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ x$2 != 'x--some-arg' ] ; then 4 | exit 2 5 | fi 6 | 7 | cat < Makefile 8 | all: 9 | echo Building 10 | if [ "x\$(CFLAGS)" != "x-O2 -g" ]; then exit 1; fi 11 | if [ "x\$(FOO)" != xbar ]; then exit 1; fi 12 | if [ "x\$(BAR)" != x2 ]; then exit 1; fi 13 | 14 | install: 15 | echo Installing 16 | if [ "x\$(FOO)" != xbar ]; then exit 1; fi 17 | if [ "x\$(BAR)" != x3 ]; then exit 1; fi 18 | mkdir -p /app/bin 19 | cp -a hello2.sh /app/bin/ 20 | mkdir -p /app/share 21 | cp -a app-data /app/share/ 22 | EOF 23 | -------------------------------------------------------------------------------- /tests/test-keyring/README: -------------------------------------------------------------------------------- 1 | These are completely random keys, which include the secret key. 2 | Use these for testing gpg signing, do *NOT* ever use these for any 3 | real application. 4 | -------------------------------------------------------------------------------- /tests/test-keyring/pubring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexlarsson/xdg-app/501802270ed1b8860987c104681b1066e57b1f1c/tests/test-keyring/pubring.gpg -------------------------------------------------------------------------------- /tests/test-keyring/secring.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexlarsson/xdg-app/501802270ed1b8860987c104681b1066e57b1f1c/tests/test-keyring/secring.gpg -------------------------------------------------------------------------------- /tests/test-run-system.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (C) 2011 Colin Walters 4 | # 5 | # This library is free software; you can redistribute it and/or 6 | # modify it under the terms of the GNU Lesser General Public 7 | # License as published by the Free Software Foundation; either 8 | # version 2 of the License, or (at your option) any later version. 9 | # 10 | # This library is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | # Lesser General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Lesser General Public 16 | # License along with this library; if not, write to the 17 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 | # Boston, MA 02111-1307, USA. 19 | 20 | export USE_SYSTEMDIR=yes 21 | 22 | . $(dirname $0)/test-run.sh 23 | -------------------------------------------------------------------------------- /tests/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id": "org.test.Hello2", 3 | "runtime": "org.test.Platform", 4 | "sdk": "org.test.Sdk", 5 | "command": "hello2.sh", 6 | "tags": ["test"], 7 | "finish-args": [ 8 | "--share=network" 9 | ], 10 | "build-options" : { 11 | "cflags": "-O2 -g", 12 | "cxxflags": "-O2 -g", 13 | "env": { 14 | "FOO": "bar", 15 | "V": "1" 16 | } 17 | }, 18 | "cleanup": ["/cleanup", "*.cleanup"], 19 | "cleanup-commands": [ "touch /app/cleaned_up" ], 20 | "modules": [ 21 | { 22 | "name": "test", 23 | "config-opts": ["--some-arg"], 24 | "post-install": [ "touch /app/bin/file.cleanup" ], 25 | "make-args": ["BAR=2" ], 26 | "make-install-args": ["BAR=3" ], 27 | "sources": [ 28 | { 29 | "type": "file", 30 | "path": "test-configure", 31 | "dest-filename": "configure", 32 | "sha256": "675a1ac2feec4d4f54e581b4b01bc3cfd2c1cf31aa5963574d31228c8a11b7e7" 33 | }, 34 | { 35 | "type": "file", 36 | "path": "app-data" 37 | }, 38 | { 39 | "type": "script", 40 | "dest-filename": "hello2.sh", 41 | "commands": [ "echo \"Hello world2, from a sandbox\"" ] 42 | }, 43 | { 44 | "type": "shell", 45 | "commands": [ 46 | "mkdir /app/cleanup/", 47 | "touch /app/cleanup/a_file" 48 | ] 49 | } 50 | ] 51 | } 52 | ] 53 | } 54 | -------------------------------------------------------------------------------- /triggers/desktop-database.trigger: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test \( -x "$(which update-desktop-database 2>/dev/null)" \) -a \( -d $1/exports/share/applications \); then 4 | exec update-desktop-database -q $1/exports/share/applications 5 | fi 6 | -------------------------------------------------------------------------------- /triggers/gtk-icon-cache.trigger: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test \( -x "$(which gtk-update-icon-cache 2>/dev/null)" \) -a \( -d $1/exports/share/icons/hicolor \); then 4 | cp /usr/share/icons/hicolor/index.theme $1/exports/share/icons/hicolor/ 5 | for dir in $1/exports/share/icons/*; do 6 | if test -f $dir/index.theme; then 7 | if ! gtk-update-icon-cache --quiet $dir; then 8 | echo "Failed to run gtk-update-icon-cache for $dir" 9 | exit 1 10 | fi 11 | fi 12 | done 13 | fi 14 | -------------------------------------------------------------------------------- /triggers/mime-database.trigger: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test \( -x "$(which update-mime-database 2>/dev/null)" \) -a \( -d $1/exports/share/mime/packages \); then 4 | exec update-mime-database $1/exports/share/mime 5 | fi 6 | -------------------------------------------------------------------------------- /uncrustify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | uncrustify -c uncrustify.cfg --no-backup `git ls-tree --name-only -r HEAD | grep \\\.[ch]$ | grep -v gvdb` 3 | --------------------------------------------------------------------------------