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

Checks whether the rootfs has UDI or Subiquity snaps #249

Merged
merged 5 commits into from
Jul 27, 2022
Merged

Conversation

CarlosNihelton
Copy link
Collaborator

Currently only checking for UDI is relevant. Soon Subiquity-only will be as well, which will break the possibility of rendering a GUI from inside Linux, since there will be no GUI there anymore.

Thus, this pull request modifies the function that checks whether the distro is GUI-enabled to check for the existence of the UDI snap.

Since I wanted to reuse your implementation of starts|ends_with algorithms, I created a new header to host them (plus some other bits with similar scope).

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Please check out carefully the isses found by clang-tidy in the new code ⚠️
⚠️ clang-format found formatting issues in the code submitted.:warning:
Make sure to run clang-format and update this pull request.
(1/1)

DistroLauncher/algorithms.h Outdated Show resolved Hide resolved
DistroLauncher/algorithms.h Outdated Show resolved Hide resolved
DistroLauncher/algorithms.h Outdated Show resolved Hide resolved
DistroLauncher/algorithms.h Outdated Show resolved Hide resolved
Let's place there those small bits that resemble std algorithms.
They seem very useful to be tied to one namespace.
Also, made them templates, to deal with char and wchar_t.

Moves concat as well
Both ubuntu-desktop-installer and subiquity.
For now only the first is relevant.
Soon the second will be.
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ Please check out carefully the isses found by clang-tidy in the new code ⚠️
⚠️ clang-format found formatting issues in the code submitted.:warning:
Make sure to run clang-format and update this pull request.
(1/1)

// Common algorithms to be used everywhere in the launcher project with style resembling the std ones.

template <typename CharT>
bool starts_with(const std::basic_string_view<CharT> tested, const std::basic_string_view<CharT> start)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ bugprone-easily-swappable-parameters ⚠️
2 adjacent parameters of starts_with of similar type (const std::basic_string_view<CharT>) are easily swapped by mistake

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is indeed somewhat bug prone, but those are the only parameters the function accept, I don't see other way to do it :D.

@CarlosNihelton CarlosNihelton marked this pull request as ready for review July 27, 2022 12:13
Copy link
Collaborator

@EduardGomezEscandell EduardGomezEscandell left a comment

Choose a reason for hiding this comment

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

👍

In the future maybe we should refactor a bit and put all algorithms tests in their own test suite.

Also, some functions around the codebase might be better here as well. Things like wide_string_to_utf8, or safe_execute as quick examples.

That I'd say is outside the scope of this PR, so approving.

@CarlosNihelton
Copy link
Collaborator Author

👍

In the future maybe we should refactor a bit and put all algorithms tests in their own test suite.

Also, some functions around the codebase might be better here as well. Things like wide_string_to_utf8, or safe_execute as quick examples.

That I'd say is outside the scope of this PR, so approving.

I like the idea.

@CarlosNihelton CarlosNihelton merged commit a85ac57 into main Jul 27, 2022
@CarlosNihelton CarlosNihelton deleted the hasSnaps branch July 27, 2022 14:54
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.

2 participants