Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
54756d39
Commit
54756d39
authored
Oct 18, 2017
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add --dry-run support to remove, autoorphans, autoremove
parent
eb459192
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
21 deletions
+84
-21
TODO
TODO
+0
-2
epm
bin/epm
+4
-0
epm-autoorphans
bin/epm-autoorphans
+33
-13
epm-autoremove
bin/epm-autoremove
+35
-6
epm-remove
bin/epm-remove
+12
-0
No files found.
TODO
View file @
54756d39
...
...
@@ -4,8 +4,6 @@ packages list таск
аналог epm purge: запоминаем список файлов, удаляем пакеты и по возможности всё, от чего зависит (рекурсивно).
--dry-run при удалении (--print)
epm autoremove [libs|python|perl|libs-devel]
--interactive
...
...
bin/epm
View file @
54756d39
...
...
@@ -79,6 +79,7 @@ verbose=
quiet
=
nodeps
=
noremove
=
dryrun
=
force
=
short
=
direct
=
...
...
@@ -334,6 +335,9 @@ check_option()
--noremove
|
--no-remove
)
# HELPOPT: exit if any packages are to be removed during upgrade
noremove
=
"--no-remove"
;;
--dry-run
|
--simulate
|
--just-print
|
-recon--no-act
)
# HELPOPT: print only (autoremove/autoorphans only)
dryrun
=
"--dry-run"
;;
--short
)
# HELPOPT: short output (just 'package' instead 'package-version-release')
short
=
"--short"
;;
...
...
bin/epm-autoorphans
View file @
54756d39
#!/bin/sh
#
# Copyright (C) 2015, 201
6
Etersoft
# Copyright (C) 2015, 201
6
Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015, 201
7
Etersoft
# Copyright (C) 2015, 201
7
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -32,18 +32,25 @@ case $PMTYPE in
apt-rpm
)
# ALT Linux only
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
echo
"We will try remove all installed packages which are missed in repositories"
warning
"Use with caution!"
if
[
-z
"
$dryrun
"
]
;
then
echo
"We will try remove all installed packages which are missed in repositories"
warning
"Use with caution!"
fi
local
PKGLIST
=
$(
__epm_orphan_altrpm
\
|
sed
-e
"s/
\.
32bit//g"
\
|
grep
-v
--
"^eepm$"
\
|
grep
-v
--
"^kernel"
)
docmd epm remove
$PKGLIST
if
[
-n
"
$quiet
"
]
;
then
echo
"
$PKGLIST
"
else
docmd epm remove
$dryrun
$PKGLIST
fi
;;
apt-dpkg|aptitude-dpkg
)
assure_exists deborphan
showcmd deborphan
a
=
''
deborphan | docmd epm remove
a
=
''
deborphan | docmd epm remove
$dryrun
;;
#aura)
# sudocmd aura -Oj
...
...
@@ -51,18 +58,22 @@ case $PMTYPE in
yum-rpm
)
showcmd package-cleanup
--orphans
local
PKGLIST
=
$(
package-cleanup
-q
--orphans
|
grep
-v
"^eepm-"
)
docmd epm remove
$PKGLIST
docmd epm remove
$
dryrun
$
PKGLIST
;;
dnf-rpm
)
# TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead.
showcmd package-cleanup
--orphans
local
PKGLIST
=
$(
package-cleanup
-q
--orphans
|
grep
-v
"^eepm-"
)
docmd epm remove
$PKGLIST
docmd epm remove
$
dryrun
$
PKGLIST
;;
urpm-rpm
)
showcmd urpme
--report-orphans
sudocmd urpme
--auto-orphans
if
[
-n
"
$dryrun
"
]
;
then
fatal
"--dry-run is not supported yet"
else
showcmd urpme
--report-orphans
sudocmd urpme
--auto-orphans
fi
;;
#emerge)
# sudocmd emerge --depclean
...
...
@@ -70,7 +81,12 @@ case $PMTYPE in
# sudocmd revdep-rebuild
# ;;
pacman
)
sudocmd pacman
-Qdtq
| sudocmd pacman
-Rs
-
if
[
-n
"
$dryrun
"
]
;
then
info
"Autoorphans packages list:"
sudocmd pacman
-Qdtq
else
sudocmd pacman
-Qdtq
| sudocmd pacman
-Rs
-
fi
;;
#slackpkg)
# clean-system removes non official packages
...
...
@@ -89,10 +105,14 @@ case $PMTYPE in
sudocmd zypper packages
--orphaned
# FIXME: x86_64/i586 are duplicated
local
PKGLIST
=
$(
zypper packages
--orphaned
|
tail
-n
+5 |
cut
-d
\|
-f
3 |
sort
-u
)
sudocmd zypper remove
--clean-deps
$PKGLIST
docmd epm remove
$dryrun
--clean-deps
$PKGLIST
;;
xbps
)
CMD
=
"xbps-remove -o"
if
[
-n
"
$dryrun
"
]
;
then
fatal
"--dry-run is not supported yet"
else
sudocmd xbps-remove
-o
fi
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
...
...
bin/epm-autoremove
View file @
54756d39
#!/bin/sh
#
# Copyright (C) 2012, 201
6
Etersoft
# Copyright (C) 2012, 201
6
Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 201
7
Etersoft
# Copyright (C) 2012, 201
7
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -32,6 +32,13 @@ __epm_autoremove_altrpm_pp()
[
-n
"
$force
"
]
||
libexclude
=
$libexclude
'[^-]*$'
showcmd
"apt-cache list-nodeps | grep -E --
\"
$libexclude
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libexclude
"
)
if
[
-n
"
$dryrun
"
]
;
then
info
"Packages for autoremoving:"
echo
"
$pkgs
"
return
0
fi
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
...
...
@@ -63,6 +70,13 @@ __epm_autoremove_altrpm_lib()
|
grep
-E
-v
--
"-(devel|devel-static|debuginfo)$"
\
|
grep
-E
-v
--
"-(util|utils|tool|tools|plugin|daemon|help)$"
\
|
grep
-E
-v
--
"^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)"
)
if
[
-n
"
$dryrun
"
]
;
then
info
"Packages for autoremoving:"
echo
"
$pkgs
"
return
0
fi
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
...
...
@@ -96,6 +110,9 @@ epm_autoremove()
case
$DISTRNAME
in
ALTLinux
)
__epm_autoremove_altrpm
[
-n
"
$dryrun
"
]
&&
return
docmd epm remove-old-kernels
if
which nvidia-clean-driver 2>/dev/null
;
then
...
...
@@ -110,9 +127,12 @@ esac
case
$PMTYPE
in
apt-dpkg|aptitude-dpkg
)
sudocmd apt-get autoremove
sudocmd apt-get autoremove
$dryrun
;;
aura
)
if
[
-n
"
$dryrun
"
]
;
then
fatal
"--dry-run is not supported yet"
fi
sudocmd aura
-Oj
;;
yum-rpm
)
...
...
@@ -123,10 +143,13 @@ case $PMTYPE in
# FIXME: package-cleanup have to use stderr for errors
local
PKGLIST
=
$(
package-cleanup
-q
--leaves
|
grep
-v
"^eepm-"
)
[
-n
"
$PKGLIST
"
]
||
break
s
udocmd yu
m remove
$PKGLIST
s
howcmd ep
m remove
$PKGLIST
done
;;
dnf-rpm
)
if
[
-n
"
$dryrun
"
]
;
then
fatal
"--dry-run is not supported yet"
fi
sudocmd dnf autoremove
;;
# see autoorhans
...
...
@@ -134,6 +157,9 @@ case $PMTYPE in
# sudocmd urpme --auto-orphans
# ;;
emerge
)
if
[
-n
"
$dryrun
"
]
;
then
fatal
"--dry-run is not supported yet"
fi
sudocmd emerge
--depclean
assure_exists revdep-rebuild
sudocmd revdep-rebuild
...
...
@@ -158,10 +184,13 @@ case $PMTYPE in
sudocmd zypper packages
--unneeded
# FIXME: x86_64/i586 are duplicated
local
PKGLIST
=
$(
zypper packages
--unneeded
|
tail
-n
+5 |
cut
-d
\|
-f
3 |
sort
-u
)
s
udocmd zypper
remove
--clean-deps
$PKGLIST
s
howcmd epm
remove
--clean-deps
$PKGLIST
;;
xbps
)
CMD
=
"xbps-remove -O"
if
[
-n
"
$dryrun
"
]
;
then
fatal
"--dry-run is not supported yet"
fi
sudocmd xbps-remove
-O
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
...
...
bin/epm-remove
View file @
54756d39
...
...
@@ -234,7 +234,19 @@ epm_remove()
[
-n
"
$pkg_files
"
]
&&
pkg_names
=
"
$pkg_names
$(
epm query
$pkg_files
)
"
[
-n
"
$pkg_names
"
]
||
fatal
"Remove: missing package(s) name."
if
[
-n
"
$dryrun
"
]
;
then
info
"Packages for removing:"
echo
"
$pkg_names
"
return
fi
epm_remove_low
$pkg_names
&&
return
local
STATUS
=
$?
if
[
-n
"
$direct
"
]
;
then
return
$STATUS
fi
# get package name for hi level package management command (with version if supported and if possible)
pkg_names
=
$(
__epm_get_hilevel_name
$pkg_names
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment