-
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
lib/repo-finder-mount: Change the schema for finding repos on volumes #1179
Conversation
823b647
to
a72264b
Compare
src/libostree/ostree-repo.c
Outdated
* ostree_repo_open() not being called on them yet), %FALSE will be returned. | ||
* | ||
* Returns: %TRUE if @a and @b are the same repository on disk, %FALSE otherwise | ||
* Since: 2017.11 |
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.
.12
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.
Oops, fixup pushed.
GHashTable *repo_refs = repo_and_refs->refs; | ||
g_autofree char *repo_path = g_file_get_path (ostree_repo_get_path (repo)); | ||
|
||
const gchar *checksum = g_hash_table_lookup (repo_refs, refs[i]); |
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.
Now that we have a nested loop, probably best to extract refs[i]
to a local variable?
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.
Sensible. Fixup pushed.
* $mount_root/.ostree/repos.d/$something. | ||
* Add it to the results, keyed by the canonicalised repository URI | ||
* to deduplicate the results. */ | ||
g_autofree char *canonical_repo_path = realpath (repo_path, NULL); |
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 new in this patch but I don't quite get why we need to canonicalize; feels like a leftover from the previous symlinks schema?
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 are still symlinks in this schema (although fewer of them); canonicalisation allows us to eliminate the duplicate arising from (for example):
$usb_stick/ostree/repo
being a repository$usb_stick/.ostree/repos.d/alias
→$usb_stick/ostree/repo
being a symlink
or the duplicate arising from two symlinks in$usb_stick/.ostree/repos.d
pointing to the same repository elsewhere on the stick.
Is there any downside to canonicalising? I guess it’s not dirfd-relative, which is a a bit of a pain, but I don’t think realpathat()
exists. I can write a libglnx version of realpathat()
if you’re concerned about that.
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.
We could canonicalize by making a hashset - maybe add ostree_repo_hash
too since you just added _equals()
? Anyways, doesn't have to be done in this patch.
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’ve opened issue #1191 as a follow-up.
☔ The latest upstream changes (presumably d0b0578) made this pull request unmergeable. Please resolve the merge conflicts. |
Ah sorry, I hadn't realized #1172 would conflict - can you rebase? |
This will compare their root directory inodes to see if they are the same repository on disk. A convenience method for the users of the public API who can’t access OstreeRepo.inode. Signed-off-by: Philip Withnall <withnall@endlessm.com>
See issue ostreedev#1174 for the rationale behind this. In summary: • It required two lists of collection–refs to be maintained: one in the repository, and one pointing to the repository. • It didn’t automatically work for live USBs of OSs based on OSTree (where there’s always a repository at /ostree/repo). • It was unnecessarily complex. The new scheme allows a list of repositories to be searched, but without needing a layer of indirection through their collection–refs. It adds /ostree/repo and /.ostree/repo as well-known repository locations which are always checked on a mounted volume (if they exist). Update the unit tests accordingly. Signed-off-by: Philip Withnall <withnall@endlessm.com> ostreedev#1174
This was some incomplete planning from while the find_remotes() API was being designed; now totally outdated. Signed-off-by: Philip Withnall <withnall@endlessm.com>
79b0558
to
4842bec
Compare
Rebased. |
This will compare their root directory inodes to see if they are the same repository on disk. A convenience method for the users of the public API who can’t access OstreeRepo.inode. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1179 Approved by: cgwalters
See issue #1174 for the rationale behind this. In summary: • It required two lists of collection–refs to be maintained: one in the repository, and one pointing to the repository. • It didn’t automatically work for live USBs of OSs based on OSTree (where there’s always a repository at /ostree/repo). • It was unnecessarily complex. The new scheme allows a list of repositories to be searched, but without needing a layer of indirection through their collection–refs. It adds /ostree/repo and /.ostree/repo as well-known repository locations which are always checked on a mounted volume (if they exist). Update the unit tests accordingly. Signed-off-by: Philip Withnall <withnall@endlessm.com> #1174 Closes: #1179 Approved by: cgwalters
This was some incomplete planning from while the find_remotes() API was being designed; now totally outdated. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1179 Approved by: cgwalters
(PR context failure is due to mirror desync with the base image, |
💔 Test failed - status-atomicjenkins |
@rh-atomic-bot retry |
See issue #1174 for the rationale behind this. In summary: • It required two lists of collection–refs to be maintained: one in the repository, and one pointing to the repository. • It didn’t automatically work for live USBs of OSs based on OSTree (where there’s always a repository at /ostree/repo). • It was unnecessarily complex. The new scheme allows a list of repositories to be searched, but without needing a layer of indirection through their collection–refs. It adds /ostree/repo and /.ostree/repo as well-known repository locations which are always checked on a mounted volume (if they exist). Update the unit tests accordingly. Signed-off-by: Philip Withnall <withnall@endlessm.com> #1174 Closes: #1179 Approved by: cgwalters
This was some incomplete planning from while the find_remotes() API was being designed; now totally outdated. Signed-off-by: Philip Withnall <withnall@endlessm.com> Closes: #1179 Approved by: cgwalters
☀️ Test successful - status-atomicjenkins |
@cgwalters and I talked about this today and decided that it probably also makes sense to hard-code searches for The use case for this is for finding remotes from a live USB which contains an OS which uses separate repos for the OS and system flatpaks; or which contains a non-OSTree OS and a system flatpak repo. |
See issue #1174 for the rationale behind this. In summary:
• It required two lists of collection–refs to be maintained: one in the
repository, and one pointing to the repository.
• It didn’t automatically work for live USBs of OSs based on OSTree
(where there’s always a repository at /ostree/repo).
• It was unnecessarily complex.
The new scheme allows a list of repositories to be searched, but without
needing a layer of indirection through their collection–refs. It adds
/ostree/repo and /.ostree/repo as well-known repository locations which
are always checked on a mounted volume (if they exist).
Update the unit tests accordingly.
Signed-off-by: Philip Withnall withnall@endlessm.com
Plus a few other trivial fixes.
#1174