allow adding image with sqfs file from internal store#125
allow adding image with sqfs file from internal store#125bcumming merged 6 commits intoeth-cscs:mainfrom
Conversation
| assert_line --partial 'bilby/24:v1' | ||
| assert_line --partial 'quokka/24:v1' | ||
| assert_line --partial 'wombat/24:replica' | ||
| assert_line --partial 'numbat/24:replica' |
There was a problem hiding this comment.
This test is applied twice (lines 402 and 403). Remove one?
Also, you probably only need to check for the presence of the incolved uenv, i.e. numbat/24:*?
There was a problem hiding this comment.
I just wanted to be consistent with the tests above, that checked for all images every time.
I don't mind changing this and only check for images that were added at this particular test, It is just inconsistent with the above testing style.
There was a problem hiding this comment.
addressed in latest commit
test/integration/cli.bats
Outdated
| run uenv --repo=$RP image ls --no-header | ||
| assert_success | ||
| assert_line --partial 'wombat/24:v1' | ||
| assert_line --partial 'numbat/24:v1' |
There was a problem hiding this comment.
You only need to check for wombat/*?
There was a problem hiding this comment.
addressed in latest commit
src/cli/add_remove.cpp
Outdated
| } | ||
| // fs::equivalent only works on existing files, check first if path even | ||
| // exists, and only then for equivalence | ||
| if (!fs::exists(uenv_paths.squashfs) || |
There was a problem hiding this comment.
It isn't clear why these checks are being performed.
Ultimately, we want to perform this step if the source uenv/squashfs is not already in the repository, so it would be good if this changed to:
if (!source_in_repo) {
...Where:
// get a reference to the concrete environment after parsing and validating
const auto& uenv = *env->uenvs.begin();
// check whether the squashfs file is inside the repository
const bool source_in_repo = util::is_child(uenv.second.squashfs_path, repo.path.value());And we can add a new function to src/util/fs.{h,cpp}:
bool is_child(const std::filesystem::path& child, const std::filesystem::path& parent) {
auto rel = child.lexically_relative(parent);
return !rel.empty() && *rel.begin() != "..";
}
There was a problem hiding this comment.
Addressed in latest commit
This fixes #15
It does not fail anymore when referencing an internal sqfs file. Additionally it allows to retag by label, i.e. this is equivalent: