-
Notifications
You must be signed in to change notification settings - Fork 843
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
get-stack: check deps before sudo #4074
Conversation
Don't need to invoke sudo if all deps are already installed. Avoiding the sudo prompt where possible is going to be an improvement.
A similar fix could probably be made for yum/dnf distros (CentOS, RHEL, etc), but that can be done separately. |
@borsboom I agree. Anything else I should do? |
What suggestion? The lines you point at are for systems I don't have. |
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 like I left a review comment "pending" without realizing it.
@@ -561,7 +561,9 @@ try_install_pkgs() { | |||
|
|||
# Install packages using apt-get | |||
apt_get_install_pkgs() { | |||
if ! sudocmd apt-get install -y ${QUIET:+-qq} "$@"; then | |||
if dpkg-query -W "$@" > /dev/null; then | |||
info "Already installed!" |
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.
Is it clear that this "Already installed!" message is referring to apt dependencies? If not, clarifying would be good.
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.
Yes, because the previous line printed is "Installing dependencies...".
@bukzor If you are able, using Docker or Vagrant to run VMs with the other distros to make a similar change would be super helpful. That said, I don't think it should be a prerequisite for merging this PR. |
@borsboom I agree that it shouldn't be a blocking issue. |
Don't need to invoke sudo if all deps are already installed.
Avoiding the sudo prompt where possible is going to be an improvement.
Please also shortly describe how you tested your change. Bonus points for added tests!
I re-ran the script a few times, sometimes uninstalling libgmp-dev, and verified it skips
sudo apt install
when appropriate.