Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.66k stars 237 forks source link

Brew upgrade don't delete old version's Cellar directory for packages installed from sources #916

Closed JuPlutonic closed 5 years ago

JuPlutonic commented 5 years ago

Please note that we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

Last packages from sources what get this problem:

wget 1.20.1 -> 1.20.1_1 -> 1.20.1_2 -> 1.20.1_3, libidn2 2.0.5 -> 2.1.0, mkvtoolnix 26.x ->30.1.0

The problem appeared in last two versions of linuxbrew. Last version:

brew config
HOMEBREW_VERSION: 1.8.6-153-g2d6d15b
ORIGIN: https://github.com/Linuxbrew/brew.git
HEAD: 2d6d15bf57bc387dfc2d0d1b8b6403e46e21e686
Last commit: 8 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: a90356997fe4ad1f82a4ed19c968e1a81604c72a
Core tap last commit: 7 hours ago
HOMEBREW_PREFIX: /opt/.linuxbrew
HOMEBREW_REPOSITORY: /opt/.linuxbrew/Homebrew
HOMEBREW_CELLAR: /opt/.linuxbrew/Cellar
HOMEBREW_CACHE: /home/salessionato/.cache/Homebrew
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_LIVECHECK_WATCHLIST: /home/salessionato/etc-bbq/.linuxbrew-changed-formulas/brew_livecheck_watchlist
HOMEBREW_LOGS: /home/salessionato/.cache/Homebrew/Logs
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_EMOJI: 0
HOMEBREW_VISUAL: /usr/bin/subl
CPU: quad-core 64-bit skylake
Homebrew Ruby: 2.6.0 => /usr/bin/ruby2.6
Clang: 7.0 build 701
Git: 2.20.1 => /opt/.linuxbrew/bin/git
Curl: 7.61.0 => /usr/bin/curl
Kernel: Linux 4.18.0-13-generic x86_64 GNU/Linux
OS: Ubuntu 18.10 (cosmic)
Host glibc: 2.28
/usr/bin/gcc: 8.2.0
glibc: N/A
gcc: 5.5.0_4
xorg: 20170115_1
  

Steps:

linuxbrew upgrade 41.91 ⏱ 10:05:50

==> Upgrading 1 outdated package:
wget 1.20.1_2 -> 1.20.1_3
==> Upgrading wget 
==> Downloading https://ftp.gnu.org/gnu/wget/wget-1.20.1.tar.gz
Already downloaded: /home/salessionato/.cache/Homebrew/downloads/985a50b7bed6c99927dc29397038164011a2f3c9074737f843933eaa21e8b34a--wget-1.20.1.tar.gz
==> ./configure --prefix=/opt/.linuxbrew/Cellar/wget/1.20.1_3 --sysconfdir=/opt/
==> make install
/opt/.linuxbrew/Cellar/wget/1.20.1_3: 49 files, 4.2MB, built in 1 minute 29 seconds

linuxbrew info wget 01:34 ⏱ 10:10:48

wget: stable 1.20.1, HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/opt/.linuxbrew/Cellar/wget/1.20.1_2 (49 files, 4.2MB)
  Built from source on 2019-01-10 at 01:01:45
/opt/.linuxbrew/Cellar/wget/1.20.1_3 (49 files, 4.2MB) *
  Built from source on 2019-01-10 at 10:10:46
From: https://github.com/Linuxbrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config (installed)
Required: libidn2 (installed), openssl (installed), util-linux (installed)
==> Options
--HEAD
    Install HEAD version

So to get only one version of wget I have to remove it with with --force key and then re run installation:

linuxbrew remove --ignore-dependencies --force wget && linuxbrew install wget
linuxbrew remove --ignore-dependencies --force libidn2 && linuxbrew install idn2
linuxbrew remove --ignore-dependencies --force mkvtoolnix && linuxbrew install mkvtoolnix
sjackman commented 5 years ago

Keeping previous versions has always been the default behaviour. You can run brew cleanup to remove old versions. A new feature with the just released Brew 1.9.0 is to set export HOMEBREW_INSTALL_CLEANUP=1 which well enable the behaviour that you desire, and which will be the default behaviour with Brew 2.0.0. See https://brew.sh/2019/01/09/homebrew-1.9.0/