Commit Graph

847 Commits

Author SHA1 Message Date
Alexander Larsson
9cfef87e1b uninstall --unused: Don't ask for ok twice
When the uninstall operation was moved to FlatpakCliTransaction the
prompting moved there. Unfortunately some prompting was left over
in the main code, this just deletes that.

This fixes #1928

Closes: #2056
Approved by: alexlarsson
2018-09-03 09:36:52 +00:00
Alexander Larsson
5051f51da6 uninstall --unused: Consider SDKs used
If some app uses a particular runtime as an sdk, consider it used.
This means if you once downloaded the sdk for some app you're debugging
it will not be removed until that app is uninstalled.

Its unclear exactly whether this is "used", but lets error on
the side of not deleting stuff.

Closes: #2057
Approved by: alexlarsson
2018-09-03 09:25:14 +00:00
Matthias Clasen
e832e7d5c2 override: Add a --show option
This option shows the contents of an override file. If an appid
is given, it shows overrides for that app, otherwise
the global overrides.

Closes: #2041
Approved by: alexlarsson
2018-08-29 14:58:15 +00:00
Matthias Clasen
b8daf08ea8 override: Add a --reset option
This option removes an override file. If an appid
is given, it removes overrides for that app, otherwise
the global overrides.

Closes: #2041
Approved by: alexlarsson
2018-08-29 14:58:15 +00:00
Matthias Clasen
07deb95c6a flatpak ps: Support child pid
The current pid column reports the pid of the bwrap
wrapper process running outside the sandbox. Add a
child-pid column that reports the pid of the main
sandbox process ("PID 1" on the inside).

Closes: #2039
Approved by: alexlarsson
2018-08-29 14:46:47 +00:00
Alexander Larsson
e2a79a275d Fix build with glib < 2.50
G_PID_FORMAT was added in glib 2.50, but pids are always %d on linux,
so we can avoid using it.

Closes: #2042
Approved by: alexlarsson
2018-08-29 07:21:26 +00:00
AsciiWolf
29f7393e43 flatpak ps: Fix typo in error message
Closes: #2034
Approved by: alexlarsson
2018-08-28 12:53:06 +00:00
Alexander Larsson
fbdc42ff9d ps: Add pid file also for flatpak build
Otherwise these will not show up in flatpak ps

Closes: #2033
Approved by: alexlarsson
2018-08-28 09:19:34 +00:00
Matthias Clasen
3548932c92 Cosmetic formatting fixes
Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
9e0f5dd79e Don't throw an error if there's nothing to show
When the .flatpak directory doesn't exist,
there are no running instances.

Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
03bb003f0f flatpak ps: Match uniqe prefixes of column names
So much more convenient to say 'app' than 'application'.

Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
ad49ca758c flatpak ps: Support commit as field
Add support for commit and runtime-commit.
We shorten these to 12 characters, as we do
elsewhere.

Closes: #2027
Approved by: alexlarsson
2018-08-28 07:51:12 +00:00
Matthias Clasen
e6f8b564cb Add a --column option
Allow the user to specify what fields to show.
This is ps, after all :)

Closes: #2023
Approved by: alexlarsson
2018-08-27 14:25:15 +00:00
Matthias Clasen
a9d4cc5838 Add a flatpak ps command
This enumerates running Flatpak instances.
For now, we just print the app ID and the PID.
More details can be added in the future.

Closes: #2023
Approved by: alexlarsson
2018-08-27 14:25:15 +00:00
Matthias Clasen
95e5b394c2 Save a pid for running sandboxes
Store the pid of the bwrap process which gets spawned or exec'ed
by flatpak inside the instance directory. This can be useful
for others, such as gnome-software, or a future 'flatpak ps'
command.

We write the pid to a file named 'pid'. It will get cleaned
up together with the instance directory.

Closes: #2023
Approved by: alexlarsson
2018-08-27 14:25:15 +00:00
Patrick Griffis
8f924de730 transaction: Print tags on install
This is specifically useful for the `properietary` tag that is
used on flathub.

Closes: #1992
Approved by: alexlarsson
2018-08-27 10:47:10 +00:00
Matthew Leeds
792a5c0606 transaction: Print newline character after error messages
Closes: #1979
Approved by: alexlarsson
2018-08-17 09:34:34 +00:00
Matthew Leeds
1fcffc8950 create-usb: Properly handle copying subpaths
Currently the create-usb command reads the subpaths listed in the
flatpak deploy data and just passes those to the ostree pull operation
to copy them to the USB. But this is not the correct way to handle them,
and leads to installs from the USB failing in the case where the locale
is partial (more specifically the install of the main ref succeeds but
the install of the locale extension doesn't).

So this commit changes create-usb to handle subpaths the same way
flatpak_dir_pull() and flatpak_dir_deploy() do, which is to copy the
/metadata path along with a subdirectory of /files for each listed
subpath. So in the case of an English partial locale, /metadata and
/files/en will be copied to the USB drive, and those are the subpaths
that will be pulled during the install (if the installing computer also
uses English).

Closes: #1972
Approved by: alexlarsson
2018-08-17 09:04:24 +00:00
Matthew Leeds
425940f0c3 create-usb: Fix a leak of the list of extensions
This only fixes the leak when we don't hit an error condition. To fix it
in that case we need an autoptr for deep lists.

Closes: #1966
Approved by: alexlarsson
2018-08-17 08:13:15 +00:00
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