FS#5974 - remove unneeded dependencies on upgrade and replace

Attached to Project: Pacman
Opened by Roman Kyrylych (Romashka) - Sunday, 10 December 2006, 10:25 GMT
Last edited by Roman Kyrylych (Romashka) - Thursday, 15 November 2007, 11:56 GMT
Task Type Feature Request
Category General
Status Assigned
Assigned To Aaron Griffin (phrakture)
Dan McGee (toofishes)
Architecture All
Severity Medium
Priority Normal
Reported Version 0.7.2 Gimmick
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 9
Private No

Details

[rk@home local]$ sudo pacman -S gimmix

Targets: confuse-2.5-2 gimmix-0.2-2

Total Package Size: 0.1 MB

Proceed with upgrade? [Y/n]

:: Retrieving packages from community...
confuse-2.5-2 [################] 100% 25K 11.6K/s 00:00:02
gimmix-0.2-2 [################] 100% 44K 3.9K/s 00:00:11

checking package integrity... done.
loading package data... done.
checking for file conflicts... done.
installing confuse... done.
installing gimmix... done.

Then I updated gimmix to version 0.3 which now doesn't depend on confuse.
But on upgrade pacman leaves confuse while it doesn't needed by any other package and was installed only as a dependency.

[rk@home local]$ sudo pacman -Su

Targets: gimmix-0.3-1

Total Package Size: 0.1 MB

Proceed with upgrade? [Y/n]

:: Retrieving packages from romashka...
gimmix-0.3-1 [/home/rk/packages/] 100% LOCAL

checking package integrity... done.
loading package data... done.
checking for file conflicts... done.
upgrading gimmix... done.

IMO pacman should remove confuse in this case. It already knows that confuse was installed as a dependency and is not required by any other package.
Such new behaviour will help to manage system clean, without useless orphans.
This task depends upon

Comment by Roman Kyrylych (Romashka) - Wednesday, 14 February 2007, 22:14 GMT
phrakture suggested the following output: "blah no longer depends on foo, would you like to remove it? [Y/n]"
Comment by Xavier (shining) - Wednesday, 13 June 2007, 10:05 GMT
The -Qe option exists exactly for this case, listing useless orphans for helping you keep the system clean.
Comment by Roman Kyrylych (Romashka) - Wednesday, 13 June 2007, 10:07 GMT
the difference is that implementin this feature request will do cleanup during upgrade, which means user won't have to do -Qe often.
Comment by Allan McRae (Allan) - Sunday, 05 August 2007, 07:24 GMT
I installed the latest ffmpeg which no longer needs amrnb as a dependancy. pacman -Qe gives no output. I noticed this only because of checking what packages I had added with pacman -Qm and amrnb is listed as it has been removed from repositories. It appears that the -Qe option misses these packages at least some of the time. My entire install was done after pacman v3 was released.
Comment by Xavier (shining) - Sunday, 05 August 2007, 07:37 GMT
That's because pacman -Qi amrnb still has ffmpeg in RequiredBy.
And that's because of a bug also reported in a comment here : http://bugs.archlinux.org/task/7495#comment17704
It's fixed in git.
That has nothing to do with this feature request though :)
Comment by Roman Kyrylych (Romashka) - Thursday, 15 November 2007, 11:54 GMT
I wanted to open another report when doing the last test for  FS#6057 , but then did a search and decided to add another case here.

Summary and Info:

When replacing package pacman doesn't remove its dependencies that are not needed by other packages, so orphans are left.

Classic taglib-rcc example. :-P ( FS#6057 ,  FS#6058 )
taglib-rcc provides and replaces taglib and depends on librcc which depends on enca and librcd.
Install taglib-rcc, then replace it back with taglib.
Pacman doesn't suggest to remove unneeded packages.
So there will be orphaned package (librcc) and its dependencies (librcd and enca, that are not needed by anything except librcc).

Steps to Reproduce:

# pacman -Si taglib-rcc | grep Depends
Depends On : gcc>=4.0.1 zlib bash libxml2 db librcc

# pacman -S taglib-rcc
resolving dependencies... done.
looking for inter-conflicts... :: taglib-rcc conflicts with taglib. Remove taglib? [Y/n]
done.

Remove: taglib

Total Removed Size: 0,65 MB

Targets: enca-1.9-2 librcd-0.1.8-3 librcc-0.2.3-6 taglib-rcc-1.4-4

Total Download Size: 0,00 MB
Total Installed Size: 2,06 MB

Proceed with installation? [Y/n]
checking package integrity... done.
(4/4) checking for file conflicts [#####################] 100%
(1/4) installing enca [#####################] 100%
(2/4) installing librcd [#####################] 100%
(3/4) installing librcc [#####################] 100%
-- Don't forget to install gtk or/and gtk2 packages to enable librcc
gui features
-- Also you may change /usr/bin/rcc-config symlink to switch between
gtk and gtk2 (rcc-gtk-config and rcc-gtk2-config)
(4/4) installing taglib-rcc [#####################] 100%

# pacman -Qi taglib-rcc | grep Depends
Depends On : gcc>=4.0.1 zlib bash libxml2 db librcc

# pacman -S taglib
resolving dependencies... done.
looking for inter-conflicts... :: taglib conflicts with taglib-rcc. Remove taglib-rcc? [Y/n]
done.

Remove: taglib-rcc

Total Removed Size: 0,68 MB

Targets: taglib-1.4-2

Total Download Size: 0,00 MB
Total Installed Size: 0,18 MB
Proceed with installation? [Y/n]
checking package integrity... done.
(1/1) checking for file conflicts [#####################] 100%
(1/1) installing taglib [#####################] 100%

# pacman -Qtd
librcc 0.2.3-6
Comment by Hugo Osvaldo Barrera (hobarrera) - Saturday, 11 May 2013, 06:32 GMT
Should this be implemented, there needs to be some mentions if the unneeded dependency is an optdepends of another package as well.
Comment by Ashley Whetter (AWhetter) - Friday, 12 July 2013, 18:06 GMT
My opinion is that this doesn't need to be implemented. pacman reports when there is a dependency that is no longer needed and the user has the option of then removing that themselves, or keeping it. Plus -Qdt and -Qet both list packages that are no longer required.
Comment by Sascha Shaw (Awebb) - Monday, 21 July 2014, 15:30 GMT
I just tested it with a simple meta package. Pacman did not inform me about former dependencies that are now not needed anymore.
Comment by Moabit (Moabit) - Tuesday, 22 July 2014, 00:41 GMT
As per Sascha Shaw (Awebb), and a conversation here: https://bbs.archlinux.org/viewtopic.php?pid=1438506

IMO this bug should be fixed, as it creates inconsistent behaviour with meta packages. Currently meta packages will automatically attempt to keep member packages in sync, by installing new members. However, if specific dependencies are removed, pacman will not prompt for removal of these packages. This happened recently with `ibfonts-meta-extended` removing seven package dependencies (see above link).
Comment by Antoine Poliakov (antoinep92) - Wednesday, 30 June 2021, 09:18 GMT
Another case where this is annoying is `code` and `electron`. I just realized I have the following installed: electron electron11 electron12 electron6 electron7 electron9, which is a bit ridiculous.
All installed as dependencies to VS Code, (of course, only the latest, electron12 is needed now) and I don't think I was ever warned during upgrades. The last `code` upgrade switched from depending on `electron11` to `electron12`, I have the pacman logs in front of me and there was no mention of `electron11` becoming orphan.

So I think something should be done about it:
- either print a warning message when a package becomes orphaned due to upgrades, even if there is a meta package involved
- or (IMO better) remove dependencies becoming orphaned during upgrades

Loading...