Commit Graph

5154 Commits

Author SHA1 Message Date
Alexander Larsson
e1f46ff43e OCI: Handle manifests without annotations in index.json
When we export a manifest to the index, always pass the ref we're
targeting instead of relying on the org.opencontainers.image.ref.name
annotation, because that may not be set if we're using labels instead.

This is no big deal, because we know what ref we're handling anyway.
2019-09-03 16:00:25 +02:00
Alexander Larsson
a9a0c37e5e OCI: Make use of labels or annotations configurable
If repo uri has ?index=label then query for labels, otherwise
keep querying for annotations like before.
2019-09-03 11:19:47 +02:00
Alexander Larsson
b5335899df build-bundle: Add --oci-use-labels switch
This allows the user to pick at runtime whether to use
annotations or labels as OCI metadata carrier. For historical
reasons annotations is the default, but some registries don't
support this and then you can use labels instead.
2019-09-03 11:19:47 +02:00
Alexander Larsson
68e5d95aa2 OCI: Use labels as commit metadata source as well as annotations
We now pull the image config as well as the manifest and fall
back on the labels field if the keys we're looking for are not
in the annotations field.

This lets us support docker manifests too, which don't have
annotations (but do have labels).
2019-09-03 11:19:47 +02:00
Alexander Larsson
83c2bdf077 OCI: Don't crash if mediaType field missing in flatpak_oci_versioned_from_json 2019-09-03 11:19:47 +02:00
Alexander Larsson
94ed2946ab OCI: Add flatpak_oci_registry_load_image_config helper
We can't use load_versioned() for images because in the docker
case there is no mediatype field.
2019-09-03 11:19:47 +02:00
Alexander Larsson
09831d535a OCI: Accept docker v2 manifests as well as OCI manifests 2019-09-03 11:19:47 +02:00
Alexander Larsson
9436cf6e10 OCI: Add docker v2 media type defines 2019-09-03 11:19:47 +02:00
Alexander Larsson
f88bad8245 oci: Query for org.flatpak.ref label instead of annotation
This is not compatible with the old stuff, but works with registries
that only support the docker manifest format.
2019-09-03 11:19:47 +02:00
Alexander Larsson
4fde171055 oci: Allow reading metadata from labels too 2019-09-03 11:19:47 +02:00
Alexander Larsson
d820e333ed oci: Always generate a history, quay needs this 2019-09-03 11:19:47 +02:00
Alexander Larsson
4de8683d0c Put annotations also in the labels 2019-09-03 11:19:47 +02:00
Alexander Larsson
6294ddb1ca oci: Add an easy api to set the labels in the image manifest 2019-09-03 11:19:47 +02:00
Alexander Larsson
2b2b5b715b OCI: Break out the annotation generation code into a helper
This doesn't change the behaviour, it just breaks out everything related
to flatpak-specific annotations into one place where it can be resued.
2019-09-03 11:19:47 +02:00
Zander
89526100ce Add English (UK)
Closes: #3068
Approved by: mwleeds
2019-08-30 22:57:31 +00:00
Zander
dc930ce7f6 Add en_GB
Closes: #3068
Approved by: mwleeds
2019-08-30 22:57:31 +00:00
Bartłomiej Piotrowski
8f7c96f408 Default end-of-life-rebase prompt to yes
Closes: #3063
Approved by: mwleeds
2019-08-20 21:15:21 +00:00
Heiko Becker
1678d0cb9f Avoid installing empty dirs with --disable-selinux-module
...by moving everything selinux specific into the scope of the
if.
2019-08-16 12:53:52 +02:00
Philip Withnall
791f31898b flatpak-installation: Handle an unconfigured remote when listing remotes
This prevents a crash in flatpak_installation_list_remotes_by_type() if
the `FlatpakDir` can’t ensure it has a repo configured.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #3028
Approved by: alexlarsson
2019-08-16 09:33:18 +00:00
Debarshi Ray
e82efa8603 Trim unused shared library linkages from the session helper
The org.freedesktop.Flatpak user D-Bus service isn't just used by
flatpak(1) or applications running as Flatpaks. It's also used by
toolbox(1) for similar reasons:
 * To keep various configuration files inside the container
   synchronized with the host
 * To let the container request certain commands to be run on the host

The org.freedesktop.Flatpak D-Bus service itself doesn't need much in
the way of dependencies, but inherits a lot of unused shared library
linkages through the libflatpak-common.la convenience library. Removing
these unused shared libraries reduces the footprint of toolbox(1) for
those who care about such things. eg., Fedora CoreOS.

This commit brings down the number of shared libraries to 19 from 62.

Closes: #3052
Approved by: alexlarsson
2019-08-16 09:13:43 +00:00
Debarshi Ray
61d4316043 common, session-helper: Make the session helper more self-contained
... by moving the definition of FlatpakHostCommandFlags from the
'common' sub-directory to 'session-helper'. It hasn't been used by
anything else ever since flatpak-builder was moved to a separate
repository in commit 52bd146561.

Closes: #3052
Approved by: alexlarsson
2019-08-16 09:13:43 +00:00
Debarshi Ray
cde7934041 build: Link against libxml only when necessary
The libxml API is used in a relatively few places inside the 'common'
sub-directory. It's definitely not as widespread as GLib. A subsequent
commit will leverage this to prevent unused shared libraries from
being linked to the session helper.

Closes: #3052
Approved by: alexlarsson
2019-08-16 09:13:43 +00:00
Debarshi Ray
ebf5d08f47 build: Link against libarchive only when necessary
The libarchive API is used in a relatively few places inside the
'common' sub-directory. It's definitely not as widespread as GLib. A
subsequent commit will leverage this to prevent unused shared
libraries from being linked to the session helper.

Closes: #3052
Approved by: alexlarsson
2019-08-16 09:13:43 +00:00
Yuri Chornoivan
de24b11390 Update Ukrainian translation
Closes: #3056
Approved by: alexlarsson
2019-08-15 20:24:44 +00:00
Owen W. Taylor
a794c07e18 OCI: correctly handle locally present icons
If the download URL for an icon was already cached locally, the HTTP
code returned FLATPAK_OCI_ERROR_NOT_CHANGED - this was treated as a real
error, and after downloading missing icons, all present icons were
deleted!

See https://bugzilla.redhat.com/show_bug.cgi?id=1683375

Closes: #3048
Approved by: alexlarsson
2019-08-15 20:04:18 +00:00
Matthew Leeds
5e65174e8d build-bundle: Fix resolving refs
Unfortunately in commit 253fcc6e3 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

Also, add a unit test that fails without this patch.

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

Closes: #3032
Approved by: alexlarsson
2019-08-15 19:42:45 +00:00
Matthew Leeds
b44c1a5799 dir: Don't overzealously rewrite an error
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson
2019-08-15 19:42:45 +00:00
Matthew Leeds
9a258e8a0c common: Use correct flag for ostree_repo_resolve_rev_ext()
Use the correct NONE flag, although both are 0 so this change won't make
any functional difference.

Closes: #3032
Approved by: alexlarsson
2019-08-15 19:42:45 +00:00
Matthew Leeds
f09049b7aa common: Fix branch validation docs
The docs for flatpak_is_valid_branch() say branch names can't start with
a digit but the implementation doesn't enforce this, and we have lots of
branches out in the wild that start with a digit (e.g. "3.32" and
"5.12"). So make the docs imply that branches can start with a digit.

The implementation also disallows "." as the leading character for a
branch, so add that to the docs. I'm just guessing that "." was intended
to be disallowed but it makes sense; otherwise the file we create named
with the branch would be hidden.

Closes: #3023
Approved by: alexlarsson
2019-08-15 09:07:14 +00:00
Philip Withnall
f80cce6b8d installation: Fix a small leak of a FlatpakCollectionRef
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #3031
Approved by: mwleeds
2019-08-03 05:03:23 +00:00
Andre Moreira Magalhaes
eaec3a8203 cli-transaction: Fix some leaks
Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>

Closes: #3025
Approved by: matthiasclasen
2019-07-23 14:54:59 +00:00
Andre Moreira Magalhaes
37a7b6edfd transaction: Append bundle to correct list on flatpak_transaction_add_install_bundle()
Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>

Closes: #3025
Approved by: matthiasclasen
2019-07-23 14:54:59 +00:00
Matthew Leeds
9a0e45941a doc/flatpak-kill: Add a hint about flatpak ps 2019-07-21 12:50:50 -07:00
Matthew Leeds
5edafefa4b doc/flatpak-enter: Make a few minor improvements 2019-07-21 12:45:58 -07:00
Simon McVittie
75b5b7c763 Don't register polkit agent if we cannot connect to system bus
This works around an old polkit client library bug which would cause
a segfault in this situation. The bug was fixed long ago in upstream
polkit, but is still present in Debian 10 'buster', Ubuntu 19.04 'disco'
and all older releases, due to Debian/Ubuntu using a branch of polkit
to avoid the mozjs dependency. It should finally get fixed in Debian 11
and Ubuntu 19.10.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/923046

Closes: #2997
Approved by: matthiasclasen
2019-07-11 18:11:21 +00:00
Matthew Leeds
f1b8a4275f transaction: Fix "Can't load dependent file" error
Make the error message translatable, and add ": " between the URL and
the rest of the error.

Closes: #3003
Approved by: mwleeds
2019-07-05 15:41:56 +00:00
Matthew Leeds
9928ce757f libtest.sh: Delete unreachable exit command 2019-07-02 16:12:42 -07:00
Matthew Leeds
4fd7d7d209 main: Handle double slashes in $XDG_DATA_DIRS
When checking for Flatpak directories in $XDG_DATA_DIRS, treat
/example//path/ as equivalent to /example/path/.

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

Closes: #2990
Approved by: alexlarsson
2019-06-28 08:44:41 +00:00
Matthew Leeds
4a9ba3b346 .papr.yml: Add back -fsanitize=address
Let's see if the crash still happens which was keeping us from adding
this flag.

Closes: #2991
Approved by: alexlarsson
2019-06-28 08:42:51 +00:00
Matthew Leeds
d8e6bf425f .papr.yml: Update to Fedora 29
Fedora 28 is end-of-life, and ostree is already on F29.

Closes: #2991
Approved by: alexlarsson
2019-06-28 08:42:51 +00:00
Richard Hughes
7e62d01d9b Add 5 missing symbols to the generated GtkDoc output
Closes: #2982
Approved by: mwleeds
2019-06-25 20:44:16 +00:00
Kukuh Syafaat
6775c3eb0b Update Indonesian translation
Closes: #2971
Approved by: matthiasclasen
2019-06-24 19:25:51 +00:00
Rafael Fontenelle
407e6dcc2d Update Brazilian Portuguese translation
Closes: #2961
Approved by: matthiasclasen
2019-06-20 19:07:35 +00:00
Matthew Leeds
1ce250b5bd common/flatpak-dir-private.h: Fix order of arguments
This issue was introduced by commit 5da7a0411.

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

Closes: #2968
Approved by: matthiasclasen
2019-06-20 19:06:51 +00:00
Matthew Leeds
9d2b73d42b .gitignore: Ignore doc/reference/libflatpak-docs.html 2019-06-14 16:23:07 -07:00
Matthew Leeds
80ee0a79a6 README: Update docs links
Now that the libflatpak reference is on docs.flatpak.org, link to it.
And link to the Introduction section as well.
2019-06-14 16:17:53 -07:00
Antonio Larrosa
7898ffef96 Rename libflapak-docs.xml to fix a typo in its name
Note the missing 't'

Closes: #2963
Approved by: mwleeds
2019-06-14 23:02:10 +00:00
Kalev Lember
18a1622755 ref: Fix a memory leak
Closes: #2964
Approved by: mwleeds
2019-06-14 22:44:27 +00:00
Ryan Gonzalez
2b93928285 revokefs-fuse: Fix some build warnings
Closes: #2952
Approved by: alexlarsson
2019-06-13 07:16:33 +00:00
Richard Hughes
4f327649fd Do not break ABI and cause gnome-software to crash
This restores the ABI to the pre-1.4.0 version. This moves the new signal to
the *end* of the struct and also correctly decrements the padding.

Fixes https://github.com/flatpak/flatpak/issues/2957, although we probably need
a 1.4.1 release with this included pretty quickly to avoid chaos.

Closes: #2958
Approved by: alexlarsson
2019-06-13 06:59:41 +00:00