Commit Graph

108 Commits

Author SHA1 Message Date
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
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
aec35fd9d9 Make --verbose a counting argument, specify twice for more info
Closes: #1077
Approved by: alexlarsson
2017-10-05 07:29:31 +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
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
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
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
b5860e8f2a common/utils: Add flatpak_repo_set_collection_id() helper method
It will be used by builtins-repo-update in a following commit to allow
updating the collection ID for an upstream repo.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Alexander Larsson
4e15d9a5f8 common: Add GSubprocessFlags to flatpak_spawnv
This is useful to e.g. hide stderr
2017-08-18 10:56:15 +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
23399ddc35 Use the CLI progress for update --appstream too 2017-05-22 17:01:14 +02:00
Alexander Larsson
2023ca03c2 common: Add flatpak_find_current_ref helper 2017-05-22 13:12:01 +02:00
Alexander Larsson
644bb1cd41 common: Break out the flatpak progress calculator to a helper method. 2017-05-10 17:24:48 +02:00
Alexander Larsson
96cdf9acfc Don't use gdbus-codegen autoptr generation
This requires a glib more recent than what we want, so just do it
manually.
2017-05-10 17:22:05 +02:00
Alexander Larsson
7a4c82529e Support build-update-repo --redirect-url=
When clients install/update they will see this property in the
(signed) summary and update the url in the config, making this
essentially a permanent redirect.
2017-05-09 17:02:00 +02:00
Alexander Larsson
21778f1075 Add support for adding new gpg keys via signed summary 2017-05-09 16:43:20 +02:00
Alexander Larsson
fb6695e9a4 Add macros for common ANSI tty escape codes 2017-05-03 11:17:41 +02:00
Matthias Clasen
ecc90b95e7 Add a helper for formatted output
For now this just uses isatty(), but we might
allow overriding this with an environment variable
in the future.
2017-05-03 11:06:43 +02:00
Matthias Clasen
62b8ae2953 table printer: move to its own source files
This is a pretty standalone object, and it is nicer to
have it in its own files. All users have been updated
to include the new flatpak-table-printer.h header.
2017-05-02 14:56:04 +02:00
Matthias Clasen
be92e4aa7e table printer: Support column titles
Add an api to set column titles, and format them in bold.
2017-05-02 14:56:04 +02:00
Matthias Clasen
2a5ce5a05e table printer: Support column alignment
Add support for aligning columns at a certain position.
This will be used to line up numbers at the decimal point,
in future commits.
2017-05-02 14:56:04 +02:00
Colin Walters
c50648a594 libglnx: Bump to latest master, use new file copy API
The new `glnx_regfile_copy_bytes()` is better than the previous
`flatpak_copy_bytes()` in that it will use reflink/sendfile if available.

More information in 3a4d0f4684
2017-04-28 10:04:22 -04:00
Alexander Larsson
8b13d3c5ee builder: Add progress reporing while downloading 2017-04-24 21:23:46 +02:00
Alexander Larsson
4a60c87958 common: Add flatpak_build_file[_va] helper
This makes it easy to construct GFiles
from a base dir and an argument list
of child elements.
2017-04-24 09:02:33 +02:00
Alexander Larsson
fe56c08203 build: Always set personality to linux32 when cross-building
This means that autodetection during builds works much better.
Fixes https://github.com/flatpak/flatpak/issues/712
2017-04-19 19:36:55 +02:00
Alexander Larsson
0dcc7332f7 Handle uris better when detecting .flatpak[repo,ref] suffix
We fully parse the argument as (possibly) a uri, which means
we can handle an argument like:
 https://git.gnome.org/browse/gnome-apps-nightly/plain/gnome-builder.flatpakref?h=stable

Which doesn't work with a simple has_suffix call.
This is important because the flatpak.org site now references
these kinds of uris.

Fixes https://github.com/flatpak/flatpak/issues/659
2017-04-03 10:02:28 +02:00
Alexander Larsson
f42a4d735b Fix ostree autoptr checks for git master
The export g_autoptr changes in ostree will be in the release 2017.4,
but the gnome CI is currently failing due to them also being in current
git master which is called 2017.3 atm. We fix this by checking against
2017.3 instead, which is safe, because the actual OSTREE_CHECK_VERSION
macro was added after the 2017.3 release too.
2017-03-30 10:01:24 +02:00
Colin Walters
d40df323b4 utils: Prepare for libostree 2017.4 defining autocleanups
See: https://github.com/ostreedev/ostree/pull/756
2017-03-29 21:06:09 +02:00
Alexander Larsson
5b0ad227e8 OCI: Verify signatures 2017-03-29 17:14:36 +02:00
Alexander Larsson
11943e7e40 OCI: Support OCI with system-helper by mirroring OCI repo
This allows us (when we later add signatures) to verify
the signatures of the OCI manifest, and can thus support
the system-helper.
2017-03-29 17:14:19 +02:00
Colin Walters
2618a19716 Import ostree's compiler warnings, fix up callers
In ostree I maintain what I consider a "baseline" set of compiler
warnings that should *always* be fatal for a modern C project.

I noticed while working on a previous patch that a `-Werror=format`
warning wasn't fatal.

There are a few that are really, really important like
`-Werror=missing-prototypes`. I also take some like `-Werror=misleading-indentation`
which already caught some bugs.  See also https://lwn.net/Articles/678019/
2017-03-27 10:42:36 +02:00
Colin Walters
64fd2c2a8d Bump libglnx, use new glnx_throw(), fix callers
One benefit here becomes immediately obvious - `flatpak_fail()` was lacking
`G_GNUC_PRINTF` which meant we missed a lot of type checking. Fix up the
callers.
2017-03-27 10:42:36 +02:00
Alexander Larsson
49b5304589 Update OCI support to latest version of spec
This is a major change in the OCI support, as the format of the OCI image
registries changed. Instead of now having a "ref" file for each image
in the repo it has a single index json file, where the ref name is now
a per-image annotation.

This allows us to support OCI much better, as we can now use the actual
flatpak ref as the OCI ref name, and we can find all the flatpak refs
in a remote.

So, with this you can just use:
 flatpak remote-add --oci remote-name URL

and then you can use the regular flatpak operations on the remote.
2017-03-13 14:31:36 +01:00
Richard Hughes
d6f4ea424d Allow specifying an ISO-8601 timestamp when using build-export
This allows us to build reproducable repo summaries, for instance in self tests.
2017-03-06 11:38:26 +01:00
Alexander Larsson
2c71298d53 builder: Its break_hardlink, not unbreak_hardlink 2017-02-22 09:43:57 +01:00
Alexander Larsson
082efe8951 Properly quote all commandlines we print
Fixes https://github.com/flatpak/flatpak/issues/236
2017-02-21 18:56:11 +01:00
Alexander Larsson
50c9812a56 utils: Remove unused/broken autorm_rf 2017-02-21 11:50:41 +01:00
Alexander Larsson
5a3c7feb15 builder: Unbreak hardlinks when eu-stripping
Otherwise this breaks with rofiles-fuse if the build produces
hardlinked installed files. For instance, as done by mesa.
2017-02-15 19:22:14 +01:00
Alexander Larsson
8c131be4f6 utils: Add missing Ostree autoptr types 2017-02-15 16:09:48 +01:00
Alexander Larsson
08ea3baf49 builder: Download files and archives directly to disk, don't keep them in memory.
This works much better for larger sources.
2017-02-09 12:26:05 +01:00
Alexander Larsson
bf316c1a82 builder: Compute SHA256 while downloading archives 2017-02-09 12:17:10 +01:00
Alexander Larsson
02202b9e76 utils: Add flatpak_copy_bytes
This copies data from one fd to another.
2017-02-07 16:39:23 +01:00
Alexander Larsson
2e453048e0 extensions: Support enable/install-if=active-gl-driver
Only use/download this extension if it matches an active gl driver.
2017-02-03 09:49:05 +01:00
Alexander Larsson
d4d15c7211 Initial flatpak_get_gl_drivers() implementation
This is supposed to list all the currently loaded "non-standard" gl drivers.
If FLATPAK_GL_DRIVERS is set, then that is used, otherwise it looks
for an nvidia driver and if so, uses that, and always adding "default"
at the end which is meant to resolve to a stable mesa fallback build, as
well as "host" which can be used if you have a host-side driver
as an unmaintained extension.
2017-02-03 09:48:16 +01:00