421 Commits

Author SHA1 Message Date
Alexander Larsson
95bab6cd91 common: Minor whitespace cleanup 2016-10-25 10:29:51 +02: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
6f1709c849 install: Show entire ref in the multiple-branches error message 2016-10-24 15:34:59 +02:00
Alexander Larsson
32d5418605 Don't use the system-helper if disabled
I.e. if there is a system-installed helper, then we should not use
it if flatpak was built without the system helper.
2016-10-24 15:27:42 +02:00
Alexander Larsson
01a68e697b Work around ostree partial commit issue
This works around:
  https://github.com/ostreedev/ostree/issues/541

Which is causing us to not pull the entire set of objects, rather
stopping at the first object which is locally available. We fix
this by pulling twice in the subdirs != NULL case, which works
because the second time the new commit is marked partial and
we then pull the entire thing.
2016-10-24 14:36:19 +02:00
Alexander Larsson
f673d544c9 Use ostree pull inherit-transation to make extra-data transactional
This means we will not end up with a partial download if something
goes wrong during the extra-data download, because we don't
commit the downloaded base files until everything is finished.

Note, this requires the latest ostree for this feature.
2016-10-24 14:36:19 +02:00
Alexander Larsson
87cc951f4a Use the new ostree argument to pull multiple subdirs in a singe pull 2016-10-24 14:36:19 +02:00
Alexander Larsson
d7a102210f extra-data: After applying extra-data, export any exports 2016-10-21 08:57:42 +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
9a45517536 update: Make --commit=ID actually download that commit
Before it would fail if the commit wasn't accidentally locally.
2016-10-20 09:15:10 +02:00
Alexander Larsson
041d3eeb39 Add generic static permissions to metadata
This allows you do do something like
  flatpak build-finish --add-policy=subsystem.key=v1 --add-policy=subsystem.key=v2

Which maps to this metadata keys:

[Policy subsystem]
key=v1;v2;

You can also --remove-policy to remove values from a key.

The policy values are parsed from the app and runtime metadata, and
are overridable by per-app overrides and on the command line, however
the values are never used by flatpak. They do end up in the flatpak-info
file for the running application though, so external agents can look
at them.

These
2016-10-19 20:39:17 +02:00
Alexander Larsson
27654ceb2f FlatpakDir: Fix timeout of summary cache
There was a msec/usec mismatch in the code that made
the summary cache time out 1000 times to soon.
2016-10-19 18:39:11 +02:00
Alexander Larsson
f9c1cc40bb run: Support running a runtime directly
This means you can do:
  flatpak run org.freedesktop.Sdk
to get a shell in a sandbox with that runtime, but with an
empty /app.

You can also specify a particular runtime branch and command like so:
  flatpak run --command=ls org.gnome.Platform//3.22 /
2016-10-19 17:33:00 +02:00
Alexander Larsson
89244ee71f system-helper: Add debug spew for all system helper calls
This helps when debugging failures.
2016-10-19 12:41:08 +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
Alexander Larsson
b2af78fb6f remotes: Add no-use-for-deps property
If this is set for a remote we will never automatically look for
dependencies in it. This makes dependency search faster, as we
don't need to search in app-only remotes.
2016-10-19 11:34:22 +02:00
Alexander Larsson
94295873e9 Summary cache: Fix valgrind report
We need to use g_hash_table_replace() to avoid the old freed key being
left in the hashtable.
2016-10-19 11:34:22 +02:00
Alexander Larsson
3c2b8a92b1 FlatpakDir: Fix leak in fetch_remote_title/default_branch
We were not freeing the GVariant returned by g_variant_dict_end.
In fact, we don't need the GVariantDict at all.
2016-10-18 10:10:03 +02:00
Alexander Larsson
cb744c2d13 tests: Fix assert comming from ostree
It seems that ostree_repo_remote_fetch_summary asserts if you
pass a NULL error, so lets not do that.
2016-10-18 10:09:09 +02:00
Alexander Larsson
aa081420a4 Fix whitespace issues 2016-10-17 17:27:51 +02:00
Mario Sanchez Prada
7e5f2580a6 New internal API to update configuration of remotes from their summary file
The new function flatpak_dir_update_remote_configuration() can be called
to fetch the contents of the summary file from the remote's source location
and update the local configuration in the installation directory accordingly.

For now, only the xa.title and xa.default-branch configuration parameters
are supported, since those seem to be the only relevant ones at the moment.
2016-10-14 16:42:17 +01:00
Mario Sanchez Prada
44dcc77a18 Check and use the remote's default branch when installing flatpaks
If no branch is explicitly stated when installing a flatpak, and several
options (branches) are available for the same ID, we now check the remote's
default branch and use that one, if it's defined and available for the app.

https://github.com/flatpak/flatpak/issues/221
2016-10-14 16:42:17 +01: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
Mario Sanchez Prada
7ed464834f Refactor code for fetching the remote's title and the default branch 2016-10-14 16:23:15 +01:00
Mario Sanchez Prada
c492def9a7 Fetch the default branch when adding a remote from its repo's summary file
Just like we do with the title, fetch the default-branch from the
repository's summary file and use that information when adding a
remote reference from the command line.

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
a5d1f6331b install: Better not-found error message
This adds more details about what was not found
2016-10-14 13:25:58 +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
972442a7b0 Don't assign unused variables 2016-10-06 12:31:54 +02:00
Alexander Larsson
5be7e4deb7 common: Remove unused variables 2016-10-06 12:31:54 +02:00
Alexander Larsson
bef4de5308 Support default-branch setting in remote configuration
For now this is a purely client side setting which lets you store
the default branch to use for a remote. This is mostly meant to
be used for UI tools, although the CLI could also be made to use this.

You can set this manually in the CLI with --default-branch, or via a
flatpakrepo file (new key DefaultBranch).
2016-10-06 11:36:28 +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
Adrian Perez de Castro
6cbf3b6c01 Support mixed (multilib/multiarch) binaries in Flatpaks
This adds a new "multiarch" feature which allows bundling e.g. 32-bit
binaries to be run in a x86_64 environment. By default, the seccomp
filter is configured to allow only the native architecture. When the
"multiarch" feature is enabled, the filter will be configured to allow
running binaries of additional architectures supported. For x86_64, this
allows x86 32-bit binaries; and for Aarch64, allows 32-bit ARM binaries.

Application bundles can use the feature e.g. in order to ship 32-bit
binaries alongside with a mostly-64-bit application. This is particularly
interesting when for applications that might launch themselves prebuilt
programs for which 64-bit versions do not exist. For example, the Steam
application is available as a 64-bit executable, but some of the games
available are 32-bit only. A Flatpak bundle for the Steam application
with "multiarch" enabled is able launch the 32-bit games -- without the
feature enabled, the seccomp filter would prevent them from running.

Multiple-architecture support is enabled by adding the "multiarch" value
for the "features" key in the metadata file for a Flatpak:

  [Context]
  features=multiarch;

The corresponding "--allow=multiarch" command line option is supported
in "flatpak build-finish" as well.
2016-10-03 09:54:05 +02:00
Alexander Larsson
c9c35133c3 Add support for --device=kvm
Solves: https://github.com/flatpak/flatpak/issues/332
2016-09-30 16:46:51 +02:00
Alexander Larsson
af76206ba5 common: Add flatpak_variant_builder_init_from_variant 2016-09-27 12:39:27 +02:00
Alexander Larsson
636130db49 Merge pull request #299 from matthiasclasen/keyring
flatpak should close up access to kernel keyring
2016-09-21 07:12:30 +02:00
Alexander Larsson
acc561c6fc Add versioning info to the appinfo file. 2016-09-19 16:33:48 +02:00
Alexander Larsson
9e6421d0d9 common: Accept empty/no url in modify_remote
This means that the remote is there, but disabled.
This is needed for e.g. bundles without origin url, and when bundles
starting using this codepath this regressed like in:
 https://github.com/flatpak/flatpak/issues/314
2016-09-19 16:27:54 +02:00
Matthias Clasen
2bfb1b435a Don't allow access to the kernel keyring
For now, we don't use the kernel keyring for anything, so it is
better to shut off the access to it.
2016-09-18 16:50:32 -04: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
135476e69a run: Print errno error code consistently
Commit 352e761c0e started the trend
to print the errno error code when unable to open a file, make all
occurrences where files are opened print the same kind of message.
2016-09-15 01:23:05 +08: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