Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make P2P API public (no longer experimental) #1596

Closed
wants to merge 2 commits into from

Conversation

mwleeds
Copy link
Member

@mwleeds mwleeds commented May 22, 2018

Currently the API that allows P2P operations (e.g. pulling an ostree ref
from a LAN or USB source) is hidden behind the configure flag
--enable-experimental-api. This commit makes the API public and makes
that flag essentially a no-op (leaving it in place in case we want to
use it again in the future). The P2P API has been tested over the last
several months and proven to work.

This means that since we're no longer using the "experimental" feature
flag, P2P builds of Flatpak will fail when using versions of OSTree from
this commit onwards, until Flatpak is patched in the near future. If you
want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree
2018.6, you'll have to patch Flatpak. However, since Flatpak won't yet
have a hard dependency on OSTree 2018.6, it needs a new way to determine
if the P2P API in OSTree is available, so this commit adds a "p2p"
feature flag. This way the feature set is more semantically correct than
if we had continued to use the "experimental" feature flag.

In addition to making the P2P API public, this commit makes the P2P unit
tests run by default, changes a few man pages to reflect the changes,
updates the .gitignore, and updates the bash completion to account for
P2P related command line options.

@papr-bot
Copy link

Can one of the admins verify this patch?

@mwleeds
Copy link
Member Author

mwleeds commented May 23, 2018

@cgwalters could you do a release with this commit included in the near future? Sorry to mess up your normal schedule but I'm trying to get Flathub P2P enabled in time for Endless 3.4.1. Thanks!

@mwleeds
Copy link
Member Author

mwleeds commented May 23, 2018

Interestingly the CI failure here:

ot-builtin-find-remotes.c:(.text+0xbf9): undefined reference to `ostree_repo_find_remotes_async'

isn't unique to this branch. You can reproduce it on the master branch using the configure flags used by the CI but with --enable-experimental-api instead of --disable-experimental-api:

./autogen.sh --sysconfdir=/etc --prefix=/usr --libdir=/usr/lib64 --enable-gtk-doc --without-curl --without-soup --disable-gtk-doc --disable-man --disable-rust --without-libarchive --without-selinux --without-smack --without-openssl --without-avahi --without-libmount --disable-rofiles-fuse --enable-experimental-api

Copy link
Member

@pwithnall pwithnall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve looked over this from the point of view of whether the changes in the patch are correct, and they look correct. I haven’t really looked at it from the point of view of whether they’re complete (whether other changes need to be made to completely un-experimentalise the API and implementation).

I also haven’t reviewed each new API and command line tool to ensure they’re the right shape to be released (as stable API which has to be supported forever). I think they are the right shape, but I’m also pretty sure that we deferred some API discussions to “the point at which the experimental API is going to be made public”. So those reviews/discussions do need to happen.

@@ -63,14 +63,12 @@ static OstreeCommand commands[] = {
{ "export", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_export,
"Stream COMMIT to stdout in tar format" },
#ifdef OSTREE_ENABLE_EXPERIMENTAL_API
{ "find-remotes", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_find_remotes,
"Find remotes to serve the given refs" },
{ "create-usb", OSTREE_BUILTIN_FLAG_NONE,
ostree_builtin_create_usb,
"Copy the refs to a USB stick" },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two ostree subcommands (find-remotes and create-usb) need to be added to bash/ostree to get completion support.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 9131d8a) made this pull request unmergeable. Please resolve the merge conflicts.

@mwleeds mwleeds force-pushed the enable-experimental-api branch 2 times, most recently from 9ec31b3 to ac94b1d Compare May 24, 2018 17:49
@cgwalters
Copy link
Member

Overall, it looks pretty good to me. Minor notes:

  • ostree_repo_pull_from_remotes_async() should probably just refer to the main ostree_repo_pull_with_options() option set

Actually that's it.

@pwithnall
Copy link
Member

  • ostree_repo_pull_from_remotes_async() should probably just refer to the main ostree_repo_pull_with_options() option set

That’s not entirely trivial to do, since they support different subsets of the options. Each of the options which is supported by both functions has the same semantics in both implementations.

For example, ostree_repo_pull_from_remotes_async() will never support the refs or override-commit-ids options.

Furthermore, an explicit copy_option() call has to be added to ostree_repo_pull_from_remotes_async() for each option it wants to pass through to ostree_repo_pull_with_options(). On that basis, I think it’s best to just explicitly list the options for the two functions separately, but copy the same wording for each equivalent option. Otherwise I can see the list of options in ostree_repo_pull_with_options() growing (and its documentation growing), but no copy_option() calls being added to ostree_repo_pull_from_remotes_async(), and hence its documentation pointing to something which is incorrect.

@pwithnall
Copy link
Member

@cgwalters: to be clear, are you happy with all of the API here being set in stone for ever more?

@cgwalters
Copy link
Member

@cgwalters: to be clear, are you happy with all of the API here being set in stone for ever more?

What would be the alternatives? Split it into a higher level library? Doesn't seem worth it. Something else?

@pwithnall
Copy link
Member

What would be the alternatives? Split it into a higher level library? Doesn't seem worth it. Something else?

Tweak it now before making it public. I’m happy the API is the right shape and architecture. There might be naming niggles or minor changes you’d want to make around the function arguments or whatever, which might be annoying once stable.

I was basically just double-checking that you’re happy with this and are not being pressured into getting it in quickly over getting it in correctly.

@mwleeds
Copy link
Member Author

mwleeds commented May 25, 2018

For the record I also want to get it right and not just do it quickly. I've looked at most of this API to see if it seems future proof, and I'll look through it again before considering this ready to merge (still need to fix the build failures also of course).

@pwithnall: you said there were discussions that were postponed to this point. Would they be on old PRs or somewhere else?

@pwithnall
Copy link
Member

For the record I also want to get it right and not just do it quickly.

I didn’t mean to imply otherwise!

@pwithnall: you said there were discussions that were postponed to this point. Would they be on old PRs or somewhere else?

I honestly can’t remember. There are a few FIXME comments in the experimental code: if any of those affect the API, we should probably look into them. Any discussions which didn’t result in a FIXME probably aren’t worth picking up again.

@mwleeds mwleeds force-pushed the enable-experimental-api branch 4 times, most recently from 8b0af03 to 041faf9 Compare May 26, 2018 01:49
@cgwalters
Copy link
Member

@mwleeds Can you split the prep commits to a separate PR?

@mwleeds
Copy link
Member Author

mwleeds commented May 29, 2018

@mwleeds Can you split the prep commits to a separate PR?

I'll get the CI happy with this branch before splitting it off; otherwise I'd have no way to know the prep commits have their intended effect.

@mwleeds mwleeds force-pushed the enable-experimental-api branch 3 times, most recently from b55106c to da55f81 Compare May 29, 2018 02:45
@mwleeds
Copy link
Member Author

mwleeds commented May 29, 2018

This is now blocked on https://gitlab.gnome.org/GNOME/libglnx/merge_requests/1 (and a libglnx update in ostree).

That should fix the Travis build, and then the only remaining failure is of flatpak, but that's intentional and will have to be fixed on the flatpak side.

@cgwalters
Copy link
Member

Currently the flatpak context is blocking though; we could disable it, or land the prep fixes in flatpak first, then bump the CI context here to pull that newer flatpak version?

@mwleeds
Copy link
Member Author

mwleeds commented May 29, 2018

Currently the flatpak context is blocking though; we could disable it, or land the prep fixes in flatpak first, then bump the CI context here to pull that newer flatpak version?

Sure, we can do the latter

@mwleeds mwleeds force-pushed the enable-experimental-api branch 2 times, most recently from 5071557 to dfbcfd4 Compare May 31, 2018 00:22
@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably bf3525a) made this pull request unmergeable. Please resolve the merge conflicts.

@mwleeds mwleeds force-pushed the enable-experimental-api branch 2 times, most recently from 6ec1b66 to 02da0c5 Compare May 31, 2018 21:58
@mwleeds
Copy link
Member Author

mwleeds commented May 31, 2018

bot, retest this please

@mwleeds
Copy link
Member Author

mwleeds commented Jun 2, 2018

Alright, so I found all the FIXME/TODO/XXX comments in the affected files and looked at each. In my opinion none of them should be considered blockers to merging this PR, and only three seem like they have the potential to cause bugs (see attached if you want the details).

"File","Line number","Comment","P2P related","Verdict"
"src/libostree/ostree-core.c",2104,"/* TODO: make this public later; just wraps the previously public","no",
"src/libostree/ostree-core.c",2131,"/* TODO */","no",
"src/libostree/ostree-repo-commit.c",1172,"/* TODO: dedup this with commit_path_final() */","no",
"src/libostree/ostree-repo-commit.c",3367,"* TODO: Do this lazily, since for e.g. bare-user-only repos","no",
"src/libostree/ostree-repo-pull.c",1403,"/* TODO - make async */","no",
"src/libostree/ostree-repo-pull.c",2507,"* them. TODO: Ideally this free space check would be above, but we'd have to","no",
"src/libostree/ostree-repo-pull.c",3018,"/* TODO; port away from this; a bit hard since both libsoup and libcurl","no",
"src/libostree/ostree-repo-pull.c",3847,"/* TODO reindent later */","no",
"src/libostree/ostree-repo.c",3977,"/* TODO more consistency checks here */","no",
"src/libostree/ostree-repo-commit.c",2097,"/* FIXME: Added OSTREE_SUPPRESS_SYNCFS since valgrind in el7 doesn't know","no",
"src/libostree/ostree-repo-commit.c",4357,"/* FIXME - cleanup detached metadata if copy below fails */","no",
"src/libostree/ostree-repo-finder-avahi.c",105,"/* FIXME: Submit these upstream */","yes","Non-critical"
"src/libostree/ostree-repo-finder-avahi.c",110,"/* FIXME: Register this with IANA? https://tools.ietf.org/html/rfc6335#section-5.2 */","yes","Non-critical"
"src/libostree/ostree-repo-finder-avahi.c",221,"/* FIXME: Need a better separator than `_`, since it’s not escaped in the input. */","yes","Non-critical but important"
"src/libostree/ostree-repo-finder-avahi.c",1376,"/* FIXME: Make this a property */","yes","Non-critical"
"src/libostree/ostree-repo-finder-mount.c",149,"/* FIXME: Need a better separator than `_`, since it’s not escaped in the input. */","yes","Non-critical but important"
"src/libostree/ostree-repo-finder-override.c",96,"/* FIXME: Need a better separator than `_`, since it’s not escaped in the input. */","yes","Non-critical but important"
"src/libostree/ostree-repo-finder.c",516,"/* FIXME: Check if this is really the ordering we want. For example, we","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",3246,"/* FIXME: Send the ETag from the cache with the request for summary.sig to","no",
"src/libostree/ostree-repo-pull.c",3841,"/* FIXME: Do we want an analogue of this which supports collection IDs? */","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5137,"/* FIXME: We currently do nothing with @progress. Comment out to assuage -Wunused-variable */","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5186,"/* FIXME: In future, we also want to pull static delta superblocks in this","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5202,"/* FIXME: All these downloads could be parallelised; that requires the","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5365,"/* FIXME: Support remotes which have contenturl, mirrorlist, etc. */","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5591,"* FIXME: It would be so much better if we could pass #OstreeRemote pointers","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5756,"/* FIXME: Rework this code to pull in parallel where possible. At the moment","yes","Non-critical"
"src/libostree/ostree-repo-pull.c",5828,"/* FIXME: We do nothing useful with @progress at the moment. */","yes","Non-critical"
"src/libostree/ostree-repo-refs.c",117,"/* FIXME: Conflict detection needs to be extended to collection–refs","yes","Non-critical but important"
"src/ostree/ot-builtin-prune.c",246,"/* FIXME: Do we also want to look at ostree_repo_list_collection_refs()? */","yes","Non-critical but important"
"src/libostree/ostree-repo-pull.c",3784,"/* XXX: would be interesting to implement metalink as another source of","no",
"src/libostree/ostree-repo.c",1697,"/* XXX Not sure it's worth failing if the group to remove","no",
"src/libostree/ostree-repo.c",5062,"/* XXX This is a hackish way to indicate to use ALL remote-specific","no",
"src/ostree/ot-remote-builtin-add.c",150,"* XXX Not sure this interacts well with if-not-exists since we don't","no",
"src/ostree/ot-remote-builtin-add.c",168,"/* XXX If we ever add internationalization, use ngettext() here. */","no",

@cgwalters
Copy link
Member

Hm, not obvious to me what failed with the installed tests.

@mwleeds
Copy link
Member Author

mwleeds commented Jun 4, 2018

I suppose this is a good opportunity for me to install Atomic so I can debug this.

@cgwalters
Copy link
Member

Let's just try it and see if it bounces.

@rh-atomic-bot r+ eeda9ea

@rh-atomic-bot
Copy link

🙀 eeda9ea is not a valid commit SHA. Please try again with 02da0c5.

@cgwalters
Copy link
Member

Ah. For excessive OCD, mind squashing the (effective) fixup commit into the main one?

@mwleeds
Copy link
Member Author

mwleeds commented Jun 4, 2018

It's a pretty separate concern than the main commit, no?

@cgwalters
Copy link
Member

OK, but it's also a requirement of the next commit right? We don't bisect much today, but let's try to keep things working between commits too.

@mwleeds
Copy link
Member Author

mwleeds commented Jun 4, 2018

Only if you're linking against an old glib

This commit includes libglnx.h in ostree-autocleanups.h, so we get the
g_autoptr backports wherever they're needed. Also, remove the "#include
libglnx.h" lines elsewhere that are no longer needed.
Currently the API that allows P2P operations (e.g. pulling an ostree ref
from a LAN or USB source) is hidden behind the configure flag
--enable-experimental-api. This commit makes the API public and makes
that flag essentially a no-op (leaving it in place in case we want to
use it again in the future). The P2P API has been tested over the last
several months and proven to work.

This means that since we're no longer using the "experimental" feature
flag, P2P builds of Flatpak will fail when using versions of OSTree from
this commit onwards, until Flatpak is patched in the near future. If you
want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree
2018.6, you'll have to patch Flatpak.  However, since Flatpak won't yet
have a hard dependency on OSTree 2018.6, it needs a new way to determine
if the P2P API in OSTree is available, so this commit adds a "p2p"
feature flag. This way the feature set is more semantically correct than
if we had continued to use the "experimental" feature flag.

In addition to making the P2P API public, this commit makes the P2P unit
tests run by default, removes the f27-experimental CI instance that's no
longer needed, changes a few man pages to reflect the changes, and
updates the bash completion script to accept the new commands and
options.
@mwleeds
Copy link
Member Author

mwleeds commented Jun 4, 2018

I changed the order of the commits

@cgwalters
Copy link
Member

@rh-atomic-bot r+ 22806ee

@rh-atomic-bot
Copy link

⌛ Testing commit 22806ee with merge 8fbf19c...

rh-atomic-bot pushed a commit that referenced this pull request Jun 4, 2018
Currently the API that allows P2P operations (e.g. pulling an ostree ref
from a LAN or USB source) is hidden behind the configure flag
--enable-experimental-api. This commit makes the API public and makes
that flag essentially a no-op (leaving it in place in case we want to
use it again in the future). The P2P API has been tested over the last
several months and proven to work.

This means that since we're no longer using the "experimental" feature
flag, P2P builds of Flatpak will fail when using versions of OSTree from
this commit onwards, until Flatpak is patched in the near future. If you
want to build Flatpak < 0.11.8 with P2P enabled and link against OSTree
2018.6, you'll have to patch Flatpak.  However, since Flatpak won't yet
have a hard dependency on OSTree 2018.6, it needs a new way to determine
if the P2P API in OSTree is available, so this commit adds a "p2p"
feature flag. This way the feature set is more semantically correct than
if we had continued to use the "experimental" feature flag.

In addition to making the P2P API public, this commit makes the P2P unit
tests run by default, removes the f27-experimental CI instance that's no
longer needed, changes a few man pages to reflect the changes, and
updates the bash completion script to accept the new commands and
options.

Closes: #1596
Approved by: cgwalters
@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing 8fbf19c to master...

@mwleeds mwleeds deleted the enable-experimental-api branch June 4, 2018 20:01
@vtolstov
Copy link

vtolstov commented Jun 5, 2018

can somebody provide more info how to use p2p via lan?

@mwleeds
Copy link
Member Author

mwleeds commented Jun 6, 2018

Hi @vtolstov,

Currently Endless OS is the only distribution with support for LAN ostree updates, and even there we have some bugs left to fix before it's a smooth experience (hopefully in the next few months). If you want to try to do LAN ostree updates on another Linux distribution you would need replacements for eos-update-server and eos-updater-avahi. However USB updates don't depend on those components, so for that you basically just need a repository with a collection ID set, as is being discussed here. See also man ostree-find-remotes and man ostree-create-usb (which are only public man pages on the master branch of ostree).

@vtolstov
Copy link

vtolstov commented Jun 6, 2018

@mwleeds Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants