Commit Graph

588 Commits

Author SHA1 Message Date
Alexander Larsson
0b34a4ef6f OCI: Set arch when exporting oci bundle 2017-09-25 15:47:51 +02:00
Alexander Larsson
20fd641983 Disable flatpak remote-add --oci by default
There are some changes needed to who automatic installation from OCI
repositories work that need to happen in the future. In order to not
"break" this support in a future stable release, we disable the adding
of oci repos unless the FLATPAK_ENABLE_EXPERIMENTAL_OCI environment
variable is set.
2017-09-22 10:15:58 +02:00
Sam Spilsbury
7be94770e3 builtins: Correctly support --no-pull option in install command
Previously we would still try to look up the remote information
to get the correct ref, this might not be supported in a case where
the user does not have an internet connection at the time that
applications are to be installed from the local repository.
2017-09-20 09:07:18 +02:00
Alexander Larsson
7eece97d3c build: Add --with-appdir
If specified, this exposes the ~/.var/app/$appid to the build
sandbox. Useful when testing uninstalled builds.
2017-09-19 11:52:27 +02:00
Alexander Larsson
66670cca4b Don't use an a11y bus proxy for flatpak build
This is unnecessarily expensive and very unlikely to be used.
2017-09-14 08:56:43 +02:00
Matthew Leeds
ee8101f9ee install: Use bash completion for file names
Since flatpak can now install from *.flatpak and *.flatpakref files
rather than just remotes, show those files in the bash completion of a
"flatpak install ..." command.

Fixes https://github.com/flatpak/flatpak/issues/672
2017-09-12 16:14:43 +02:00
Matthew Leeds
037a13cde0 completion: Make filename completions smarter
Many flatpak commands only work on *.flatpak or *.flatpakref files, so
the bash auto completion showing every file is distracting and
unnecessary. This commit makes flatpak only show relevant files when
possible by using the "-G globpattern" compgen option.
2017-09-12 16:14:43 +02:00
handsome-feng
9f7667e698 Show update-able apps/runtimes but dont download or install (#985)
* Show update-able apps/runtimes but dont download or install
2017-09-04 14:23:55 +02:00
Alexander Larsson
de4b6840d2 Initial work on accessiblity support
This creates a dbus proxy for the a11y bus and sets AT_SPI_BUS_ADDRESS in the
environment to the filtered bus.

The app is only allowed to send a very limited amount of messages to
org.a11y.atspi.Registry on the bus, and nothing else.

This requires a patch to at-spi2-core to read the address from
AT_SPI_BUS_ADDRESS:
     https://github.com/flatpak/freedesktop-sdk-images/blob/1.6/at-spi2-core-address-env-var.patch

Fixes https://github.com/flatpak/flatpak/issues/79
2017-09-01 15:36:29 +02:00
Alexander Larsson
75d7e76276 build: Add --die-with-parent option and drop it by default
We no longer use bwrap --die-with-parent by default, because it has
problems due to the semantics of PR_SET_PDEATHSIG. In particular, it
will kill bwrap as soon as *any* thread in the parent exits, not just
the main one.

This caused weird problems in gnome-builder, as seen in:
 https://bugzilla.gnome.org/show_bug.cgi?id=783950#c14

It should be safe to use this from single-threaded apps though,
so flatpak-builder can still use it. It just has to explicitly
enable it.
2017-08-30 11:21:28 +02:00
Alexander Larsson
0da103748a flatpakref: Add new SuggestRemoteName key support
If a flatpakref has this set, for instance:

 SuggestRemoteName=gnome-apps

Then flatpak install will ask if you want to configure
this as a "real" remote, rather than an origin remote (which
will only install that app).

This is useful when creating flatpakref files for remotes
that have multiple applications in them, such as e.g. flathub
or the gnome nightly builds. However, it should not be
set of one-application repositories.
2017-08-28 18:17:58 +02:00
Alexander Larsson
02894b2202 common: Create remote_is_already_configured() helper
This will be reused later
2017-08-28 17:47:01 +02:00
Alexander Larsson
1aadc3ee40 build: Fix issues when symlinks in / point into /var
Set up /var to $appdir/var binding after all the other filesystem
setup has happened. Before we did not do this, so a link from e.g.
/foo to /var/foo would be created in the appdir var rather than the tmpfs
var, which would fail with EEXIST the second time because that directory
is persisted.

In particular, this was problematic on endless os where /var/home is
a symlink.
2017-08-18 17:06:03 +02:00
Alexander Larsson
326507602c build-update-repo: Don't remove next-to-last deltas
When creating a new commit of an app, we create deltas of it and from
its parent to it, and remove all other deltas. This can be problematic
during the switchover to the new delta, because some active operation
may be using the current delta when its deleted.

We fix this by keeping the parent and grandparent-to-parent deltas
around (but we never *generate* them).
2017-08-18 15:53:09 +02:00
Philip Withnall
b6828cda31 repo-update: Disallow changing collection IDs
Emit an error message if the user tries to change the collection ID of
an existing repository between two non-empty values. Allow them to set a
collection ID where one was not set before. Changing the collection ID
once it’s already been set will break updates for all clients who have
previously pulled from the repository.

If a developer really wants to change the collection ID for a
repository, they’re going to have to recreate the repository from
scratch.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
5c0eef7bde remote-add: Verify that GPG is enabled if collections are
Emit an error message if a collection ID is specified but GPG is not
enabled, since pulling using collection IDs requires GPG.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
e5e52b4b79 common/utils: Allow collection-id to be updated from repo config
In order to provide a transition path for repositories to add collection
IDs to themselves and propagate those collection IDs to clients’ remote
configurations, add another repo config key which controls whether the
repository’s collection ID is published. If xa.collection-id is set in
the repo’s published metadata, the client will update its configuration
to the given ID — but only if no ID is set already. This is a one-time
transition to prevent malicious repositories from remotely changing the
user’s configuration to associate their remote with a well-known
collection ID they don’t own.

Add a test for this.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
bc0f90764e common/dir: Fix error handling for flatpak_dir_lookup_repo_metadata()
It can return FALSE with an error set, or FALSE without one set, which
indicates the key was not found.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
a220fd3cd3 app/repo: Load repository metadata from ostree-metadata ref if possible
Newer repositories will store metadata there, rather than in the summary
file (although the summary file will still be updated where possible for
backwards compatibility).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
024d835460 common: Support unsigned summary files and separate repo metadata
In order to eliminate some race conditions around updating the
summary{,.sig} file on the server, and to decouple signing the summary
from signing commits, and to support peer to peer mirrors of content
from multiple upstream collections: add support for unsigned summary
files.

This relaxes the requirement for gpg-verify-summary=true iff
collection-id is set in a remote’s local configuration. It depends on
some pending libostree changes to verify the ref for each commit using
the commit’s signed metadata. See
https://github.com/ostreedev/ostree/issues/983.

Metadata storage has moved from the summary file to a new
ostree-metadata well-known branch on each repository, since this can be
signed for each update and for each collection separately. If the
collection-id is set in a remote’s local configuration, flatpak will
retrieve all repository metadata from this branch rather than from the
summary file. If collection-id is unset, it will ignore this branch and
continue to use the summary file, which will continue to be updated (and
externally signed as summary.sig) for backwards compatibility.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
ae7d960372 common: Support collection IDs in flatpak{ref,repo} and bundle files
These are loaded from the ref/repo/bundle metadata and added to the new
remote configuration.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
f3c898da05 app: Add support for collection IDs to built-in flatpak commands
This sets the collection ID on remote configs and in commit metadata
when building flatpaks.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
30a5cf8136 common: Support collections in check_for_updates() and forward the results
Search for updates on peer to peer sources as well as the internet in
check_for_updates(), and pass the resulting OstreeRepoFinderResult array
to the pull() calls, so a consistent set of checksums are pulled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Matthias Clasen
776f3b17b9 Merge pull request #922 from chergert/wip/chergert/fix-855
flatpak-enter: warn when not running as root
2017-07-14 16:03:26 -04:00
Matthias Clasen
941caede42 Merge pull request #921 from ramcq/missing-app-crash
fix crash in flatpak info when app is not present in origin
2017-07-14 13:57:20 -04:00
Robert McQueen
230e18db7b fix crash in flatpak info when app is not present in origin 2017-07-14 12:21:32 +01:00
Robert McQueen
5fccf0cc0d remote-add: also ignore resolver errors
Resolver errors are more likely in offline remote adds than IO
errors. Catch them first when we're downgrading metadata update
errors to a warning.

https://phabricator.endlessm.com/T17172
2017-07-12 18:43:21 +01:00
Robert McQueen
f2dbaecf86 allow remote add to succeed when offline
Updating the metadata at the end of adding a remote means that it fails
if we're offline, even if we have the .flatpakrepo file available.
Unlike the other error cases in the process, which mean the operation
really has messed up, the remote is actually usable even if the
metadata update fails, because future operations will grab the
summary and any new metadata - so we should change this to a warning
to allow the operation to succeed when we're offline.

https://github.com/flatpak/flatpak/issues/917
2017-07-12 11:20:26 +01:00
Christian Hergert
7bf60270fe flatpak-enter: warn when not running as root
Currently, all conceivable configurations and installations of
flatpak require root to perform this operation. That may not be
the case in the future, but until then, we should warn when the
user is not root as the operation will fail.

Fixes https://github.com/flatpak/flatpak/issues/855
2017-07-09 14:27:26 -07:00
Matthias Clasen
ed08538f92 Merge pull request #900 from pwithnall/lan-and-usb-preparation
LAN/USB preparation refactoring
2017-07-08 20:54:28 -04:00
Matthias Clasen
261ff03b63 Merge pull request #907 from smcv/metadata
Document all metadata groups and keys
2017-07-07 17:50:15 -04:00
Philip Withnall
81301f0ef4 general: Remove trailing \n from GLib log messages
The GLib logging framework automatically appends a \n to messages, so it
doesn’t need to be added by callers.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-07 17:18:24 +01:00
Simon McVittie
489bfddfb3 common: Add and use constants for flatpak-metadata(5) groups and keys
This makes it easier to avoid typos, and also makes it easier to see
what groups and keys are in use. In the header file, they are
clustered according to the group in which the keys are used.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-07-07 16:06:21 +01:00
Philip Withnall
f47a696392 build: Add AM_* variables to all per-target special variables
For example, add $(AM_CFLAGS) to mumble_CFLAGS. Since $(WARN_CFLAGS) is
only added to $(AM_CFLAGS), this fixes the lack of inclusion of the
compiler warning flags in the compilation of half of flatpak.

Note that $(AM_*) variables are only used by automake if a more specific
(per-target) special variable is not defined instead. So if you define
mumble_CFLAGS, AM_CFLAGS will not be used for that target unless
explicitly included in mumble_CFLAGS.

See
https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html.

Do the same for $(AM_LIBADD), $(AM_LDFLAGS), etc. These are not
currently defined, but it’s good practice to include them in
mumble_LIBADD (etc.) just in case they’re defined in future. Hopefully
their inclusions will be cargo-culted to any new targets which are
added, retaining full coverage of the code base.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-06 15:05:58 +01:00
Philip Withnall
548f60ebc0 general: Add missing static modifier to various local methods
The compiler warning flag which was supposed to warn about this was not
being included in the CFLAGS for these targets. That will be fixed in an
upcoming commit.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-06 14:41:21 +01:00
Philip Withnall
4ffe706cd9 app/repo: Use utility function to load repository summary
Rather than reinventing the code.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-06 14:41:01 +01:00
Matthias Clasen
a80a1b9bb2 Merge pull request #896 from pwithnall/missing-n
app/build-export: Add missing N_() around a translatable option
2017-07-05 12:48:14 -04:00
Philip Withnall
574f3692ec app/build-export: Fix gcc warning about too many arguments for printf
Drop the spurious final argument.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-05 15:56:43 +01:00
Philip Withnall
c4228fac67 app/build-export: Add missing N_() around a translatable option
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-07-05 15:51:02 +01:00
Philip Withnall
a8ad392750 common/dir: Factor out common code for getting repo metadata
There are several places which query keys in the metadata in the summary
file. Factor out a common function to do that, and write it in such a
way that it could be extended to read the metadata from somewhere else
in future (the plan being that metadata will move to an ostree-metadata
branch rather than the summary file).

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-06-30 16:06:50 +02:00
Philip Withnall
2c931a9267 app/repo: Factor out common GVariant operation
Factor out a common GVariant child getter from all the print_*()
functions. This will make upcoming changes a little easier to integrate.

This introduces no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-06-30 10:17:34 +02:00
Alexander Larsson
06b14a8960 export: Record flatpak version in default commit version 2017-06-20 09:45:26 +02:00
Alexander Larsson
504a3a25ea info: Make --show-metadata machine parseable
This is useful mainly to parse the keyfile, and is not very
nice for pretty output.
2017-06-19 10:58:09 +02:00
Alexander Larsson
e5aa73f4a5 build-export: Canonicalize file permissions
This canonicalizes the file modes for directories to 0755, and
for files to 0755 for executables or 0644 otherwise.

This means we never get files/dirs writable by non-root in the
system repo, and we never get setuid/setgid/sticky-bit, all
which could potentially be a problem if we store them in the
system repo.

See https://github.com/flatpak/flatpak/pull/837 for some discussion
about this.
2017-06-08 08:50:46 +02:00
Philip Withnall
9ef301beeb ls-remote: Drop unused variable
Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-06-06 20:09:07 +01:00
Alexander Larsson
4119de9eae build-commit-from: Don't copy old xa.ref in metadata
This caused installations of the new commit to break because the
first xa.ref was used, which was the old one.
2017-06-05 12:45:20 +02:00
Alexander Larsson
e69237f792 Handle app ids with dashes when ignoring locale/debug.
org.foo.foo-bar extensions become org.foo.foo_bar.Locale, etc, so
we need to handle this properly.
2017-05-30 18:07:46 +02:00
Alexander Larsson
005fb63cc0 list/remote-ls: Also ignore .Sources by default 2017-05-30 17:45:12 +02:00
Alexander Larsson
d1fae1f476 remote-ls: Don't show Locale/Debug and secondary arches by default.
Locale and Debug extensions, and refs for a secondary arch, when the
primary arch alternative exists, are not shown unless you specify
--all or -a.

This makes the default output more useful.
2017-05-30 17:41:24 +02:00
Alexander Larsson
f072d585b0 list: Don't list .Locale and .Debug by default (override with -a) 2017-05-30 17:41:01 +02:00