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

Add support for all Linux distros using apt #7309

Merged

Conversation

seanballais
Copy link
Contributor

@seanballais seanballais commented Jul 3, 2020

Fixes #7307

Changelog: Feature: Checking if a Linux distro uses apt is now based on the existence of apt in the system, instead of checking if the distro currently being used is in a hard-coded list of distros known to use apt.
Docs: omit

@CLAassistant
Copy link

@CLAassistant CLAassistant commented Jul 3, 2020

CLA assistant check
All committers have signed the CLA.

@seanballais seanballais force-pushed the feature/add-apt-distros-support branch from 664c727 to cba4503 Compare Jul 4, 2020
@seanballais seanballais marked this pull request as ready for review Jul 4, 2020
Copy link
Member

@memsharded memsharded left a comment

I would say that it is extremely unlikely that some distro will have other thing different to apt, located in /usr/bin/apt.

What I am not 100% sure is that all those different distros will have apt located in that exact place, and not elsewhere. Have you checked that?

Thanks for contributing this!

@memsharded memsharded added this to the 1.28 milestone Jul 5, 2020
@memsharded memsharded requested a review from SSE4 Jul 5, 2020
@SSE4
Copy link
Contributor

@SSE4 SSE4 commented Jul 6, 2020

@seanballais I am also not sure, may apt reside for instance in directories like in /bin, /usr/local/bin, /opt, etc? maybe using tools.which and then checking some apt-specific command may run (such as apt-get or apt-cache).
I personally don't like hard-coded paths, and can imagine edge cases where apt was installed from sources to the non-standard directory.

@seanballais
Copy link
Contributor Author

@seanballais seanballais commented Jul 6, 2020

@SSE4, @memsharded, I updated the check based on your feedback. I detracted though a bit, and checked for apt-get itself instead since it it was AptTool uses (aside from apt-add-repository, etc.). As a final check, I checked if the help text of the detected apt-get has "This APT has Super Cow Powers.", which is in the actual apt-get's help text. The only problem I have with this check is that a modified or future official version of apt package is used where the aforementioned substring is removed. Should we worry about this problem? Anyhow, I'd like to get your feedback.

@SSE4
Copy link
Contributor

@SSE4 SSE4 commented Jul 6, 2020

@seanballais yes, this definitely might be a problem, I suspect text might be different for different locales, e.g. it could display Spanish translation for es-es, etc.:

apt-get --help
apt 0.7.14ubuntu6 для i386 скомпилирован Aug 14 2008 16:54:20
…
В APT есть коровья СУПЕРСИЛА.

just running something like apt-get moo and checking that exit code is zero should be way more reliable

@seanballais
Copy link
Contributor Author

@seanballais seanballais commented Jul 6, 2020

@SSE4, I've just changed the check from using --help to using moo.

@seanballais seanballais force-pushed the feature/add-apt-distros-support branch from 520301a to 0919f7d Compare Jul 6, 2020
SSE4
SSE4 approved these changes Jul 6, 2020
czoido
czoido approved these changes Jul 6, 2020
@czoido czoido merged commit 9cb35b6 into conan-io:develop Jul 6, 2020
2 checks passed
@seanballais seanballais deleted the feature/add-apt-distros-support branch Jul 7, 2020
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.

5 participants