Commit Graph

94 Commits (7f31a1acae8f9825ccd083cf450cf411e467fb68)

Author SHA1 Message Date
Alexander Larsson f20e5f7823 bundles: Support dependencies and runtime-repo
If the bundle contains an origin link we can now install related
things from it, such as locale data.

You can also build the bundle with --runtime-repo=URL, where the url
points to a flatpakrepo file for a repo with runtimes. This works
similar to the RuntimeRepo= feature in flatpakref files.
2016-12-20 16:27:57 +01:00
Alexander Larsson 5a12917a2f oci: Fix leak in flatpak_pull_from_oci 2016-12-19 14:19:41 +01:00
Alexander Larsson f92f233758 flatpak_bundle_load: Fix leak 2016-12-19 14:19:41 +01:00
Mario Sanchez Prada 81492a352a Migrate flatpak-<utils|transaction>.c to flatpak_dir_get_system_list()
We need to traverse now the full list of system directories, as
defined in /etc/flatpak/installations.d, not just the default one.
2016-12-17 00:32:45 +00:00
Mario Sanchez Prada 521c3fcd4b Rename flatpak_dir_get_system() into flatpak_dir_get_system_default()
There will be a way to retrieve the list of all system installations,
not just the default one, so we rename this for backward compatibility.

Note that some (most?) of the places where we will be now using this
renamed function will likely have to migrate to using specific system
installations, but we don't have the necessary APIs yet so we do this
as an initial step to all the incremental changes that will come next.
2016-12-16 19:17:13 +00:00
Alexander Larsson da897250cc Avoid interactive prompts when redirected, assume no 2016-12-13 11:45:16 +01:00
Alexander Larsson 1e854ddc11 Fix all clang warnings 2016-12-13 10:20:28 +01:00
Alexander Larsson 9ddc4aca48 Support flatpak install --oci to install apps from OCI 2016-12-12 16:22:16 +01:00
Alexander Larsson 53c28de636 utils: Add VARIANT_BUILDER_INITIALIZER and new_empty_string_dict 2016-12-12 12:23:13 +01:00
Alexander Larsson cf0cd287c6 Add flatpak_table_printer_add_column_len 2016-12-12 12:22:50 +01:00
Alexander Larsson aa9640af7e Add flatpak_pull_from_oci helper 2016-12-09 14:44:25 +01:00
Alexander Larsson 186ff0f002 Add flatpak_download_http_uri util function 2016-12-08 16:41:20 +01:00
Alexander Larsson 9865ed8989 utils: Disable automatic gzip content decoding in session
This was interacting badly with the OCI layer downloading, by
automatically uncompressing the gzip:ed layers.
2016-12-08 16:41:20 +01:00
Alexander Larsson e514dc2e14 Add flatpak_create_soup_session 2016-12-08 16:41:20 +01:00
Alexander Larsson ddb40187c6 Fix various leaks found by valgrind 2016-11-28 15:17:04 +01:00
Alexander Larsson ca99d5be58 build-init: Give error if initializing with a partial dependency
If you're building a runtime and have a base runtime with expected
extensions, fail to build if the actually installed extension is
partial (i.e. if it has a subdir specified).

Fixes https://github.com/flatpak/flatpak/issues/390
2016-11-15 11:11:00 +01:00
Alexander Larsson 18ad54b4a0 utils: Add utils to read and resolve symlinks 2016-11-11 22:17:56 +01:00
Alexander Larsson 9a2e68406c flatpak_number_prompt: Add missing va_end 2016-11-11 10:44:11 +01:00
Alexander Larsson 6c0fd7d16c flatpak_yes_no_prompt: Add missing va_end 2016-11-11 10:43:27 +01:00
Jan Jedelský 47e9283450 Add support for unmaintained extensions (#361)
See https://github.com/flatpak/flatpak/issues/167
2016-10-25 10:25:15 +02:00
Alexander Larsson 4bea82a608 update-repo: Collect extra-data sizes for the summary 2016-10-21 08:57:42 +02:00
Alexander Larsson 906b3b5871 dir: When pulling/deploying an app, support xa.extra-data-sources
If the downloaded app has a "xa.extra-data-sources" property in
the commit, then we download these as part of the pull operation
and store the result in the commitmeta object in the repo.

Then during deploy we look at the xa.extra-data-sources properties
again and extract them from the commitmeta into /app/extra
in the app, and afterwards we run /app/bin/apply_extra in a minimal
sandbox that has read-write access to /app/extra, but nowhere else.

There are some complexities:

We need to re-verify when extracting, because the commitmeta is not
really signed, so we could have picked up random stuff there
from the upstream repo, or from an attacker misusing the system-helper
local install codepath.

When using the system-helper the pull will fail if the commitmeta
is to large, so we have some code in this case to manually transfer
the larger commitmeta on the side to the local-pull code.
2016-10-21 08:57:42 +02:00
Alexander Larsson 9c3f77da3a utils: Add flatpak_load_http_uri helper function 2016-10-21 08:57:42 +02:00
Alexander Larsson 28261d839e update/install: Install/Update runtime dependencies as needed
When an application requires a runtime that is not installed, search
for it and prompt for permissions to install it. Also, update required
runtimes when the app is being updated.
2016-10-19 12:40:49 +02:00
Mario Sanchez Prada 81d1bef4a0 Support --default-branch when updating the repository summary file
Add support for this flag in build-update-repo, so that we can define
a default branch in the server side, to be picked by the clients.

https://github.com/flatpak/flatpak/issues/221
2016-10-14 16:23:15 +01:00
Alexander Larsson 70e9b2c737 update: Support specifying multiple arguments 2016-10-14 16:39:10 +02:00
Alexander Larsson 7018717ce2 install: Support installing multiple apps at the same time
Instead of using "NAME [BRANCH]" as the command list we now
support REF..., where each REF can be partial. This is easiest
explained by examples. Here are some valid refs:

  org.test.App - only app id
  app/org.test.App/x86_64/stable - full ref
  org.test.App/x86_64/stable - full ref without prefix
  org.test.App - only app id
  org.test.App//stable - only branch
  org.test.App/x86_64 - only arch

If any parts are left out they are wildcarded. Such parts are filled
first by looking at other command line arguments like --arch and
--app/--runtime. And finally by looking at what is available in the
remote. If there are multiple matches the user is told the options
in an error message.
2016-10-14 15:45:16 +02:00
Alexander Larsson c3606392aa common: Make flatpak_split_partial_ref_arg more regular and capable
Instead of in-place editing we return proper new strings. We
also handle kinds, both the defaults and supporting app/ and runtime/
prefixes.
2016-10-14 12:08:37 +02:00
Alexander Larsson c23316cb5d Add FlatpakKinds flag and use instead of booleans 2016-10-14 11:20:53 +02:00
Alexander Larsson 8fd165074c bundle: Properly handle byteswapping 2016-10-06 12:31:54 +02:00
Alexander Larsson 63638583b0 Change app-id rules again, now only allow dashes in last element
It turns out that live apps were exporting files with dashes
other than "-symbolic". For instance "org.libreoffice.LibreOffice" was
exporting "org.libreoffice.LibreOffice-writer.desktop".

Allowing any dashes in the last segment like this is really no diffent
than allowing org.libreoffice.LibreOffice.writer.desktop which we
already do. Any conflicts here are under the control of the owner
of the org.libreoffice prefix.

However, allowing dashes in the earlier segments is more problematic.
For instance, any file exported by "org.my-foo.App" could conflict with
an app called "org.my" if this was allowed.

So, as a middle ground, we're allowing dashes in the last segment of
the App id only.
2016-10-06 11:36:28 +02:00
Alexander Larsson af76206ba5 common: Add flatpak_variant_builder_init_from_variant 2016-09-27 12:39:27 +02:00
Alexander Larsson 5c075525a8 Allow application ids containing "-"
For a long time we have been disallowing "-" in application names,
which is different than what dbus allows for bus names. Also "-" used
to be not allowed by GApplication in glib. This is in part because
dbus object paths do *not* allow dashes, so you can't legally map
from e.g. a valid name like "org.foo-bar.gazonk" to a valid path
like "/org/foo-bar/gazonk".

This is a problem because many existing apps already use "-" in the
name, either as the last part (org.gnome.font-viewer) or because
the dns name it refers to has a dash.

This was recently discussed in the dbus community, and the result
is to recommend that "-" in the bus names be converted to "_" in object
paths.

This change makes it also allowed to have "-" in a flatpak app id.

For flatpak specifically we were relying on "-" not being allowed to
handle the case of exporting "org.foo.App-symbolic.png". If "-" is
allowed this name can conflict between apps called "org.foo.App-symbolic"
and "org.foo.App".

To handle this we add two special cases:
 * App ids can't end with "-symbolic".
 * Apps are allowed to export files with $appid-symbolic as prefix.
2016-09-16 16:44:05 +02:00
Sebastian Rasmussen b21f4bf542 Prefer g_strerror() to strerror()
It handles encodins better, is thread-safe and more portable.
2016-09-15 01:22:54 +08:00
Alexander Larsson 1d1189aeab Fix crash if completing with NULL shell_cur
This happens if you do e.g.
  flatpak complete "flatpak install " 11

Reported by aki237
2016-09-14 14:31:33 +02:00
Matthias Clasen 06c7aca9f9 Make flatpak_is_valid_branch set a GError
Return detailed information about the problem with the branch in
the GError. Update all callers.
2016-09-13 13:28:42 -04:00
Matthias Clasen fe91657a44 Update the docs
Update the doc comment for flatpak_is_valid_name to reflect
current reality.
2016-09-13 13:15:41 -04:00
Matthias Clasen 687cae783e Always set an error when failing name validation
This was an oversight in the previous patch to improve
name validation error messages.
2016-09-13 13:13:43 -04:00
Matthias Clasen b2b281e485 Make flatpak_is_valid_name set a GError
Return detailed information about the problem with the name in
the GError. Update all callers.
2016-09-12 23:25:54 -04:00
Alexander Larsson fba645a999 Remove unused local variables reported by clang 2016-09-12 11:11:35 +02:00
Alexander Larsson 6689c5c7f1 Switch back to mtime==0 for ostree checkouts
OSTree upstream changed back from mtime 1
2016-09-09 09:22:56 +02:00
Alexander Larsson e16ca25a67 utils: Change flatpak_invocation_lookup_app_id to lookup_app_info
This lets you get the entire app info rather than just the id.
For host processes you'll get an empty info with just an empty
name.
2016-09-08 12:37:32 +02:00
Alexander Larsson 4408468e78 common: Remove leftover spew 2016-09-08 12:36:11 +02:00
Alexander Larsson 0d22bad5e6 document-portal: Detect remote peer app id using flatpak-info
This drops the requirement on unprivileged cgroups, and thus the
dependency on systemd --user.
2016-09-08 11:24:10 +02:00
Alexander Larsson aafc0f3b66 run/metadata: Add support for --allow=devel
This enables support for ptrace and perf for the app, similar
to what run -d manually gave you before. This is nice to be
able to package an app like gnome-software.
2016-09-05 21:41:14 +02:00
Alexander Larsson ff6839a291 utils: Add flatpak_is_in_sandbox() helper 2016-09-05 11:54:12 +02:00
Alexander Larsson e50f7a363f build-update-repo: Reuse cache info from old summary
This makes rebuilding partial changes much faster.
2016-09-02 11:13:11 +02:00
Alexander Larsson ba377b29e6 common: Add utility function to load summary file from local repo 2016-09-02 11:10:29 +02:00
Dan Nicholson d2d9804187 utils: Only collect cache data once per revision
If there are multiple refs pointing to the same revision, then
collecting the size and metadata info for each of them is wasteful.
Maintain a hash table of the data so that it's only collected once per
revision.

This slightly widens an existing race where a ref could be updated
before the summary file is regenerated. In that case, the data in the
xa.cache variant would correspond to the wrong revision. I don't believe
this can be fixed unless there's locking at the ostree level.
2016-09-01 10:11:13 -07:00
Dan Nicholson e86ae01ba0 utils: Only update summary info for flatpak refs
If there are non-flatpak refs in the ostree repo, there's no use in
collecting size or metadata information for them. Instead, only operate
on refs in the appstream, app or runtime prefixes.
2016-09-01 10:11:13 -07:00