Repository navigation
Drop support p2p in favour of simpler side-loading scheme - #3476
Conversation
|
This pull request fixes 3 alerts when merging f773c64 into 6395d04 - view on LGTM.com fixed alerts:
|
|
Don't really have time for a full review right now but I wonder if And do you have any thoughts on how LAN updates fit into this? If it becomes a priority to get those working, are these changes going to make that much more difficult? |
|
I dunno about lowering this, all the supporting code is in flatpak atm and I'm not sure how much it would help if ostree had some support, as most of the work is done in the resolve phase which revolves around pre-acquiring the metadata for pre-install permission checks. @cgwalters opinions? @mwleeds I understand you don't have time for a full review of the code, but it would be nice if you can do a highlevel reveiew of the feature and see if it would work for the endless usecase (where you're currently using p2p). Maybe @ramcq can give some feedback too? |
|
We probably also want a way to add temporary sideload repos on the commandline (or in the libflatpak APIs) for things like installers that don't want to mess with the global configuration. |
|
Hmm, I guess with sideload repos lowered to ostree we could do pulls from the network a bit better. I.e if the sideloaded version is older than the upstream but still have some objects in common we could avoid downloading those. |
|
This pull request fixes 3 alerts when merging 80792eb into 6395d04 - view on LGTM.com fixed alerts:
|
|
So, wrt LAN updates the way I see them working is that we set up a machine on the local network that runs what is essentially a caching http forwarder. It can be something like a custom nginx setup or even some app that endless works that you just install on some machine. There are some alternatives to how this can be set up in flatpak on the client:
The last setup is quite flexible in that it will automatically work when the mirror is available and fall back to the upstream otherwise. However, it will need some fixes in flatpak where it downloads files by itself which does not currently handle mirrorlist uris. I also looked at using the mirrorlist support to handle sideloading individual objects, but the mirror support is http(s) only. |
This allows us to print some separators for the logs also. tests: Convert more tests to ok helper
We use some BASH_XTRACEFD hackery to hide the trace output from the internals of the assert (and ok) functions, so that the log output can focus on what is important, i.e. what asserts are checked and what errors do they print.
9993752 to
5cf9bb8
Compare
|
New version, now with testcase and fixes that were needed to make both appstream sideloading and --system sideloading work. |
|
This pull request fixes 3 alerts when merging 5cf9bb8 into 6395d04 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 3 alerts when merging e947d5a into 6395d04 - view on LGTM.com fixed alerts:
|
I don't get it. The commits already have collection IDs set in their metadata if the server is configured properly. Why add another option?
As you said in a later comment, I think it would be really helpful to pull what you can locally even if the Internet has a newer version of something, since that seems like a common use case. If it's too complicated to pull from both the local and online source in the same transaction, perhaps we could do two updates: the local one then the online one.
I'm not convinced it would be bad to enable collection IDs on existing versions of Flatpak. The known bugs were fixed a long time ago (see flathub/flathub#676 (comment)).
|
| return FALSE; | ||
|
|
||
| if (flatpak_deploy_data_has_subpaths (deploy_data)) | ||
| return flatpak_fail (error, _("Related ref '%s' is only partially installed"), ref); |
There was a problem hiding this comment.
Why do we want to fail? If you're offline and have your language, the person you're sharing it with probably has the same language right
There was a problem hiding this comment.
Hmm, its possible you want it. But it is more likely you're not even aware of this happening, which will cause you to generate a usb repo that may break for users in weird ways. I.e. the pull would just stop in the middle with some "missing object 123abc..." error.
Maybe we could have a switch that turns this into a warning instead.
There was a problem hiding this comment.
Yeah, better to have a warning and ideally a more useful error message on the install side than "missing object".
What Endless needs is:
In both cases from repositories created with So while I don't have a good grasp on these changes yet, if it can do those things it should work for us. I could potentially take a closer look next week, but if it might be reworked to lower |
|
Oh, and we also have:
|
I'm not sure what you mean here. We have a remote "flathub" and a sideload repo containing mirror refs like |
Its hard to do it outside of ostree, because we have no idea what objects from the old repo we will need until we start pulling the new version from the network. We could use the mirror functionality of ostree, but that unfortunately only works for http urls. We could pull whatever is the current version of the ref into the repo and then the latest from upstream, but that will cause a lot of i/o (and extra diskspace use) copying things that are unlikely to be used, especially as old sideload repos grow more and more stale. |
But, if we land this PR, it will be known that long-term using collection-ids like in regular p2p is going to go away. Then it seems like a poor idea to enable if for users of older versions. For example, it may cause issues when a later flatpak update goes back to non-p2p. |
Oh, interesting. Yeah, we should do this too. Also, probably mark FlatpakRemoteRefs that are available offline in general.
I think the right place to do USB disk probing is in the udev scripts (or equivalent) anyway rather than every instance of flatpak probing all the disks all the time. That could also gives the sysadmin more control of what is probed etc. However, we should probably ship an example udev rule and the required tooling to make this easy to setup. |
|
Actually, i wonder if we can just reusing the regular per-remote collection-id option. It does change some things wrt how refs are stored, but if we don't call the p2p APIs i think we'll get essentially normal behaviour. I'm gonna research this a bit. |
|
(Just a brief comment to say that I’m not going to weigh in on this. I haven’t had time to work on P2P for a while, and evidently didn’t leave it in a finished enough state. I still think that the general solution of collection IDs and repo finders is appropriate, and that with some profiling work on the implementation of the repo finders, it would be a lot more usable. However, I don’t personally have time to do that work, so I’ll shut up. Carry on however you think is best. 🙂) |
|
This pull request fixes 3 alerts when merging 294b67c into 6395d04 - view on LGTM.com fixed alerts:
|
|
I'm pretty satisfied with the state of this and am gonna merge it now. The main missing part is to write an example udev rule to automatically add sideload repos. I will file a separate issue for that. |
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On versions of Flatpak prior to 1.7.1, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak#3476). Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running older flatpak versions, such as Endless OS versions older than 3.9.0 (which is planned for November 2020). Also, update the unit tests to check that this is working. This has the additional benefit of checking that the locally configured collection ID matches the one configured on the server side. A mismatch would cause offline distribution to fail.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, drop changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, as it’s no longer present in the test repositories.
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, enhance changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, to ensure it’s present in the test repositories (by dbn)
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, enhance changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, to ensure it’s present in the test repositories (by dbn)
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, enhance changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, to ensure it’s present in the test repositories (by dbn)
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, enhance changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, to ensure it’s present in the test repositories (by dbn)
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, enhance changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, to ensure it’s present in the test repositories (by dbn)
On all recent versions of Endless, the offline app install functionality depends on the "ostree-metadata" ref being available for each collection. So for example a flash drive containing refs from both eos-apps and flathub would have to have both (com.endlessm.Apps, ostree-metadata) and (org.flathub.Stable, ostree-metadata) on it. However Flatpak from 1.7.1 onward no longer depends on ostree-metadata to do offline updates and therefore no longer pulls it during online install/update operations (see flatpak/flatpak#3476). Upstream Flatpak does still put ostree-metadata on a drive in "flatpak create-usb" if it exists locally. So this is a patch to fill the gap: pull ostree-metadata any time we're fetching from a remote, so it will be available when create-usb is run, so such USB drives will work with computers running Endless OS versions older than 3.9.0. Also, update the unit tests to check that this is working. Rebase 1.10.2 (T31594): Fix minor rebase conflict, drop duplicate definition of variable, enhance changes to `test-sideload.sh` which check that the `ostree-metadata` ref is actually present, to ensure it’s present in the test repositories (by dbn)
As discussed on the list: https://lists.freedesktop.org/archives/flatpak/2020-February/001912.html
Instead of using the ostree p2p APIs we support a much simpler approach that only allows sideloading via local repositories. We only use regular non-p2p codepaths for remote installs, and we never create any local collection-id refs. However, the remote repo does enable a collection id and all refs are commited bound to that. This allow us to use create-usb to create a sideloading repo.
There is a new global option xa.sideload-repos which is list of pahts to local repos we will sideload from. Then each app that wants to enable this sets xa.sideload-collection-id so that we know what collection id in the sideload repos to pull from.
Picking of the repo to install from happens when resolving the refs in FlatpakTransaction, and if we're sideloading we just pass the file: uri of the repo instead of the repo name to the regular ostree pull operation. There is some trickiness in the resolve to ensure we get the best (fastest, but available) source, but it is nothing compared to the full power of the ostree p2p battle-station.
This is an initial WIP, I want to go over the codebase more to see what can be streamlined. But, it would be good to get some external review at this point.
Known remaining issues: