-
Notifications
You must be signed in to change notification settings - Fork 290
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
create-usb: Add a create-usb command to complement OstreeRepoFinderMount #1182
Conversation
Thinking about file systems, this either needs to check the file system of the destination repository (and check that it supports xattrs), or use a repository mode which doesn’t need xattrs (I think the only option in this case is archive-z2; we can’t use bare-user-only because we can’t lose the permissions since the repository isn’t a leaf checkout). Colin, would it make sense for this tool to potentially eventually grow a |
I’ve pushed fixups which check whether the destination file system supports xattrs. If it does, |
☔ The latest upstream changes (presumably d0b0578) made this pull request unmergeable. Please resolve the merge conflicts. |
be45860
to
d23a4e9
Compare
Hm, need to think about this a bit more; big picture I'd been trying to slowly move away from the This feels like sort of an in-between; not opposed or anything, just need to think about it a bit. |
☔ The latest upstream changes (presumably 64b23fd) made this pull request unmergeable. Please resolve the merge conflicts. |
Previously, collection–refs could only be pulled from a repository if it had a summary file (which listed them). There was no way to pull from a local repository which doesn’t have a summary file, and where the refs were stored as refs/remotes/$remote/$ref, with a config section linking that $remote to the queried collection ID. Fix that by explicitly supporting pull_data->remote_repo_local in fetch_ref_contents(). Signed-off-by: Philip Withnall <withnall@endlessm.com>
a293fc6
to
230bb0d
Compare
This can be used to put OSTree repositories on USB sticks in a format recognised by OstreeRepoFinderMount. Signed-off-by: Philip Withnall <withnall@endlessm.com>
230bb0d
to
0c2e340
Compare
Rebased (same for the other dependent PRs). |
src/libostree/ostree-repo-pull.c
Outdated
&refs, cancellable, error)) | ||
return FALSE; | ||
|
||
ret_contents = g_strdup (g_hash_table_lookup (refs, ref->ref_name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just ostree_repo_resolve_rev()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, yes.
src/libostree/ostree-repo-pull.c
Outdated
cancellable, error)) | ||
return FALSE; | ||
|
||
ret_contents = g_strdup (g_hash_table_lookup (refs, ref)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(See below, this reminds me we need a collection equivalent of ostree_repo_resolve_rev()
.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ll add a basic version of that in this PR, but it’ll basically be a splitting out of the code which is already in the PR. It can be optimised in a follow-up issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fine by me.
if (!glnx_fstatat_allow_noent (ostree_repo_get_dfd (dest_repo), "summary", &stbuf, 0, error)) | ||
return FALSE; | ||
if (errno == ENOENT && | ||
!ostree_repo_regenerate_summary (dest_repo, NULL, cancellable, error)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to regenerate the summary always after doing a pull, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really; only when publishing the summary
. Although the end result is equivalent.
if (ret < 0 && errno != EEXIST) | ||
return glnx_throw_errno_prefix (error, "symlinkat(%s → %s)", symlink_path, relative_dest_repo_path); | ||
else if (ret >= 0) | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a private _ostree_make_temporary_symlink_at()
though it's harder to use private bits from the cmdline. It uses glnx_gen_temp_name()
which is visible here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fairly similar to what I’ve got in ot-builtin-create-usb.c
. Is there anything wrong with the code I’ve got already? I’d prefer to keep the template as %02u
since that’s a bit more human-friendly than XXXXXX
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine as is, just noting.
Summary of what @cgwalters and I discussed today:
|
This is a parallel for ostree_repo_resolve_rev_ext() which works on collection–refs. At the moment, the implementation is simple and uses ostree_repo_list_collection_refs(). In future, it could be rewritten to check the checksum directly rather than enumerating all potentially-relevant checksums. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This is more efficient in the non-collection case; in the collection case, the implementation of ostree_repo_resolve_collection_ref() needs to be rewritten to improve efficiency. Signed-off-by: Philip Withnall <withnall@endlessm.com>
I’ve pushed a few updates. |
Note that I’m still running through the tests on these updates, so don’t push anything yet! The code is good to review though. |
ostree_repo_resolve_collection_ref (OstreeRepo *self, | ||
const OstreeCollectionRef *ref, | ||
gboolean allow_noent, | ||
OstreeRepoResolveRevExtFlags flags, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe take this opportunity to add OSTREE_REPO_RESOLVE_REV_EXT_ALLOW_NOENT
and drop the boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Although we already shipped ostree_repo_resolve_rev_ext()
which has both...dunno)
Looks like the test case error matching will have to be adjusted:
|
LGTM aside from that! |
Indeed. The rest of the tests pass. PR updated. |
We do eventually plan to create a UI for creating a USB stick, but it’s a very long-term plan, and it’s not currently clear what shape the UI would be, or where it would be integrated.
I briefly asked Alex and he seemed favourable to the idea of some kind of So eventually we may end up libraryising the code in |
💔 Test failed - status-atomicjenkins |
@rh-atomic-bot, retest please |
@rh-atomic-bot retry |
Indeed seems to pass locally, and I can't see an obvious error (though unfortunately g-d-t-r makes it a pain...need to use |
Previously, collection–refs could only be pulled from a repository if it had a summary file (which listed them). There was no way to pull from a local repository which doesn’t have a summary file, and where the refs were stored as refs/remotes/$remote/$ref, with a config section linking that $remote to the queried collection ID. Fix that by explicitly supporting pull_data->remote_repo_local in fetch_ref_contents(). Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This can be used to put OSTree repositories on USB sticks in a format recognised by OstreeRepoFinderMount. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This is a parallel for ostree_repo_resolve_rev_ext() which works on collection–refs. At the moment, the implementation is simple and uses ostree_repo_list_collection_refs(). In future, it could be rewritten to check the checksum directly rather than enumerating all potentially-relevant checksums. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This is more efficient in the non-collection case; in the collection case, the implementation of ostree_repo_resolve_collection_ref() needs to be rewritten to improve efficiency. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
💔 Test failed - status-atomicjenkins |
Took a quick stab at a debugging aid in #1218 |
Looking at the log:
I think the problem is this line in
Exit status 127 normally means ‘command not found’, which would fit with this. Also from the log, we have Fix pushed. |
🎊😁🎆🎶 |
Previously, collection–refs could only be pulled from a repository if it had a summary file (which listed them). There was no way to pull from a local repository which doesn’t have a summary file, and where the refs were stored as refs/remotes/$remote/$ref, with a config section linking that $remote to the queried collection ID. Fix that by explicitly supporting pull_data->remote_repo_local in fetch_ref_contents(). Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This can be used to put OSTree repositories on USB sticks in a format recognised by OstreeRepoFinderMount. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This is a parallel for ostree_repo_resolve_rev_ext() which works on collection–refs. At the moment, the implementation is simple and uses ostree_repo_list_collection_refs(). In future, it could be rewritten to check the checksum directly rather than enumerating all potentially-relevant checksums. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This is more efficient in the non-collection case; in the collection case, the implementation of ostree_repo_resolve_collection_ref() needs to be rewritten to improve efficiency. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
💔 Test failed - status-atomicjenkins |
@rh-atomic-bot retry |
This can be used to put OSTree repositories on USB sticks in a format recognised by OstreeRepoFinderMount. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This is a parallel for ostree_repo_resolve_rev_ext() which works on collection–refs. At the moment, the implementation is simple and uses ostree_repo_list_collection_refs(). In future, it could be rewritten to check the checksum directly rather than enumerating all potentially-relevant checksums. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
This is more efficient in the non-collection case; in the collection case, the implementation of ostree_repo_resolve_collection_ref() needs to be rewritten to improve efficiency. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1182 Approved by: cgwalters
☀️ Test successful - status-atomicjenkins |
This can be used to put OSTree repositories on USB sticks in a format
recognised by OstreeRepoFinderMount.
Signed-off-by: Philip Withnall withnall@endlessm.com
This depends on PR #1179 (and hence contains the same initial commits, because github can’t understand dependencies between PRs), and must be rebased and updated after PR #1179 is pushed.