Commit Graph

51 Commits (c07bc507794a027d66088d73c0ea3462f8a435db)

Author SHA1 Message Date
Matt Watson ee83b5a70d install: handle arch when installing from a flatpakref
Before this commit
$ flatpak install --arch someArch --from some.flatpakref
Would completely ignore the arch argument and only install for the
default flatpak architecture. Since flatpakref files don't include
an arch field, there's no reason we can't attempt to install the
arch specified on the command line.
2017-01-20 15:28:11 +01:00
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
Mario Sanchez Prada 15e7f14ca3 Adjusted internal representation for storage types of system installations
I set these as separate bits by mistake when there's no good reason for
them to be like that, as they are not flags that are meant to be combined,
but a list of exclusive values.
2016-12-20 09:52:03 +01:00
Mario Sanchez Prada ed1b0e2b23 Add internal API: flatpak_dir_get_name()
This will allow us to refactor some code using in the CLI, when
we want to print the name of a FlatpakDir for detailed listings.
2016-12-17 00:56:10 +00:00
Mario Sanchez Prada a663e5ba73 Add public API: implement the other getters required by GNOME Software
Implemented the following functions along with the required internal APIs:

  * flatpak_installation_get_id ()
  * flatpak_installation_get_display_name ()
  * flatpak_installation_get_priority ()
  * flatpak_installation_get_storage_type ()
2016-12-17 00:32:53 +00:00
Mario Sanchez Prada 34cf626029 Support additional configuration fields for system installations
As per the discussion with GNOME Software maintainer Richard Hughes [1],
we need to support a few additional fields in the configuration files
for better integration with external clients. Thus, this commits adds
support for reading "DisplayName", "StorageType" and "Priority" values
from the configuration files, being all of them optional.

Note: priorities are currently used to sort the system installations
list statically stored in flatpak-dir.c (bigger number, bigger priority).

[1] https://mail.gnome.org/archives/gnome-software-list/2016-December/msg00000.html
2016-12-17 00:32:52 +00:00
Mario Sanchez Prada 9d97382f82 Add internal API: flatpak_dir_get_system_by_id()
It will return a FlatpakDir by ID, according to the configuration.
2016-12-17 00:32:44 +00:00
Mario Sanchez Prada 1858b8987d Add internal API: flatpak_dir_get_id()
This will be used both from the CLI commands and the public API.
2016-12-17 00:32:44 +00:00
Mario Sanchez Prada d27270635a Add internal API: flatpak_dir_get_system_list()
This will return an array of FlatpakDir instances with all the system
installations configured via key files in an optional drop-in directory
under FLATPAK_CONFIGDIR/installations.d, plus the default one.
2016-12-17 00:32:38 +00:00
Mario Sanchez Prada 22e3f83fb6 Remove internal API flatpak_dir_get(gboolean user)
User and system installations is no longer a binary decision, so remove
this API to force explicit calls to either flatpak_dir_get_system_default()
or flatpak_dir_get_system_list() when dealing with system installations.
2016-12-16 19:17:18 +00:00
Mario Sanchez Prada 44a2d73c98 Rename flatpak_get_system_base_dir_location(void) for the default case
It will be called flatpak_get_system_default_base_dir_location() now, to
distinguish it from the one that retrieves all the system directories.
2016-12-16 19:17:16 +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 e1bf3eff52 Flatpak[ref|repo]: Add Version field
If this is set it has to be 1, or we fail.
This lets us later introduce incompatible changes.
2016-12-13 15:54:14 +01:00
Alexander Larsson 9ddc4aca48 Support flatpak install --oci to install apps from OCI 2016-12-12 16:22:16 +01:00
Alexander Larsson bb6e1d535f install: Support RuntimeRepo= key in flatpakref files
This allows an app to point to the repo where the runtime it uses
comes from, and the user will be asked to add that if its not
already configured.
2016-12-02 16:31:14 +01:00
Alexander Larsson a709be6021 install --from: Try to reuse existing remotes
We don't really need to create an origin remote if the same
uri is already there for an enumeratable remote, we can
just reuse that. Having multiple remotes for a single
repository just means we'll be downloading the summary file
multiple times.
2016-10-27 10:18:47 +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 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 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
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 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 c23316cb5d Add FlatpakKinds flag and use instead of booleans 2016-10-14 11:20:53 +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 edac377e86 origin remotes: Store main ref
If you install an app via a bundle of a .flatpakref file then
the ref of the app is also saved with the remote metadata.
2016-09-12 11:58:22 +02:00
Alexander Larsson 71500ae5ec Add support for .flatpakref files
These are similar to .flatpakrepo, but for a single app.

For example, if you have a file gedit.flatpakref with this:

[Flatpak Ref]
Title=GEdit
Name=org.gnome.gedit
Branch=stable
Url=http://sdk.gnome.org/repo-apps/
IsRuntime=False
GPGKey=mQENBFUUCGcBCAC/K9WeV4xCaKr3NKRqPXeY5mpaXAJyasLqCtrDx92WUgbu0voWrhohNAKpqizod2dvzc/XTxm3rHyIxmNfdhz1gaGhynU75Qw4aJVcly2eghTIl++gfDtOvrOZo/VuAq30f32dMIgHQdRwEpgCwz7WyjpqZYltPAEcCNL4MTChAfiHJeeiQ5ibystNBW8W6Ymf7sO4m4g5+/aOxI54oCOzD9TwBAe+yXcJJWtc2rAhMCjtyPJzxd0ZVXqIzCe1xRvJ6Rq7YCiMbiM2DQFWXKnmYQbj4TGNMnwNdAajCdrcBWEMSbzq7EzuThIJRd8Ky4BkEe1St6tuqwFaMZz+F9eXABEBAAG0KEdub21lIFNESyAzLjE2IDxnbm9tZS1vcy1saXN0QGdub21lLm9yZz6JATgEEwECACIFAlUUCGcCGwMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEArkz6VV0VKBa5cH/0vXa31YgEjNk78gGFXqnQxdD1WYA87OYxDi189l4lA802EFTF4wCBuZyDOqdd5BhS3Ab0cR778DmZXRUP2gwe+1zTJypU2JMnDpkwJ4NK1VP6/tE4SAPrznBtmb76BKaWBqUfZ9Wq1zg3ugvqkZB/Exq+usypIOwQVp1KL58TrjBRda0HvRctzkNhr0qYAtkfLFe0GvksBp4vBm8uGwAx7fw/HbhIjQ9pekTwvB+5GwDPO/tSip/1bQfCS+XJB8Ffa04HYPLGedalnWBrwhYY+G/kn5Zh9L/AC8xeLwTJTHM212rBjPa9CWs9C6a57MSaeGIEHLC1hEyiJJ15w8jmY=

You can then install gedit with
  flatpak install --from gedit.flatpakref
2016-09-09 16:50:32 +02:00
Alexander Larsson fbca999cc9 Create /app/(.updated|.removed) file after update/uninstall
This way running apps can easily detect this and restart themselves.
2016-09-06 09:16:04 +02:00
Matthias Clasen 75218c4a65 Fix license headers
We were referring to the nonexisting "version 2" of the
Lesser GPL. It should be "version 2.1".
2016-07-29 14:27:49 -04:00
Alexander Larsson 764cb91cbe Remove workaround for issue #144 now that ostree is fixed
The fix for this is in ostree 2016.7

https://github.com/flatpak/flatpak/issues/144
2016-07-29 01:20:40 +02:00
Alexander Larsson 5da7a0411a lib: Support listing related refs 2016-07-01 10:32:57 +02:00
Alexander Larsson 4a40fece78 Add flatpak_dir_install_or_update
This is needed in the case where we can do any, such as when
installing related refs, which may be already installed.
2016-06-30 16:55:31 +02:00
Alexander Larsson 8293527dbd FlatpakDir: Add flatpak_dir_find_remote/local_related
This lets us find all the "related" refs to a ref in a particular
remote, or locally.  These are the things we should automatically
download or delete when installing/updating/uninstalling the ref.

The implementation currently looks at all the extensions handled by the
app/runtime. For debug extensions and extensions marked no-autodownload we
only consider them related if its already locally installed. For locale
extensions we always consider them related, but we only pull the current
locale data for it.
2016-06-30 16:55:26 +02:00
Alexander Larsson 9be05bc511 common: Remove unused functions 2016-06-29 16:43:02 +02:00
Alexander Larsson 9915e3740b Disable static deltas for system-helper updates
Due to an issue with ostree (https://github.com/ostreedev/ostree/pull/362)
applying non-from-scratch deltas fail when using parent_repo such as
in the system-helper case. We fix this temporarily by disabling the
use of deltas for that case.
2016-06-23 12:16:02 +02:00
Alexander Larsson cfef57e343 Properly handle subpaths on update 2016-06-07 22:12:51 +02:00
Alexander Larsson 8ef84cc3d1 Move shared bundle install code to flatpak_dir_install_bundle 2016-06-03 14:30:25 +02:00
Alexander Larsson 13707f6b18 system-helper: Support directly pulling local remotes
For a local (file:// uri) remote, do an (untrusted) direct pull instead
of pulling into the users cached repo first. This way we do less copies,
as well as guaranteeing the source of the data. The later means its
mostly safe to also allow this for non-gpg signed remotes.
2016-06-02 15:30:08 +02:00
Alexander Larsson eeaa832095 Replace bash completion shell script with C-based version
This doesn't do everything yet, but its got the basics covered.
2016-05-27 16:30:13 +02:00
Alexander Larsson 910328e535 Support no-deploy and no-pull via system helper 2016-05-20 13:30:50 +02:00
Alexander Larsson 251dcdb680 system-helper: Never use a system helper recursively 2016-05-17 11:54:44 +02:00
Alexander Larsson 1504f7bd7f system-helper: Support add/modify/delete of remotes 2016-05-13 16:23:43 +02:00
Alexander Larsson 2875cdead5 remote-delete: Move to FlatpakDir and add checks for installed refs
You can't remove a remote unless you --force or there are no installs
from it.
2016-05-13 14:17:46 +02:00
Alexander Larsson 753cdc97fd Fix typo: flatpak_dir_modify_remove -> flatpak_dir_modify_remote 2016-05-13 13:59:48 +02:00
Alexander Larsson 5407b8efc6 system-helper: Support uninstall 2016-05-12 21:23:36 +02:00
Alexander Larsson fe0a1be5f8 common: Add flags for flatpak_dir_uninstall
This is better than a list of booleans.
2016-05-12 19:52:48 +02:00
Alexander Larsson c5e178f339 Use flatpak_dir_uninstall for app and lib 2016-05-12 17:18:14 +02:00
Alexander Larsson 2ef6d9d5d9 common: Remove FlatpakDirError in favour of FlatpakError from the lib 2016-05-12 16:43:16 +02:00
Alexander Larsson 9e4bb25b2c modify-remote: Move the actual config rewriting to FlatpakDir
This is in preparation for doing this in the system helper.
2016-05-11 15:43:40 +02:00
Alexander Larsson 1877f0be8d system-helper: Add support for updating appstream branch 2016-05-11 10:35:24 +02:00