It's a good idea to NULL initialize g_autoptr/g_autofree variables, so
we can be sure uninitialized memory isn't passed to g_free or similar.
Closes: #1968
Approved by: alexlarsson
The old pattern of using a separate 'OCI' flag was very ugly
internally in the code once it was extended to flatpak bundles and
flatpakrefs - using a different URI scheme means that the nature
of the remote can't be accidentally lost in some part of the code.
Probing would be possible as well, but would make it difficult to
add a remote when offline, and also doesn't deal well with the
fact that our data layout is different for the two types of remotes -
the type of remote could change at any point!
As a side effect this change enables flatpakrefs and flatpak bundles for OCI
registries.
This mirrors ostree commit --disable-fsync and is useful in some cases.
For instance, we'd like to use it when building the temporary import
repositories in flathub.
Closes: #1951
Approved by: alexlarsson
Now that appstream data and icons are retrievded from the index, the OCI
code is expected to be fully usable, and to work with registries as they
will actually be deployed.
Closes: #1910
Approved by: alexlarsson
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
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
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
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
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/1877Closes: #1924
Approved by: treitter
Since the create-usb command doesn't run as root (and if it did GNOME
Software wouldn't be able to call out to it), it can't update the
summary file in the source repo if the system installation is being
used. So the user is expected to run `ostree summary -u` before using
create-usb. But if the create-usb command then updates the appstream
data and repo metadata refs, the summary will no longer point to the
latest commits on those refs. As a short term fix, avoid updating the
appstream data and repo metadata, and mention in the manpage that the
user should do so. The better solution, not requiring any manual steps
on the user's part, will require a fix for
https://github.com/ostreedev/ostree/issues/1664.
This adds the flatpak_transaction_add_install_flatpakref method
to easily install from flatpakref files. It additionally
adds a new signal called add-new-remote which is called in two
cases:
To ask if the user wants to add a "normal" remote for the url
specified by a flatpakref file.
When a new remote is required for the runtimes the application
depends on.
Closes: #1868
Approved by: alexlarsson
With the newly introduced generated sources in app/,
the (parallel) GNOME ci builds were failing. Add the
generated sources to BUILT_SOURCES to fix that. For
good measure, also add them to CLEAN_FILES.
Closes: #1843
Approved by: mwleeds
Include annotations:
org.freedesktop.appstream.appdata
org.freedesktop.appstream.icon-{64,128}
into OCI bundles. This not only makes the bundle self-describing, but also
if the bundle is imported into a registry, it becomes possible to browse
the registry and recreate an appstream by only retrieving the annotations
for relevant images, without having to download the actual images.
The icon annotations are formatted as data: URI's with base64 data. The idea
is that a server-side process to collect annotations could extract the icons
to separate storage and rewrite the URI's to remote URL's.
Closes: #1834
Approved by: alexlarsson
This is a pretty lowlevel version of the permissions, and there
is no nice API for the library to produce these. However its got
the basics of permission tracking.
Closes: #1799
Approved by: alexlarsson
This changes the signals to use a FlatpakTransactionOperation
argument instead of a bunch of arguments in the signal, making
this easier to extend in the future.
This is an API break, but nobody is using this API yet, and it
was only available in one unstable release.
Closes: #1797
Approved by: alexlarsson
If there was no refs found to delete, we don't want to print the "ok?" prompt.
Instead we just say that nothing was found.
Closes: #1776
Approved by: alexlarsson
Simplify some of the return logic when handling pushing/popping the
thread default main context by using g_autoptr(GMainContextPopDefault).
Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1736
Approved by: alexlarsson