Commit Graph

828 Commits

Author SHA1 Message Date
Matthew Leeds
c3a0617557 NULL initialize g_auto variables
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
2018-08-17 08:06:51 +00:00
Alexander Larsson
fe66d412ff build-commit-from: Fix gvariant leaks
ostree_repo_pull, etc does not sink the options variant, so
make sure to ref-sink it ourselves.

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:10 +00:00
Alexander Larsson
b8eb940795 build-commit-from: Fix some leaks
Use &s to get child strings, otherwise we get a copy.

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Alexander Larsson
cbbc98b50d Make FlatpakRemoteState refcounted
This is needed to fix a memory leak

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Alexander Larsson
0d1e094f9a info: Fix leak
We have to free the return value of flatpak_deploy_get_dir.

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Alexander Larsson
7e65d23a4a info: Fix leak
We have to free the FlatpakDir

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Alexander Larsson
60283fb58d info: Fix leak
flatpak_dir_read_latest return value has to be freed

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Owen W. Taylor
d7d05a8619 Use oci+http[s]:// as an URL to identify OCI registries
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.
2018-08-13 11:23:28 +02:00
Alexander Larsson
3fa34ebd8a Work around libsoup recursive type hang in tests
Closes: #1952
Approved by: alexlarsson
2018-08-09 15:45:08 +00:00
Alexander Larsson
f176d3eba3 Add --disable-fsync to build-export and build-commit-from
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
2018-08-09 13:12:42 +00:00
Owen W. Taylor
8a32f0e718 Remove FLATPAK_ENABLE_EXPERIMENTAL_OCI envvar check
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
2018-08-09 12:49:36 +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
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
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
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
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
Matthew Leeds
ea36e8e83f repair: Fix --help output 2018-07-16 17:18:08 -07: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
AsciiWolf
354d36f6b4 Fix typo in permission-remove command
Closes: #1894
Approved by: mwleeds
2018-07-11 12:55:06 +00:00
Alexander Larsson
0ac154e913 lib: Add FLATPAK_ERROR_REMOTE_NOT_FOUND error
And return it where we look up remotes.

Partial fix of #1855
2018-07-10 19:26:16 +02:00
Matthew Leeds
9c40725739 app: Drop some dead code
Since commit 096f7d4fb dropped flatpak_dir_check_for_appstream_update(),
this code can never be reached. Drop it to fix coverity issue 1471677.
2018-07-10 19:25:59 +02:00
Matthew Leeds
b35144a691 create-usb: Avoid invalidating the summary file
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.
2018-07-10 19:25:39 +02:00
Alexander Larsson
3f4518b15c Run uncrustify
Closes: #1870
Approved by: alexlarsson
2018-07-08 10:05:37 +00:00
Alexander Larsson
98fd052695 transaction: Move the handling of bundle runtime remote from cli code
This allows libflatpak users to also add runtime remotes
as needed by bundles.

Closes: #1868
Approved by: alexlarsson
2018-07-07 15:38:46 +00:00
Alexander Larsson
c0ebd3a121 transaction: Move flatpakref installation to transaction code
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
2018-07-07 15:38:46 +00:00
Matthew Leeds
e959fd3db0 WIP: Add a create-usb command
Fixes https://github.com/flatpak/flatpak/issues/1672

Closes: #1828
Approved by: alexlarsson
2018-07-07 15:25:50 +00:00
Simon McVittie
1f99b36593 build: Include built files from app/
This fixes an out-of-tree build.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1848
Approved by: alexlarsson
2018-07-02 08:17:08 +00:00
Simon McVittie
63162411e6 build: Tell make how to build app/*-dbus-generated.h
This was already set up for common/, but not yet for app/.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1848
Approved by: alexlarsson
2018-07-02 08:17:08 +00:00
Matthias Clasen
db1b39bdae Fix parallel builds
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
2018-06-29 17:53:00 +00:00
Alexander Larsson
f504656890 transaction: Mark error const in operation-error signal
Closes: #1841
Approved by: alexlarsson
2018-06-29 12:56:15 +00:00
Matthias Clasen
4c0662b03a Add a permission-reset command
This command removes all permissions for a given app
from the permission store.

Closes: #1837
Approved by: alexlarsson
2018-06-29 11:52:40 +00:00
Matthias Clasen
e9f5b1cf06 Add a permission-show command
This shows all the entries pertaining to a particular
app from the permission store.

Closes: #1837
Approved by: alexlarsson
2018-06-29 11:52:40 +00:00
Matthias Clasen
9867bb0cf5 Add a permission-remove command
This removes an item from the permission store.

Closes: #1837
Approved by: alexlarsson
2018-06-29 11:52:40 +00:00
Matthias Clasen
5d9bbeaed2 Add a permission-list command
This command dumps the content of the permission store
database(s).

Closes: #1837
Approved by: alexlarsson
2018-06-29 11:52:40 +00:00
Matthias Clasen
2a095814b5 Generate code for permission store proxy
This commit generates the code for the permission
store interface. Subsequent commits will use it.

Closes: #1837
Approved by: alexlarsson
2018-06-29 11:52:40 +00:00
Owen W. Taylor
8f73dbd32d Include appstream and icons in OCI bundles as annotations
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
2018-06-29 08:43:31 +00:00
Alexander Larsson
8d07ee5393 build: Respect extensions when building an extension
When building a runtime extension we still want to allow other
extensions to be used.

This fixes https://github.com/flatpak/flatpak-builder/issues/156
2018-06-21 10:47:37 +02:00
Alexander Larsson
491d174879 Make p2p build non-optional
Closes: #1800
Approved by: alexlarsson
2018-06-19 18:10:56 +00:00
Alexander Larsson
80a33e6a1b CliTransaction: Print permissions in ready callback
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
2018-06-19 14:54:22 +00:00
Alexander Larsson
b1a7930cc7 TablePrinter: Add span cells
These can be used to print rows that are not cell-aligned.

Closes: #1799
Approved by: alexlarsson
2018-06-19 14:54:22 +00:00
Alexander Larsson
0515e49140 transaction: Add APIs to set dependency sources
Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
5e8b5e5319 Transaction: Use flatpakTransactionOperation in signals
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
2018-06-19 08:30:21 +00:00
Alexander Larsson
ffaf2d5386 Cli transaction: Print the full uninstall/install/update lists in ready
This lets you see what operations will happen and you can confirm
it before starting the heavy operations.

Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
3367938432 update: Don't update appdata if transaction was aborted by user
Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Matthew Leeds
2df6916505 Fix a few mistakes in the docs 2018-06-15 12:31:40 -07:00
Alexander Larsson
a123c858a5 uninstall --unused: Don't prompt if no unused refs found
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
2018-06-11 09:22:55 +00:00
Alexander Larsson
27fe8dd6a3 build: Compute app_context before using it
This fixes a crash dereferencing a null app_context.

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

Closes: #1774
Approved by: alexlarsson
2018-06-11 08:24:08 +00:00
Philip Withnall
441fe25255 all: Use GMainContextPopDefault when handling thread defaults
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
2018-06-04 12:22:30 +00:00