Subject: Re: How to uninstall packages that were installed as dependency but are no longer required
From: Brian Inglis <[email-masked]>
To: [email-masked]
Date: Tue, 30 Mar 2021 11:18:32 -0600
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>

On 2021-03-30 02:07, Marco Atzeri via Cygwin wrote:
> On 30.03.2021 07:51, Yasuhiro Kimura wrote:
>> If you repeat the update of installed Cygwin packages for a while,
>> it's quite possible that there are some packages that were installed
>> as dependency but are no longer required by any others.
>>
>> Then is there any way to detect and uninstall such ones?
>>
>> I expect such way as `apt autoremove` of Debian or `dnf autoremove` of
>> Fedora.

> as currently we are not tracking between choosen packages
> and installed by dependency, Cygwin is lacking such capabilities

The undocumented third field in installed.db is automatic dependency 0 / 
manually picked 1:

$ sort -k3 /etc/setup/installed.db | uniq -cf2
          1 INSTALLED.DB 3
       1203 _autorebase _autorebase-001007-1.tar.bz2 0
        467 aalib aalib-1.4rc5-12.tar.bz2 1

> the most likely candidates for removal are the different version
> of the same libraries
> 
> $ cygcheck -cd | grep "^lib" | tee lib.txt
> 
> in my case I see
> 
> libvpx1                                 1.3.0-2
> libvpx3                                 1.5.0-1
> libvpx4                                 1.6.1-1
> libvpx5                                 1.7.0-1
> 
> $ cygcheck-dep -q -n libvpx1 libvpx3 libvpx4 libvpx5
> libvpx1: is needed for ( )
> libvpx3: is needed for ( )
> libvpx4: is needed for ( )
> libvpx5: is needed for ( gstreamer1.0-plugins-good libvpx-devel )

Using the above info you could run a check for automatic dependencies no longer 
needed, but you *MUST* retain and not attempt to deinstall Base packages, plus 
packages automatically installed to replace obsolete packages, which ideally 
would inherit the manually picked flag of the obsolete package.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple