Commit Graph

158 Commits (8cd7a0ab315e86b577a015ff2eb9ae2397c64653)

Author SHA1 Message Date
Alexander Larsson 6c5ee01d01 complete: Don't read outside string
Sometimes the shell_cur value given to us by bash
is longer than expected, so don't step outside the
string in this case.

Fixes https://github.com/flatpak/flatpak/issues/764
2017-05-19 12:52:39 +02:00
Alexander Larsson 1c46cfe45d progress: Tweak metadata part of download
We artificially limit the metadata phase to the first 20 metadata
objects, because otherwise that phase takes too long time, as it
downloads content at the same time.
2017-05-18 15:36:34 +02:00
Alexander Larsson 435091e5cf progress: Simplify the progress calculations
For the delta case we can get perfect results by just ignoring
the counts and relying on the sizes. However, this needs a
recent ostree that supports the fetched-delta-part-size field.

For the object case we keep using the object average size
to estimate a size which we can compare with the extra data
size.
2017-05-18 15:14:42 +02:00
Alexander Larsson fbd5452aac progress: Use the new atomic progress API
We read everything at once, which means we will not
race against the download thread possibly updating the
values.
2017-05-18 12:28:57 +02:00
Georges Basile Stavracas Neto 6924658f59 Improve progress report calculation
Now that we have access to the total extra-data download size,
we can have much more precise progress reports by summing up
all the download sizes from OSTree and extra-data.

This patch makes the progress report callback use the extra-data
sizes, as well as calculate the average size (in bytes) of the
content.

flatpak/flatpak#609
2017-05-18 09:02:02 +02:00
Alexander Larsson 2fa6e2fe97 build-update-repo: Use the size/metadata info in the commit object
If the data is already there, there is no need to re-calculate it.
2017-05-11 10:09:39 +02:00
Alexander Larsson 1e5ffa926a Add workaround to flatpak_repo_collect_sizes for uncommited objects
It turns out the underlying call ostree_repo_query_object_storage_size
doesn't work for staged objects, so we work around this by actually
loading the object, walking back to the original unix input stream
and fstat:ing the fd from that.
2017-05-11 10:09:39 +02:00
Matthias Clasen 029a5e38e1 Remove unused variables
clang flags these.
2017-05-11 08:38:32 +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 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 fe09ffaa03 Optimize flatpak_summary_match_subrefs
This is called a lot during update, so we rewrite it to
avoid splitting up each ref in the summary file.
2017-05-09 15:18:13 +02:00
Alexander Larsson a058c5cbf2 Optimize flatpak_variant_bsearch_str
Rather than parsing a get_child string we just access
the right child and type.
2017-05-09 15:15:54 +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 1998acb18e table printer: Only show titles on ttys
Avoid showing column titles unless stdout is a tty.
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
Matthias Clasen fbcaf05362 table printer: Introduce a cell struct
No functional change here, simply some data structure reorg,
so we can have more data for each cell in the future.
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 47062137a5 fixup! common: Add flatpak_build_file[_va] helper 2017-04-24 12:23:20 +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 b426306884 appstream: Don't strip .desktop extension if thats the actual id
The telegram app is org.telegram.desktop, so we can't assume
the id in the appstream data that ends in .desktop is just a desktop
file extension.
2017-04-12 09:40:04 +02:00
Simon McVittie 646b4c468b Use correct format string for guint64 on 32-bit
Signed-off-by: Simon McVittie <smcv@debian.org>
2017-04-04 12:17:28 +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 41d9717113 Fix unused variable errors reported by clang 2017-03-30 10:01:24 +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
Alexander Larsson 759eee8cea OCI: Verify layer checksum while applying
This means we verify the exact data we use, which is
what was signed. In particular, this means in the
system-helper we don't open us up to the user
manipulating the file while it is being applied.
2017-03-29 17:14:19 +02:00
Alexander Larsson 980bd48f0e OCI: flatpak_pull_from_oci - verify manifest ref
This ensures the actual manifest ref matches what was specified
in the index. This is required as the goal is to sign/trust
the manifest, but not necessarily the index.
2017-03-29 17:14:19 +02:00
Alexander Larsson 82aad1ccb1 Correctly find system unmaintained extensions
We should not terminate the extension search just because
an earlier directory succeeds. Even non-existant directories
succeed, and anyway we should continue searching even if it
wasn't empty, because multiple subdir extensions may match.

Fixes https://github.com/flatpak/flatpak/issues/654
2017-03-27 11:18:16 +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 3385c9dc5c Fix some warnings reported by clang 2017-03-15 10:17:26 +01:00
André Klitzing 567802749c Fix some issues with musl
* Use realpath instead of canonicalize_file_name
* Add missing include
2017-03-15 10:14:39 +01: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
Alexander Larsson 7d1a8f69f6 appstream: Don't add runtime to flatpak bundle tag for runtimes 2017-03-08 12:31:44 +01:00
Alexander Larsson 640a02315b extensions: Support multiple versions
This means an extension point can include extensions of multiple
(specified) versions. This is useful for e.g. the GL extensions,
where we want a single extension for all the essentially unversioned
GL extensions (like the nvidia one) that is used by all the
runtimes.
2017-03-06 14:36:20 +01:00
Alexander Larsson 3122d1c014 flatpak_list_extensions: Break out code into helper
This is a minor restructure to make the code more readable
and extensible.
2017-03-06 14:36:20 +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 9d9bd184c7 zero-mtime: Handle error when enumerating directory 2017-02-28 11:02:32 +01:00
Alexander Larsson 4db1e74090 utils: Fix flatpak_bundle_load typo
If we failed to look up the app metadata we would
clear out a different out argument instead.
2017-02-28 10:46:56 +01:00
Alexander Larsson e1e27559d1 utils: Fix list_unmtainained_refs
There was a stray goto out that caused it to only look at the first
element in the system dirs list.
2017-02-28 10:41:29 +01:00
Mario Sanchez Prada d0b5b51076 Initialize g_autofree string to NULL, not to crash when early returning
Otherwise, anytime we fail in ostree_repo_write_metadata() will cause
an invalid free to happen, and flatpak to crash.
2017-02-23 14:27:22 +00: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 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
Mario Sanchez Prada 86bf88d89f Allow cancelling the downloading process for extra data
So far, the installation of external apps can only be cancelled
before flatpak starts downloading the extra data, as there's no
cancellable being passed to g_input_stream_read_async().

This fixes that problem, making it possible to cancel installs
from GNOME Software regardless of the installation stage.
2017-02-14 09:01:16 +01:00