Commit 9344bbf4 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-autoremove: add i586-libs, debuginfo, devel, gem, ruby support

parent 07c65a5e
......@@ -72,26 +72,37 @@ __epm_autoremove_altrpm_pp()
return 0
}
__epm_autoremove_altrpm_package_group()
{
if epmqp "$*" ; then
confirm_info "We will remove unused (without dependencies) packages above."
docmd epm remove $(epmqp --short "$*")
fi
}
__epm_autoremove_altrpm_lib()
{
local pkgs fullpkgs
local nodevel="$1"
local flag=''
local opt="$1"
local libgrep=''
info
if [ "$nodevel" = "nodevel" ] ; then
if [ "$opt" = "libs" ] ; then
info "Removing all non -devel/-debuginfo libs packages not need by anything..."
local develrule='-(devel|devel-static)$'
else
libgrep='^(lib|bzlib|zlib)'
elif [ "$opt" = "i586-libs" ] ; then
info "Removing all non -devel/-debuginfo i586-libs packages not need by anything..."
local develrule='-(devel|devel-static)$'
libgrep='^(i586-lib|i586-bzlib|i586-zlib)'
elif [ "$opt" = "devel" ] ; then
info "Removing all non -debuginfo libs packages (-devel too) not need by anything..."
local develrule='-(NONONO)$'
libgrep='^(lib|bzlib|zlib)'
else
fatal "Internal error: unsupported opt $opt"
fi
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force
local flag=
local libgrep='^(lib|i586-lib|bzlib|zlib)'
[ -n "$force" ] || libexclude=$libgrep'[^-]*$'
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -E -- \"$libgrep\""
......@@ -100,7 +111,7 @@ __epm_autoremove_altrpm_lib()
| grep -E -v -- "$develrule" \
| grep -E -v -- "-(debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm|distro_info)" )
pkgs=$(skip_manually_installed $fullpkgs)
if [ -n "$dryrun" ] ; then
......@@ -129,7 +140,7 @@ __epm_autoremove_altrpm_lib()
}
epm_autoremove_default_groups="python2 python3 perl libs"
epm_autoremove_default_groups="python2 python3 perl gem ruby libs"
__epm_autoremove_altrpm()
{
......@@ -139,27 +150,44 @@ __epm_autoremove_altrpm()
if [ -z "$pkg_names" ] ; then
pkg_names="$epm_autoremove_default_groups"
elif [ "$pkg_names" = "python" ] ; then
pkg_names="python2 python3"
fi
for i in $pkg_names ; do
case $i in
libs)
__epm_autoremove_altrpm_lib nodevel
__epm_autoremove_altrpm_lib libs
;;
i586-libs)
__epm_autoremove_altrpm_lib i586-libs
;;
debuginfo)
__epm_autoremove_altrpm_package_group '-debuginfo-'
;;
python)
__epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules)'
devel)
__epm_autoremove_altrpm_package_group '^(rpm-build-|gcc-|glibc-devel-)'
;;
python2)
__epm_autoremove_altrpm_pp '^(python-module-|python-modules-)'
;;
python3)
__epm_autoremove_altrpm_pp '^(python3-module-|python3-modules)'
__epm_autoremove_altrpm_pp '^(python3-module-|python3-modules-)'
;;
php)
__epm_autoremove_altrpm_pp '^(php7-|php5-|php8-)'
;;
gem)
__epm_autoremove_altrpm_pp '^(gem-)'
;;
ruby)
__epm_autoremove_altrpm_pp '^(ruby-)'
;;
perl)
__epm_autoremove_altrpm_pp '^(perl-)'
;;
libs-devel)
__epm_autoremove_altrpm_lib
__epm_autoremove_altrpm_lib devel
;;
*)
fatal "autoremove: unsupported '$i'. Use epm autoremove --help to list supported ones"
......@@ -180,10 +208,18 @@ epm_autoremove_print_help()
Supported package groups:
libs - unused libraries
libs-devel - unused -devel packages
i586-libs - unused i586-libs libraries
debuginfo - all debuginfo packages
devel - all packages used for build/developing
python - all python modules
python2 - python2 modules
python3 - python3 modules
perl - perl- modules
perl - perl modules
gem - gem modules
ruby - ruby modules
Use
--auto|--assumeyes|--non-interactive for non interactive mode
EOF
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment