Commit baed4b38 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-packages: add size sort support for rpm and dpkg

parent 7aaabf25
...@@ -267,6 +267,9 @@ check_option() ...@@ -267,6 +267,9 @@ check_option()
--short) # HELPOPT: short output (just 'package' instead 'package-version-release') --short) # HELPOPT: short output (just 'package' instead 'package-version-release')
short="--short" short="--short"
;; ;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
sort="$1"
;;
--auto) # HELPOPT: non interactive mode --auto) # HELPOPT: non interactive mode
non_interactive=1 non_interactive=1
;; ;;
......
...@@ -17,9 +17,26 @@ ...@@ -17,9 +17,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
__epm_packages_sort()
{
# FIXME: sort depends on --sort value
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
docmd rpm -qa --queryformat "%{size} %{name}-%{version}-%{release}\n" $pkg_filenames | sort -n
;;
apt-dpkg)
docmd dpkg-query -W --showformat="\${Size} \${Package}-\${Version}\n" $pkg_filenames | sort -n
;;
*)
fatal "Sorted package list are not realized for $PMTYPE"
;;
esac
}
epm_packages() epm_packages()
{ {
local CMD local CMD
[ -n "$sort" ] && __epm_packages_sort && return
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
......
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