How to remove a package and all unneeded dependencies

I want to remove kdenlive from my Arch Linux. I also want to remove all packages that are needed only by kdenlive. I tried doing

sudo pacman -Rnsu kdenlive

Here’s what I see when I run the command:

checking dependencies...
:: google-chrome optionally requires kwallet: for storing passwords in KWallet
:: imagemagick optionally requires libzip: OpenRaster support
:: libreoffice-fresh optionally requires kio: for KF5 KDE desktop integration
:: qt5-base optionally requires qt5-wayland: to run Qt applications in a Wayland session
:: root optionally requires qt5-webengine: Support for WebGUI
:: vlc optionally requires kwallet: kwallet keystore
:: zoom optionally requires qt5-webengine: SSO login support
warning: dependency cycle detected:
warning: usbmuxd will be removed after its libimobiledevice dependency

Packages (80) accounts-qml-module-0.7-4  attica-5.94.0-1  breeze-icons-5.94.0-1  cdparanoia-10.2-8
              convertlit-1.8-10  ebook-tools-0.2.2-7  frei0r-plugins-1.7.0-2  gavl-1.4.0-6
              graphene-1.10.8-1  gst-plugins-base-1.20.2-1  kaccounts-integration-22.04.1-1
              karchive-5.94.0-1  kauth-5.94.0-1  kbookmarks-5.94.0-1  kcmutils-5.94.0-1
              kcodecs-5.94.0-1  kcompletion-5.94.0-1  kconfig-5.94.0-1  kconfigwidgets-5.94.0-1
              kcoreaddons-5.94.0-1  kcrash-5.94.0-1  kdbusaddons-5.94.0-1  kdeclarative-5.94.0-1
              kded-5.94.0-1  kfilemetadata-5.94.0-1  kglobalaccel-5.94.0-1  kguiaddons-5.94.0-1
              ki18n-5.94.0-1  kiconthemes-5.94.0-1  kio-5.94.0-1  kirigami2-5.94.0-1
              kitemviews-5.94.0-1  kjobwidgets-5.94.0-1  knewstuff-5.94.0-2  knotifications-5.94.0-1
              knotifyconfig-5.94.0-1  kpackage-5.94.0-1  kservice-5.94.0-1  ktextwidgets-5.94.0-1
              kwallet-5.94.0-1  kwidgetsaddons-5.94.0-1  kwindowsystem-5.94.0-1  kxmlgui-5.94.0-1
              libaccounts-glib-1.25-7  libaccounts-qt-1.16-3  libdbusmenu-qt5-0.9.3+16.04.20160218-6
              libebur128-1.2.6-1  libimobiledevice-1.3.0-5  libplist-2.2.0-5  libusbmuxd-2.0.2-1
              libvisual-0.4.0-8  libzip-1.8.0-1  media-player-info-24-2  minizip-1:1.2.12-2  mlt-7.6.0-1
              polkit-qt5-0.114.0-1  poppler-qt5-22.05.0-2  purpose-5.94.0-1
              qt5-declarative-5.15.4+kde+r19-1  qt5-graphicaleffects-5.15.4+kde+r0-1
              qt5-location-5.15.4+kde+r2-1  qt5-multimedia-5.15.4+kde+r1-1
              qt5-networkauth-5.15.4+kde+r0-1  qt5-quickcontrols-5.15.4+kde+r0-1
              qt5-quickcontrols2-5.15.4+kde+r4-1  qt5-speech-5.15.4+kde+r1-1
              qt5-wayland-5.15.4+kde+r38-1  qt5-webchannel-5.15.4+kde+r3-1  qt5-webengine-5.15.9-3
              signon-kwallet-extension-22.04.1-1  signon-plugin-oauth2-0.25-1  signon-ui-0.17+20171022-3
              signond-8.61-1  snappy-1.1.9-2  solid-5.94.0-1  sonnet-5.94.0-1  syndication-5.94.0-1
              upower-0.99.18-1  usbmuxd-1.1.1-1  kdenlive-22.04.1-1

Total Removed Size:  486.11 MiB

:: Do you want to remove these packages? [Y/n]

What I’m concerned about is that zoom optionally requires qt5-webengine, yet qt5-webengine appears in the list of packages to be removed. I thought the -u option would prevent that. What I want is to remove everything that was installed along with kdenlive while keeping anything that is even optionally required by anything else.

How can I do that?

Asked By: SU3

||

If you want to not remove optional dependencies I think you’ll have to massage the list yourself, remove anything you want to keep.

pacman -Rsp kdenlive &| vim -R -

then :%s/v-d+(.d+)+-d+$// to strip the version numbers, delete the entries for packages you want to keep, then build your pacman -R from that.

. . . or it might be easier to just reinstall the ones you want, do the -Rsu then pacman --asdeps -S the ones you want back.

Answered By: jthill