Commit Graph

2024 Commits

Author SHA1 Message Date
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
db6f65b336 Merge pull request #368 from mariospr/glib-dep
Use g_key_file_load_from_data() instead of g_key_file_load_from_bytes()
2016-10-24 13:24:53 +02:00
Mario Sanchez Prada
dbaaf65d3b Use g_key_file_load_from_data() instead of g_key_file_load_from_bytes()
The g_key_file_load_from_bytes() function was added in GLib 2.50, and that
is too high as flatpak wants to support centos7/rhel7, which is now in 2.42.
2016-10-24 11:45:57 +01:00
Alexander Larsson
173897c544 Require OStree 2016.12 for new features and fixes
We want to use the new transactioned detached metadata support,
multi-subdirs pull, and inherit-transactions on pull. Also, there are
some fixes we like.
2016-10-22 10:11:09 +02:00
Alexander Larsson
509a358ba3 Make looks_like_branch better
Fixes https://github.com/flatpak/flatpak/issues/359
2016-10-21 21:42:37 +02:00
Alexander Larsson
c3bea6c8fc remote-add: Assume --from if location ends with .flatpakrepo
If you try to set the flatpakrepo uri as a repo uri for a new remote
things get really confused, so lets try to do the right thing anyway.
2016-10-21 12:46:38 +02:00
Alexander Larsson
eb92727f65 tests: Add some more verification to the bundle tests 2016-10-21 10:30:20 +02:00
Alexander Larsson
25e39dfddd build-finish: Add --extra-data= argument 2016-10-21 08:57:42 +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
f3c71cfbf8 build-export: Read Extra Data section and put in commit metadata
If you put a section like:

[Extra Data]
uri=https://sdk.gnome.org/gno%6De.flatpakrepo
checksum=ace1b504d32eefdf05b53044e6f785fe7886cc5657b5df034c3b9ac8e3aeb70c
size=1335
uri2=http://sdk.gnome.org/gedit.flatpakref
checksum2=d8baa109fb5fdcfe90379f3e93c5ab29f11772b42bf569bb3481e4aff489b0dd
size2=1472
name2=renamed.flatpakref

Then this information will be put in the commit object and the
later will be used when downloading the app.
2016-10-21 08:57:42 +02:00
Alexander Larsson
0695712152 lib: Don't list updates from disabled remotes 2016-10-21 08:46:57 +02:00
Alexander Larsson
daa2d79fd1 transaction: Fix error reportin in case an update fails 2016-10-20 14:26:38 +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
1ea064c9b0 update: Add back support for --commit= 2016-10-19 18:12:50 +02:00
Alexander Larsson
f117985e37 remote-add: Make --from a boolean arg instead of a string arg
So before you did:
 flatpak --user remote-add --from=https://sdk.gnome.org/gnome.flatpakrepo gnome
Now you do:
 flatpak --user remote-add --from gnome https://sdk.gnome.org/gnome.flatpakrepo

This is a somewhat break, but this means we handle --from the same in
remote-add and install, which seems important.
2016-10-19 18:00:12 +02:00
Alexander Larsson
4c037b5381 install: Support http uris in install --from
This means you can do this:
     flatpak --user install --from https://sdk.gnome.org/gedit.flatpakref
2016-10-19 17:50:39 +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
944c1d58c7 tests: Add suppression for ostree static delta valgrind issue
I filed this upstream as:
 https://github.com/ostreedev/ostree/issues/533

Lets ignore it for now so we can use valgrind tests for the flatpak
parts.
2016-10-19 13:21:29 +02:00
Alexander Larsson
5e4f46f9c2 tests: Make the valgrind based checks default to not checking for leaks
Use FLATPAK_TESTS_VALGRIND_LEAKS to check for leaks.
We're not currently passing the leak checks, so this helps letting
us make valgrind checks useful.
2016-10-19 13:13:30 +02:00
Alexander Larsson
68a0e7f8f5 build-finish: Fix usage output
It was using the build-bundle output instead.
2016-10-19 12:53:16 +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
e1527c9347 system-helper: Correctly return ALREADY_INSTALLED error on noop deploy
This was breaking the test suite
2016-10-19 12:41:08 +02:00
Alexander Larsson
c70c453eab remote-add: Support installing .flatpakrepo files from http uri 2016-10-19 12:41:08 +02:00
Alexander Larsson
0999def431 uninstall: Only try to uninstall related apps that are installed 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
3b461a6c5a Merge pull request #354 from mariospr/default-branch
Only override the default branch, if needed, after splitting a ref
2016-10-18 12:11:56 +02:00
Mario Sanchez Prada
5c1bf1e3d9 Only override the default branch, if needed, after splitting a ref
Otherwise we'll be always trying to force the installation from the
default branch for a repo, regardless of whether the app being
installed is available for that branch.
2016-10-18 11:09:02 +01:00
Alexander Larsson
0f05143227 builder: Handle the case where the source directory is in a symlink
It can happen, like in https://github.com/flatpak/flatpak/issues/353
that there are references in the source to the absolute source path.
We need to ensure that is visible in the build. We mostly do this,
but for technical reasons it didn't get the same pathname when
the source was inside a symlinked directory. We fix this with an
extra bind-mount to the symlinked directory name too.

This fixes https://github.com/flatpak/flatpak/issues/353
2016-10-18 11:06:43 +02:00
Alexander Larsson
6345f0bae7 build-finish: Support exporting more than hicolor icons
We really want apps to be able to export e.g. HighContrast icons too.
2016-10-18 10:14:10 +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
e8cf8be8ab install: Check that runtime is installed before installing app 2016-10-17 17:54:35 +02:00
Alexander Larsson
9bb630d674 update: Don't reorder arguments 2016-10-17 17:33:10 +02:00
Alexander Larsson
b2cc643f2c install: Actually handle more than two REFs 2016-10-17 17:28:28 +02:00
Alexander Larsson
d248f0887b install: Don't print error if related refs were already installed 2016-10-17 17:28:09 +02:00
Alexander Larsson
aa081420a4 Fix whitespace issues 2016-10-17 17:27:51 +02:00
Alexander Larsson
8df193bc37 update: Fix completion of options 2016-10-17 17:27:34 +02:00
Alexander Larsson
ee0ffbcb35 uninstall: Support multiple REFs 2016-10-17 17:27:16 +02:00
Alexander Larsson
5b11c03adc install: Don't override default_branch specified on commandline
Fixes issue pointed out in review at:
 https://github.com/flatpak/flatpak/pull/345
2016-10-17 12:34:32 +02:00
Alexander Larsson
0abdcd3f03 Merge pull request #345 from mariospr/issue221
Add server-side support for default-branch for remote repositories
2016-10-17 12:31:07 +02:00
Alexander Larsson
b337c95d78 dbus proxy: Tight down what is allowed to send to the bus
Make sure we can only send message calls (not e.g. unicast signals)
to the bus. Also, whitelist the list of allowed interfaces to
org.freedesktop.DBus and org.freedesktop.DBus.Introspectable

See https://github.com/flatpak/flatpak/issues/343 for the origin
discussion of this.
2016-10-17 12:19:46 +02:00
Alexander Larsson
4cb3f7fd79 builder: Support application inheritance
When initializing a build you can initialize the application directory
with the files from another directory, and optionally a set of its
extensions. This allows one to create a "base" application that
can be derived from in multiple forms. A typical example is an application
framework like Electron. The base electron app has all the dependencies
needed to write Electron app, and then your manifest can add the specific
files needed for your application.

An example snipped could look something like:

    "base": "org.base.App",
    "base-version": "stable",
    "base-extensions": ["org.base.app.Locale", "org.base.app.Debug" ],
2016-10-17 11:40:57 +02:00