3
# Copyright (C) 2012, 2016, 2017, 2020 Etersoft
4
# Copyright (C) 2012, 2016, 2017, 2020 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
load_helper epm-sh-warmup
24
# FIXME: sort depends on --sort value
27
# FIXME: space with quotes problems, use point instead
29
docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" "$@" | sed -e "s|@| |g" | sort -n -k1
33
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\n" "$@" | sed -e "s|@| |g" | sort -n -k1
36
fatal "Sorted package list function is not implemented for $PMTYPE"
44
local VERSION=$(apt-cyg show "$1" | grep -m1 "^version: " | sed -e "s|^version: ||g")
50
grep -v "^$" | grep -- "$*"
53
# TODO: we have a problem with error status here
57
[ -n "$sort" ] && __epm_packages_sort "$@" && return
63
#CMD="dpkg -l $pkg_filenames"
64
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}:\${Architecture}\n"
65
# TODO: ${Architecture}
66
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n"
68
$CMD "$@" | grep "^i" | sed -e "s|.* ||g" | __fo_pfn "$@"
74
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n"
75
docmd $CMD "$@" | __fo_pfn "$@"
78
docmd pkcon get-packages --filter installed
87
CMD="flatpak list --app"
91
# print with colors for console output
92
isatty && CMD="qlist -I"
97
$CMD | sed -e "s| .*||g" | __fo_pfn "$@"
100
if [ -n "$@" ] ; then
106
if [ -n "$short" ] ; then
107
$CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g" | __fo_pfn "$@"
109
$CMD | sed -e "s| .*||g" | __fo_pfn "$@"
115
if [ -n "$short" ] ; then
116
$CMD | sed -e "s| .*||g" -e "s|.*/||g" | __fo_pfn "$@"
121
CMD="npackdcl list --status=installed"
122
# TODO: use search if pkg_filenames is not empty
128
CMD="eopkg list-installed"
134
CMD="ls -1 /var/log/packages/"
135
if [ -n "$short" ] ; then
136
# FIXME: does not work for libjpeg-v8a
137
# TODO: remove last 3 elements (if arch is second from the last?)
139
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g" | __fo_pfn "$@"
144
docmd brew list | xargs -n1 echo
147
CMD="opkg list-installed"
150
CMD="apk list --installed"
156
CMD="ls -1 /usr/local/tce.installed"
159
CMD="guix package -I"
168
docmd pkg list-installed
173
if [ -n "$short" ] ; then
174
$CMD | sed -e "s|^ii ||g" -e "s| .*||g" -e "s|\(.*\)-.*|\1|g" | __fo_pfn "$@"
176
$CMD | sed -e "s|^ii ||g" -e "s| .*||g" | __fo_pfn "$@"
181
CMD="pm list packages"
183
$CMD | sed -e "s|^package:||g" | __fo_pfn "$@"
187
CMD="apt-cyg list $@"
188
if [ -z "$short" ] ; then
190
# TODO: fix this slow way
191
for i in $($CMD) ; do
192
__aptcyg_print_full $i
198
fatal "Have no suitable query command for $PMTYPE"
202
docmd $CMD | __fo_pfn "$@"
203
# FIXME: we print empty lines, but will lost error status