Commit Graph

7164 Commits

Author SHA1 Message Date
Alexander Larsson
b6a1eb8d48 Delete some unused variables 2020-11-10 14:32:13 +01:00
Alexander Larsson
9b9c2f0a93 decomposed: Pass FlatpakDecomposed to find_*_related functions 2020-11-10 14:32:13 +01:00
Alexander Larsson
a988ee19d8 decompose: Use FlatpakDecomposed for bundles 2020-11-10 14:32:13 +01:00
Alexander Larsson
a3a2dcb2c5 decomposed: Remove _decomposed prefix on functions
We now converted most of these and removed the non-prefixed functions,
so rename them back.
2020-11-10 14:32:13 +01:00
Alexander Larsson
c14486f935 Use decomposed in flatpak_summary_match_subrefs() 2020-11-10 14:32:13 +01:00
Alexander Larsson
109cac60f6 decomposed: Store a FlatpakDecomposed in FlatpakRelated 2020-11-10 14:32:13 +01:00
Alexander Larsson
59509fd82d Add flatpak_decomposed_id_has_prefix() 2020-11-10 14:32:13 +01:00
Alexander Larsson
38a0706e76 decomposed: Return decomposed from find_installed_pref/ref 2020-11-10 14:32:13 +01:00
Alexander Larsson
97767f1a69 decomposed: Pass decomposed to flatpak_dir_deploy_install/update 2020-11-10 14:32:13 +01:00
Alexander Larsson
28f1ce3d62 Remove unused (non-decomposed) flatpak_dir_list_refs 2020-11-10 14:32:13 +01:00
Alexander Larsson
d8ad979378 repair: Convert to decomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
1402128f22 decomposed: Convert flatpak_dir_deploy() to take decomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
7e40dbfb74 Convert flatpak_dir_deploy() to use FlatpakDecomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
e98376bdf1 decomposed: Add flatpak_decomposed_equal_except_branch ()
This is used in flatpak_dir_deploy()
2020-11-10 14:32:13 +01:00
Alexander Larsson
6897b8e2ff decomposed: Take decomposed arg in flatpak_dir_load_deployed()
Then convert all callers
2020-11-10 14:32:13 +01:00
Alexander Larsson
48641c05f6 app utils: Add print_aligned_take()
This makes it easy to print a string that came from a strdup() like
return value.
2020-11-10 14:32:13 +01:00
Alexander Larsson
5a858230dd decomposed: Add flatpak_decomposed_get_kind_metadata_group()
This is a useful helper.
2020-11-10 14:32:13 +01:00
Alexander Larsson
3b7f31350e dir: Use FlatpakDecomposed in apply_extra_data()
Just replaces flatpak_decompose_ref + GStrv
2020-11-10 14:32:13 +01:00
Alexander Larsson
1fc8d540d5 uninstall: Use FlatpakDecomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
b77c337790 update: Convert to user FlatpakDecomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
eadf6147ae list: Use decomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
5ea43736d9 flatpak_dir_list_refs_decomposed: Support kinds as a flag
This lets you get both apps and runtimes in one call.
2020-11-10 14:32:13 +01:00
Alexander Larsson
ee9507a81d remote-ls: Fix regression with -a
During the previous coversion we accidentally dropped
flatpak_make_valid_id_prefix() when getting the "parent"
id of a subid (like `foo.Locale`).
2020-11-10 14:32:13 +01:00
Alexander Larsson
a65eb29faf dir: Use decomposed in flatpak_dir_list_unused_refs() 2020-11-10 14:32:13 +01:00
Alexander Larsson
3544e907c3 dir: Remove flatpak_dir_get_all_installed_refs()
This is now made unused by the _decomposed versions
2020-11-10 14:32:13 +01:00
Alexander Larsson
784fc00c0c dir: Replace one user of flatpak_dir_list_refs with _decomposed version 2020-11-10 14:32:13 +01:00
Alexander Larsson
fa1a494566 decomposed: Convert various "current ref" functions to use FlatpakDecomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
fbcef76a37 Add flatpak_dir_list_refs_for_name_decomposed 2020-11-10 14:32:13 +01:00
Alexander Larsson
d7377f33bd transaction: Use flatpak_decomposed_new_from_pref() 2020-11-10 14:32:13 +01:00
Alexander Larsson
105edb64f5 decomposed: Add flatpak_decomposed_new_from_pref()
This is useful as we have partial refs in the metadata files, like
the app runtime dependency.
2020-11-10 14:32:13 +01:00
Alexander Larsson
08dc7cb2aa dir: Remove unused non-_decomposed() helpers
This removes flatpak_dir_list_remote_refs() and
flatpak_dir_list_all_remote_refs() which have no more users, as everything
migrated to the _decomposed() versions.
2020-11-10 14:32:13 +01:00
Alexander Larsson
877cede50b decomposed: Store ref data inline if possible.
When we're not taking the string from elsewhere, store the string data
inline.
2020-11-10 14:32:13 +01:00
Alexander Larsson
cd34088969 Transaction: Convert internal refs to FlatpakDecomposed
We convert early in the API so that we can rely on the format everywhere
and use the faster getters for the parts of the refs.
2020-11-10 14:32:13 +01:00
Alexander Larsson
840cb2ed3d decomposed: Add id_has_suffix() helper 2020-11-10 14:32:13 +01:00
Alexander Larsson
db11607016 installation: Use the FlatpakDecomposed APIs to create FlatpakRef:s
This means we do a bit less string operations, but it also allows us
to pick up the collection-id when listing refs from a file: uri, fixing
the issues described in https://github.com/flatpak/flatpak/pull/3909

This slightly changes the behaviour of collection ids and remotes.
When listing regular remotes we only ever return the refs with the
collection id specified by the configuration of that remote. However,
when specifying a file: uri for the remote name we return all the refs
in the repo, with their corresponding collection id.

This means the test suite has to change a bit as before we returned
all the collrefs from the remote, not just the one matching the configured
collection id.
2020-11-05 10:43:10 +01:00
Alexander Larsson
247fed25ff remote-state: For local repos, set collection id for main ref table too
If you're listing a file: uri we (as before) add the collection-ref
tables, but we now also set the proper collection-id for the main ref
table if the ostree.summary.collection-id key is set.
2020-11-05 10:43:10 +01:00
Alexander Larsson
bd5029e72a dir: Add flatpak_dir_list_refs_decomposed() 2020-11-05 10:43:10 +01:00
Alexander Larsson
abb097f812 decomposed: Support defaults in flatpak_decomposed_new_from_parts
This allows NULL for arch and branch, similar to
e.g. flatpak_build_runtime_ref().
2020-11-05 10:43:10 +01:00
Alexander Larsson
3b63c51ce6 decomposed: Add support for FlatpakRefKind 2020-11-05 10:43:10 +01:00
Alexander Larsson
425147e4b1 Add flatpak_decomposed_new_from_parts() 2020-11-05 10:43:10 +01:00
Alexander Larsson
5dae1fc6bc Break out ref helper functions to separate file
flatpak-utils.c is getting large, and also I got some issues with
include order, so split out things that are purely handling ref stings
in various ways to its own file.
2020-11-05 10:43:10 +01:00
Alexander Larsson
ed192e1044 remote-ls: Add a smarter fallback for names if appstream is missing
Rather than just taking the last element of the name we also
look at known extensions like .Platform, .Sdk, .Debug, .Locale, etc.
2020-11-05 10:43:10 +01:00
Alexander Larsson
7757b1dea7 RemoteState: For a local repos, add refs with all collection ids.
If you are listing a remote named (e.g.) file:///some/path/to/repo then we
have no idea what the actual collection id is for that remote, so we can't
pick the right part. In practice, this is typically done when listing
a side-load repo, such as described in
https://blogs.gnome.org/mclasen/2018/08/26/about-flatpak-installations/
or by the endless software installer that lists available offline apps.

This kinda abuses the FlatpakDecomposed object to store the collection
id, even if that doesn't normally carry this. This is not optimal, but it
is kind of a weird case and there isn't really any other place for it that
makes sense either, and having it there is efficient and keeps the APIs.
2020-11-05 10:43:10 +01:00
Alexander Larsson
e1da8d9455 remote-ls: Use list_decomposed() 2020-11-05 10:43:10 +01:00
Alexander Larsson
089a5bebd5 Add flatpak_dir_list_remote_refs_decomposed() 2020-11-05 10:43:10 +01:00
Alexander Larsson
7465ba0f18 Various FlatpakDecomposed API updates
getters now have three forms:
  const char *foo_peek() returns pointer into data and length
  const char* foo_get() returns zero terminated pointer into data
  char *foo_dup() returns allocated zero terminated pointer

Not everything has all of these (as that is not always possible), but
it is clear what each one does.

We also now support storing a collection id for a
FlatpakDecomposed. This is not typically done (as we use the source
remote to define the collecion id and don't expose this concept to the
user). However, for the case when directly listing a local repo (such as
a side-load repo) we need this.

We now validate the arch string. The valid chars are a-z, A-Z, 0-9 and
_. This was't previously verified, but no arches in existance have other
chars.

There is a new flatpak_decomposed_new_from_decomposed() which lets you
modify part of another ref. Say replace the arch or the branch and
keep the rest the same.
2020-11-05 10:43:10 +01:00
Phaedrus Leeds
ce377e577f transaction: Tweak docs around eol-rebase 2020-11-05 09:33:26 +01:00
Alexander Larsson
97740ab3f6 remote state: Try loading non-index summary from memory cache before fetching
We used to go:
 * indexed summary memory cache
 * indexed summary fetch
 * compat summary memory cache
 * compat summary fetch

But now we go:
 * indexed summary memory cache
 * compat summary memory cache
 * indexed summary fetch
 * compat summary fetch

This means in the compat case we don't constantly have to fail the
summary fetch before using the memory cache.
2020-11-03 15:14:16 +01:00
Alexander Larsson
dddeaca8c3 transaction: Reuse FlatpakRemoteState when finding dependencies
This moves a bunch of code from FlatpakDir to FlatpakTransaction which was
only used to find dependencies. This allows us to reuse the existing
cache of FlatpakRemoteState objects in the transaction.
2020-11-03 14:19:58 +01:00
Alexander Larsson
d61721022d Change the last user of flatpak_dir_list_all_remote_refs to use _decomposed
This will let us remove the non-decomposed one.
2020-11-03 12:57:37 +01:00