postmodern / ruby-install

Installs Ruby, JRuby, TruffleRuby, or mruby
MIT License
1.89k stars 250 forks source link

Use apt-get instead of apt #459

Closed joshheinrichs-shopify closed 1 year ago

joshheinrichs-shopify commented 1 year ago

When running non-interactively, this message appears in the logs:

>>> Installing dependencies for ruby 3.2.1 ...
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

This isn't a huge deal, but apt doesn't appear to respect some options in /etc/apt/apt.conf.d/ when ran non-interactively. These options are respected when running apt-get. This is at least true for DPkg::Lock::Timeout, but may apply to other options as well.

joshheinrichs-shopify commented 1 year ago

I dug into this a bit deeper and it looks like apt and apt-config set their lock timeout based on Binary::apt::Dpkg::Lock::Timeout rather than DPkg::Lock::Timeout.

https://salsa.debian.org/apt-team/apt/-/blob/a19f606aad717fe5c9c69237c3af53feb547115e/apt-private/private-cmndline.cc#L498-501

It's still probably better to use apt-get than apt, but we don't absolutely need this if apt's output is highly desirable in interactive contexts.

postmodern commented 1 year ago

One of the benefits of apt is it has a better ANSI progress bar and friendlier output. Maybe we could fallback to apt-get if stdout is not a TTY (ex: if [[ -t 1 ]]; then).

joshheinrichs-shopify commented 1 year ago

👍 if this becomes a common theme, switching based on whether we're a tty / a env var or something makes sense, but for the sake of simplicity i'm happy to stick with apt as the sole front end since there's a workaround for my specific problem.