Packages added by the dependency solver in order to resolve a user's request, are marked as having been automatically installed. They may later be removed, if no more manually installed packages depend on them (e.g. by zypper remove --clean-deps).
However things may go haywire. Automatically installed packages may turn out to be useful, and you may want to exclude them from any automatic cleanup. And vice versa.
For this you need to be able to inspect and manipulate a packages 'autoinstalled' property. This is what this project is going to provide.
Zypper search/info command output should distinguish between 'automatically' installed packages and those requested by the user, e.g. by using 'i' for automatically installed and 'I' for user requested packages.
2 new commands markauto/unmarkauto shall allow to change an installed packages 'autoinstalled' property.
Ihis is IMO the prerequisite if we want to provide more automatic cleanup commands.
Looking for hackers with the skills:
This project is part of:
Hack Week 15
Activity
Comments
Similar Projects
Ansible for add-on management by lmanfredi
Description
Machines can contains various combinations of add-ons and are often modified during the time.
The list of repos can change so I would like to create an automation able to reset the status to a given state, based on metadata available for these machines
Goals
Create an Ansible automation able to take care of add-on (repo list) configuration using metadata as reference
Resources
- Machines
- Repositories
- Developing modules
- Basic VM Guest management
- Module
zypper_repository_list
- ansible-collections community.general
Results
Created WIP project Ansible-add-on-openSUSE
"autoremove" functionality for zypper by e_bischoff
The purpose would be to have the equivalent of Ubuntu's "apt-get autoremove" functionality.
When you install package P, it might draw in dependancies D1, D2, ... Dn automatically.
When you later uninstall P, the dependancies D1, D2, ..., Dn might remain on your system.
If you keep installing and uninstalling packages, after a while your system remains cluttered with things you don't need.
The idea would be to mark all dependancies that were installed but not explicitely requested as "installed automatically". Then a command like "zypper autoremove" could remove them at once if they are not needed anymore.
Approaches seen online
After scouring forms for solutions these are some alias's used to replicate the functionality
zypper packages --unneeded | awk -F'|' 'NR==0 || NR==1 || NR==2 || NR==3 || NR==4 {next} {print $3}' | grep -v Name | sudo xargs zypper remove --clean-deps
This one is a script and has bashisms
bash mapfile -t unneeded < <(zypper --quiet pa --unneeded | awk '$1 == "i" { print $5, "-", $7 }') (( ${#unneeded@]} )) && sudo zypper --quiet rm --clean-deps --details "${unneeded@]}"
sudo zypper rm $(zypper pa --unneeded | awk '/i / {print $3}' FS='|' | uniq | tr -d ' ')
Based on testing zypper packages --orphaned
provides packages that are not in any repo, even if a user has explicitly installed them, so --orphaned
may not be the way to go, instead focusing on --unneeded