Commit Graph

3978 Commits

Author SHA1 Message Date
Owen W. Taylor
6838206e2a test-oci-registry.sh: Tests for talking to an OCI registry
Add a new test case to test the OCI remote functionality. The tests talk to
a server that implements good-enough index generation and bits of the
docker registry protocol. Adding and remove remotes, summary and appstream
generation, and image installation are all tested.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
4dfa7721bb Remove unused etag functionality
Checking the registry against a previous etag is now handled inside
flatpak_cache_http_uri(), so remove the etag parameters that were
previously passed around in various places for simplicity.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
baa7d35ca1 Extract the appstream data from the OCI registry index
Previously the code assumed that appstream data was stored in a separate
OCI image in the registry. Replace that with storing the appstream data
and icons as image annotations. When we download a new version of the
image index, the appstream data is combined, and icons are downloaded
as necessary.

Since there is no longer a content hash for the appstream data, it's
not practical for the user to download the appstream data and pass it
to the system helper, instead the system helper just downloads the
appstream data directly.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
926678b736 Use http-driven caching for summary generation
Redo the handling of generating summary information from an OCI registry
to be a two step process. First download the index, using the newly
added HTTP caching functionality. Then regenerate the summary from the
index, using mtimes to avoid duplicate work.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
951aed561a Add flatpak_cache_http_uri: cache downloads based on HTTP headers
Add a new function, flatpak_cache_http_uri() that when passed an URL and
a local destination location, either a) downloads the content and stores
it at the destination location, storing HTTP cache header information
like Last-Modified, Etag into user xattrs (if available) or a separate
file or b) if the downloaded content is already present, checks the
header information to decide whether the downloaded content can be used
or needs to be revalidated witha conditional request.

Tests are added that use a special case test server that adds HTTP caching
headers and reacts to them based on query parameters. A small test binary
'httpcache' is added for the tests to use.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
cd6a10cb66 flatpak-utils-http.c: Split HTTP functionality into a separate file
In preparation for extending the HTTP downloading function to include
caching, split HTTP related utilities into a separate file with a
separate header.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
83506fa028 test-oci.sh: Remove confusing references to 'registry'
The directory where we export an OCI image to is not a "registry", even
if it's a FlatpakOciRegistry internally. So change export registry from
oci/registry to oci/image.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
66f618fa83 Remove support for OCI image layouts on remote servers
The code checked whether an OCI registry URI was an OCI image layout accessed
via HTTP by looking for /oci-layout, but distributing OCI images in this way
is not really a thing anybody does. It would be inefficient way to store
large numbers of images, since all versions need to be listed in index.json.

The code still uses OCI image layouts to represent "local registries" in
analogy to local ostree repositories.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
9916280f02 Fix various double / in generated OCI index URIs
In a couple different places, double slashes were inserted into the
generated OCI index URIs - e..g, index//static instead of index/static.
While most HTTP servers/applications will normalize double slashes,
this is not required, and such URIs are, in any case, ugly.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Alexander Larsson
b8d13b00c1 Update bubblewrap to 0.3.0
Closes: #1948
Approved by: alexlarsson
2018-08-08 16:04:40 +00:00
Alexander Larsson
95d0e47617 Post release version bump
Closes: #1949
Approved by: alexlarsson
2018-08-08 15:41:49 +00:00
Matthew Leeds
69fc58d345 dir: Fallback to the system default locale, not all
When Flatpak is fetching a locale extension it has to decide which
subpaths to fetch based on what language is being used on the computer.
This happens in flatpak_dir_get_locale_subpaths() which indirectly uses
the org.freedesktop.Accounts D-Bus object to check what language is
configured for each user. The problem is that if any user doesn't have a
language set, Flatpak falls back to pulling all languages, rather than
checking the system default using localed. The effect is that on Endless
OS systems, Flatpak is pulling entire locale extensions rather than just
the subset for the configured language, which is a significant waste of
bandwidth. In my testing, the "Language" property on the primary user
account is not set on Endless, but it is set on Fedora.

A side effect of this bug is to cause offline USB app installs to
sometimes fail, because if the USB only has a partial locale and you try
to pull the whole thing, the pull fails.

This commit fixes the issue by doing another D-Bus call to localed to get
the system default(s), then checking AccountsService as before, treating
an unset language for a user account as meaning "use the system
default". Then only if no languages are set for the users or the system,
fall back to pulling all languages. The code to communicate with localed
is based on the code in gnome-control-center in
panels/region/cc-region-panel.c

This extra synchronous D-Bus call adds some overhead which might be able
to be avoided; see https://github.com/flatpak/flatpak/issues/1938

Using this patch I can see that Flatpak is pulling partial locales now,
based on the output of `flatpak list -a | grep partial` after installing
Bijiben from Flathub.

Closes: #1937
Approved by: alexlarsson
2018-08-08 15:04:11 +00:00
Matthew Leeds
a42af4a795 dir: Remove unused GDBusConnection variable
We're using g_dbus_proxy_new_for_bus_sync() not g_dbus_proxy_new_sync()
so we don't need a GDBusConnection.

Closes: #1937
Approved by: alexlarsson
2018-08-08 15:04:11 +00:00
Matthew Leeds
1e75e645f1 create-usb: Automatically update the repo summary
Copying refs from the system repo into a repo on a USB drive requires
the summary in the system repo to be up to date (and similarly for other
flatpak installations like a per-user one). At the moment we expect the
user to run `sudo ostree summary -u` before `flatpak create-usb` which
is a bad user experience. Another option is to set
`core.auto-update-summary` to true on the ostree repo config, but there
are significant performance concerns with that: it involves updating the
summary after every transaction rather than only when we need it. So
this commit changes the create-usb command to use the "UpdateSummary"
system-helper method to update the summary in the source repo before
copying to the destination. This strategy allows us to continue to let
non-root users use `flatpak create-usb`. This commit also tries to
update the remote repo metadata and appstream data for each remote
before copying to the USB, because we can now do that without
invalidating the summary.

Closes: #1945
Approved by: alexlarsson
2018-08-08 14:42:16 +00:00
Matthew Leeds
8292732e65 Add a system-helper UpdateSummary method
This system-helper method will allow flatpak to update the ostree repo
summary while running as a non-root user that's in the "sudo" group.
This will allow the `flatpak create-usb` command to work without
requiring the user to first run `sudo ostree summary -u`, and without
requiring the system to have `core.auto-update-summary` set to true in
the ostree repo config. This is also much more efficient than
`core.auto-update-summary` because it allows us to only update the
summary when we need it rather than after every transaction.

Generating the summary basically just involves traversing the repo to
enumerate all the refs and putting this information into a file, so I
don't think there are security concerns with allowing it to happen
without authentication.

Closes: #1945
Approved by: alexlarsson
2018-08-08 14:42:16 +00:00
Umang Jain
153720a737 common/dir: min-free-space-size should be honored for child repos too
https://github.com/flatpak/flatpak/issues/1826

Closes: #1912
Approved by: alexlarsson
2018-08-08 14:29:45 +00:00
Umang Jain
13610e3ed3 common/dir: Port to min-free-space-size
Use min-free-space-size as a replacement for min-free-space-percent.

Previously, flatpak used to disable min-free-space-percent by re-writing
the config with min-free-space-percent=0. As the new version of ostree (2018.7)
now supports min-free-space-size, we should use that and migrate from -percent
option in existing repos to -size=500MB.

Config is rewritten with min-free-space-size in case of:
1) It has min-free-space-percent=0 only. (That is probably from the
   previous re-writes).
2) If there are no min-free-space-* options.

Other than that, the config remains unchanged and the co-existence(if any)
of these options is governed by ostree.

https://github.com/flatpak/flatpak/issues/1826

Closes: #1912
Approved by: alexlarsson
2018-08-08 14:29:45 +00:00
Umang Jain
d34d117ae4 utils: Copy g_ascii_string_to_unsigned from glib-2.54.0
This avoids the glib's version bump needed for the subsequent min-free-space-size
porting patches.

Closes: #1912
Approved by: alexlarsson
2018-08-08 14:29:45 +00:00
Alexander Larsson
2d3f493f27 run: Add --die-with-parent to run
This is similare to the already existing arg in flatpak build.

Closes: #1946
Approved by: alexlarsson
2018-08-08 12:09:14 +00:00
Matthew Leeds
486eb76f75 system-helper: Update outdated vendor_url
Closes: #1943
Approved by: alexlarsson
2018-08-07 09:31:17 +00:00
Matthias Clasen
e03c61ebbc Add file format docs to flatpak.1
The flatpak.1 man page serves as an overview page that lists
all the individual command man pages. Make it a complete
overview by listing the file format man pages as well.

Closes: #1944
Approved by: alexlarsson
2018-08-07 09:30:30 +00:00
Matthias Clasen
1efc0ac49f Avoid a crash in the absence of session bus
When the system bus is not available, we set
system_helper_bus to (gpointer)1. And then we
segfault in finalize, trying to unref it.

Thats not nice, so avoid it.

Closes: #1940
Approved by: alexlarsson
2018-08-06 07:55:34 +00:00
Matthias Clasen
fa9aad2e09 Warn when skipping installations
When we fail to parse an installation, emit some
warnings that give the user a chance to figure out
what is going wrong. I ran into the missing quotes
issue myself when I first tried to create a custom
installation.

Closes: #1939
Approved by: alexlarsson
2018-08-06 07:34:40 +00:00
Rafael Fontenelle
7a9a9b64d0 Update Brazilian Portuguese translation
Closes: #1941
Approved by: alexlarsson
2018-08-06 07:20:07 +00:00
Matthew Leeds
f8bb76cd30 common: Fix a couple typos 2018-08-02 15:42:07 -07:00
Matthias Clasen
9783472eaa Fix error pileup
All the error handling in the for loop is meant to
use local_error, not error.

Closes: #1936
Approved by: mwleeds
2018-08-01 16:50:11 +00:00
Matthew Leeds
6b2fa94351 create-usb: Initialize a hash table in the correct scope
We need all_collection_ids to be initialized outside the loop that
iterates over all the refs; otherwise it only has the collection IDs
from the last ref (and related).

This fixes a bug where flatpak only includes the ostree-metadata and
appstream data for the collection IDs associated with the last ref given
on the command line and its runtime and related refs. So flatpak now
includes ostree-metadata and appstream data for collection IDs
associated with all the refs given (and their runtimes and related
refs).

Closes: #1930
Approved by: treitter
2018-07-27 23:45:09 +00:00
Matthias Clasen
97f2e3a3fa Merge pull request #1929 from flatpak/autoprune-unless-docs
doc: Document the autoprune-unless metadata key
2018-07-27 18:54:19 -04:00
Matthew Leeds
59997dd126 doc: Document the autoprune-unless metadata key 2018-07-27 12:47:08 -07:00
P. F. Chimento
fbd84d93e4 manpage: Refer to flatpak-metadata documentation
The documentation for extension info can be found there.

See #1341.

Closes: #1927
Approved by: mwleeds
2018-07-27 19:27:19 +00:00
Matthew Leeds
67510fa6cf create-usb: Rename variables for clarity
Closes: #1924
Approved by: treitter
2018-07-25 23:19:52 +00:00
Matthew Leeds
4a723f6b90 create-usb: Don't look for runtimes of runtimes
Currently the create-usb command looks for a runtime for every ref
passed to it, whether it's an app or runtime. This leads to an error
when a runtime was specified because runtimes don't have runtimes.
Normally you shouldn't need to pass a runtime to create-usb because it
finds dependencies on its own, but you conceivably could (and in fact
the eos-updater-prepare-volume tool in Endless does in order to make
sure an icon theme "runtime" is included with OS updates).

This commit fixes the issue by only checking for runtimes for apps. The
way it's written takes extra care to ensure the FlatpakKinds value used
is based on the ref value used, to protect against the case where one ID
exists in multiple installations with a different kind in each one, even
though it's hard to imagine that happening in actual use.

It's difficult to add a unit test for this at the moment since the unit
test for create-usb is blocked in
https://github.com/flatpak/flatpak/pull/1877

Closes: #1924
Approved by: treitter
2018-07-25 23:19:52 +00:00
Kukuh Syafaat
f1629aa731 Update Indonesian translation
Closes: #1922
Approved by: mwleeds
2018-07-25 20:11:58 +00:00
Will Thompson
96854b902a system-helper: fix error when updating not-installed app
Closes: #1919
Approved by: mwleeds
2018-07-24 20:30:52 +00:00
Piotr Drąg
26fe8c81a3 Update Polish translation
Closes: #1917
Approved by: mwleeds
2018-07-23 02:44:26 +00:00
Kalev Lember
942d417aac Update to latest libglnx
This pulls in the renameat2() fix that's required for building with
latest glibc (e.g. Fedora rawhide).

Closes: #1890

Closes: #1914
Approved by: alexlarsson
2018-07-21 08:34:13 +00:00
Matthias Clasen
c7c0366259 Merge pull request #1909 from mwleeds/add-repair-manpage
Add a man page for the repair command
2018-07-18 09:40:48 -04:00
Matthew Leeds
425385d3ea fixup! doc: Add a man page for the repair command 2018-07-17 12:20:44 -07:00
Matthew Leeds
af10bb98ec doc: Add a man page for the repair command
Add a man page based on one of the comments in
app/flatpak-builtins-repair.c

Fixes https://github.com/flatpak/flatpak/issues/1820
2018-07-16 17:43:12 -07:00
Matthew Leeds
ea36e8e83f repair: Fix --help output 2018-07-16 17:18:08 -07:00
Piotr Drąg
f067f184f0 Update Polish translation
Closes: #1905
Approved by: mwleeds
2018-07-16 20:27:13 +00:00
Kukuh Syafaat
0d61a8f3c6 Update Indonesian translation
Closes: #1901
Approved by: mwleeds
2018-07-16 20:05:19 +00:00
Richard Hughes
0afef8a38a Fix a memory leak when calling flatpak_build_file()
Closes: #1898
Approved by: mwleeds
2018-07-12 13:14:03 +00:00
Richard Hughes
d8c5d9c3b9 Fix several memory leaks when debugging is turned on
Closes: #1898
Approved by: mwleeds
2018-07-12 13:14:03 +00:00
朝歌
d7b9d3fc2b Update flatpak-document-unexport.xml
Closes: #1896
Approved by: mwleeds
2018-07-12 11:41:52 +00:00
Simon McVittie
596216532d app: Don't distribute gdbus-codegen output in tarballs
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1891
Approved by: alexlarsson
2018-07-11 18:32:54 +00:00
Matthew Leeds
11c9d124d7 dir: Propagate errors from copying summary{.sig}
This commit ensures that flatpak_remote_state_save_summary()
initializes the passed GError pointer when returning FALSE. I found this
when looking into https://github.com/flatpak/flatpak/issues/1255 because
at the time of that bug report flatpak_dir_update_appstream() had this
g_file_replace_contents() code in it, which would have caused a seg
fault in update_appstream() after an unsuccessful call to
flatpak_dir_update_appstream().

Fixes https://github.com/flatpak/flatpak/issues/1255

Closes: #1893
Approved by: alexlarsson
2018-07-11 18:22:32 +00:00
Matthew Leeds
8aaacaac50 doc: Fix another typo 2018-07-11 17:58:13 +02:00
Matthew Leeds
6a49f65b6a doc: Fix a typo 2018-07-11 17:54:52 +02:00
AsciiWolf
8852534743 Update Czech translation
Closes: #1894
Approved by: mwleeds
2018-07-11 12:55:06 +00:00