summaryrefslogtreecommitdiff
path: root/app
Commit message (Collapse)AuthorAgeFilesLines
...
* uninstall: Make error message prettierPhaedrus Leeds2022-04-191-5/+10
| | | | | | The "*unspecified*" bits are ugly, and the ref/arch/branch syntax is especially confusing when we're doing fuzzy matching, since it implies the id was searched for exactly.
* uninstall: Error out when all refs are invalidPhaedrus Leeds2022-04-191-0/+7
| | | | | | | | | | | | | | | | | Currently if you specify one non-existent ref to the uninstall command, it exits with a non-zero status: $ flatpak uninstall notaflatpak error: notaflatpak/*unspecified*/*unspecified* not installed ...but if you specify more than one non-existent ref you get warnings for each and a zero exit status: $ flatpak uninstall notaflatpak alsonot Warning: notaflatpak is not installed Warning: alsonot is not installed So make the latter case error out like the former.
* build: Consistently include libglnx header as "libglnx.h"Simon McVittie2022-04-1144-44/+44
| | | | | | | | | | | | | | Recent Meson versions have warnings if you add the subprojects directory as an include path, because the way Meson wants to consume subprojects is by the subproject's build system producing a Meson dependency object that encapsulates its include directory. Flatpak doesn't have a Meson build system yet, but I'm working on that. libglnx seems to be set up to have the libglnx directory be its include path instead: for example, ostree (by the author of libglnx) already uses "libglnx.h" or <libglnx.h> everywhere. Do the same here. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Improve --sideload-repo option to take create-usb dirsPhaedrus Leeds2022-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when using the sideloading support for offline updates, there are two types of directories that are interesting: an ostree repo directory on a directory that was passed to `flatpak create-usb`. By default the latter has a repo at the subpath ".ostree/repo", and if a custom destination was specified with "--destination-repo", a symlink is created pointing to it in ".ostree/repos.d". Currently Flatpak supports either repos or create-usb dirs in the `sideload-repos` directory in either the Flatpak installation or `/run/flatpak` (see flatpak(1)), but only supports repo directories being passed to "--sideload-repo" for the install and update commands. This is pretty confusing and actually made me think the sideload support was broken because I forgot about this limitation. So change things so we can accept either type of directory specified either way: via option or via the "sideload-repos" directories. I've tested all of the following cases: - pointing to a repo with --sideload-repo - pointing to a create-usb dir with --sideload-repo - linking to a repo in ~/.local/share/flatpak/sideload-repos - linking to a create-usb dir in ~/.local/share/flatpak/sideload-repos - pulling from a sideload repo when online as a performance improvement
* app: Don't overzealously tab complete optionsPhaedrus Leeds2022-02-211-0/+3
| | | | | | | | If the user hasn't typed a '-', don't offer options in the tab autocompletion. This is consistent with other linux commands, and less messy. Fixes https://github.com/flatpak/flatpak/issues/4753
* Delete some unreachable ref-not-found codePhaedrus Leeds2022-02-191-10/+4
| | | | | | | flatpak_remote_state_lookup_ref() always sets the error to FLATPAK_ERROR_REF_NOT_FOUND when it returns FALSE. Found by coverity CID 1514265
* search: Improve memory efficiencyPhaedrus Leeds2022-02-171-12/+7
|
* search: Properly get branch valuesPhaedrus Leeds2022-02-171-5/+13
|
* search: Fix printing app ID with no .desktop suffixPhaedrus Leeds2022-02-171-3/+17
| | | | | | | | | | | | | | In https://github.com/flatpak/flatpak/issues/4535 it was brough to light that the search command strips the ".desktop" suffix from app IDs even if they genuinely end in .desktop. This commit fixes the reverse issue now that we've ported to libappstream: don't include the .desktop suffix even if it's present in the id of the appstream component, which it sometimes is. Fortunately we already ignore any components that don't have flatpak <bundle> elements, so we can unambiguously get the ID there. Fixes #4535
* app: Check appstream file not found error codePhaedrus Leeds2022-02-171-4/+2
| | | | | | Now that we switched from appstream-glib we don't need this hack. See https://github.com/ximion/appstream/pull/362
* Add macro for having appstream 0.14.0Phaedrus Leeds2022-02-172-2/+7
| | | | | | | Older versions of libappstream don't provide AS_CHECK_VERSION() so we can't use that, and we need the check because as_component_get_branch() is only in libappstream >= 0.14.0, and the return value of as_metadata_parse_file() changed in 0.14.0
* app: Drop unnecessary wrappersPhilip Withnall2022-02-175-22/+6
| | | | | | | | | Since the port from libappstream-glib to libappstream, these wrappers are trivially thin and can be dropped. This commit introduces no functional changes. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
* app: Port to libappstreamPhilip Withnall2022-02-176-145/+91
| | | | | | | | | | | | | | libappstream-glib is mostly unmaintained, and libappstream is more actively developed (and up to date with the AppStream specification). Port from libappstream-glib to libappstream. Handily, a lot of the APIs are exactly the same. The main changes are: * `AsApp` → `AsComponent` * `AsStore` → `AsMetadata` Signed-off-by: Philip Withnall <pwithnall@endlessos.org> (Mostly done by Philip, then Phaedrus finished this)
* Revert "search: Don't strip .desktop suffix overzealously"Phaedrus Leeds2022-02-171-29/+2
| | | | | | This reverts commit 62e09b406b8a7fb517c294d2c0b149a83f2cc64b. This is implemented differently after the libappstream port.
* Revert "search: Use <bundle> ID to determine flatpak app ID"Phaedrus Leeds2022-02-171-30/+16
| | | | | | This reverts commit 39de0ef280a98f67d639444cc6ea3bcfa61c0eec. This is implemented differently after the libappstream port.
* build-init: Write .gitignore in build dirWill Thompson2022-02-141-0/+13
| | | | | | | | | | | It is common for the build directory to be within a Git checkout. Developers never want to check this directory into Git. Make 'flatpak build-init', and hence 'flatpak-builder', create a blanket .gitignore file inside this directory, so the containing checkout doesn't need to predict the name of the build directory and ignore it. (Inspired by Meson's treatment of its build directory.)
* app: Make ALL_DIRS and STANDARD_DIRS imply OPTIONAL_REPOSimon McVittie2022-02-112-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is already the case that when we are using ALL_DIRS, we always combine it with OPTIONAL_REPO, meaning no need to populate empty installations. ALL_DIRS is used for commands that iterate through all known installations to enumerate apps/runtimes, such as `flatpak run` and `flatpak list`; for these commands, it's reasonable to say that if the installation does not have a libostree repository, then that's equivalent to it having a libostree repository with no apps and no runtimes. Make this happen automatically if forgotten. For STANDARD_DIRS, we were inconsistent about this: `flatpak remote-list` had OPTIONAL_REPO, but the other commands did not. STANDARD_DIRS is used for `flatpak create-usb`, and for all the commands that manipulate remotes. For the commands that manipulate remotes, it seems reasonable to say that if an installation has no libostree repository and we are unable to create one, then that's equivalent to an installation with a libostree repository but no remotes. Similarly, for create-usb, an installation where we are unable to create a libostree repository seems like it should be equivalent to an installation whose libostree repository does not contain any of the refs we are interested in. Resolves: https://github.com/flatpak/flatpak/issues/4111 Signed-off-by: Simon McVittie <smcv@collabora.com>
* Don't rely on AS_BUNDLE_KIND_FLATPAK existingSimon McVittie2022-01-121-0/+2
| | | | | | The appstream-glib in Ubuntu 16.04 didn't have this. Signed-off-by: Simon McVittie <smcv@debian.org>
* Export to share/metainfo not share/appdataPhaedrus Leeds2022-01-101-2/+8
| | | | | | | | | Read metainfo files from both share/appdata and share/metainfo to support new and old versions of flatpak-builder (https://github.com/flatpak/flatpak-builder/pull/441) but only export to the new path. Fixes https://github.com/flatpak/flatpak/issues/4599
* document-unexport: Finish implementing --doc-idPhaedrus Leeds2022-01-101-4/+41
| | | | Picking up Matthias' commit from a few years ago to get it mergeable.
* document-unexport: Allow unexporting by docidMatthias Clasen2022-01-101-1/+6
| | | | | | | | If the backing document has been deleted, then looking up the doc-id fails. To work around this, allow specifying the doc-id directly. Closes: #1897
* repair: Properly mark invalid commits as partialPhaedrus Leeds2022-01-101-2/+30
| | | | | | | | | | | | | | | | | | | | Commits that are found to have missing or invalid objects need to be marked partial so that when the thing referencing them is reinstalled, the missing objects will be pulled. libostree treats non-partial commits as complete even if they're not, since verifying their completeness is an expensive operation. This exactly mirrors what the "ostree fsck" command does when it finds corruption in a commit. This fix is especially important because corrupt repos have been an issue lately so we at least need repair to work properly. Relatedly, delete invalid commit objects to ensure they are re-downloaded, though it's not clear that code path is almost ever reachable. Fixes https://github.com/flatpak/flatpak/issues/4618
* app: Don't use polkit agent in history commandPhaedrus Leeds2022-01-041-2/+3
| | | | | | | | There's no need to use polkit in the history command, so don't start the agent in flatpak-main.c. This means we can avoid a test failure in test-history.sh which was caused by old versions of valgrind being unaware of syscall sched_getattr, which is used in g_bus_get_sync(), itself called by install_polkit_agent().
* history: Fix exclusion of temp reposPhaedrus Leeds2022-01-041-6/+9
| | | | | Without this change there are history entries showing pulls into temporary repos which we don't want.
* history: Omit entries for appstream refsPhaedrus Leeds2022-01-041-10/+14
| | | | | | | | | | | | | Currently we include entries in the output of the history command for pulls of appstream refs, e.g. "appstream2/x86_64". However since they don't have an application ID the Application column shows up blank and it seems like a pull of nothing which is confusing. These are basically an implementation detail like the temp repo pulls we already exclude, so I think it makes sense to exclude them from the output. It would also make sense to exclude pulls of ostree-metadata refs, but for some reason I don't see those in practice, even with a collection ID set on the remote.
* history: Fix printing refsPhaedrus Leeds2022-01-041-16/+24
| | | | | | | | | | | | | The history command seems to have been broken since it was changed to use FlatpakDecomposed, since that type only works for app or runtime refs, resulting in errors such as: $ flatpak history error: appstream2/x86_64 is not application or runtime Fix this by making the logic a bit smarter, and don't let any one invalid ref entry prevent the whole command from working. Fixes #4332
* run: Fix session-bus and a11y-bus args being incorrectPatrick Griffis2022-01-041-1/+1
| | | | | This would incorrectly overwrite the a11y-bus option and not set the default session-bus options.
* app: Refuse to work with sudo and --userPhaedrus Leeds2022-01-041-0/+10
| | | | | | Have heard of people running Flatpak commands with both sudo and --user, and not expecting it work on the root user's installation. Let's just not allow it since it's not something people ever do intentionally.
* list: Tweak logic for excluding Locale/Debug extensionsPhaedrus Leeds2021-11-181-21/+13
| | | | | | | | | | | | | | | | | | | | The man page states that the --all option for the list command includes runtime extensions (e.g. that end in .Locale or .Debug) and this is the case. When --all is omitted, we only show such extensions when the thing they extend is not already in the list. However when you run a command like "flatpak list --runtime --columns=application,branch", you get a list that excludes runtime locale extensions but includes app locale extensions, since the corresponding apps are not in the list despite presumably being installed. This doesn't seem like the right behavior, so tweak the logic so that app locale extensions are excluded when --all is omitted and --runtime is used. Strictly speaking the "extension-of" information is not guaranteed to be present in the deploy data (which acquires it from the metadata), but in practice it seems to be present for all but Sources extensions, and I think it should be considered required since we are already using it to implement functionality elsewhere in Flatpak: https://github.com/flatpak/flatpak/issues/4585
* app: Don't tab-complete on aliasesPhaedrus Leeds2021-11-181-1/+1
| | | | Fixes https://github.com/flatpak/flatpak/issues/4036
* Make test suite logs prettierPhaedrus Leeds2021-11-161-7/+7
| | | | | | | | | | | | | | This fixes a few issues with the unit test logs that make them ugly: 1. Currently some lines of output from a command will appear after the line from xtrace which has the next command, since the command was printing to stdout and xtrace uses stderr. E.g. "Installation complete." will appear after "+ flatpak --user install -y ..." but it is from the previous install command. 2. Lines of output have many spaces after them to pad them to the table width but this is not needed for non-fancy output. 3. Lines of output are mixed with output from httpd since they don't end with a newline character, e.g. "Installing… ▊ 4%127.0.0.1 - - [16/Nov/2021 00:18:24] "GET /..."
* build-finish: Export appstream metainfo into a single directoryGuido Günther2021-11-151-0/+1
| | | | | | | | | | | | | This is similar to what is done for desktop files and allows applications to use a flatpak's metainfo to retrieve e.g. required input controllers or the supported screen sizes. Similar to what can be done for non-flatpak'ed apps by looking at /usr/share/{metainfo,appdata}. Since flatpak moves the metadata from metainfo/ to appdata/ during build we only need to export files from that single directory. Signed-off-by: Guido Günther <agx@sigxcpu.org>
* app: Fix behavior when installing end-of-life-rebased refPhaedrus Leeds2021-11-152-5/+32
| | | | | | | | | | | | | | | | | | | | | | Currently if the user specifies a ref to install that has been renamed via the end-of-life-rebased mechanism, for example "flatpak install com.visualstudio.code.oss", Flatpak erroneously tries to install both the old and new versions of the app. This happens because the code handling end-of-life-rebase conditions is written assuming the rebased app is being updated rather than installed for the first time. Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in end_of_lifed_with_rebase(), we treat a failure of flatpak_transaction_add_uninstall() as fatal and return FALSE from the signal handler, which means that the install operation that triggered the signal will not be skipped (see the docs for FlatpakTransaction::end-of-lifed-with-rebase). So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and ignore it, so that the installation of the old version of the renamed app will be properly cancelled. Fixes https://github.com/flatpak/flatpak/issues/3754
* build-update-repo: Don't try to generate deltas of unknown refsPhaedrus Leeds2021-11-151-1/+1
| | | | | Spotted this by code inspection. Ignoring such refs was clearly the intended behavior based on the comment.
* app: Don't use carriage return for non-fancy outputPhaedrus Leeds2021-11-151-5/+5
| | | | | | | | | flatpak_fancy_output() determines whether the output we write is intended for e.g. a tty or e.g. a log file, the latter being "not fancy". Currently we write carriage return characters in the not fancy case, but change that to new lines, which are interpreted correctly by editors such as vim (whereas a carriage return shows up as ^M since it is not the correct newline character on Unixy operating systems).
* search: Use <bundle> ID to determine flatpak app IDPhaedrus Leeds2021-11-151-16/+28
| | | | | | The <bundle> element in the appstream data unambiguously provides the full four-part flatpak ref, so use it to determine the app ID. But fall back to using the <id> element, since that is required to be present.
* search: Don't strip .desktop suffix overzealouslyPhaedrus Leeds2021-11-151-2/+29
| | | | | | | | This commit changes the search command to properly output the app ID for IDs that end in .desktop, e.g. to print org.telegram.desktop rather than org.telegram. Fixes https://github.com/flatpak/flatpak/issues/4535
* build-init: Use SDK arch for SDK extensions...gasinvein2021-10-211-4/+7
| | | | ...instead of the app we're building arch.
* repair: Fix incorrect progress when refs are skippedRyan Gonzalez2021-09-171-1/+3
| | | | | | Issue was shown in this comment: https://github.com/flatpak/flatpak/issues/3542#issuecomment-917497591
* install: Avoid a superfluous prompt to choose the only remotePhaedrus Leeds2021-08-243-6/+8
| | | | | | | | | | | | The install command can search available remotes for a specified flatpak when a remote wasn't specified. In case only one remote is configured, or in case only one of the configured remotes matches the ref specified, we currently prompt the user to confirm use of the remote anyway (unless -y/--assumeyes was used). Skip this prompt even when -y/--assumeyes was not used, since the remote to use will still effectively be confirmed when the list of refs to be installed is presented for confirmation. Fixes https://github.com/flatpak/flatpak/issues/4364
* Add missing G_GNUC_PRINTF attributesSimon McVittie2021-05-254-8/+2
| | | | | | | | | | This allows callers to be checked for mismatches between format string and arguments, and also means gcc can assume that the format string and the arguments match up correctly when forwarding them to functions like g_strdup_vprintf, removing the need to suppress -Wformat-nonliteral warnings. Signed-off-by: Simon McVittie <smcv@collabora.com>
* completion: Always pass a format string to flatpak_completion_debugSimon McVittie2021-05-251-1/+1
| | | | | | | | In principle this could have been subject to a format string attack via an argument containing %n, although in practice the code that uses this format string is #if 0. Signed-off-by: Simon McVittie <smcv@collabora.com>
* CLI: List arch if it is not the primary arch (even if unique)Alexander Larsson2021-05-193-3/+31
| | | | | | Currenly we only list arch in the list of things to install from a transaction if not all the refs are the same arch. It makes more sense to show the arch even if its unique if they are not the primary arch.
* Include more architectures when listing installed refs.Alexander Larsson2021-05-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | It turns out that we can't currently uninstall a ref from a non-standard arch without specifying the arch even if there is no similar ref installed for the main arch. (#4264) The fundamental reason for this that `flatpak_dir_find_installed_ref(s)` currently only returns refs with standard arches unless you explicitly specify an arch. This changes flatpak_dir_find_installed_refs() to always return all the refs for all installed arches. This is generally what we want anyway, except in the case of "flatpak run org.some.Platform" where we don't want to prompt if there are multiple arches installed, so that is manually changed. This changes find_matching_ref() to look for refs in all arches, but always prefer (without prompting) the default arch if that is installed. This also matches what all current callers want. Fixes #4264
* builtin-utils: Use shared helperAlexander Larsson2021-05-191-5/+11
| | | | | This uses the new flatpak_remote_state_ensure_subsummary_all_arches() helper in ensure_remote_state_all_arches().
* Transaction: Ensure we download the subsummary for the arch of added refsAlexander Larsson2021-05-191-5/+1
| | | | | | | | By default we only download the main arch subsummary, so if you added a ref for some other arch it failed to find the ref. This works with the CLI, because it explicilty loads the subsummary when its trying to expand the parial ref to the full ref. However apps using libflatpak don't do that so they failed.
* Fix several memory leaksPhaedrus Leeds2021-05-041-3/+3
|
* list: Add a g_assert() for a coverity warningPhaedrus Leeds2021-05-041-0/+1
|
* remote-info: Fix memory leak of branchPhaedrus Leeds2021-05-041-1/+1
|
* remote-info: Fix printing of branchPhaedrus Leeds2021-05-041-1/+1
|