Commit Graph

226 Commits

Author SHA1 Message Date
Alexander Larsson
7dd92d8a9b build-update-repo: Fix org.telegram.desktop icons
The telegram app id is org.telegram.desktop, and its appstream
component id is org.telegram.desktop.desktop, which we did not
properly handle (we special cased the app-id-ends-with-desktop case
and then did not remote .desktop). This replaces that with a more
approach that *always* matches the whole app id as prefix, and then
replaces a ".desktop" in the suffix part only.

Closes: #1593
Approved by: alexlarsson
2018-04-23 12:20:15 +00:00
Alexander Larsson
7fd085acd7 appstream: Generate appstream2/$arch branches with uncompressed xml
These delta better, and the files will be downloaded as compressed
.filez objects anyway.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
5102a19d22 appdata: Sort by ref-order to make appdata stable
This is nice for e.g. doing deltas of them.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
484c743e4a appdata: Include compatible arches in main arch when unique
For example, if a i386 build is in the repo but no x86-64 version then
also add the i386 build to the x86-64 appstream data.  However, don't
add it if that would cause a duplicate (i.e. both the x86-64 and i386
version).

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Sam Spilsbury
a8620a5592 utils: Export flatpak_name_matches_one_*_prefix
We will use this later to determine what files to export
in both the build-export and build-finish stages.

Closes: #1589
Approved by: alexlarsson
2018-04-19 07:31:25 +00:00
Sam Spilsbury
b6d1a20223 flatpak-utils: Remove tag from extension name before adding it
Closes: #1531
Approved by: alexlarsson
2018-04-18 07:43:56 +00:00
Alexander Larsson
8d7f888bf1 build-update-repo: Add end-of-line metadata to summary
This adds a "sparse-cache" metadata dict to the summary, where
we can add additional per-ref information that we don't expect
to be there for most refs. Initially we add the eol and
eol-rebase info to it so that we can see which remote refs
are end-of-line.

Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
42335c74a0 appstream: Don't include end-of-line refs in appdata
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
8e992e04ad flatpak-utils.c: Remove leftover spew
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
957544ca30 flatpak-utils: Mark strings for translation
Closes: #1566
Approved by: alexlarsson
2018-04-12 12:36:49 +00:00
Alexander Larsson
11ef9999b6 Add flatpak portal
This listens to org.freedesktop.portal.Flatpak and lets flatpak
sandboxes do flatpak specific things.

Initially this only allows access to "Spawn", which lets you start a
new copy of the current or latest version of the calling app,
optionally with sandboxing.

This allows the app to re-start itself with the latest version after
an update, and the sandboxing is useful for apps that want to manually
sandbox part of themselves.

You can also expose one or more subdirectories of
~/.var/app/$appid/sandbox/ to the app, read-write or read-only. This is
useful to communicate with the sandbox.
2018-04-04 17:25:59 +02:00
Alexander Larsson
8570dcab85 run: Allow specifying an exact commit and runtime-commit
This also looks for removed but live deploys so that an app
can be re-started as long as it is live.
2018-04-04 17:25:59 +02:00
Alexander Larsson
ffa73cbd83 flatpak-utils.c: Remove various unused functions
Most of these were used by flatpak-builder and should have been
dropped when it was split out.

Closes: #1492
Approved by: alexlarsson
2018-03-19 09:33:53 +00:00
Patrick Griffis
82f993e1c7 Fix assertion when no gsettings schema installed
Fixes #1455

Closes: #1456
Approved by: mwleeds
2018-02-28 22:08:22 +00:00
David King
8be4b550f3 common: Include sys/mman.h for memfd_create()
Versions of glibc starting with 2.27 include support for memfd_create()
in sys/mman.h, and the included libglnx then drops its internal define.
2018-02-19 14:00:08 +01:00
Alexander Larsson
cbeb1716a9 appdata: Remove unnecessary spew when generating appdata
The process was printing a line for every mismatching component id
in the xml for each app, which is starting to get very large log files
on flathub.

Closes: #1426
Approved by: alexlarsson
2018-02-16 08:07:20 +00:00
Alexander Larsson
eb692a9bb8 Move buffer_to_sealed_memfd_or_tmpfile to flatpak-utils.h
Closes: #1374
Approved by: alexlarsson
2018-02-05 14:31:30 +00:00
Robert McQueen
f73357cc5b extract_appstream: debug if an exported appstream is skipped
We had missing icons for a few apps due to this - if this ever happens
it means something very weird is going on with the export process in
a flatpak, so it's probably worth alerting the repo admin.

Closes: #1367
Approved by: pwithnall
2018-01-31 18:34:18 +00:00
Robert McQueen
6ab657b910 extract_appstream: allow component IDs not to end in .desktop
The appstream spec suggests that IDs should end in .desktop, but does
not require it. Make the repo appstream update process permit this
so that the appstream and icons are extracted correctly.

Closes: #1367
Approved by: pwithnall
2018-01-31 18:34:18 +00:00
Iceyer
1cea02a2f6 common: Fix division by zero when calculate progress
Closes: #1331
Approved by: alexlarsson
2018-01-23 09:22:36 +00:00
Matthew Leeds
bc2534fbd5 common: Fix memory leak in flatpak_number_prompt
Closes: #1206
Approved by: alexlarsson
2017-11-28 14:35:46 +00:00
Patrick Griffis
3b78dc66c3 Add "have-intel-gpu" check, useful for VAAPI extension
Closes: #1198
Approved by: alexlarsson
2017-11-24 11:17:47 +00:00
Patrick Griffis
bc3e464051 Automatically install active Gtk theme if found
Closes: #1181
Approved by: alexlarsson
2017-11-21 09:56:05 +00:00
Alexander Larsson
bd118ff528 OCI: Add support for system-helper with new OCI approach
Since we don't have GPG signatures for the OCI images we verify
the data sent by the client by doing a query to the index from
the helper to ensure that the ref/digest tuple is correct.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00:00
Alexander Larsson
d6ea398dd5 Remove GPG signatures handling for OCI images
This is not really standardized for now, and most registries
depend on TLS security instead.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00:00
Alexander Larsson
c3b155b09a Use the new metastore index API for OCI remotes
This means the url of the remote is a service supporting:
 https://github.com/owtaylor/metastore/blob/master/docs/protocol.md

And we use that to find all flatpak images and the repository url
itself.

This also add support for docker-v2 registries that support OCI
images.

Closes: #1171
Approved by: alexlarsson
2017-11-16 20:50:34 +00:00
Gunnar Andersson
98c21473fc Fix whitespace issues (remove TAB usage)
Signed-off-by: Gunnar Andersson <gandersson@genivi.org>

Closes: #1107
Approved by: mwleeds
2017-10-17 06:21:07 +00:00
Alexander Larsson
87ed5378db Add missing translation markers
As mentioned in https://github.com/flatpak/flatpak/issues/1102 we
lack translations for some strings. This fixes the ones i found in
a quick check.

Closes: #1106
Approved by: mwleeds
2017-10-16 19:03:06 +00:00
Alexander Larsson
c763295944 common: Add flatpak_subpaths_merge
This merges to subpath sets, which is useful if two sets are
specified from different sources.

Closes: #1098
Approved by: alexlarsson
2017-10-11 12:48:07 +00:00
Alexander Larsson
62760761b7 common: Clean up the locale detection
This is mostly a cleanup of some code and extracting common code to
helper functions. But additionally, we switch the xa.languages config
value to be a list of languages, rather than dirs, although for
backwars compat we still support if it specifies dirs.

Closes: #1098
Approved by: alexlarsson
2017-10-11 12:48:07 +00:00
Alexander Larsson
f6658ad712 Use the new glnx glnx_autofd name for glnx_fd_close
This is a lot clearer

Closes: #1091
Approved by: alexlarsson
2017-10-09 10:19:00 +00:00
Alexander Larsson
aec35fd9d9 Make --verbose a counting argument, specify twice for more info
Closes: #1077
Approved by: alexlarsson
2017-10-05 07:29:31 +00:00
Alexander Larsson
e759819c5d Fix uninitialized variable read if stdout is not a tty
This showed up when running the tests in valgrind, where
ioctl (STDOUT_FILENO, TIOCGWINSZ) fails. We fall back to 80 chars
in this case.

Closes: #1079
Approved by: cgwalters
2017-10-04 15:43:59 +00:00
Philip Withnall
166a4e144d common: Don’t commit arbitrary files into the ostree-metadata branch
When building the ostree-metadata branch (which only happens when
configured with --enable-p2p), we are supposed to create empty commits
which contain only metadata. However, the code to do this was wrong, and
was instead pulling in all the files from the current working directory
and committing them.

Fix that code to actually create an empty commit.

This could have been a fairly serious bug were it not for the fact that
nobody’s using this code because it’s all experimental.

Spotted as part of https://github.com/ostreedev/ostree/pull/1158.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1066
Approved by: alexlarsson
2017-10-04 12:54:30 +00:00
Matthew Leeds
71f4a87f51 dir: Print debug output when opening flatpak dirs
It's easy to end up with multiple flatpak installations on a system, and
it's not always clear which one(s) flatpak is using. So this commit adds
some debug output in some cases when flatpak opens an installation
directory such as /var/lib/flatpak. This is especially important for
people who build flatpak themselves because if you omit --prefix=/usr
or use --with-system-install-dir your flatpak will look in non-standard
locations like /usr/local/var/lib/flatpak.

If we were to print this every time a flatpak directory is opened, it
would flood the log. So instead add a utility function and use it
strategically. Many flatpak commands will log the directory when they
use flatpak_option_context_parse(), others in
flatpak_find_deploy_for_ref(), and for others the logging has been
added manually.

Closes: #1067
Approved by: alexlarsson
2017-10-04 12:39:43 +00:00
Alexander Larsson
5cd8db035b common: Add flatpak_switch_symlink_and_remove
This creates a symlink pointing to a target, but if the symlink
already exists, it ensures (atomically) that the previous target
is deleted. This is useful to keep a single-item cache around.

Closes: #1073
Approved by: alexlarsson
2017-10-04 10:27:14 +00:00
Alexander Larsson
acdf869693 common: Add commit id to FlatpakExtension
Closes: #1069
Approved by: alexlarsson
2017-10-03 08:01:46 +00:00
Alexander Larsson
b35177e4bf appstream update: Don't skip all arches if one is unchanged
Move skip_commit from a function global to a per-loop variable so
that it is reset for each architecture.
2017-09-26 16:34:30 +02:00
Alexander Larsson
c3cfc4aa78 Remove unused variables 2017-09-26 11:58:44 +02:00
Alexander Larsson
98d3a58129 Update to latest libglnx and update tmpfile use for api change 2017-09-22 12:38:10 +02:00
Alexander Larsson
07d62fb86e generate_appstream: Add debug output when skipping commit
This might help us debug a weird behaviour on flathub where
it was never updating the appstream.
2017-09-19 16:34:26 +02:00
Philip Withnall
2faffecc42 common/utils: Fix is_number("") to return FALSE
Previously, it was possible to enter ‘ ’ (a space) at a number prompt,
and it would be stripped, passed to is_number() (which would erroneously
return TRUE), then passed to strtol() and the return value used
unconditionally.

Fix that by fixing is_number() to return FALSE for the empty string.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-09-18 15:36:24 +02:00
Alexander Larsson
75c2db1a73 Fix some leaks
g_variant_dict_end() returns a floating reference, we have to
sink it before using it with a g_autoptr.
2017-09-14 13:07:12 +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
Alexander Larsson
4178fbdc09 update-repo: Ensure we commit the appstream data with canonical permissions 2017-08-28 11:39:17 +02:00
Alexander Larsson
18451644ff Update to latest libglnx (and fix some callers) 2017-08-18 15:34:29 +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
c4819af5a0 common: Support collection IDs for related refs and extensions
Add support for collection IDs to the code which finds and pulls
related refs and other extensions.

Currently, related refs must have the same collection ID as the parent
ref — this is the most likely scenario anyway. In future, it should be
possible to extend the code to support pulling related refs from other
collections.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Philip Withnall
26eb76637d common/utils: Add collection ID support for appstream/* branches
Also add collection and ref binding metadata to the generated appstream
commits, so they can be verified when using unsigned summary files.

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